1*33de042dSApple OSS Distributions<h2>mach_port_request_notification</h2> 2*33de042dSApple OSS Distributions<hr> 3*33de042dSApple OSS Distributions<p> 4*33de042dSApple OSS Distributions<strong>Function</strong> - Request notification of the specified port event type. 5*33de042dSApple OSS Distributions<h3>SYNOPSIS</h3> 6*33de042dSApple OSS Distributions<pre> 7*33de042dSApple OSS Distributions<strong>kern_return_t mach_port_request_notification</strong> 8*33de042dSApple OSS Distributions <strong>(ipc_space_t</strong> <var>task</var>, 9*33de042dSApple OSS Distributions <strong>mach_port_name_t</strong> <var>name</var>, 10*33de042dSApple OSS Distributions <strong>mach_msg_id_t</strong> <var>variant</var>, 11*33de042dSApple OSS Distributions <strong>mach_port_mscount_t</strong> <var>sync</var>, 12*33de042dSApple OSS Distributions <strong>mach_port_send_once_t</strong> <var>notify</var>, 13*33de042dSApple OSS Distributions <strong>mach_msg_type_name_t</strong> <var>notify_type</var>, 14*33de042dSApple OSS Distributions <strong>mach_port_send_once_t</strong> <var>*previous</var><strong>);</strong> 15*33de042dSApple OSS Distributions</pre> 16*33de042dSApple OSS Distributions<h3>PARAMETERS</h3> 17*33de042dSApple OSS Distributions<dl> 18*33de042dSApple OSS Distributions<p> 19*33de042dSApple OSS Distributions<dt> <var>task</var> 20*33de042dSApple OSS Distributions<dd> 21*33de042dSApple OSS Distributions[in task send right] 22*33de042dSApple OSS DistributionsThe task holding the specified right. 23*33de042dSApple OSS Distributions<p> 24*33de042dSApple OSS Distributions<dt> <var>name</var> 25*33de042dSApple OSS Distributions<dd> 26*33de042dSApple OSS Distributions[in scalar] 27*33de042dSApple OSS DistributionsThe task's name for the right. 28*33de042dSApple OSS Distributions<p> 29*33de042dSApple OSS Distributions<dt> <var>variant</var> 30*33de042dSApple OSS Distributions<dd> 31*33de042dSApple OSS Distributions[in scalar] 32*33de042dSApple OSS DistributionsThe type of notification. 33*33de042dSApple OSS Distributions<p> 34*33de042dSApple OSS Distributions<dt> <var>sync</var> 35*33de042dSApple OSS Distributions<dd> 36*33de042dSApple OSS Distributions[in scalar] 37*33de042dSApple OSS DistributionsSome variants use this value to overcome race conditions. 38*33de042dSApple OSS Distributions<p> 39*33de042dSApple OSS Distributions<dt> <var>notify</var> 40*33de042dSApple OSS Distributions<dd> 41*33de042dSApple OSS Distributions[in notify send-once or receive (to be converted to send-once) right] 42*33de042dSApple OSS DistributionsA 43*33de042dSApple OSS Distributionssend-once right, to which the notification will be sent. 44*33de042dSApple OSS Distributions<p> 45*33de042dSApple OSS Distributions<dt> <var>notify_type</var> 46*33de042dSApple OSS Distributions<dd> 47*33de042dSApple OSS Distributions[in scalar] 48*33de042dSApple OSS DistributionsIPC type of the <var>notify</var> right; either 49*33de042dSApple OSS Distributions<strong>MACH_MSG_TYPE_MAKE_SEND_ONCE</strong> or <strong>MACH_MSG_TYPE_MOVE_SEND_ONCE</strong>. 50*33de042dSApple OSS Distributions<p> 51*33de042dSApple OSS Distributions<dt> <var>previous</var> 52*33de042dSApple OSS Distributions<dd> 53*33de042dSApple OSS Distributions[out notify send-once right] 54*33de042dSApple OSS DistributionsThe previously registered send-once right. 55*33de042dSApple OSS Distributions</dl> 56*33de042dSApple OSS Distributions<h3>DESCRIPTION</h3> 57*33de042dSApple OSS Distributions<p> 58*33de042dSApple OSS DistributionsThe <strong>mach_port_request_notification</strong> function registers a request for a 59*33de042dSApple OSS Distributionsnotification and supplies a send-once right that the notification 60*33de042dSApple OSS Distributionswill use. It is an atomic 61*33de042dSApple OSS Distributionsswap, returning the previously registered send-once right (or 62*33de042dSApple OSS Distributions<strong>MACH_PORT_NULL</strong> for none). A notification request may be 63*33de042dSApple OSS Distributionscancelled by providing <strong>MACH_PORT_NULL</strong>. 64*33de042dSApple OSS Distributions<p> 65*33de042dSApple OSS DistributionsThe <var>variant</var> argument takes the following values: 66*33de042dSApple OSS Distributions<dl> 67*33de042dSApple OSS Distributions<dt> <strong>MACH_NOTIFY_PORT_DESTROYED</strong> 68*33de042dSApple OSS Distributions<dd> 69*33de042dSApple OSS Distributions<var>sync</var> must be zero. The <var>name</var> must specify a receive right, 70*33de042dSApple OSS Distributionsand the call requests a port-destroyed notification for the receive 71*33de042dSApple OSS Distributionsright. If the receive right were to have been destroyed, for instance 72*33de042dSApple OSS Distributionsby <strong>mach_port_destroy</strong>, then instead the receive right will be 73*33de042dSApple OSS Distributionssent in a port-destroyed notification to the registered send-once right. 74*33de042dSApple OSS Distributions<p> 75*33de042dSApple OSS Distributions<dt> <strong>MACH_NOTIFY_DEAD_NAME</strong> 76*33de042dSApple OSS Distributions<dd> 77*33de042dSApple OSS DistributionsThe call requests a dead-name notification. <var>name</var> specifies send, 78*33de042dSApple OSS Distributionsreceive, or send-once rights for a port. If the port is destroyed (and the 79*33de042dSApple OSS Distributionsright remains, becoming a dead name), then a dead-name notification 80*33de042dSApple OSS Distributionswhich carries the name of the right will be sent to the registered 81*33de042dSApple OSS Distributionssend-once right. If <var>sync</var> is non-zero, 82*33de042dSApple OSS Distributionsthe <var>name</var> may specify a dead name, and 83*33de042dSApple OSS Distributionsa dead-name notification is immediately generated. 84*33de042dSApple OSS Distributions<p> 85*33de042dSApple OSS DistributionsWhenever a dead-name notification is generated, the user reference 86*33de042dSApple OSS Distributionscount of the dead name is incremented. For example, a send right with 87*33de042dSApple OSS Distributionstwo user refs has a registered dead-name request. If the port is 88*33de042dSApple OSS Distributionsdestroyed, the send right turns into a dead name with three user refs 89*33de042dSApple OSS Distributions(instead of two), and a dead-name notification is generated. 90*33de042dSApple OSS Distributions<p> 91*33de042dSApple OSS DistributionsIf the name is made available for reuse, perhaps because of 92*33de042dSApple OSS Distributions<strong>mach_port_destroy</strong> or <strong>mach_port_mod_refs</strong>, 93*33de042dSApple OSS Distributionsor the name denotes a 94*33de042dSApple OSS Distributionssend-once right which has a message sent to it, then the registered send-once 95*33de042dSApple OSS Distributionsright is used to generate a port-deleted notification instead. 96*33de042dSApple OSS Distributions<p> 97*33de042dSApple OSS Distributions<dt> <strong>MACH_NOTIFY_NO_SENDERS</strong> 98*33de042dSApple OSS Distributions<dd> 99*33de042dSApple OSS DistributionsThe call requests a no-senders notification. <var>name</var> must specify a 100*33de042dSApple OSS Distributionsreceive right. If the receive right's make-send count is greater than or 101*33de042dSApple OSS Distributionsequal to the sync value, and it has no extant send rights, than an 102*33de042dSApple OSS Distributionsimmediate no-senders notification is generated. Otherwise the notification is 103*33de042dSApple OSS Distributionsgenerated when the receive right next loses its last extant send right. In 104*33de042dSApple OSS Distributionseither case, any previously registered send-once right is returned. 105*33de042dSApple OSS Distributions<p> 106*33de042dSApple OSS DistributionsThe no-senders notification carries the value the port's make-send 107*33de042dSApple OSS Distributionscount had when it was generated. The make-send count is incremented 108*33de042dSApple OSS Distributionswhenever a send right is made directly from a receive right. The 109*33de042dSApple OSS Distributionsmake-send count is reset to zero when the receive right is carried in a 110*33de042dSApple OSS Distributionsmessage. 111*33de042dSApple OSS Distributions<p> 112*33de042dSApple OSS DistributionsWhen moving a receive right, no-senders notifications are canceled, 113*33de042dSApple OSS Distributionswith a send-once notification sent to indicate the cancelation. 114*33de042dSApple OSS Distributions</dl> 115*33de042dSApple OSS Distributions<h3>NOTES</h3> 116*33de042dSApple OSS Distributions<p> 117*33de042dSApple OSS DistributionsThis interface is machine word length specific because of the port name 118*33de042dSApple OSS Distributionsparameter. 119*33de042dSApple OSS Distributions<h3>RETURN VALUES</h3> 120*33de042dSApple OSS Distributions<dl> 121*33de042dSApple OSS Distributions<p> 122*33de042dSApple OSS Distributions<dt> <strong>KERN_INVALID_NAME</strong> 123*33de042dSApple OSS Distributions<dd> 124*33de042dSApple OSS Distributions<var>name</var> did not denote a right. 125*33de042dSApple OSS Distributions<p> 126*33de042dSApple OSS Distributions<dt> <strong>KERN_INVALID_RIGHT</strong> 127*33de042dSApple OSS Distributions<dd> 128*33de042dSApple OSS Distributions<var>name</var> denoted an invalid right. 129*33de042dSApple OSS Distributions<p> 130*33de042dSApple OSS Distributions<dt> <strong>KERN_INVALID_CAPABILITY</strong> 131*33de042dSApple OSS Distributions<dd> 132*33de042dSApple OSS Distributions<var>notify</var> was invalid. 133*33de042dSApple OSS Distributions</dl> 134*33de042dSApple OSS Distributions<p> 135*33de042dSApple OSS DistributionsWhen using <strong>MACH_NOTIFY_DEAD_NAME</strong>: 136*33de042dSApple OSS Distributions<dl> 137*33de042dSApple OSS Distributions<p> 138*33de042dSApple OSS Distributions<dt> <strong>KERN_UREFS_OVERFLOW</strong> 139*33de042dSApple OSS Distributions<dd> 140*33de042dSApple OSS Distributions<var>name</var> denotes a dead name, but generating an immediate dead-name 141*33de042dSApple OSS Distributionsnotification would overflow the name's user-reference count. 142*33de042dSApple OSS Distributions</dl> 143*33de042dSApple OSS Distributions<h3>RELATED INFORMATION</h3> 144*33de042dSApple OSS Distributions<p> 145*33de042dSApple OSS DistributionsFunctions: 146*33de042dSApple OSS Distributions<a href="mach_msg.html"><strong>mach_msg</strong></a>, 147*33de042dSApple OSS Distributions<a href="mach_port_get_attributes.html"><strong>mach_port_get_attributes</strong></a>. 148