Go to the first, previous, next, last section, table of contents.
mach_port_request_notification
registers a request
for a notification and supplies the send-once right notify to
which the notification will be sent. The notify_type denotes the
IPC type for the send-once right, which can be
MACH_MSG_TYPE_MAKE_SEND_ONCE
or
MACH_MSG_TYPE_MOVE_SEND_ONCE
. It is an atomic swap, returning
the previously registered send-once right (or MACH_PORT_NULL
for
none) in previous. A previous notification request may be
cancelled by providing MACH_PORT_NULL
for notify.
The variant argument takes the following values:
MACH_NOTIFY_PORT_DESTROYED
mach_port_destroy
, then instead the receive right will be sent in
a port-destroyed notification to the registered send-once right.
MACH_NOTIFY_DEAD_NAME
mach_port_destroy
or mach_port_mod_refs
, or the name
denotes a send-once right which has a message sent to it, then the
registered send-once right is used to generate a port-deleted
notification.
MACH_NOTIFY_NO_SENDERS
MACH_MSG_TYPE_MAKE_SEND
is used to create a new send right from
the receive right. The make-send count is reset to zero when the
receive right is carried in a message.
The function returns KERN_SUCCESS
if the call succeeded,
KERN_INVALID_TASK
if task was invalid,
KERN_INVALID_VALUE
if variant was invalid,
KERN_INVALID_NAME
if name did not denote a right,
KERN_INVALID_RIGHT
if name denoted an invalid right and
KERN_INVALID_CAPABILITY
if notify was invalid.
When using MACH_NOTIFY_PORT_DESTROYED
, the function returns
KERN_INVALID_VALUE
if sync wasn't zero.
When using MACH_NOTIFY_DEAD_NAME
, the function returns
KERN_RESOURCE_SHORTAGE
if the kernel ran out of memory,
KERN_INVALID_ARGUMENT
if name denotes a dead name, but
sync is zero or notify is MACH_PORT_NULL
, and
KERN_UREFS_OVERFLOW
if name denotes a dead name, but
generating an immediate dead-name notification would overflow the name's
user-reference count.
The mach_port_request_notification
call is actually an RPC to
task, normally a send right for a task port, but potentially any
send right. In addition to the normal diagnostic return codes from the
call's server (normally the kernel), the call may return mach_msg
return codes.
Go to the first, previous, next, last section, table of contents.