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