+ ip_lock(port);
+ assert(ip_active(port));
+ send = ipc_port_make_send_locked(port);
+
+ if (1 == port->ip_srights) {
+ ipc_port_t old_notify;
+
+ /* transfer our ref to the port, and arm the no-senders notification */
+ assert(IP_NULL == port->ip_nsrequest);
+ ipc_port_nsrequest(port, port->ip_mscount, ipc_port_make_sonce_locked(port), &old_notify);
+ /* port unlocked */
+ assert(IP_NULL == old_notify);
+ } else {
+ /* piggyback on the existing port reference, so consume ours */
+ ip_unlock(port);
+ semaphore_dereference(semaphore);
+ }
+ return (send);