- Timestamp:
- 2012-09-07T08:12:05Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e0c836e8
- Parents:
- 131d9a4 (diff), 8cf4823 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 22 added
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile
r131d9a4 r70253688 97 97 srv/bd/part/mbr_part \ 98 98 srv/fs/exfat \ 99 srv/fs/udf \ 99 100 srv/fs/fat \ 100 101 srv/fs/cdfs \ -
uspace/app/bdsh/errors.h
r131d9a4 r70253688 30 30 #define ERRORS_H 31 31 32 #include <io/verify.h> 33 32 34 /* Various error levels */ 33 35 #define CL_EFATAL -1 … … 46 48 extern volatile int cli_errno; 47 49 48 extern void cli_error(int, const char *, ...); 50 extern void cli_error(int, const char *, ...) 51 PRINTF_ATTRIBUTE(2, 3); 49 52 50 53 #endif -
uspace/app/bdsh/input.c
r131d9a4 r70253688 67 67 int process_input(cliuser_t *usr) 68 68 { 69 token_t *tokens = calloc(WORD_MAX, sizeof(token_t));70 if (tokens == NULL)69 token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t)); 70 if (tokens_buf == NULL) 71 71 return ENOMEM; 72 token_t *tokens = tokens_buf; 72 73 73 74 char *cmd[WORD_MAX]; … … 80 81 81 82 if (usr->line == NULL) { 82 free(tokens );83 free(tokens_buf); 83 84 return CL_EFAIL; 84 85 } … … 213 214 } 214 215 tok_fini(&tok); 215 free(tokens );216 free(tokens_buf); 216 217 217 218 return rc; -
uspace/app/edit/edit.c
r131d9a4 r70253688 111 111 #define BUF_SIZE 64 112 112 #define TAB_WIDTH 8 113 #define ED_INFTY 65536114 113 115 114 /** Maximum filename length that can be entered. */ … … 507 506 static void key_handle_movement(unsigned int key, bool select) 508 507 { 508 spt_t pt; 509 509 switch (key) { 510 510 case KC_LEFT: … … 521 521 break; 522 522 case KC_HOME: 523 caret_move_relative(0, -ED_INFTY, dir_after, select); 523 tag_get_pt(&pane.caret_pos, &pt); 524 pt_get_sol(&pt, &pt); 525 caret_move(pt, select, true); 524 526 break; 525 527 case KC_END: 526 caret_move_relative(0, +ED_INFTY, dir_before, select); 528 tag_get_pt(&pane.caret_pos, &pt); 529 pt_get_eol(&pt, &pt); 530 caret_move(pt, select, true); 527 531 break; 528 532 case KC_PAGE_UP: -
uspace/app/top/screen.h
r131d9a4 r70253688 36 36 37 37 #include <io/console.h> 38 #include <io/verify.h> 38 39 #include "top.h" 39 40 … … 43 44 extern void screen_done(void); 44 45 extern void print_data(data_t *); 45 extern void show_warning(const char *, ...); 46 extern void show_warning(const char *, ...) 47 PRINTF_ATTRIBUTE(1, 2); 46 48 47 49 extern int tgetchar(unsigned int); -
uspace/dist/src/c/demos/top/screen.h
r131d9a4 r70253688 36 36 37 37 #include <io/console.h> 38 #include <io/verify.h> 38 39 #include "top.h" 39 40 … … 43 44 extern void screen_done(void); 44 45 extern void print_data(data_t *); 45 extern void print_warning(const char *, ...); 46 extern void print_warning(const char *, ...) 47 PRINTF_ATTRIBUTE(1, 2); 46 48 47 49 extern int tgetchar(unsigned int); -
uspace/drv/bus/isa/i8237.c
r131d9a4 r70253688 351 351 352 352 /* 16 bit transfers are a bit special */ 353 ddf_msg(LVL_DEBUG, "Unspoiled address: %p and size: %zu.", pa, size); 353 ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu16 ")", 354 pa, size); 354 355 if (channel > 4) { 355 356 /* Size must be aligned to 16 bits */ … … 367 368 const dma_channel_t dma_channel = controller_8237.channels[channel]; 368 369 369 ddf_msg(LVL_DEBUG, "Setting channel %u , to address %p(%zu), mode %hhx.",370 channel, pa, size, mode);370 ddf_msg(LVL_DEBUG, "Setting channel %u to address %#" PRIx32 " " 371 "(size %" PRIu16 "), mode %hhx.", channel, pa, size, mode); 371 372 372 373 /* Mask DMA request */ -
uspace/drv/char/ps2mouse/ps2mouse.c
r131d9a4 r70253688 75 75 const ssize_t size = chardev_read(sess, &data, 1); \ 76 76 if (size != 1) { \ 77 ddf_msg(LVL_ERROR, "Failed reading byte: % d)", size);\77 ddf_msg(LVL_ERROR, "Failed reading byte: %zd)", size);\ 78 78 return size < 0 ? size : EIO; \ 79 79 } \ -
uspace/drv/nic/rtl8139/driver.c
r131d9a4 r70253688 620 620 /* Check if the header is valid, otherwise we are lost in the buffer */ 621 621 if (size == 0 || size > RTL8139_FRAME_MAX_LENGTH) { 622 ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4" PRIu16", "623 "header 0x%4" PRIx16". Offset: %zu)", size, frame_header,622 ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4" PRIu16 ", " 623 "header 0x%4" PRIx16 ". Offset: %d)", size, frame_header, 624 624 rx_offset); 625 625 goto rx_err; … … 1162 1162 1163 1163 /* Allocate buffer for receiver */ 1164 ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size % zubytes",1164 ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size %d bytes", 1165 1165 RxBUF_TOT_LENGTH); 1166 1166 … … 1249 1249 /* Gain control over port's registers. */ 1250 1250 if (pio_enable(rtl8139->io_addr, RTL8139_IO_SIZE, &rtl8139->io_port)) { 1251 ddf_msg(LVL_ERROR, "Cannot gain the port % lxfor device %s.", rtl8139->io_addr,1251 ddf_msg(LVL_ERROR, "Cannot gain the port %p for device %s.", rtl8139->io_addr, 1252 1252 ddf_dev_get_name(dev)); 1253 1253 return EADDRNOTAVAIL; … … 1296 1296 1297 1297 assert(dev); 1298 ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = % d)",1298 ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %zu)", 1299 1299 ddf_dev_get_name(dev), ddf_dev_get_handle(dev)); 1300 1300 … … 1328 1328 rc = nic_connect_to_services(nic_data); 1329 1329 if (rc != EOK) { 1330 ddf_msg(LVL_ERROR, "Failed to connect to services ", rc);1330 ddf_msg(LVL_ERROR, "Failed to connect to services (%d)", rc); 1331 1331 goto err_irq; 1332 1332 } … … 2139 2139 pio_write_32(rtl8139->io_port + TCTR, 0); 2140 2140 2141 ddf_msg(LVL_DEBUG, "Periodic mode. Interrupt mask %"PRIx16", poll.full_skips %" 2142 PRIu32", last timer %"PRIu32".", rtl8139->int_mask, 2143 rtl8139->poll_timer.full_skips, rtl8139->poll_timer.last_val); 2141 ddf_msg(LVL_DEBUG, "Periodic mode. Interrupt mask %" PRIx16 ", " 2142 "poll.full_skips %zu, last timer %" PRIu32, 2143 rtl8139->int_mask, rtl8139->poll_timer.full_skips, 2144 rtl8139->poll_timer.last_val); 2144 2145 break; 2145 2146 default: -
uspace/lib/c/Makefile
r131d9a4 r70253688 95 95 generic/inetping.c \ 96 96 generic/io/asprintf.c \ 97 generic/io/input.c \ 97 98 generic/io/io.c \ 98 99 generic/io/chargrid.c \ … … 106 107 generic/io/vsnprintf.c \ 107 108 generic/io/printf_core.c \ 109 generic/io/con_srv.c \ 108 110 generic/io/console.c \ 109 111 generic/io/visualizer.c \ -
uspace/lib/c/arch/abs32le/_link.ld.in
r131d9a4 r70253688 15 15 #ifdef LOADER 16 16 . = 0x70001000 + SIZEOF_HEADERS; 17 18 .interp : {19 *(.interp);20 } :interp :text21 17 #else 22 18 . = 0x1000 + SIZEOF_HEADERS; 23 19 #endif 24 25 /* Make sure the code is aligned reasonably */26 . = ALIGN(., 16);27 20 28 21 .text : { … … 30 23 *(.rodata .rodata.*); 31 24 } :text 25 26 #ifdef LOADER 27 .interp : { 28 *(.interp); 29 } :interp :text 30 #endif 32 31 33 32 . = . + 0x1000; -
uspace/lib/c/arch/abs32le/include/types.h
r131d9a4 r70253688 47 47 48 48 typedef uint32_t sysarg_t; 49 typedef int32_t native_t; 49 50 50 51 typedef int32_t ssize_t; -
uspace/lib/c/arch/amd64/_link.ld.in
r131d9a4 r70253688 16 16 #ifdef LOADER 17 17 . = 0x70001000 + SIZEOF_HEADERS; 18 19 .interp : {20 *(.interp);21 } :interp :text22 18 #else 23 19 . = 0x1000 + SIZEOF_HEADERS; 24 20 #endif 25 26 /* Make sure the code is aligned reasonably */27 . = ALIGN(., 16);28 21 29 22 .init : { … … 35 28 *(.rodata .rodata.*); 36 29 } :text 30 31 #ifdef LOADER 32 .interp : { 33 *(.interp); 34 } :interp :text 35 #endif 37 36 38 37 . = . + 0x1000; -
uspace/lib/c/arch/amd64/include/types.h
r131d9a4 r70253688 47 47 48 48 typedef uint64_t sysarg_t; 49 typedef int64_t native_t; 49 50 50 51 typedef int64_t ssize_t; -
uspace/lib/c/arch/arm32/_link.ld.in
r131d9a4 r70253688 15 15 #ifdef LOADER 16 16 . = 0x70001000 + SIZEOF_HEADERS; 17 18 .interp : {19 *(.interp);20 } :interp :text21 17 #else 22 18 . = 0x1000 + SIZEOF_HEADERS; 23 19 #endif 24 25 /* Make sure the code is aligned reasonably */26 . = ALIGN(., 8);27 20 28 21 .init : { … … 34 27 *(.rodata .rodata.*); 35 28 } :text 29 30 #ifdef LOADER 31 .interp : { 32 *(.interp); 33 } :interp :text 34 #endif 36 35 37 36 . = . + 0x1000; -
uspace/lib/c/arch/arm32/include/types.h
r131d9a4 r70253688 48 48 49 49 typedef uint32_t sysarg_t; 50 typedef int32_t native_t; 50 51 51 52 typedef int32_t ssize_t; -
uspace/lib/c/arch/ia32/_link.ld.in
r131d9a4 r70253688 24 24 . = 0x1000 + SIZEOF_HEADERS; 25 25 #endif 26 27 #if defined(LOADER) || defined(DLEXE)28 .interp : {29 *(.interp);30 } :interp :text31 #endif32 33 /* Make sure the code is aligned reasonably */34 . = ALIGN(., 16);35 26 36 27 .init : { … … 71 62 } :text 72 63 #endif 64 65 #if defined(LOADER) || defined(DLEXE) 66 .interp : { 67 *(.interp); 68 } :interp :text 69 #endif 70 73 71 . = . + 0x1000; 74 72 -
uspace/lib/c/arch/ia32/include/types.h
r131d9a4 r70253688 47 47 48 48 typedef uint32_t sysarg_t; 49 typedef int32_t native_t; 49 50 50 51 typedef int32_t ssize_t; -
uspace/lib/c/arch/ia64/_link.ld.in
r131d9a4 r70253688 15 15 #ifdef LOADER 16 16 . = 0x800000000 + SIZEOF_HEADERS; 17 18 .interp : {19 *(.interp);20 } :interp :text21 17 #else 22 18 . = 0x4000 + SIZEOF_HEADERS; 23 19 #endif 24 20 25 /* Make sure the code is aligned reasonably*/21 /* Workaround proper alignment of the .init section */ 26 22 . = ALIGN(., 16); 27 23 … … 34 30 *(.rodata .rodata.*); 35 31 } :text 32 33 #ifdef LOADER 34 .interp : { 35 *(.interp); 36 } :interp :text 37 #endif 36 38 37 39 . = . + 0x4000; -
uspace/lib/c/arch/ia64/include/types.h
r131d9a4 r70253688 57 57 58 58 typedef uint64_t sysarg_t; 59 typedef int64_t native_t; 59 60 60 61 typedef int64_t ssize_t; -
uspace/lib/c/arch/mips32/_link.ld.in
r131d9a4 r70253688 15 15 #ifdef LOADER 16 16 . = 0x70004000 + SIZEOF_HEADERS; 17 18 .interp : {19 *(.interp);20 } :interp :text21 17 #else 22 18 . = 0x4000 + SIZEOF_HEADERS; 23 19 #endif 24 25 /* Make sure the code is aligned reasonably */26 . = ALIGN(., 16);27 20 28 21 .init : { … … 34 27 *(.rodata .rodata.*); 35 28 } :text 29 30 #ifdef LOADER 31 .interp : { 32 *(.interp); 33 } :interp :text 34 #endif 36 35 37 36 . = . + 0x4000; -
uspace/lib/c/arch/mips32/include/types.h
r131d9a4 r70253688 48 48 49 49 typedef uint32_t sysarg_t; 50 typedef int32_t native_t; 50 51 51 52 typedef int32_t ssize_t; -
uspace/lib/c/arch/mips64/_link.ld.in
r131d9a4 r70253688 16 16 #ifdef LOADER 17 17 . = 0x70004000 + SIZEOF_HEADERS; 18 19 .interp : {20 *(.interp);21 } :interp :text22 18 #else 23 19 . = 0x4000 + SIZEOF_HEADERS; 24 20 #endif 25 26 /* Make sure the code is aligned reasonably */27 . = ALIGN(., 16);28 21 29 22 .init : { … … 35 28 *(.rodata .rodata.*); 36 29 } :text 30 31 #ifdef LOADER 32 .interp : { 33 *(.interp); 34 } :interp :text 35 #endif 37 36 38 37 . = . + 0x4000; -
uspace/lib/c/arch/mips64/include/types.h
r131d9a4 r70253688 48 48 49 49 typedef uint64_t sysarg_t; 50 typedef int64_t native_t; 50 51 51 52 typedef int64_t ssize_t; -
uspace/lib/c/arch/ppc32/_link.ld.in
r131d9a4 r70253688 16 16 #ifdef LOADER 17 17 . = 0x70001000 + SIZEOF_HEADERS; 18 19 .interp : {20 *(.interp);21 } :interp :text22 18 #else 23 19 . = 0x1000 + SIZEOF_HEADERS; 24 20 #endif 25 26 /* Make sure the code is aligned reasonably */27 . = ALIGN(., 4);28 21 29 22 .init : { … … 35 28 *(.rodata .rodata.*); 36 29 } :text 30 31 #ifdef LOADER 32 .interp : { 33 *(.interp); 34 } :interp :text 35 #endif 37 36 38 37 . = . + 0x1000; -
uspace/lib/c/arch/ppc32/include/types.h
r131d9a4 r70253688 47 47 48 48 typedef uint32_t sysarg_t; 49 typedef int32_t native_t; 49 50 50 51 typedef int32_t ssize_t; -
uspace/lib/c/arch/sparc64/_link.ld.in
r131d9a4 r70253688 15 15 #ifdef LOADER 16 16 . = 0x70004000 + SIZEOF_HEADERS; 17 18 .interp : {19 *(.interp);20 } :interp :text21 17 #else 22 18 . = 0x4000 + SIZEOF_HEADERS; 23 19 #endif 24 25 /* Make sure the code is aligned reasonably */26 . = ALIGN(., 16);27 20 28 21 .init : { … … 34 27 *(.rodata .rodata.*); 35 28 } :text 29 30 #ifdef LOADER 31 .interp : { 32 *(.interp); 33 } :interp :text 34 #endif 36 35 37 36 . = . + 0x4000; -
uspace/lib/c/arch/sparc64/include/types.h
r131d9a4 r70253688 47 47 48 48 typedef uint64_t sysarg_t; 49 typedef int64_t native_t; 49 50 50 51 typedef int64_t ssize_t; -
uspace/lib/c/generic/io/console.c
r131d9a4 r70253688 38 38 #include <async.h> 39 39 #include <errno.h> 40 #include <stdio.h>41 40 #include <malloc.h> 42 41 #include <vfs/vfs_sess.h> … … 126 125 { 127 126 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 128 async_req_1_0(exch, CONSOLE_ CURSOR_VISIBILITY, (show != false));127 async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false)); 129 128 async_exchange_end(exch); 130 129 } … … 151 150 { 152 151 async_exch_t *exch = async_exchange_begin(ctrl->output_sess); 153 async_req_2_0(exch, CONSOLE_ GOTO, col, row);152 async_req_2_0(exch, CONSOLE_SET_POS, col, row); 154 153 async_exchange_end(exch); 155 154 } -
uspace/lib/c/generic/io/output.c
r131d9a4 r70253688 37 37 #include <as.h> 38 38 #include <ipc/output.h> 39 #include <io/concaps.h> 39 40 #include <io/output.h> 40 41 -
uspace/lib/c/generic/tls.c
r131d9a4 r70253688 42 42 #include <str.h> 43 43 #include <align.h> 44 #include <unistd.h> 44 45 45 46 /** Create TLS (Thread Local Storage) data structures. … … 57 58 58 59 tcb = __alloc_tls(&data, tls_size); 60 if (!tcb) 61 return NULL; 59 62 60 63 /* … … 89 92 90 93 result = malloc(sizeof(tcb_t) + size); 94 if (!result) 95 return NULL; 91 96 *data = ((void *)result) + sizeof(tcb_t); 97 92 98 return result; 93 99 } … … 118 124 size = ALIGN_UP(size, &_tls_alignment); 119 125 *data = memalign((uintptr_t) &_tls_alignment, sizeof(tcb_t) + size); 120 126 if (!*data) 127 return NULL; 121 128 tcb = (tcb_t *) (*data + size); 122 129 tcb->self = tcb; -
uspace/lib/c/include/io/console.h
r131d9a4 r70253688 37 37 38 38 #include <sys/time.h> 39 #include <io/concaps.h> 40 #include <io/kbd_event.h> 39 41 #include <io/keycode.h> 40 42 #include <async.h> 41 43 #include <bool.h> 42 44 #include <stdio.h> 43 44 typedef enum {45 CONSOLE_CAP_NONE = 0,46 CONSOLE_CAP_STYLE = 1,47 CONSOLE_CAP_INDEXED = 2,48 CONSOLE_CAP_RGB = 449 } console_caps_t;50 45 51 46 /** Console control structure. */ … … 69 64 aid_t input_aid; 70 65 } console_ctrl_t; 71 72 typedef enum {73 KEY_PRESS,74 KEY_RELEASE75 } kbd_event_type_t;76 77 /** Console event structure. */78 typedef struct {79 /** List handle */80 link_t link;81 82 /** Press or release event. */83 kbd_event_type_t type;84 85 /** Keycode of the key that was pressed or released. */86 keycode_t key;87 88 /** Bitmask of modifiers held. */89 keymod_t mods;90 91 /** The character that was generated or '\0' for none. */92 wchar_t c;93 } kbd_event_t;94 66 95 67 extern console_ctrl_t *console_init(FILE *, FILE *); -
uspace/lib/c/include/io/klog.h
r131d9a4 r70253688 38 38 #include <sys/types.h> 39 39 #include <stdarg.h> 40 #include <io/verify.h> 40 41 41 42 extern size_t klog_write(const void *, size_t); 42 43 extern void klog_update(void); 43 extern int klog_printf(const char *, ...); 44 extern int klog_printf(const char *, ...) 45 PRINTF_ATTRIBUTE(1, 2); 44 46 extern int klog_vprintf(const char *, va_list); 45 47 -
uspace/lib/c/include/io/log.h
r131d9a4 r70253688 37 37 #include <stdarg.h> 38 38 #include <inttypes.h> 39 #include < bool.h>39 #include <io/verify.h> 40 40 41 41 typedef enum { … … 46 46 LVL_DEBUG, 47 47 LVL_DEBUG2, 48 48 49 49 /** For checking range of values */ 50 50 LVL_LIMIT … … 62 62 extern log_t log_create(const char *, log_t); 63 63 64 extern void log_msg(log_t, log_level_t, const char *, ...); 64 extern void log_msg(log_t, log_level_t, const char *, ...) 65 PRINTF_ATTRIBUTE(3, 4); 65 66 extern void log_msgv(log_t, log_level_t, const char *, va_list); 66 67 -
uspace/lib/c/include/ipc/console.h
r131d9a4 r70253688 43 43 CONSOLE_GET_EVENT, 44 44 CONSOLE_GET_POS, 45 CONSOLE_ GOTO,45 CONSOLE_SET_POS, 46 46 CONSOLE_CLEAR, 47 47 CONSOLE_SET_STYLE, 48 48 CONSOLE_SET_COLOR, 49 49 CONSOLE_SET_RGB_COLOR, 50 CONSOLE_ CURSOR_VISIBILITY50 CONSOLE_SET_CURSOR_VISIBILITY 51 51 } console_request_t; 52 52 -
uspace/lib/c/include/stdio.h
r131d9a4 r70253688 39 39 #include <stdarg.h> 40 40 #include <str.h> 41 42 #ifndef NVERIFY_PRINTF 43 44 #define PRINTF_ATTRIBUTE(start, end) \ 45 __attribute__((format(gnu_printf, start, end))) 46 47 #else /* NVERIFY_PRINTF */ 48 49 #define PRINTF_ATTRIBUTE(start, end) 50 51 #endif /* NVERIFY_PRINTF */ 41 #include <io/verify.h> 52 42 53 43 #define EOF (-1) -
uspace/lib/draw/surface.c
r131d9a4 r70253688 44 44 surface_flags_t flags; 45 45 46 s ysarg_t dirty_x_lo;47 s ysarg_t dirty_x_hi;48 s ysarg_t dirty_y_lo;49 s ysarg_t dirty_y_hi;46 surface_coord_t dirty_x_lo; 47 surface_coord_t dirty_x_hi; 48 surface_coord_t dirty_y_lo; 49 surface_coord_t dirty_y_hi; 50 50 51 51 pixelmap_t pixmap; 52 52 }; 53 53 54 surface_t *surface_create( 55 sysarg_t width, sysarg_t height,pixel_t *pixbuf, surface_flags_t flags)54 surface_t *surface_create(surface_coord_t width, surface_coord_t height, 55 pixel_t *pixbuf, surface_flags_t flags) 56 56 { 57 57 surface_t *surface = (surface_t *) malloc(sizeof(surface_t)); … … 118 118 } 119 119 120 void surface_get_resolution(surface_t *surface, s ysarg_t *width, sysarg_t *height)120 void surface_get_resolution(surface_t *surface, surface_coord_t *width, surface_coord_t *height) 121 121 { 122 122 assert(width); … … 127 127 } 128 128 129 void surface_get_damaged_region(surface_t *surface, s ysarg_t *x, sysarg_t *y,130 s ysarg_t *width, sysarg_t *height)129 void surface_get_damaged_region(surface_t *surface, surface_coord_t *x, surface_coord_t *y, 130 surface_coord_t *width, surface_coord_t *height) 131 131 { 132 132 assert(x); … … 151 151 } 152 152 153 void surface_put_pixel(surface_t *surface, s ysarg_t x, sysarg_t y, pixel_t pixel)153 void surface_put_pixel(surface_t *surface, surface_coord_t x, surface_coord_t y, pixel_t pixel) 154 154 { 155 155 surface->dirty_x_lo = surface->dirty_x_lo > x ? x : surface->dirty_x_lo; … … 163 163 } 164 164 165 pixel_t surface_get_pixel(surface_t *surface, s ysarg_t x, sysarg_t y)165 pixel_t surface_get_pixel(surface_t *surface, surface_coord_t x, surface_coord_t y) 166 166 { 167 167 if (x < surface->pixmap.width && y < surface->pixmap.height) { -
uspace/lib/draw/surface.h
r131d9a4 r70253688 45 45 typedef struct surface surface_t; 46 46 47 typedef sysarg_t surface_coord_t; 48 47 49 typedef enum { 48 50 SURFACE_FLAG_NONE = 0, … … 50 52 } surface_flags_t; 51 53 52 extern surface_t *surface_create(s ysarg_t, sysarg_t, pixel_t *, surface_flags_t);54 extern surface_t *surface_create(surface_coord_t, surface_coord_t, pixel_t *, surface_flags_t); 53 55 extern void surface_destroy(surface_t *); 54 56 … … 56 58 extern pixel_t *surface_direct_access(surface_t *); 57 59 extern pixelmap_t *surface_pixmap_access(surface_t *); 58 extern void surface_get_resolution(surface_t *, s ysarg_t *, sysarg_t *);59 extern void surface_get_damaged_region(surface_t *, s ysarg_t *, sysarg_t *,60 s ysarg_t *, sysarg_t *);60 extern void surface_get_resolution(surface_t *, surface_coord_t *, surface_coord_t *); 61 extern void surface_get_damaged_region(surface_t *, surface_coord_t *, surface_coord_t *, 62 surface_coord_t *, surface_coord_t *); 61 63 extern void surface_reset_damaged_region(surface_t *); 62 64 63 extern void surface_put_pixel(surface_t *, s ysarg_t, sysarg_t, pixel_t);64 extern pixel_t surface_get_pixel(surface_t *, s ysarg_t, sysarg_t);65 extern void surface_put_pixel(surface_t *, surface_coord_t, surface_coord_t, pixel_t); 66 extern pixel_t surface_get_pixel(surface_t *, surface_coord_t, surface_coord_t); 65 67 66 68 #endif -
uspace/lib/drv/include/ddf/log.h
r131d9a4 r70253688 35 35 36 36 #include <io/log.h> 37 #include <io/verify.h> 37 38 38 39 extern int ddf_log_init(const char *); 39 extern void ddf_msg(log_level_t, const char *, ...); 40 extern void ddf_msg(log_level_t, const char *, ...) 41 PRINTF_ATTRIBUTE(2, 3); 40 42 41 43 extern void ddf_dump_buffer(char *, size_t, const void *, size_t, size_t, -
uspace/lib/ext4/libext4_filesystem.c
r131d9a4 r70253688 1284 1284 block_t *block; 1285 1285 while (level > 0) { 1286 1287 /* Sparse check */ 1288 if (current_block == 0) 1289 return EOK; 1290 1286 1291 int rc = block_get(&block, fs->device, current_block, 0); 1287 1292 if (rc != EOK) -
uspace/lib/gui/terminal.c
r131d9a4 r70253688 39 39 #include <surface.h> 40 40 #include <gfx/font-8x16.h> 41 #include <io/con_srv.h> 42 #include <io/concaps.h> 41 43 #include <io/console.h> 42 #include <ipc/console.h>43 44 #include <task.h> 44 45 #include <adt/list.h> … … 60 61 61 62 static LIST_INITIALIZE(terms); 63 64 static int term_open(con_srvs_t *, con_srv_t *); 65 static int term_close(con_srv_t *); 66 static int term_read(con_srv_t *, void *, size_t); 67 static int term_write(con_srv_t *, void *, size_t); 68 static void term_sync(con_srv_t *); 69 static void term_clear(con_srv_t *); 70 static void term_set_pos(con_srv_t *, sysarg_t col, sysarg_t row); 71 static int term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *); 72 static int term_get_size(con_srv_t *, sysarg_t *, sysarg_t *); 73 static int term_get_color_cap(con_srv_t *, console_caps_t *); 74 static void term_set_style(con_srv_t *, console_style_t); 75 static void term_set_color(con_srv_t *, console_color_t, console_color_t, 76 console_color_attr_t); 77 static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 78 static void term_set_cursor_visibility(con_srv_t *, bool); 79 static int term_get_event(con_srv_t *, kbd_event_t *); 80 81 static con_ops_t con_ops = { 82 .open = term_open, 83 .close = term_close, 84 .read = term_read, 85 .write = term_write, 86 .sync = term_sync, 87 .clear = term_clear, 88 .set_pos = term_set_pos, 89 .get_pos = term_get_pos, 90 .get_size = term_get_size, 91 .get_color_cap = term_get_color_cap, 92 .set_style = term_set_style, 93 .set_color = term_set_color, 94 .set_rgb_color = term_set_rgb_color, 95 .set_cursor_visibility = term_set_cursor_visibility, 96 .get_event = term_get_event 97 }; 98 99 static terminal_t *srv_to_terminal(con_srv_t *srv) 100 { 101 return srv->srvs->sarg; 102 } 62 103 63 104 static void getterm(const char *svc, const char *app) … … 341 382 } 342 383 343 static void term_set_cursor(terminal_t *term, sysarg_t col, sysarg_t row) 344 { 345 fibril_mutex_lock(&term->mtx); 346 chargrid_set_cursor(term->frontbuf, col, row); 347 fibril_mutex_unlock(&term->mtx); 348 349 term_update(term); 350 } 351 352 static void term_set_cursor_visibility(terminal_t *term, bool visible) 353 { 354 fibril_mutex_lock(&term->mtx); 355 chargrid_set_cursor_visibility(term->frontbuf, visible); 356 fibril_mutex_unlock(&term->mtx); 357 358 term_update(term); 359 } 360 361 static void term_read(terminal_t *term, ipc_callid_t iid, ipc_call_t *icall) 362 { 363 ipc_callid_t callid; 364 size_t size; 365 if (!async_data_read_receive(&callid, &size)) { 366 async_answer_0(callid, EINVAL); 367 async_answer_0(iid, EINVAL); 368 return; 369 } 370 371 char *buf = (char *) malloc(size); 372 if (buf == NULL) { 373 async_answer_0(callid, ENOMEM); 374 async_answer_0(iid, ENOMEM); 375 return; 376 } 377 384 static int term_open(con_srvs_t *srvs, con_srv_t *srv) 385 { 386 return EOK; 387 } 388 389 static int term_close(con_srv_t *srv) 390 { 391 return EOK; 392 } 393 394 static int term_read(con_srv_t *srv, void *buf, size_t size) 395 { 396 terminal_t *term = srv_to_terminal(srv); 397 uint8_t *bbuf = buf; 378 398 size_t pos = 0; 379 399 … … 386 406 /* Copy to the buffer remaining characters. */ 387 407 while ((pos < size) && (term->char_remains_len > 0)) { 388 b uf[pos] = term->char_remains[0];408 bbuf[pos] = term->char_remains[0]; 389 409 pos++; 390 410 … … 416 436 } 417 437 418 (void) async_data_read_finalize(callid, buf, size); 419 async_answer_1(iid, EOK, size); 420 free(buf); 438 return size; 421 439 } 422 440 … … 449 467 } 450 468 451 static void term_write(terminal_t *term, ipc_callid_t iid, ipc_call_t *icall) 452 { 453 void *buf; 454 size_t size; 455 int rc = async_data_write_accept(&buf, false, 0, 0, 0, &size); 456 457 if (rc != EOK) { 458 async_answer_0(iid, rc); 459 return; 460 } 469 static int term_write(con_srv_t *srv, void *data, size_t size) 470 { 471 terminal_t *term = srv_to_terminal(srv); 461 472 462 473 size_t off = 0; 463 474 while (off < size) 464 term_write_char(term, str_decode(buf, &off, size)); 465 466 async_answer_1(iid, EOK, size); 467 free(buf); 468 } 469 470 static void term_clear(terminal_t *term) 471 { 475 term_write_char(term, str_decode(data, &off, size)); 476 477 return size; 478 } 479 480 static void term_sync(con_srv_t *srv) 481 { 482 terminal_t *term = srv_to_terminal(srv); 483 484 term_update(term); 485 } 486 487 static void term_clear(con_srv_t *srv) 488 { 489 terminal_t *term = srv_to_terminal(srv); 490 472 491 fibril_mutex_lock(&term->mtx); 473 492 chargrid_clear(term->frontbuf); … … 477 496 } 478 497 479 static void term_get_cursor(terminal_t *term, ipc_callid_t iid, ipc_call_t *icall) 480 { 481 sysarg_t col; 482 sysarg_t row; 483 484 fibril_mutex_lock(&term->mtx); 485 chargrid_get_cursor(term->frontbuf, &col, &row); 486 fibril_mutex_unlock(&term->mtx); 487 488 async_answer_2(iid, EOK, col, row); 489 } 490 491 static void term_set_style(terminal_t *term, console_style_t style) 492 { 498 static void term_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row) 499 { 500 terminal_t *term = srv_to_terminal(srv); 501 502 fibril_mutex_lock(&term->mtx); 503 chargrid_set_cursor(term->frontbuf, col, row); 504 fibril_mutex_unlock(&term->mtx); 505 506 term_update(term); 507 } 508 509 static int term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row) 510 { 511 terminal_t *term = srv_to_terminal(srv); 512 513 fibril_mutex_lock(&term->mtx); 514 chargrid_get_cursor(term->frontbuf, col, row); 515 fibril_mutex_unlock(&term->mtx); 516 517 return EOK; 518 } 519 520 static int term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows) 521 { 522 terminal_t *term = srv_to_terminal(srv); 523 524 fibril_mutex_lock(&term->mtx); 525 *cols = term->cols; 526 *rows = term->rows; 527 fibril_mutex_unlock(&term->mtx); 528 529 return EOK; 530 } 531 532 static int term_get_color_cap(con_srv_t *srv, console_caps_t *caps) 533 { 534 (void) srv; 535 *caps = TERM_CAPS; 536 537 return EOK; 538 } 539 540 static void term_set_style(con_srv_t *srv, console_style_t style) 541 { 542 terminal_t *term = srv_to_terminal(srv); 543 493 544 fibril_mutex_lock(&term->mtx); 494 545 chargrid_set_style(term->frontbuf, style); … … 496 547 } 497 548 498 static void term_set_color( terminal_t *term, console_color_t bgcolor,549 static void term_set_color(con_srv_t *srv, console_color_t bgcolor, 499 550 console_color_t fgcolor, console_color_attr_t attr) 500 551 { 552 terminal_t *term = srv_to_terminal(srv); 553 501 554 fibril_mutex_lock(&term->mtx); 502 555 chargrid_set_color(term->frontbuf, bgcolor, fgcolor, attr); … … 504 557 } 505 558 506 static void term_set_rgb_color( terminal_t *term, pixel_t bgcolor,559 static void term_set_rgb_color(con_srv_t *srv, pixel_t bgcolor, 507 560 pixel_t fgcolor) 508 561 { 562 terminal_t *term = srv_to_terminal(srv); 563 509 564 fibril_mutex_lock(&term->mtx); 510 565 chargrid_set_rgb_color(term->frontbuf, bgcolor, fgcolor); … … 512 567 } 513 568 514 static void term_get_event(terminal_t *term, ipc_callid_t iid, ipc_call_t *icall) 515 { 569 static void term_set_cursor_visibility(con_srv_t *srv, bool visible) 570 { 571 terminal_t *term = srv_to_terminal(srv); 572 573 fibril_mutex_lock(&term->mtx); 574 chargrid_set_cursor_visibility(term->frontbuf, visible); 575 fibril_mutex_unlock(&term->mtx); 576 577 term_update(term); 578 } 579 580 static int term_get_event(con_srv_t *srv, kbd_event_t *event) 581 { 582 terminal_t *term = srv_to_terminal(srv); 516 583 link_t *link = prodcons_consume(&term->input_pc); 517 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 518 519 async_answer_4(iid, EOK, event->type, event->key, event->mods, event->c); 520 free(event); 584 kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link); 585 586 *event = *kevent; 587 free(kevent); 588 return EOK; 521 589 } 522 590 … … 612 680 613 681 if (atomic_postinc(&term->refcnt) == 0) 614 term_set_cursor_visibility(term, true); 615 616 /* Accept the connection */ 617 async_answer_0(iid, EOK); 618 619 while (true) { 620 ipc_call_t call; 621 ipc_callid_t callid = async_get_call(&call); 622 623 if (!IPC_GET_IMETHOD(call)) 624 return; 625 626 switch (IPC_GET_IMETHOD(call)) { 627 case VFS_OUT_READ: 628 term_read(term, callid, &call); 629 break; 630 case VFS_OUT_WRITE: 631 term_write(term, callid, &call); 632 break; 633 case VFS_OUT_SYNC: 634 term_update(term); 635 async_answer_0(callid, EOK); 636 break; 637 case CONSOLE_CLEAR: 638 term_clear(term); 639 async_answer_0(callid, EOK); 640 break; 641 case CONSOLE_GOTO: 642 term_set_cursor(term, IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 643 async_answer_0(callid, EOK); 644 break; 645 case CONSOLE_GET_POS: 646 term_get_cursor(term, callid, &call); 647 break; 648 case CONSOLE_GET_SIZE: 649 async_answer_2(callid, EOK, term->cols, term->rows); 650 break; 651 case CONSOLE_GET_COLOR_CAP: 652 async_answer_1(callid, EOK, TERM_CAPS); 653 break; 654 case CONSOLE_SET_STYLE: 655 term_set_style(term, IPC_GET_ARG1(call)); 656 async_answer_0(callid, EOK); 657 break; 658 case CONSOLE_SET_COLOR: 659 term_set_color(term, IPC_GET_ARG1(call), IPC_GET_ARG2(call), 660 IPC_GET_ARG3(call)); 661 async_answer_0(callid, EOK); 662 break; 663 case CONSOLE_SET_RGB_COLOR: 664 term_set_rgb_color(term, IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 665 async_answer_0(callid, EOK); 666 break; 667 case CONSOLE_CURSOR_VISIBILITY: 668 term_set_cursor_visibility(term, IPC_GET_ARG1(call)); 669 async_answer_0(callid, EOK); 670 break; 671 case CONSOLE_GET_EVENT: 672 term_get_event(term, callid, &call); 673 break; 674 default: 675 async_answer_0(callid, EINVAL); 676 } 677 } 682 chargrid_set_cursor_visibility(term->frontbuf, true); 683 684 con_conn(iid, icall, &term->srvs); 678 685 } 679 686 … … 727 734 728 735 async_set_client_connection(term_connection); 736 con_srvs_init(&term->srvs); 737 term->srvs.ops = &con_ops; 738 term->srvs.sarg = term; 739 729 740 int rc = loc_server_register(NAME); 730 741 if (rc != EOK) { -
uspace/lib/gui/terminal.h
r131d9a4 r70253688 41 41 #include <font.h> 42 42 #include <io/chargrid.h> 43 #include <io/con_srv.h> 43 44 #include <adt/list.h> 44 45 #include <adt/prodcons.h> … … 66 67 67 68 service_id_t dsid; 69 con_srvs_t srvs; 68 70 } terminal_t; 69 71 -
uspace/srv/hid/compositor/compositor.c
r131d9a4 r70253688 49 49 #include <adt/prodcons.h> 50 50 #include <adt/list.h> 51 #include <io/input.h> 51 52 #include <ipc/graph.h> 52 #include <ipc/input.h>53 53 #include <ipc/window.h> 54 54 … … 92 92 sysarg_t id; 93 93 uint8_t state; 94 sysarg_t hpos; 95 sysarg_t vpos; 94 desktop_point_t pos; 96 95 sysarg_t btn_num; 97 sysarg_t btn_hpos; 98 sysarg_t btn_vpos; 99 int accum_dx; 100 int accum_dy; 96 desktop_point_t btn_pos; 97 desktop_vector_t accum; 101 98 sysarg_t grab_flags; 102 99 bool pressed; … … 135 132 vslmode_t mode; 136 133 async_sess_t *sess; 137 sysarg_t hpos; 138 sysarg_t vpos; 134 desktop_point_t pos; 139 135 surface_t *surface; 140 136 } viewport_t; … … 143 139 static LIST_INITIALIZE(viewport_list); 144 140 145 static async_sess_t *input_sess; 141 /** Input server proxy */ 142 static input_t *input; 143 144 static int comp_key_press(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 145 static int comp_mouse_move(input_t *, int, int); 146 static int comp_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned); 147 static int comp_mouse_button(input_t *, int, int); 148 149 static input_ev_ops_t input_ev_ops = { 150 .key = comp_key_press, 151 .move = comp_mouse_move, 152 .abs_move = comp_abs_move, 153 .button = comp_mouse_button 154 }; 155 156 static void input_disconnect(void); 157 158 159 static pointer_t *input_pointer(input_t *input) 160 { 161 return input->user; 162 } 146 163 147 164 static pointer_t *pointer_create() … … 153 170 154 171 link_initialize(&p->link); 155 p-> hpos= coord_origin;156 p-> vpos= coord_origin;172 p->pos.x = coord_origin; 173 p->pos.y = coord_origin; 157 174 p->btn_num = 1; 158 p->btn_hpos = p->hpos; 159 p->btn_vpos = p->vpos; 160 p->accum_dx = 0; 161 p->accum_dy = 0; 175 p->btn_pos = p->pos; 176 p->accum.x = 0; 177 p->accum.y = 0; 162 178 p->grab_flags = GF_EMPTY; 163 179 p->pressed = false; … … 286 302 bool isec_vp = rectangle_intersect( 287 303 x_dmg_glob, y_dmg_glob, w_dmg_glob, h_dmg_glob, 288 vp-> hpos, vp->vpos, w_dmg_vp, h_dmg_vp,304 vp->pos.x, vp->pos.y, w_dmg_vp, h_dmg_vp, 289 305 &x_dmg_vp, &y_dmg_vp, &w_dmg_vp, &h_dmg_vp); 290 306 … … 292 308 293 309 /* Paint background color. */ 294 for (sysarg_t y = y_dmg_vp - vp-> vpos; y < y_dmg_vp - vp->vpos+ h_dmg_vp; ++y) {295 for (sysarg_t x = x_dmg_vp - vp-> hpos; x < x_dmg_vp - vp->hpos+ w_dmg_vp; ++x) {310 for (sysarg_t y = y_dmg_vp - vp->pos.y; y < y_dmg_vp - vp->pos.y + h_dmg_vp; ++y) { 311 for (sysarg_t x = x_dmg_vp - vp->pos.x; x < x_dmg_vp - vp->pos.x + w_dmg_vp; ++x) { 296 312 surface_put_pixel(vp->surface, x, y, bg_color); 297 313 } … … 331 347 * coordinates. */ 332 348 transform = win->transform; 333 double hpos = vp->hpos; 334 double vpos = vp->vpos; 335 transform_translate(&transform, -hpos, -vpos); 349 double_point_t pos; 350 pos.x = vp->pos.x; 351 pos.y = vp->pos.y; 352 transform_translate(&transform, -pos.x, -pos.y); 336 353 337 354 source_set_transform(&source, transform); … … 340 357 341 358 drawctx_transfer(&context, 342 x_dmg_win - vp-> hpos, y_dmg_win - vp->vpos, w_dmg_win, h_dmg_win);359 x_dmg_win - vp->pos.x, y_dmg_win - vp->pos.y, w_dmg_win, h_dmg_win); 343 360 } 344 361 } … … 354 371 bool isec_ptr = rectangle_intersect( 355 372 x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp, 356 ptr-> hpos, ptr->vpos, w_dmg_ptr, h_dmg_ptr,373 ptr->pos.x, ptr->pos.y, w_dmg_ptr, h_dmg_ptr, 357 374 &x_dmg_ptr, &y_dmg_ptr, &w_dmg_ptr, &h_dmg_ptr); 358 375 … … 365 382 366 383 pixel_t pix = 0; 367 sysarg_t x_vp = x_dmg_ptr - vp-> hpos;368 sysarg_t y_vp = y_dmg_ptr - vp-> vpos;369 sysarg_t x_ptr = x_dmg_ptr - ptr-> hpos;370 sysarg_t y_ptr = y_dmg_ptr - ptr-> vpos;384 sysarg_t x_vp = x_dmg_ptr - vp->pos.x; 385 sysarg_t y_vp = y_dmg_ptr - vp->pos.y; 386 sysarg_t x_ptr = x_dmg_ptr - ptr->pos.x; 387 sysarg_t y_ptr = y_dmg_ptr - ptr->pos.y; 371 388 372 389 for (sysarg_t y = 0; y < h_dmg_ptr; ++y) { … … 759 776 fibril_mutex_unlock(&viewport_list_mtx); 760 777 loc_service_unregister(winreg_id); 761 async_hangup(input_sess);778 input_disconnect(); 762 779 763 780 /* Close all clients and their windows. */ … … 880 897 881 898 link_initialize(&vp->link); 882 vp-> hpos= coord_origin;883 vp-> vpos= coord_origin;899 vp->pos.x = coord_origin; 900 vp->pos.y = coord_origin; 884 901 885 902 /* Establish output bidirectional connection. */ … … 981 998 /* window_list_mtx locked by caller */ 982 999 983 int dx = pointer->accum _dx;984 int dy = pointer->accum _dy;985 pointer->accum _dx = 0;986 pointer->accum _dy = 0;1000 int dx = pointer->accum.x; 1001 int dy = pointer->accum.y; 1002 pointer->accum.x = 0; 1003 pointer->accum.y = 0; 987 1004 988 1005 bool move = (pointer->grab_flags & GF_MOVE_X) || (pointer->grab_flags & GF_MOVE_Y); … … 1055 1072 } 1056 1073 1057 static void comp_mouse_move(pointer_t *pointer, ipc_callid_t iid, ipc_call_t *icall) 1058 { 1059 int dx = (int) IPC_GET_ARG1(*icall); 1060 int dy = (int) IPC_GET_ARG2(*icall); 1074 static int comp_abs_move(input_t *input, unsigned x , unsigned y, 1075 unsigned max_x, unsigned max_y) 1076 { 1077 /* XXX TODO Use absolute coordinates directly */ 1078 1079 pointer_t *pointer = input_pointer(input); 1080 1081 sysarg_t width, height; 1082 1083 fibril_mutex_lock(&viewport_list_mtx); 1084 if (list_empty(&viewport_list)) { 1085 printf("No viewport found\n"); 1086 fibril_mutex_unlock(&viewport_list_mtx); 1087 return EOK; /* XXX */ 1088 } 1089 link_t *link = list_first(&viewport_list); 1090 viewport_t *vp = list_get_instance(link, viewport_t, link); 1091 surface_get_resolution(vp->surface, &width, &height); 1092 desktop_point_t vp_pos = vp->pos; 1093 fibril_mutex_unlock(&viewport_list_mtx); 1094 1095 desktop_point_t pos_in_viewport; 1096 pos_in_viewport.x = x * width / max_x; 1097 pos_in_viewport.y = y * height / max_y; 1098 1099 /* Calculate offset from pointer */ 1100 fibril_mutex_lock(&pointer_list_mtx); 1101 desktop_vector_t delta; 1102 delta.x = (vp_pos.x + pos_in_viewport.x) - pointer->pos.x; 1103 delta.y = (vp_pos.y + pos_in_viewport.y) - pointer->pos.y; 1104 fibril_mutex_unlock(&pointer_list_mtx); 1105 1106 return comp_mouse_move(input, delta.x, delta.y); 1107 } 1108 1109 static int comp_mouse_move(input_t *input, int dx, int dy) 1110 { 1111 pointer_t *pointer = input_pointer(input); 1061 1112 1062 1113 /* Update pointer position. */ 1063 1114 fibril_mutex_lock(&pointer_list_mtx); 1064 sysarg_t old_hpos = pointer->hpos; 1065 sysarg_t old_vpos = pointer->vpos; 1115 desktop_point_t old_pos = pointer->pos; 1066 1116 sysarg_t cursor_width; 1067 1117 sysarg_t cursor_height; 1068 1118 surface_get_resolution(pointer->cursor.states[pointer->state], 1069 1119 &cursor_width, &cursor_height); 1070 pointer-> hpos+= dx;1071 pointer-> vpos+= dy;1120 pointer->pos.x += dx; 1121 pointer->pos.y += dy; 1072 1122 fibril_mutex_unlock(&pointer_list_mtx); 1073 comp_damage(old_ hpos, old_vpos, cursor_width, cursor_height);1074 comp_damage(old_ hpos + dx, old_vpos+ dy, cursor_width, cursor_height);1123 comp_damage(old_pos.x, old_pos.y, cursor_width, cursor_height); 1124 comp_damage(old_pos.x + dx, old_pos.y + dy, cursor_width, cursor_height); 1075 1125 1076 1126 fibril_mutex_lock(&window_list_mtx); … … 1084 1134 sysarg_t width, height; 1085 1135 surface_get_resolution(top->surface, &width, &height); 1086 within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1136 within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1087 1137 top->transform, width, height, &point_x, &point_y); 1088 1138 fibril_mutex_unlock(&window_list_mtx); … … 1103 1153 } else { 1104 1154 /* Pointer is grabbed by top-level window action. */ 1105 pointer->accum _dx += dx;1106 pointer->accum _dy += dy;1155 pointer->accum.x += dx; 1156 pointer->accum.y += dy; 1107 1157 #if ANIMATE_WINDOW_TRANSFORMS == 1 1108 1158 sysarg_t x, y, width, height; … … 1118 1168 } 1119 1169 1120 async_answer_0(iid, EOK); 1121 } 1122 1123 static void comp_mouse_button(pointer_t *pointer, ipc_callid_t iid, ipc_call_t *icall) 1124 { 1125 sysarg_t btn_num = IPC_GET_ARG1(*icall); 1126 bool pressed = (bool) IPC_GET_ARG2(*icall); 1127 1128 if (pressed) { 1129 pointer->btn_hpos = pointer->hpos; 1130 pointer->btn_vpos = pointer->vpos; 1131 pointer->btn_num = btn_num; 1170 return EOK; 1171 } 1172 1173 static int comp_mouse_button(input_t *input, int bnum, int bpress) 1174 { 1175 pointer_t *pointer = input_pointer(input); 1176 1177 if (bpress) { 1178 pointer->btn_pos = pointer->pos; 1179 pointer->btn_num = bnum; 1132 1180 pointer->pressed = true; 1133 1181 … … 1137 1185 if (!win || !win->surface) { 1138 1186 fibril_mutex_unlock(&window_list_mtx); 1139 async_answer_0(iid, EOK); 1140 return; 1187 return EOK; 1141 1188 } 1142 1189 sysarg_t x, y, width, height; 1143 1190 surface_get_resolution(win->surface, &width, &height); 1144 bool within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1191 bool within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1145 1192 win->transform, width, height, &x, &y); 1146 1193 fibril_mutex_unlock(&window_list_mtx); … … 1154 1201 event->data.pos.pos_id = pointer->id; 1155 1202 event->data.pos.type = POS_PRESS; 1156 event->data.pos.btn_num = b tn_num;1203 event->data.pos.btn_num = bnum; 1157 1204 event->data.pos.hpos = x; 1158 1205 event->data.pos.vpos = y; 1159 1206 comp_post_event(event); 1160 1207 } else { 1161 async_answer_0(iid, ENOMEM); 1162 return; 1163 } 1164 } 1165 } else if (pointer->pressed && pointer->btn_num == btn_num) { 1208 return ENOMEM; 1209 } 1210 } 1211 } else if (pointer->pressed && pointer->btn_num == (unsigned)bnum) { 1166 1212 pointer->pressed = false; 1167 1213 … … 1178 1224 if (win->surface) { 1179 1225 surface_get_resolution(win->surface, &width, &height); 1180 within_client = comp_coord_to_client(pointer-> hpos, pointer->vpos,1226 within_client = comp_coord_to_client(pointer->pos.x, pointer->pos.y, 1181 1227 win->transform, width, height, &point_x, &point_y); 1182 1228 } … … 1191 1237 pointer->grab_flags = GF_EMPTY; 1192 1238 fibril_mutex_unlock(&window_list_mtx); 1193 async_answer_0(iid, EOK); 1194 return; 1239 return EOK; 1195 1240 } 1196 1241 … … 1257 1302 event->data.pos.pos_id = pointer->id; 1258 1303 event->data.pos.type = POS_RELEASE; 1259 event->data.pos.btn_num = b tn_num;1304 event->data.pos.btn_num = bnum; 1260 1305 event->data.pos.hpos = point_x; 1261 1306 event->data.pos.vpos = point_y; … … 1263 1308 pointer->grab_flags = GF_EMPTY; 1264 1309 1265 } else if (within_client && (pointer->grab_flags == GF_EMPTY) && (b tn_num == 1)) {1310 } else if (within_client && (pointer->grab_flags == GF_EMPTY) && (bnum == 1)) { 1266 1311 1267 1312 /* Bring the window to the foreground. */ … … 1286 1331 } 1287 1332 1288 async_answer_0(iid, EOK); 1289 } 1290 1291 static void comp_key_press(ipc_callid_t iid, ipc_call_t *icall) 1292 { 1293 kbd_event_type_t type = IPC_GET_ARG1(*icall); 1294 keycode_t key = IPC_GET_ARG2(*icall); 1295 keymod_t mods = IPC_GET_ARG3(*icall); 1296 wchar_t c = IPC_GET_ARG4(*icall); 1297 1333 return EOK; 1334 } 1335 1336 static int comp_key_press(input_t *input, kbd_event_type_t type, keycode_t key, 1337 keymod_t mods, wchar_t c) 1338 { 1298 1339 bool win_transform = (mods & KM_ALT) && ( 1299 1340 key == KC_W || key == KC_S || key == KC_A || key == KC_D || … … 1378 1419 if (event == NULL) { 1379 1420 fibril_mutex_unlock(&window_list_mtx); 1380 async_answer_0(iid, ENOMEM); 1381 return; 1421 return ENOMEM; 1382 1422 } 1383 1423 … … 1448 1488 } else if (win_close) { 1449 1489 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 1450 if (event == NULL) { 1451 async_answer_0(iid, ENOMEM); 1452 return; 1453 } 1490 if (event == NULL) 1491 return ENOMEM; 1454 1492 1455 1493 link_initialize(&event->link); … … 1502 1540 switch (key) { 1503 1541 case KC_I: 1504 vp-> hpos+= 0;1505 vp-> vpos+= -20;1542 vp->pos.x += 0; 1543 vp->pos.y += -20; 1506 1544 break; 1507 1545 case KC_K: 1508 vp-> hpos+= 0;1509 vp-> vpos+= 20;1546 vp->pos.x += 0; 1547 vp->pos.y += 20; 1510 1548 break; 1511 1549 case KC_J: 1512 vp-> hpos+= -20;1513 vp-> vpos+= 0;1550 vp->pos.x += -20; 1551 vp->pos.y += 0; 1514 1552 break; 1515 1553 case KC_L: 1516 vp-> hpos+= 20;1517 vp-> vpos+= 0;1554 vp->pos.x += 20; 1555 vp->pos.y += 0; 1518 1556 break; 1519 1557 default: 1520 vp-> hpos+= 0;1521 vp-> vpos+= 0;1558 vp->pos.x += 0; 1559 vp->pos.y += 0; 1522 1560 break; 1523 1561 } 1524 1562 1525 sysarg_t x = vp-> hpos;1526 sysarg_t y = vp-> vpos;1563 sysarg_t x = vp->pos.x; 1564 sysarg_t y = vp->pos.y; 1527 1565 sysarg_t width, height; 1528 1566 surface_get_resolution(vp->surface, &width, &height); … … 1594 1632 } else { 1595 1633 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 1596 if (event == NULL) { 1597 async_answer_0(iid, ENOMEM); 1598 return; 1599 } 1634 if (event == NULL) 1635 return ENOMEM; 1600 1636 1601 1637 link_initialize(&event->link); … … 1609 1645 } 1610 1646 1611 async_answer_0(iid, EOK); 1612 } 1613 1614 static void input_events(ipc_callid_t iid, ipc_call_t *icall, void *arg) 1615 { 1647 return EOK; 1648 } 1649 1650 static int input_connect(const char *svc) 1651 { 1652 async_sess_t *sess; 1653 service_id_t dsid; 1654 1655 int rc = loc_service_get_id(svc, &dsid, 0); 1656 if (rc != EOK) { 1657 printf("%s: Input service %s not found\n", NAME, svc); 1658 return rc; 1659 } 1660 1661 sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0); 1662 if (sess == NULL) { 1663 printf("%s: Unable to connect to input service %s\n", NAME, 1664 svc); 1665 return EIO; 1666 } 1667 1616 1668 fibril_mutex_lock(&pointer_list_mtx); 1617 1669 pointer_t *pointer = pointer_create(); … … 1622 1674 fibril_mutex_unlock(&pointer_list_mtx); 1623 1675 1624 /* Ignore parameters, the connection is already opened. */ 1625 while (true) { 1626 ipc_call_t call; 1627 ipc_callid_t callid = async_get_call(&call); 1628 1629 if (!IPC_GET_IMETHOD(call)) { 1630 fibril_mutex_lock(&pointer_list_mtx); 1631 if (pointer != NULL) { 1632 list_remove(&pointer->link); 1633 pointer_destroy(pointer); 1634 } 1635 fibril_mutex_unlock(&pointer_list_mtx); 1636 async_hangup(input_sess); 1637 return; 1638 } 1639 1640 switch (IPC_GET_IMETHOD(call)) { 1641 case INPUT_EVENT_KEY: 1642 comp_key_press(callid, &call); 1643 break; 1644 case INPUT_EVENT_MOVE: 1645 comp_mouse_move(pointer, callid, &call); 1646 break; 1647 case INPUT_EVENT_BUTTON: 1648 comp_mouse_button(pointer, callid, &call); 1649 break; 1650 default: 1651 async_answer_0(callid, EINVAL); 1652 } 1653 } 1654 } 1655 1656 static async_sess_t *input_connect(const char *svc) 1657 { 1658 async_sess_t *sess; 1659 service_id_t dsid; 1660 1661 int rc = loc_service_get_id(svc, &dsid, 0); 1662 if (rc == EOK) { 1663 sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0); 1664 if (sess == NULL) { 1665 printf("%s: Unable to connect to input service %s\n", NAME, svc); 1666 return NULL; 1667 } 1668 } else 1669 return NULL; 1670 1671 async_exch_t *exch = async_exchange_begin(sess); 1672 rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL); 1673 async_exchange_end(exch); 1674 1676 if (pointer == NULL) { 1677 printf("%s: Cannot create pointer.\n", NAME); 1678 async_hangup(sess); 1679 return ENOMEM; 1680 } 1681 1682 rc = input_open(sess, &input_ev_ops, pointer, &input); 1675 1683 if (rc != EOK) { 1676 1684 async_hangup(sess); 1677 printf("%s: Unable to c reate callback connection toservice %s (%s)\n",1685 printf("%s: Unable to communicate with service %s (%s)\n", 1678 1686 NAME, svc, str_error(rc)); 1679 return NULL; 1680 } 1681 1682 return sess; 1687 return rc; 1688 } 1689 1690 return EOK; 1691 } 1692 1693 static void input_disconnect(void) 1694 { 1695 pointer_t *pointer = input->user; 1696 input_close(input); 1697 pointer_destroy(pointer); 1683 1698 } 1684 1699 … … 1733 1748 1734 1749 /* Establish input bidirectional connection. */ 1735 input_sess = input_connect(input_svc); 1736 if (input_sess == NULL) { 1737 return -1; 1738 } 1750 rc = input_connect(input_svc); 1751 if (rc != EOK) 1752 return rc; 1739 1753 1740 1754 /* Create viewports and connect them to visualizers. */ … … 1742 1756 rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING); 1743 1757 if (rc != EOK) { 1744 async_hangup(input_sess);1758 input_disconnect(); 1745 1759 return -1; 1746 1760 } … … 1750 1764 rc = loc_category_get_svcs(cat_id, &svcs, &svcs_cnt); 1751 1765 if (rc != EOK || svcs_cnt == 0) { 1752 async_hangup(input_sess);1766 input_disconnect(); 1753 1767 return -1; 1754 1768 } … … 1766 1780 1767 1781 if (list_empty(&viewport_list)) { 1768 async_hangup(input_sess);1782 input_disconnect(); 1769 1783 return -1; 1770 1784 } -
uspace/srv/hid/compositor/compositor.h
r131d9a4 r70253688 36 36 #define COMPOSITOR_COMPOSITOR_H_ 37 37 38 typedef native_t desktop_coord_t; 39 typedef struct { 40 desktop_coord_t x; 41 desktop_coord_t y; 42 } desktop_point_t; 43 typedef desktop_point_t desktop_vector_t; 44 45 /* TODO remove? */ 46 typedef struct { 47 double x; 48 double y; 49 } double_point_t; 50 typedef double_point_t double_vector_t; 51 38 52 #endif 39 53 -
uspace/srv/hid/console/console.c
r131d9a4 r70253688 36 36 #include <stdio.h> 37 37 #include <adt/prodcons.h> 38 #include <ipc/input.h> 39 #include <ipc/console.h> 38 #include <io/input.h> 40 39 #include <ipc/vfs.h> 41 40 #include <errno.h> … … 43 42 #include <loc.h> 44 43 #include <event.h> 44 #include <io/con_srv.h> 45 #include <io/kbd_event.h> 45 46 #include <io/keycode.h> 46 47 #include <io/chargrid.h> 47 #include <io/console.h>48 48 #include <io/output.h> 49 49 #include <align.h> … … 79 79 chargrid_t *frontbuf; /**< Front buffer */ 80 80 frontbuf_handle_t fbid; /**< Front buffer handle */ 81 con_srvs_t srvs; /**< Console service setup */ 81 82 } console_t; 82 83 83 /** Session to the input server*/84 static async_sess_t *input_sess;84 /** Input server proxy */ 85 static input_t *input; 85 86 86 87 /** Session to the output server */ … … 101 102 static console_t *kernel_console = &consoles[KERNEL_CONSOLE]; 102 103 104 static int input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 105 static int input_ev_move(input_t *, int, int); 106 static int input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned); 107 static int input_ev_button(input_t *, int, int); 108 109 static input_ev_ops_t input_ev_ops = { 110 .key = input_ev_key, 111 .move = input_ev_move, 112 .abs_move = input_ev_abs_move, 113 .button = input_ev_button 114 }; 115 116 static int cons_open(con_srvs_t *, con_srv_t *); 117 static int cons_close(con_srv_t *); 118 static int cons_read(con_srv_t *, void *, size_t); 119 static int cons_write(con_srv_t *, void *, size_t); 120 static void cons_sync(con_srv_t *); 121 static void cons_clear(con_srv_t *); 122 static void cons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row); 123 static int cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *); 124 static int cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *); 125 static int cons_get_color_cap(con_srv_t *, console_caps_t *); 126 static void cons_set_style(con_srv_t *, console_style_t); 127 static void cons_set_color(con_srv_t *, console_color_t, console_color_t, 128 console_color_attr_t); 129 static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 130 static void cons_set_cursor_visibility(con_srv_t *, bool); 131 static int cons_get_event(con_srv_t *, kbd_event_t *); 132 133 static con_ops_t con_ops = { 134 .open = cons_open, 135 .close = cons_close, 136 .read = cons_read, 137 .write = cons_write, 138 .sync = cons_sync, 139 .clear = cons_clear, 140 .set_pos = cons_set_pos, 141 .get_pos = cons_get_pos, 142 .get_size = cons_get_size, 143 .get_color_cap = cons_get_color_cap, 144 .set_style = cons_set_style, 145 .set_color = cons_set_color, 146 .set_rgb_color = cons_set_rgb_color, 147 .set_cursor_visibility = cons_set_cursor_visibility, 148 .get_event = cons_get_event 149 }; 150 151 static console_t *srv_to_console(con_srv_t *srv) 152 { 153 return srv->srvs->sarg; 154 } 155 103 156 static void cons_update(console_t *cons) 104 157 { … … 125 178 fibril_mutex_unlock(&cons->mtx); 126 179 fibril_mutex_unlock(&switch_mtx); 127 }128 129 static void cons_clear(console_t *cons)130 {131 fibril_mutex_lock(&cons->mtx);132 chargrid_clear(cons->frontbuf);133 fibril_mutex_unlock(&cons->mtx);134 135 cons_update(cons);136 180 } 137 181 … … 195 239 } 196 240 197 static void input_events(ipc_callid_t iid, ipc_call_t *icall, void *arg) 198 { 199 /* Ignore parameters, the connection is already opened */ 200 while (true) { 201 ipc_call_t call; 202 ipc_callid_t callid = async_get_call(&call); 203 204 if (!IPC_GET_IMETHOD(call)) { 205 /* TODO: Handle hangup */ 206 async_hangup(input_sess); 207 return; 208 } 209 210 kbd_event_type_t type; 211 keycode_t key; 212 keymod_t mods; 213 wchar_t c; 214 215 switch (IPC_GET_IMETHOD(call)) { 216 case INPUT_EVENT_KEY: 217 type = IPC_GET_ARG1(call); 218 key = IPC_GET_ARG2(call); 219 mods = IPC_GET_ARG3(call); 220 c = IPC_GET_ARG4(call); 221 222 if ((key >= KC_F1) && (key < KC_F1 + CONSOLE_COUNT) && 223 ((mods & KM_CTRL) == 0)) 224 cons_switch(&consoles[key - KC_F1]); 225 else { 226 /* Got key press/release event */ 227 kbd_event_t *event = 228 (kbd_event_t *) malloc(sizeof(kbd_event_t)); 229 if (event == NULL) { 230 async_answer_0(callid, ENOMEM); 231 break; 232 } 233 234 link_initialize(&event->link); 235 event->type = type; 236 event->key = key; 237 event->mods = mods; 238 event->c = c; 239 240 /* 241 * Kernel console does not read events 242 * from us, so we will redirect them 243 * to the (last) active userspace console 244 * if necessary. 245 */ 246 console_t *target_console = cons_get_active_uspace(); 247 248 prodcons_produce(&target_console->input_pc, 249 &event->link); 250 } 251 252 async_answer_0(callid, EOK); 253 break; 254 case INPUT_EVENT_MOVE: 255 async_answer_0(callid, EOK); 256 break; 257 case INPUT_EVENT_BUTTON: 258 async_answer_0(callid, EOK); 259 break; 260 default: 261 async_answer_0(callid, EINVAL); 262 } 263 } 241 static int input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key, 242 keymod_t mods, wchar_t c) 243 { 244 if ((key >= KC_F1) && (key < KC_F1 + CONSOLE_COUNT) && 245 ((mods & KM_CTRL) == 0)) { 246 cons_switch(&consoles[key - KC_F1]); 247 } else { 248 /* Got key press/release event */ 249 kbd_event_t *event = 250 (kbd_event_t *) malloc(sizeof(kbd_event_t)); 251 if (event == NULL) { 252 return ENOMEM; 253 } 254 255 link_initialize(&event->link); 256 event->type = type; 257 event->key = key; 258 event->mods = mods; 259 event->c = c; 260 261 /* 262 * Kernel console does not read events 263 * from us, so we will redirect them 264 * to the (last) active userspace console 265 * if necessary. 266 */ 267 console_t *target_console = cons_get_active_uspace(); 268 269 prodcons_produce(&target_console->input_pc, 270 &event->link); 271 } 272 273 return EOK; 274 } 275 276 static int input_ev_move(input_t *input, int dx, int dy) 277 { 278 return EOK; 279 } 280 281 static int input_ev_abs_move(input_t *input, unsigned x , unsigned y, 282 unsigned max_x, unsigned max_y) 283 { 284 return EOK; 285 } 286 287 static int input_ev_button(input_t *input, int bnum, int bpress) 288 { 289 return EOK; 264 290 } 265 291 … … 293 319 } 294 320 295 static void cons_set_cursor (console_t *cons, sysarg_t col, sysarg_t row)296 { 297 fibril_mutex_lock(&cons->mtx); 298 chargrid_set_cursor (cons->frontbuf, col, row);321 static void cons_set_cursor_vis(console_t *cons, bool visible) 322 { 323 fibril_mutex_lock(&cons->mtx); 324 chargrid_set_cursor_visibility(cons->frontbuf, visible); 299 325 fibril_mutex_unlock(&cons->mtx); 300 326 … … 302 328 } 303 329 304 static void cons_set_cursor_visibility(console_t *cons, bool visible) 305 { 306 fibril_mutex_lock(&cons->mtx); 307 chargrid_set_cursor_visibility(cons->frontbuf, visible); 308 fibril_mutex_unlock(&cons->mtx); 309 310 cons_update_cursor(cons); 311 } 312 313 static void cons_get_cursor(console_t *cons, ipc_callid_t iid, ipc_call_t *icall) 314 { 315 sysarg_t col; 316 sysarg_t row; 317 318 fibril_mutex_lock(&cons->mtx); 319 chargrid_get_cursor(cons->frontbuf, &col, &row); 320 fibril_mutex_unlock(&cons->mtx); 321 322 async_answer_2(iid, EOK, col, row); 323 } 324 325 static void cons_write(console_t *cons, ipc_callid_t iid, ipc_call_t *icall) 326 { 327 void *buf; 328 size_t size; 329 int rc = async_data_write_accept(&buf, false, 0, 0, 0, &size); 330 331 if (rc != EOK) { 332 async_answer_0(iid, rc); 333 return; 334 } 335 336 size_t off = 0; 337 while (off < size) 338 cons_write_char(cons, str_decode(buf, &off, size)); 339 340 async_answer_1(iid, EOK, size); 341 free(buf); 342 } 343 344 static void cons_read(console_t *cons, ipc_callid_t iid, ipc_call_t *icall) 345 { 346 ipc_callid_t callid; 347 size_t size; 348 if (!async_data_read_receive(&callid, &size)) { 349 async_answer_0(callid, EINVAL); 350 async_answer_0(iid, EINVAL); 351 return; 352 } 353 354 char *buf = (char *) malloc(size); 355 if (buf == NULL) { 356 async_answer_0(callid, ENOMEM); 357 async_answer_0(iid, ENOMEM); 358 return; 359 } 360 330 static int cons_open(con_srvs_t *srvs, con_srv_t *srv) 331 { 332 return EOK; 333 } 334 335 static int cons_close(con_srv_t *srv) 336 { 337 return EOK; 338 } 339 340 static int cons_read(con_srv_t *srv, void *buf, size_t size) 341 { 342 uint8_t *bbuf = buf; 343 console_t *cons = srv_to_console(srv); 361 344 size_t pos = 0; 362 345 … … 369 352 /* Copy to the buffer remaining characters. */ 370 353 while ((pos < size) && (cons->char_remains_len > 0)) { 371 b uf[pos] = cons->char_remains[0];354 bbuf[pos] = cons->char_remains[0]; 372 355 pos++; 373 356 … … 394 377 } 395 378 } 396 397 (void) async_data_read_finalize(callid, buf, size); 398 async_answer_1(iid, EOK, size); 399 free(buf); 400 } 401 402 static void cons_set_style(console_t *cons, console_style_t style) 403 { 379 380 return size; 381 } 382 383 static int cons_write(con_srv_t *srv, void *data, size_t size) 384 { 385 console_t *cons = srv_to_console(srv); 386 387 size_t off = 0; 388 while (off < size) 389 cons_write_char(cons, str_decode(data, &off, size)); 390 return size; 391 } 392 393 static void cons_sync(con_srv_t *srv) 394 { 395 console_t *cons = srv_to_console(srv); 396 397 cons_update(cons); 398 } 399 400 static void cons_clear(con_srv_t *srv) 401 { 402 console_t *cons = srv_to_console(srv); 403 404 fibril_mutex_lock(&cons->mtx); 405 chargrid_clear(cons->frontbuf); 406 fibril_mutex_unlock(&cons->mtx); 407 408 cons_update(cons); 409 } 410 411 static void cons_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row) 412 { 413 console_t *cons = srv_to_console(srv); 414 415 fibril_mutex_lock(&cons->mtx); 416 chargrid_set_cursor(cons->frontbuf, col, row); 417 fibril_mutex_unlock(&cons->mtx); 418 419 cons_update_cursor(cons); 420 } 421 422 static int cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row) 423 { 424 console_t *cons = srv_to_console(srv); 425 426 fibril_mutex_lock(&cons->mtx); 427 chargrid_get_cursor(cons->frontbuf, col, row); 428 fibril_mutex_unlock(&cons->mtx); 429 430 return EOK; 431 } 432 433 static int cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows) 434 { 435 console_t *cons = srv_to_console(srv); 436 437 fibril_mutex_lock(&cons->mtx); 438 *cols = cons->cols; 439 *rows = cons->rows; 440 fibril_mutex_unlock(&cons->mtx); 441 442 return EOK; 443 } 444 445 static int cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps) 446 { 447 console_t *cons = srv_to_console(srv); 448 449 fibril_mutex_lock(&cons->mtx); 450 *ccaps = cons->ccaps; 451 fibril_mutex_unlock(&cons->mtx); 452 453 return EOK; 454 } 455 456 static void cons_set_style(con_srv_t *srv, console_style_t style) 457 { 458 console_t *cons = srv_to_console(srv); 459 404 460 fibril_mutex_lock(&cons->mtx); 405 461 chargrid_set_style(cons->frontbuf, style); … … 407 463 } 408 464 409 static void cons_set_color(con sole_t *cons, console_color_t bgcolor,465 static void cons_set_color(con_srv_t *srv, console_color_t bgcolor, 410 466 console_color_t fgcolor, console_color_attr_t attr) 411 467 { 468 console_t *cons = srv_to_console(srv); 469 412 470 fibril_mutex_lock(&cons->mtx); 413 471 chargrid_set_color(cons->frontbuf, bgcolor, fgcolor, attr); … … 415 473 } 416 474 417 static void cons_set_rgb_color(con sole_t *cons, pixel_t bgcolor,475 static void cons_set_rgb_color(con_srv_t *srv, pixel_t bgcolor, 418 476 pixel_t fgcolor) 419 477 { 478 console_t *cons = srv_to_console(srv); 479 420 480 fibril_mutex_lock(&cons->mtx); 421 481 chargrid_set_rgb_color(cons->frontbuf, bgcolor, fgcolor); … … 423 483 } 424 484 425 static void cons_get_event(console_t *cons, ipc_callid_t iid, ipc_call_t *icall) 426 { 485 static void cons_set_cursor_visibility(con_srv_t *srv, bool visible) 486 { 487 console_t *cons = srv_to_console(srv); 488 489 cons_set_cursor_vis(cons, visible); 490 } 491 492 static int cons_get_event(con_srv_t *srv, kbd_event_t *event) 493 { 494 console_t *cons = srv_to_console(srv); 427 495 link_t *link = prodcons_consume(&cons->input_pc); 428 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 429 430 async_answer_4(iid, EOK, event->type, event->key, event->mods, event->c); 431 free(event); 496 kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link); 497 498 *event = *kevent; 499 free(kevent); 500 return EOK; 432 501 } 433 502 … … 452 521 453 522 if (atomic_postinc(&cons->refcnt) == 0) 454 cons_set_cursor_visibility(cons, true); 455 456 /* Accept the connection */ 457 async_answer_0(iid, EOK); 458 459 while (true) { 460 ipc_call_t call; 461 ipc_callid_t callid = async_get_call(&call); 462 463 if (!IPC_GET_IMETHOD(call)) 464 return; 465 466 switch (IPC_GET_IMETHOD(call)) { 467 case VFS_OUT_READ: 468 cons_read(cons, callid, &call); 469 break; 470 case VFS_OUT_WRITE: 471 cons_write(cons, callid, &call); 472 break; 473 case VFS_OUT_SYNC: 474 cons_update(cons); 475 async_answer_0(callid, EOK); 476 break; 477 case CONSOLE_CLEAR: 478 cons_clear(cons); 479 async_answer_0(callid, EOK); 480 break; 481 case CONSOLE_GOTO: 482 cons_set_cursor(cons, IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 483 async_answer_0(callid, EOK); 484 break; 485 case CONSOLE_GET_POS: 486 cons_get_cursor(cons, callid, &call); 487 break; 488 case CONSOLE_GET_SIZE: 489 async_answer_2(callid, EOK, cons->cols, cons->rows); 490 break; 491 case CONSOLE_GET_COLOR_CAP: 492 async_answer_1(callid, EOK, cons->ccaps); 493 break; 494 case CONSOLE_SET_STYLE: 495 cons_set_style(cons, IPC_GET_ARG1(call)); 496 async_answer_0(callid, EOK); 497 break; 498 case CONSOLE_SET_COLOR: 499 cons_set_color(cons, IPC_GET_ARG1(call), IPC_GET_ARG2(call), 500 IPC_GET_ARG3(call)); 501 async_answer_0(callid, EOK); 502 break; 503 case CONSOLE_SET_RGB_COLOR: 504 cons_set_rgb_color(cons, IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 505 async_answer_0(callid, EOK); 506 break; 507 case CONSOLE_CURSOR_VISIBILITY: 508 cons_set_cursor_visibility(cons, IPC_GET_ARG1(call)); 509 async_answer_0(callid, EOK); 510 break; 511 case CONSOLE_GET_EVENT: 512 cons_get_event(cons, callid, &call); 513 break; 514 default: 515 async_answer_0(callid, EINVAL); 516 } 517 } 518 } 519 520 static async_sess_t *input_connect(const char *svc) 523 cons_set_cursor_vis(cons, true); 524 525 con_conn(iid, icall, &cons->srvs); 526 } 527 528 529 static int input_connect(const char *svc) 521 530 { 522 531 async_sess_t *sess; … … 524 533 525 534 int rc = loc_service_get_id(svc, &dsid, 0); 526 if (rc == EOK) { 527 sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0); 528 if (sess == NULL) { 529 printf("%s: Unable to connect to input service %s\n", NAME, 530 svc); 531 return NULL; 532 } 533 } else 534 return NULL; 535 536 async_exch_t *exch = async_exchange_begin(sess); 537 rc = async_connect_to_me(exch, 0, 0, 0, input_events, NULL); 538 async_exchange_end(exch); 539 535 if (rc != EOK) { 536 printf("%s: Input service %s not found\n", NAME, svc); 537 return rc; 538 } 539 540 sess = loc_service_connect(EXCHANGE_ATOMIC, dsid, 0); 541 if (sess == NULL) { 542 printf("%s: Unable to connect to input service %s\n", NAME, 543 svc); 544 return EIO; 545 } 546 547 rc = input_open(sess, &input_ev_ops, NULL, &input); 540 548 if (rc != EOK) { 541 549 async_hangup(sess); 542 printf("%s: Unable to c reate callback connection toservice %s (%s)\n",550 printf("%s: Unable to communicate with service %s (%s)\n", 543 551 NAME, svc, str_error(rc)); 544 return NULL;545 } 546 547 return sess;552 return rc; 553 } 554 555 return EOK; 548 556 } 549 557 … … 574 582 static bool console_srv_init(char *input_svc, char *output_svc) 575 583 { 584 int rc; 585 576 586 /* Connect to input service */ 577 input_sess= input_connect(input_svc);578 if ( input_sess == NULL)587 rc = input_connect(input_svc); 588 if (rc != EOK) 579 589 return false; 580 590 … … 586 596 /* Register server */ 587 597 async_set_client_connection(client_connection); 588 intrc = loc_server_register(NAME);598 rc = loc_server_register(NAME); 589 599 if (rc != EOK) { 590 600 printf("%s: Unable to register server (%s)\n", NAME, … … 628 638 } 629 639 640 con_srvs_init(&consoles[i].srvs); 641 consoles[i].srvs.ops = &con_ops; 642 consoles[i].srvs.sarg = &consoles[i]; 643 630 644 char vc[LOC_NAME_MAXLEN + 1]; 631 645 snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i); -
uspace/srv/hid/remcons/remcons.c
r131d9a4 r70253688 34 34 35 35 #include <async.h> 36 #include <errno.h> 37 #include <io/con_srv.h> 36 38 #include <stdio.h> 37 #include <adt/prodcons.h> 38 #include <ipc/input.h> 39 #include <ipc/console.h> 40 #include <ipc/vfs.h> 41 #include <errno.h> 39 #include <stdlib.h> 42 40 #include <str_error.h> 43 41 #include <loc.h> … … 45 43 #include <io/keycode.h> 46 44 #include <align.h> 47 #include <malloc.h>48 #include <as.h>49 45 #include <fibril_synch.h> 50 46 #include <task.h> … … 75 71 sizeof(telnet_force_character_mode_command) / sizeof(telnet_cmd_t); 76 72 77 78 /** Handling client requests (VFS and console interface). 79 * 80 * @param user Telnet user the requests belong to. 81 */ 82 static void client_connection_message_loop(telnet_user_t *user) 83 { 84 while (true) { 85 ipc_call_t call; 86 ipc_callid_t callid = 0; 87 88 /* 89 * The getterm task might terminate while we are here, 90 * waiting for a call. Also, the socket might be closed 91 * meanwhile. 92 * We want to detect this situation early, so we use a 93 * timeout variant of async_get_call(). 94 */ 95 while (callid == 0) { 96 callid = async_get_call_timeout(&call, 1000); 97 98 if (telnet_user_is_zombie(user)) { 99 if (callid != 0) { 100 async_answer_0(callid, EINTR); 101 } 102 return; 103 } 104 } 105 106 if (!IPC_GET_IMETHOD(call)) { 107 return; 108 } 109 110 switch (IPC_GET_IMETHOD(call)) { 111 case CONSOLE_GET_SIZE: 112 async_answer_2(callid, EOK, 100, 1); 113 break; 114 case CONSOLE_GET_POS: 115 fibril_mutex_lock(&user->guard); 116 async_answer_2(callid, EOK, user->cursor_x, 0); 117 fibril_mutex_unlock(&user->guard); 118 break; 119 case CONSOLE_GET_EVENT: { 120 kbd_event_t event; 121 int rc = telnet_user_get_next_keyboard_event(user, &event); 122 if (rc != EOK) { 123 /* Silently ignore. */ 124 async_answer_0(callid, EOK); 125 break; 126 } 127 async_answer_4(callid, EOK, event.type, event.key, event.mods, event.c); 128 break; 129 } 130 case CONSOLE_GOTO: { 131 int new_x = IPC_GET_ARG1(call); 132 telnet_user_update_cursor_x(user, new_x); 133 async_answer_0(callid, ENOTSUP); 134 break; 135 } 136 case VFS_OUT_READ: 137 async_answer_0(callid, ENOTSUP); 138 break; 139 case VFS_OUT_WRITE: { 140 uint8_t *buf; 141 size_t size; 142 int rc = async_data_write_accept((void **)&buf, false, 0, 0, 0, &size); 143 144 if (rc != EOK) { 145 async_answer_0(callid, rc); 146 break; 147 } 148 149 rc = telnet_user_send_data(user, buf, size); 150 free(buf); 151 152 if (rc != EOK) { 153 async_answer_0(callid, rc); 154 break; 155 } 156 157 async_answer_1(callid, EOK, size); 158 break; 159 } 160 case VFS_OUT_SYNC: 161 async_answer_0(callid, EOK); 162 break; 163 case CONSOLE_CLEAR: 164 async_answer_0(callid, EOK); 165 break; 166 167 case CONSOLE_GET_COLOR_CAP: 168 async_answer_1(callid, EOK, CONSOLE_CAP_NONE); 169 break; 170 case CONSOLE_SET_STYLE: 171 async_answer_0(callid, ENOTSUP); 172 break; 173 case CONSOLE_SET_COLOR: 174 async_answer_0(callid, ENOTSUP); 175 break; 176 case CONSOLE_SET_RGB_COLOR: 177 async_answer_0(callid, ENOTSUP); 178 break; 179 180 case CONSOLE_CURSOR_VISIBILITY: 181 async_answer_0(callid, ENOTSUP); 182 break; 183 184 default: 185 async_answer_0(callid, EINVAL); 186 break; 187 } 188 } 73 static int remcons_open(con_srvs_t *, con_srv_t *); 74 static int remcons_close(con_srv_t *); 75 static int remcons_write(con_srv_t *, void *, size_t); 76 static void remcons_sync(con_srv_t *); 77 static void remcons_clear(con_srv_t *); 78 static void remcons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row); 79 static int remcons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *); 80 static int remcons_get_size(con_srv_t *, sysarg_t *, sysarg_t *); 81 static int remcons_get_color_cap(con_srv_t *, console_caps_t *); 82 static int remcons_get_event(con_srv_t *, kbd_event_t *); 83 84 static con_ops_t con_ops = { 85 .open = remcons_open, 86 .close = remcons_close, 87 .read = NULL, 88 .write = remcons_write, 89 .sync = remcons_sync, 90 .clear = remcons_clear, 91 .set_pos = remcons_set_pos, 92 .get_pos = remcons_get_pos, 93 .get_size = remcons_get_size, 94 .get_color_cap = remcons_get_color_cap, 95 .set_style = NULL, 96 .set_color = NULL, 97 .set_rgb_color = NULL, 98 .set_cursor_visibility = NULL, 99 .get_event = remcons_get_event 100 }; 101 102 static telnet_user_t *srv_to_user(con_srv_t *srv) 103 { 104 return srv->srvs->sarg; 105 } 106 107 static int remcons_open(con_srvs_t *srvs, con_srv_t *srv) 108 { 109 telnet_user_t *user = srv_to_user(srv); 110 111 telnet_user_log(user, "New client connected (%p).", srv); 112 113 /* Force character mode. */ 114 send(user->socket, (void *)telnet_force_character_mode_command, 115 telnet_force_character_mode_command_count, 0); 116 117 return EOK; 118 } 119 120 static int remcons_close(con_srv_t *srv) 121 { 122 telnet_user_t *user = srv_to_user(srv); 123 124 telnet_user_notify_client_disconnected(user); 125 telnet_user_log(user, "Client disconnected (%p).", srv); 126 127 return EOK; 128 } 129 130 static int remcons_write(con_srv_t *srv, void *data, size_t size) 131 { 132 telnet_user_t *user = srv_to_user(srv); 133 int rc; 134 135 rc = telnet_user_send_data(user, data, size); 136 if (rc != EOK) 137 return rc; 138 139 return size; 140 } 141 142 static void remcons_sync(con_srv_t *srv) 143 { 144 (void) srv; 145 } 146 147 static void remcons_clear(con_srv_t *srv) 148 { 149 (void) srv; 150 } 151 152 static void remcons_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row) 153 { 154 telnet_user_t *user = srv_to_user(srv); 155 156 telnet_user_update_cursor_x(user, col); 157 } 158 159 static int remcons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row) 160 { 161 telnet_user_t *user = srv_to_user(srv); 162 163 *col = user->cursor_x; 164 *row = 0; 165 166 return EOK; 167 } 168 169 static int remcons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows) 170 { 171 (void) srv; 172 173 *cols = 100; 174 *rows = 1; 175 176 return EOK; 177 } 178 179 static int remcons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps) 180 { 181 (void) srv; 182 *ccaps = CONSOLE_CAP_NONE; 183 184 return EOK; 185 } 186 187 static int remcons_get_event(con_srv_t *srv, kbd_event_t *event) 188 { 189 telnet_user_t *user = srv_to_user(srv); 190 int rc; 191 192 rc = telnet_user_get_next_keyboard_event(user, event); 193 if (rc != EOK) { 194 /* XXX What? */ 195 memset(event, 0, sizeof(*event)); 196 return EOK; 197 } 198 199 return EOK; 189 200 } 190 201 … … 198 209 return; 199 210 } 200 async_answer_0(iid, EOK);201 202 telnet_user_log(user, "New client connected (%" PRIxn").", iid);203 204 /* Force character mode. */205 send(user->socket, (void *)telnet_force_character_mode_command,206 telnet_force_character_mode_command_count, 0);207 211 208 212 /* Handle messages. */ 209 client_connection_message_loop(user); 210 211 telnet_user_notify_client_disconnected(user); 212 telnet_user_log(user, "Client disconnected (%" PRIxn").", iid); 213 con_conn(iid, icall, &user->srvs); 213 214 } 214 215 … … 232 233 fibril_mutex_lock(&user->guard); 233 234 user->task_finished = true; 235 user->srvs.aborted = true; 234 236 fibril_condvar_signal(&user->refcount_cv); 235 237 fibril_mutex_unlock(&user->guard); … … 251 253 fibril_mutex_lock(&user->guard); 252 254 user->task_finished = true; 255 user->srvs.aborted = true; 253 256 fibril_condvar_signal(&user->refcount_cv); 254 257 fibril_mutex_unlock(&user->guard); … … 295 298 closesocket(user->socket); 296 299 user->socket_closed = true; 300 user->srvs.aborted = true; 297 301 continue; 298 302 } else if (user->socket_closed) { … … 380 384 assert(user); 381 385 386 con_srvs_init(&user->srvs); 387 user->srvs.ops = &con_ops; 388 user->srvs.sarg = user; 389 user->srvs.abort_timeout = 1000; 390 391 telnet_user_add(user); 392 382 393 fid_t fid = fibril_create(network_user_fibril, user); 383 394 assert(fid); -
uspace/srv/hid/remcons/user.c
r131d9a4 r70253688 35 35 #include <stdio.h> 36 36 #include <adt/prodcons.h> 37 #include <ipc/input.h>38 #include <ipc/console.h>39 #include <ipc/vfs.h>40 37 #include <errno.h> 41 38 #include <str_error.h> … … 95 92 user->locsrv_connection_count = 0; 96 93 97 94 user->cursor_x = 0; 95 96 return user; 97 } 98 99 void telnet_user_add(telnet_user_t *user) 100 { 98 101 fibril_mutex_lock(&users_guard); 99 102 list_append(&user->link, &users); 100 103 fibril_mutex_unlock(&users_guard); 101 102 user->cursor_x = 0;103 104 return user;105 104 } 106 105 … … 199 198 if ((recv_length == 0) || (recv_length == ENOTCONN)) { 200 199 user->socket_closed = true; 200 user->srvs.aborted = true; 201 201 return ENOENT; 202 202 } -
uspace/srv/hid/remcons/user.h
r131d9a4 r70253688 36 36 #define TELNET_USER_H_ 37 37 38 #include <adt/prodcons.h> 38 39 #include <fibril_synch.h> 39 40 #include <inttypes.h> 41 #include <io/con_srv.h> 40 42 #include "remcons.h" 41 43 … … 55 57 /** Path name of the service. */ 56 58 char *service_name; 59 /** Console service setup */ 60 con_srvs_t srvs; 57 61 58 62 /** Producer-consumer of kbd_event_t. */ … … 77 81 78 82 extern telnet_user_t *telnet_user_create(int); 83 extern void telnet_user_add(telnet_user_t *); 79 84 extern void telnet_user_destroy(telnet_user_t *); 80 85 extern telnet_user_t *telnet_user_get_for_client_connection(service_id_t); -
uspace/srv/net/ethip/pdu.c
r131d9a4 r70253688 69 69 frame->size); 70 70 71 log_msg(LOG_DEFAULT, LVL_DEBUG, "Encoding Ethernet frame src=%llx dest=%llx etype=%x", 72 frame->src, frame->dest, frame->etype_len); 71 log_msg(LOG_DEFAULT, LVL_DEBUG, "Encoding Ethernet frame " 72 "src=%" PRIx64 " dest=%" PRIx64 " etype=%x", 73 frame->src.addr, frame->dest.addr, frame->etype_len); 73 74 log_msg(LOG_DEFAULT, LVL_DEBUG, "Encoded Ethernet frame (%zu bytes)", size); 74 75 … … 104 105 frame->size); 105 106 106 log_msg(LOG_DEFAULT, LVL_DEBUG, "Decoding Ethernet frame src=%llx dest=%llx etype=%x", 107 frame->src, frame->dest, frame->etype_len); 107 log_msg(LOG_DEFAULT, LVL_DEBUG, "Decoding Ethernet frame " 108 "src=%" PRIx64 " dest=%" PRIx64 " etype=%x", 109 frame->src.addr, frame->dest.addr, frame->etype_len); 108 110 log_msg(LOG_DEFAULT, LVL_DEBUG, "Decoded Ethernet frame payload (%zu bytes)", frame->size); 109 111 -
uspace/srv/net/tcp/conn.c
r131d9a4 r70253688 999 999 } else { 1000 1000 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: Nothing left in segment, dropping " 1001 "(xfer_size=%zu, SEG.LEN=% zu, seg->ctrl=%u)",1002 conn->name, xfer_size, seg->len, (unsigned )seg->ctrl);1001 "(xfer_size=%zu, SEG.LEN=%" PRIu32 ", seg->ctrl=%u)", 1002 conn->name, xfer_size, seg->len, (unsigned int) seg->ctrl); 1003 1003 /* Nothing left in segment */ 1004 1004 tcp_segment_delete(seg); … … 1146 1146 void tcp_conn_segment_arrived(tcp_conn_t *conn, tcp_segment_t *seg) 1147 1147 { 1148 log_msg(LOG_DEFAULT, LVL_DEBUG, "% c: tcp_conn_segment_arrived(%p)",1148 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_segment_arrived(%p)", 1149 1149 conn->name, seg); 1150 1150 -
uspace/srv/net/tcp/segment.c
r131d9a4 r70253688 250 250 log_msg(LOG_DEFAULT, LVL_DEBUG2, "Segment dump:"); 251 251 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - ctrl = %u", (unsigned)seg->ctrl); 252 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - seq = % 253 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - ack = % 254 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - len = % 255 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - wnd = % 256 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - up = % 252 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - seq = %" PRIu32, seg->seq); 253 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - ack = %" PRIu32, seg->ack); 254 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - len = %" PRIu32, seg->len); 255 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - wnd = %" PRIu32, seg->wnd); 256 log_msg(LOG_DEFAULT, LVL_DEBUG2, " - up = %" PRIu32, seg->up); 257 257 } 258 258 -
uspace/srv/net/tcp/sock.c
r131d9a4 r70253688 114 114 *rsock = NULL; 115 115 116 sock = calloc( sizeof(tcp_sockdata_t), 1);116 sock = calloc(1, sizeof(tcp_sockdata_t)); 117 117 if (sock == NULL) 118 118 return ENOMEM; … … 277 277 278 278 socket->backlog = backlog; 279 socket->lconn = calloc( sizeof(tcp_conn_t *), backlog);279 socket->lconn = calloc(backlog, sizeof(tcp_conn_t *)); 280 280 if (socket->lconn == NULL) { 281 281 fibril_mutex_unlock(&socket->lock); … … 293 293 for (i = 0; i < backlog; i++) { 294 294 295 lconn = calloc( sizeof(tcp_sock_lconn_t), 1);295 lconn = calloc(1, sizeof(tcp_sock_lconn_t)); 296 296 if (lconn == NULL) { 297 297 /* XXX Clean up */ -
uspace/srv/net/tcp/tqueue.c
r131d9a4 r70253688 172 172 173 173 xfer_seqlen = min(snd_buf_seqlen, avail_wnd); 174 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: snd_buf_seqlen = %zu, SND.WND = % zu, "174 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: snd_buf_seqlen = %zu, SND.WND = %" PRIu32 ", " 175 175 "xfer_seqlen = %zu", conn->name, snd_buf_seqlen, conn->snd_wnd, 176 176 xfer_seqlen); -
uspace/srv/net/udp/sock.c
r131d9a4 r70253688 104 104 105 105 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_sock_socket()"); 106 sock = calloc( sizeof(udp_sockdata_t), 1);106 sock = calloc(1, sizeof(udp_sockdata_t)); 107 107 if (sock == NULL) { 108 108 async_answer_0(callid, ENOMEM);
Note:
See TracChangeset
for help on using the changeset viewer.