Changes in uspace/lib/net/generic/packet_remote.c [fbcdeb8:ab9378b4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/generic/packet_remote.c
rfbcdeb8 rab9378b4 38 38 #include <async.h> 39 39 #include <errno.h> 40 #include <fibril_synch.h> 40 41 #include <ipc/packet.h> 41 42 #include <sys/mman.h> … … 46 47 #include <net/packet.h> 47 48 #include <net/packet_header.h> 49 50 static FIBRIL_MUTEX_INITIALIZE(packet_return_lock); 48 51 49 52 /** Obtain the packet from the packet server as the shared memory block. … … 66 69 packet_id_t packet_id, size_t size) 67 70 { 71 /* 72 * Prevent racing for address space with other invocations 73 * of packet_return(). 74 * 75 * XXX This of course does not prevent us racing with other 76 * competitors for address space mapping. 77 */ 78 fibril_mutex_lock(&packet_return_lock); 79 *packet = (packet_t *) as_get_mappable_page(size); 80 68 81 async_exch_t *exch = async_exchange_begin(sess); 69 82 ipc_call_t answer; 70 83 aid_t message = async_send_1(exch, NET_PACKET_GET, packet_id, &answer); 71 int rc = async_share_in_start_0_0(exch, size, (void *) packet);84 int rc = async_share_in_start_0_0(exch, *packet, size); 72 85 async_exchange_end(exch); 73 86 … … 75 88 async_wait_for(message, &result); 76 89 77 if (rc != EOK) 90 if (rc != EOK) { 91 munmap(*packet, size); 92 fibril_mutex_unlock(&packet_return_lock); 78 93 return rc; 79 80 if (packet == (void *) -1) 81 return ENOMEM; 94 } 82 95 83 96 rc = pm_add(*packet); 84 97 if (rc != EOK) { 85 98 munmap(*packet, size); 99 fibril_mutex_unlock(&packet_return_lock); 86 100 return rc; 87 101 } 88 102 103 fibril_mutex_unlock(&packet_return_lock); 89 104 return result; 90 105 }
Note:
See TracChangeset
for help on using the changeset viewer.