- Timestamp:
- 2012-06-13T16:19:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49c94a3
- Parents:
- 33f9670 (diff), 2902e1bb (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:
-
- 30 edited
-
app/tester/mm/common.c (modified) (1 diff)
-
app/tester/mm/mapping1.c (modified) (1 diff)
-
drv/bus/usb/uhci/utils/malloc32.h (modified) (1 diff)
-
drv/bus/usb/usbmast/main.c (modified) (1 diff)
-
lib/c/arch/ia64/include/fibril.h (modified) (2 diffs)
-
lib/c/arch/ia64/include/thread.h (modified) (2 diffs)
-
lib/c/generic/as.c (modified) (1 diff)
-
lib/c/generic/elf/elf_load.c (modified) (1 diff)
-
lib/c/generic/fibril.c (modified) (1 diff)
-
lib/c/generic/malloc.c (modified) (1 diff)
-
lib/c/generic/mman.c (modified) (1 diff)
-
lib/c/generic/thread.c (modified) (3 diffs)
-
lib/c/include/as.h (modified) (1 diff)
-
lib/c/include/fibril.h (modified) (1 diff)
-
lib/c/include/sys/mman.h (modified) (1 diff)
-
lib/fb/imgmap.c (modified) (1 diff)
-
lib/fb/screenbuffer.c (modified) (1 diff)
-
lib/fs/libfs.c (modified) (1 diff)
-
srv/bd/ata_bd/ata_bd.c (modified) (1 diff)
-
srv/bd/file_bd/file_bd.c (modified) (1 diff)
-
srv/bd/gxe_bd/gxe_bd.c (modified) (1 diff)
-
srv/bd/part/guid_part/guid_part.c (modified) (1 diff)
-
srv/bd/part/mbr_part/mbr_part.c (modified) (1 diff)
-
srv/bd/rd/rd.c (modified) (1 diff)
-
srv/hid/fb/fb.c (modified) (2 diffs)
-
srv/net/tcp/sock.c (modified) (1 diff)
-
srv/net/udp/sock.c (modified) (21 diffs)
-
srv/net/udp/udp.c (modified) (1 diff)
-
srv/net/udp/udp_type.h (modified) (2 diffs)
-
srv/vfs/vfs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/mm/common.c
r33f9670 r1d4024cf 342 342 link_initialize(&area->link); 343 343 344 area->addr = as_area_create( (void *) -1, size,344 area->addr = as_area_create(AS_AREA_ANY, size, 345 345 AS_AREA_WRITE | AS_AREA_READ); 346 if (area->addr == (void *) -1) {346 if (area->addr == AS_MAP_FAILED) { 347 347 free(area); 348 348 check_consistency("map_area (a)"); -
uspace/app/tester/mm/mapping1.c
r33f9670 r1d4024cf 42 42 TPRINTF("Creating AS area...\n"); 43 43 44 void *result = as_area_create( (void *) -1, size,44 void *result = as_area_create(AS_AREA_ANY, size, 45 45 AS_AREA_READ | AS_AREA_WRITE); 46 if (result == (void *) -1)46 if (result == AS_MAP_FAILED) 47 47 return NULL; 48 48 -
uspace/drv/bus/usb/uhci/utils/malloc32.h
r33f9670 r1d4024cf 99 99 static inline void * get_page(void) 100 100 { 101 void *address = as_area_create( (void *) -1, UHCI_REQUIRED_PAGE_SIZE,101 void *address = as_area_create(AS_AREA_ANY, UHCI_REQUIRED_PAGE_SIZE, 102 102 AS_AREA_READ | AS_AREA_WRITE); 103 if (address == (void *) -1)103 if (address == AS_MAP_FAILED) 104 104 return NULL; 105 105 -
uspace/drv/bus/usb/usbmast/main.c
r33f9670 r1d4024cf 302 302 303 303 (void) async_share_out_finalize(callid, &comm_buf); 304 if (comm_buf == (void *) -1) {304 if (comm_buf == AS_MAP_FAILED) { 305 305 async_answer_0(callid, EHANGUP); 306 306 return; -
uspace/lib/c/arch/ia64/include/fibril.h
r33f9670 r1d4024cf 49 49 #define PFM_MASK (~0x3fffffffff) 50 50 51 #define PSTHREAD_INITIAL_STACK_PAGES_NO 252 53 51 /* Stack is divided into two equal parts (for memory stack and register stack). */ 54 #define PSTHREAD_INITIAL_STACK_DIVISION 252 #define FIBRIL_INITIAL_STACK_DIVISION 2 55 53 56 54 #define context_set(c, _pc, stack, size, tls) \ … … 58 56 (c)->pc = (uint64_t) _pc; \ 59 57 (c)->bsp = ((uint64_t) stack) + \ 60 size / PSTHREAD_INITIAL_STACK_DIVISION; \58 size / FIBRIL_INITIAL_STACK_DIVISION; \ 61 59 (c)->ar_pfs &= PFM_MASK; \ 62 60 (c)->sp = ((uint64_t) stack) + \ 63 ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \61 ALIGN_UP((size / FIBRIL_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \ 64 62 SP_DELTA; \ 65 63 (c)->tp = (uint64_t) tls; \ -
uspace/lib/c/arch/ia64/include/thread.h
r33f9670 r1d4024cf 27 27 */ 28 28 29 /** @addtogroup libcia64 29 /** @addtogroup libcia64 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_ia64_THREAD_H_ 37 37 38 #define THREAD_INITIAL_STACK_PAGES_NO 239 40 38 #endif 41 39 -
uspace/lib/c/generic/as.c
r33f9670 r1d4024cf 46 46 * 47 47 * @param base Starting virtual address of the area. 48 * If set to (void *) -1, the kernel finds49 * a mappable area.48 * If set to AS_AREA_ANY ((void *) -1), 49 * the kernel finds a mappable area. 50 50 * @param size Size of the area. 51 51 * @param flags Flags describing type of the area. 52 52 * 53 53 * @return Starting virtual address of the created area on success. 54 * @return (void *) -1otherwise.54 * @return AS_MAP_FAILED ((void *) -1) otherwise. 55 55 * 56 56 */ -
uspace/lib/c/generic/elf/elf_load.c
r33f9670 r1d4024cf 366 366 a = as_area_create((uint8_t *) base + bias, mem_sz, 367 367 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 368 if (a == (void *) -1) {368 if (a == AS_MAP_FAILED) { 369 369 DPRINTF("memory mapping failed (0x%x, %d)\n", 370 370 base + bias, mem_sz); -
uspace/lib/c/generic/fibril.c
r33f9670 r1d4024cf 286 286 } 287 287 288 /** Delete a fibril that has never run. 289 * 290 * Free resources of a fibril that has been created with fibril_create() 291 * but never readied using fibril_add_ready(). 292 * 293 * @param fid Pointer to the fibril structure of the fibril to be 294 * added. 295 */ 296 void fibril_destroy(fid_t fid) 297 { 298 fibril_t *fibril = (fibril_t *) fid; 299 300 free(fibril->stack); 301 fibril_teardown(fibril); 302 } 303 288 304 /** Add a fibril to the ready list. 289 305 * -
uspace/lib/c/generic/malloc.c
r33f9670 r1d4024cf 285 285 /* Align the heap area size on page boundary */ 286 286 size_t asize = ALIGN_UP(size, PAGE_SIZE); 287 void *astart = as_area_create( (void *) -1, asize,287 void *astart = as_area_create(AS_AREA_ANY, asize, 288 288 AS_AREA_WRITE | AS_AREA_READ); 289 if (astart == (void *) -1)289 if (astart == AS_MAP_FAILED) 290 290 return false; 291 291 -
uspace/lib/c/generic/mman.c
r33f9670 r1d4024cf 42 42 { 43 43 if (!start) 44 start = (void *) -1;44 start = AS_AREA_ANY; 45 45 46 46 // if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) -
uspace/lib/c/generic/thread.c
r33f9670 r1d4024cf 41 41 #include <str.h> 42 42 #include <async.h> 43 #include <errno.h> 44 #include <as.h> 43 45 #include "private/thread.h" 44 46 45 #ifndef THREAD_INITIAL_STACK_PAGES _NO46 #define THREAD_INITIAL_STACK_PAGES_NO 2 47 #ifndef THREAD_INITIAL_STACK_PAGES 48 #define THREAD_INITIAL_STACK_PAGES 2 47 49 #endif 48 50 … … 65 67 66 68 uarg->uspace_thread_function(uarg->uspace_thread_arg); 67 /* XXX: we cannot free the userspace stack while running on it 68 free(uarg->uspace_stack); 69 free(uarg); 70 */ 69 /* 70 * XXX: we cannot free the userspace stack while running on it 71 * 72 * free(uarg->uspace_stack); 73 * free(uarg); 74 */ 71 75 72 76 /* If there is a manager, destroy it */ … … 92 96 thread_id_t *tid) 93 97 { 94 char *stack; 95 uspace_arg_t *uarg; 96 int rc; 97 98 stack = (char *) malloc(getpagesize() * THREAD_INITIAL_STACK_PAGES_NO); 99 if (!stack) 100 return -1; 101 102 uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t)); 103 if (!uarg) { 104 free(stack); 105 return -1; 98 uspace_arg_t *uarg = 99 (uspace_arg_t *) malloc(sizeof(uspace_arg_t)); 100 if (!uarg) 101 return ENOMEM; 102 103 size_t stack_size = getpagesize() * THREAD_INITIAL_STACK_PAGES; 104 void *stack = as_area_create(AS_AREA_ANY, stack_size, 105 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 106 if (stack == AS_MAP_FAILED) { 107 free(uarg); 108 return ENOMEM; 106 109 } 107 110 108 111 uarg->uspace_entry = (void *) FADDR(__thread_entry); 109 uarg->uspace_stack = (void *) stack; 112 uarg->uspace_stack = stack; 113 uarg->uspace_stack_size = stack_size; 110 114 uarg->uspace_thread_function = function; 111 115 uarg->uspace_thread_arg = arg; 112 116 uarg->uspace_uarg = uarg; 113 117 114 rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name,115 (sysarg_t) str_size(name), (sysarg_t) tid);118 int rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, 119 (sysarg_t) name, (sysarg_t) str_size(name), (sysarg_t) tid); 116 120 117 if (rc ) {121 if (rc != EOK) { 118 122 /* 119 123 * Failed to create a new thread. 120 * Free up the allocated structures.124 * Free up the allocated data. 121 125 */ 126 as_area_destroy(stack); 122 127 free(uarg); 123 free(stack);124 128 } 125 129 126 130 return rc; 127 131 } -
uspace/lib/c/include/as.h
r33f9670 r1d4024cf 41 41 #include <libarch/config.h> 42 42 43 #define AS_AREA_ANY ((void *) -1) 44 #define AS_MAP_FAILED ((void *) -1) 45 43 46 static inline size_t SIZE2PAGES(size_t size) 44 47 { -
uspace/lib/c/include/fibril.h
r33f9670 r1d4024cf 87 87 88 88 extern fid_t fibril_create(int (*func)(void *), void *arg); 89 extern void fibril_destroy(fid_t fid); 89 90 extern fibril_t *fibril_setup(void); 90 91 extern void fibril_teardown(fibril_t *f); -
uspace/lib/c/include/sys/mman.h
r33f9670 r1d4024cf 39 39 #include <sys/types.h> 40 40 41 #define MAP_FAILED ((void *) -1)41 #define MAP_FAILED AS_MAP_FAILED 42 42 43 43 #define MAP_SHARED (1 << 0) -
uspace/lib/fb/imgmap.c
r33f9670 r1d4024cf 420 420 421 421 if ((flags & IMGMAP_FLAG_SHARED) == IMGMAP_FLAG_SHARED) { 422 imgmap = (imgmap_t *) as_area_create( (void *) -1, size,422 imgmap = (imgmap_t *) as_area_create(AS_AREA_ANY, size, 423 423 AS_AREA_READ | AS_AREA_WRITE); 424 if (imgmap == (void *) -1)424 if (imgmap == AS_MAP_FAILED) 425 425 return NULL; 426 426 } else { -
uspace/lib/fb/screenbuffer.c
r33f9670 r1d4024cf 79 79 80 80 if ((flags & SCREENBUFFER_FLAG_SHARED) == SCREENBUFFER_FLAG_SHARED) { 81 scrbuf = (screenbuffer_t *) as_area_create( (void *) -1, size,81 scrbuf = (screenbuffer_t *) as_area_create(AS_AREA_ANY, size, 82 82 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 83 if (scrbuf == (void *) -1)83 if (scrbuf == AS_MAP_FAILED) 84 84 return NULL; 85 85 } else { -
uspace/lib/fs/libfs.c
r33f9670 r1d4024cf 339 339 */ 340 340 rc = async_share_in_start_0_0(exch, PLB_SIZE, (void *) ®.plb_ro); 341 if (reg.plb_ro == (void *) -1) {341 if (reg.plb_ro == AS_MAP_FAILED) { 342 342 async_exchange_end(exch); 343 343 async_forget(req); -
uspace/srv/bd/ata_bd/ata_bd.c
r33f9670 r1d4024cf 308 308 309 309 (void) async_share_out_finalize(callid, &fs_va); 310 if (fs_va == (void *) -1) {310 if (fs_va == AS_MAP_FAILED) { 311 311 async_answer_0(callid, EHANGUP); 312 312 return; -
uspace/srv/bd/file_bd/file_bd.c
r33f9670 r1d4024cf 189 189 190 190 (void) async_share_out_finalize(callid, &fs_va); 191 if (fs_va == (void *) -1) {191 if (fs_va == AS_MAP_FAILED) { 192 192 async_answer_0(callid, EHANGUP); 193 193 return; -
uspace/srv/bd/gxe_bd/gxe_bd.c
r33f9670 r1d4024cf 196 196 197 197 (void) async_share_out_finalize(callid, &fs_va); 198 if (fs_va == (void *) -1) {198 if (fs_va == AS_MAP_FAILED) { 199 199 async_answer_0(callid, EHANGUP); 200 200 return; -
uspace/srv/bd/part/guid_part/guid_part.c
r33f9670 r1d4024cf 350 350 351 351 (void) async_share_out_finalize(callid, &fs_va); 352 if (fs_va == (void *) -1) {352 if (fs_va == AS_MAP_FAILED) { 353 353 async_answer_0(callid, EHANGUP); 354 354 return; -
uspace/srv/bd/part/mbr_part/mbr_part.c
r33f9670 r1d4024cf 427 427 428 428 (void) async_share_out_finalize(callid, &fs_va); 429 if (fs_va == (void *) -1) {429 if (fs_va == AS_MAP_FAILED) { 430 430 async_answer_0(callid, EHANGUP); 431 431 return; -
uspace/srv/bd/rd/rd.c
r33f9670 r1d4024cf 106 106 if (async_share_out_receive(&callid, &comm_size, &flags)) { 107 107 (void) async_share_out_finalize(callid, &fs_va); 108 if (fs_va == (void *) -1) {108 if (fs_va == AS_MAP_FAILED) { 109 109 async_answer_0(callid, EHANGUP); 110 110 return; -
uspace/srv/hid/fb/fb.c
r33f9670 r1d4024cf 305 305 306 306 int rc = async_share_out_finalize(callid, &frontbuf->data); 307 if ((rc != EOK) || (frontbuf->data == (void *) -1)) {307 if ((rc != EOK) || (frontbuf->data == AS_MAP_FAILED)) { 308 308 free(frontbuf); 309 309 async_answer_0(iid, ENOMEM); … … 348 348 349 349 int rc = async_share_out_finalize(callid, &imagemap->data); 350 if ((rc != EOK) || (imagemap->data == (void *) -1)) {350 if ((rc != EOK) || (imagemap->data == AS_MAP_FAILED)) { 351 351 free(imagemap); 352 352 async_answer_0(iid, ENOMEM); -
uspace/srv/net/tcp/sock.c
r33f9670 r1d4024cf 151 151 sock, sock_id); 152 152 153 if (rc != EOK) 153 if (rc != EOK) { 154 fibril_destroy(sock->recv_fibril); 155 sock->recv_fibril = 0; 154 156 return rc; 157 } 155 158 156 159 sock_core = socket_cores_find(&sock->client->sockets, *sock_id); -
uspace/srv/net/udp/sock.c
r33f9670 r1d4024cf 51 51 #include "ucall.h" 52 52 53 #define FRAGMENT_SIZE 102454 55 53 /** Free ports pool start. */ 56 54 #define UDP_FREE_PORTS_START 1025 … … 63 61 64 62 static void udp_sock_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg); 63 static int udp_sock_recv_fibril(void *arg); 65 64 66 65 int udp_sock_init(void) … … 82 81 83 82 socket = (udp_sockdata_t *)sock_core->specific_data; 84 assert(socket->assoc != NULL); 85 udp_uc_destroy(socket->assoc); 83 (void)socket; 84 85 /* XXX We need to force the receive fibril to quit */ 86 86 } 87 87 … … 91 91 async_exch_t *exch = async_exchange_begin(sock_core->sess); 92 92 async_msg_5(exch, NET_SOCKET_RECEIVED, (sysarg_t)sock_core->socket_id, 93 FRAGMENT_SIZE, 0, 0, 1);93 UDP_FRAGMENT_SIZE, 0, 0, 1); 94 94 async_exchange_end(exch); 95 95 } … … 113 113 sock->client = client; 114 114 115 sock->recv_buffer_used = 0; 116 sock->recv_error = UDP_EOK; 117 fibril_mutex_initialize(&sock->recv_buffer_lock); 118 fibril_condvar_initialize(&sock->recv_buffer_cv); 119 115 120 rc = udp_uc_create(&sock->assoc); 116 121 if (rc != EOK) { 122 free(sock); 123 async_answer_0(callid, rc); 124 return; 125 } 126 127 sock->recv_fibril = fibril_create(udp_sock_recv_fibril, sock); 128 if (sock->recv_fibril == 0) { 129 udp_uc_destroy(sock->assoc); 130 free(sock); 131 async_answer_0(callid, ENOMEM); 132 return; 133 } 134 135 sock_id = SOCKET_GET_SOCKET_ID(call); 136 rc = socket_create(&client->sockets, client->sess, sock, &sock_id); 137 if (rc != EOK) { 138 fibril_destroy(sock->recv_fibril); 117 139 udp_uc_destroy(sock->assoc); 118 140 free(sock); … … 121 143 } 122 144 123 sock_id = SOCKET_GET_SOCKET_ID(call); 124 rc = socket_create(&client->sockets, client->sess, sock, &sock_id); 125 if (rc != EOK) { 126 async_answer_0(callid, rc); 127 return; 128 } 145 fibril_add_ready(sock->recv_fibril); 129 146 130 147 sock_core = socket_cores_find(&client->sockets, sock_id); … … 134 151 SOCKET_SET_SOCKET_ID(answer, sock_id); 135 152 136 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);153 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, UDP_FRAGMENT_SIZE); 137 154 SOCKET_SET_HEADER_SIZE(answer, sizeof(udp_header_t)); 138 155 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), … … 205 222 } 206 223 207 udp_sock_notify_data(sock_core);208 209 224 log_msg(LVL_DEBUG, " - success"); 210 225 async_answer_0(callid, rc); … … 245 260 ipc_callid_t wcallid; 246 261 size_t length; 247 uint8_t buffer[ FRAGMENT_SIZE];262 uint8_t buffer[UDP_FRAGMENT_SIZE]; 248 263 udp_error_t urc; 249 264 int rc; … … 292 307 goto out; 293 308 } 294 295 udp_sock_notify_data(sock_core);296 309 } 297 310 … … 330 343 } 331 344 332 if (length > FRAGMENT_SIZE)333 length = FRAGMENT_SIZE;345 if (length > UDP_FRAGMENT_SIZE) 346 length = UDP_FRAGMENT_SIZE; 334 347 335 348 rc = async_data_write_finalize(wcallid, buffer, length); … … 367 380 368 381 IPC_SET_ARG1(answer, 0); 369 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);382 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, UDP_FRAGMENT_SIZE); 370 383 async_answer_2(callid, EOK, IPC_GET_ARG1(answer), 371 384 IPC_GET_ARG2(answer)); … … 386 399 ipc_call_t answer; 387 400 ipc_callid_t rcallid; 388 uint8_t buffer[FRAGMENT_SIZE];389 401 size_t data_len; 390 xflags_t xflags;391 402 udp_error_t urc; 403 udp_sock_t rsock; 392 404 struct sockaddr_in addr; 393 udp_sock_t rsock;394 405 int rc; 395 406 … … 416 427 (void)flags; 417 428 418 urc = udp_uc_receive(socket->assoc, buffer, FRAGMENT_SIZE, &data_len, 419 &xflags, &rsock); 420 log_msg(LVL_DEBUG, "**** udp_uc_receive done, data_len=%zu", data_len); 429 log_msg(LVL_DEBUG, "udp_sock_recvfrom(): lock recv_buffer lock"); 430 fibril_mutex_lock(&socket->recv_buffer_lock); 431 while (socket->recv_buffer_used == 0 && socket->recv_error == UDP_EOK) { 432 log_msg(LVL_DEBUG, "udp_sock_recvfrom(): wait for cv"); 433 fibril_condvar_wait(&socket->recv_buffer_cv, 434 &socket->recv_buffer_lock); 435 } 436 437 log_msg(LVL_DEBUG, "Got data in sock recv_buffer"); 438 439 rsock = socket->recv_fsock; 440 data_len = socket->recv_buffer_used; 441 urc = socket->recv_error; 442 443 log_msg(LVL_DEBUG, "**** recv data_len=%zu", data_len); 421 444 422 445 switch (urc) { … … 437 460 log_msg(LVL_DEBUG, "**** udp_uc_receive -> %d", rc); 438 461 if (rc != EOK) { 462 fibril_mutex_unlock(&socket->recv_buffer_lock); 439 463 fibril_mutex_unlock(&socket->lock); 440 464 async_answer_0(callid, rc); … … 450 474 log_msg(LVL_DEBUG, "addr read receive"); 451 475 if (!async_data_read_receive(&rcallid, &addr_length)) { 476 fibril_mutex_unlock(&socket->recv_buffer_lock); 452 477 fibril_mutex_unlock(&socket->lock); 453 478 async_answer_0(callid, EINVAL); … … 461 486 rc = async_data_read_finalize(rcallid, &addr, addr_length); 462 487 if (rc != EOK) { 488 fibril_mutex_unlock(&socket->recv_buffer_lock); 463 489 fibril_mutex_unlock(&socket->lock); 464 490 async_answer_0(callid, EINVAL); … … 469 495 log_msg(LVL_DEBUG, "data read receive"); 470 496 if (!async_data_read_receive(&rcallid, &length)) { 497 fibril_mutex_unlock(&socket->recv_buffer_lock); 471 498 fibril_mutex_unlock(&socket->lock); 472 499 async_answer_0(callid, EINVAL); … … 478 505 479 506 log_msg(LVL_DEBUG, "data read finalize"); 480 rc = async_data_read_finalize(rcallid, buffer, length);507 rc = async_data_read_finalize(rcallid, socket->recv_buffer, length); 481 508 482 509 if (length < data_len && rc == EOK) … … 489 516 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 490 517 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 491 492 /* Push one fragment notification to client's queue */ 493 udp_sock_notify_data(sock_core); 518 519 socket->recv_buffer_used = 0; 520 521 fibril_condvar_broadcast(&socket->recv_buffer_cv); 522 fibril_mutex_unlock(&socket->recv_buffer_lock); 494 523 fibril_mutex_unlock(&socket->lock); 495 524 } … … 538 567 } 539 568 569 static int udp_sock_recv_fibril(void *arg) 570 { 571 udp_sockdata_t *sock = (udp_sockdata_t *)arg; 572 udp_error_t urc; 573 xflags_t xflags; 574 size_t rcvd; 575 576 log_msg(LVL_DEBUG, "udp_sock_recv_fibril()"); 577 578 while (true) { 579 log_msg(LVL_DEBUG, "[] wait for rcv buffer empty()"); 580 fibril_mutex_lock(&sock->recv_buffer_lock); 581 while (sock->recv_buffer_used != 0) { 582 fibril_condvar_wait(&sock->recv_buffer_cv, 583 &sock->recv_buffer_lock); 584 } 585 586 log_msg(LVL_DEBUG, "[] call udp_uc_receive()"); 587 urc = udp_uc_receive(sock->assoc, sock->recv_buffer, 588 UDP_FRAGMENT_SIZE, &rcvd, &xflags, &sock->recv_fsock); 589 sock->recv_error = urc; 590 591 udp_sock_notify_data(sock->sock_core); 592 593 if (urc != UDP_EOK) { 594 fibril_condvar_broadcast(&sock->recv_buffer_cv); 595 fibril_mutex_unlock(&sock->recv_buffer_lock); 596 break; 597 } 598 599 log_msg(LVL_DEBUG, "[] got data - broadcast recv_buffer_cv"); 600 601 sock->recv_buffer_used = rcvd; 602 fibril_mutex_unlock(&sock->recv_buffer_lock); 603 fibril_condvar_broadcast(&sock->recv_buffer_cv); 604 } 605 606 udp_uc_destroy(sock->assoc); 607 608 return 0; 609 } 610 540 611 static void udp_sock_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 541 612 { -
uspace/srv/net/udp/udp.c
r33f9670 r1d4024cf 73 73 printf(NAME ": UDP (User Datagram Protocol) service\n"); 74 74 75 rc = log_init(NAME, LVL_ WARN);75 rc = log_init(NAME, LVL_DEBUG); 76 76 if (rc != EOK) { 77 77 printf(NAME ": Failed to initialize log.\n"); -
uspace/srv/net/udp/udp_type.h
r33f9670 r1d4024cf 36 36 #define UDP_TYPE_H 37 37 38 #include <fibril.h> 38 39 #include <fibril_synch.h> 39 40 #include <socket_core.h> 40 41 #include <sys/types.h> 42 43 #define UDP_FRAGMENT_SIZE 4096 44 41 45 42 46 typedef enum { … … 141 145 /** Connection */ 142 146 udp_assoc_t *assoc; 147 /** Receiving fibril */ 148 fid_t recv_fibril; 149 uint8_t recv_buffer[UDP_FRAGMENT_SIZE]; 150 size_t recv_buffer_used; 151 udp_sock_t recv_fsock; 152 fibril_mutex_t recv_buffer_lock; 153 fibril_condvar_t recv_buffer_cv; 154 udp_error_t recv_error; 143 155 } udp_sockdata_t; 144 156 -
uspace/srv/vfs/vfs.c
r33f9670 r1d4024cf 173 173 * Allocate and initialize the Path Lookup Buffer. 174 174 */ 175 plb = as_area_create( (void *) -1, PLB_SIZE,175 plb = as_area_create(AS_AREA_ANY, PLB_SIZE, 176 176 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 177 if (plb == (void *) -1) {177 if (plb == AS_MAP_FAILED) { 178 178 printf("%s: Cannot create address space area\n", NAME); 179 179 return ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.
