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