1 <h2>mach_port_allocate
</h2>
<hr>
<p>
<strong>Function
</strong> - Create caller-specified type of port right.
<h3>SYNOPSIS
</h3>
<pre>
<strong>kern_return_t mach_port_allocate
</strong>
<strong>(ipc_space_t
</strong> <var>task
</var>,
<strong>mach_port_right_t
</strong> <var>right
</var>,
<strong>mach_port_name_t
</strong> <var>*name
</var><strong>);
</strong>
</pre>
<h3>PARAMETERS
</h3>
<dl>
<p>
<dt> <var>task
</var>
<dd>
[in task send right]
The task acquiring the port right.
<p>
<dt> <var>right
</var>
<dd>
[in scalar]
The kind of entity to be created. This is one of the following:
<dl>
<p>
<dt> <strong>MACH_PORT_RIGHT_RECEIVE
</strong>
<dd>
<strong>mach_port_allocate
</strong> creates a port. The new port is not a
member of any port set. It doesn't have any extant send or
send-once rights. Its make-send count is zero, its sequence
number is zero, its queue limit is
<strong>MACH_PORT_QLIMIT_DEFAULT
</strong>, and
it has no queued messages.
<var>name
</var> denotes the
receive right for the new port.
<var>task
</var> does not hold send rights for the new port, only the
receive right.
<strong>mach_port_insert_right
</strong> and
<strong>mach_port_extract_right
</strong> can be used to convert the receive right into a
combined send/receive right.
<p>
<dt> <strong>MACH_PORT_RIGHT_PORT_SET
</strong>
<dd>
<strong>mach_port_allocate
</strong> creates a port set. The new port set has
no members.
<p>
<dt> <strong>MACH_PORT_RIGHT_DEAD_NAME
</strong>
<dd>
<strong>mach_port_allocate
</strong> creates a dead name. The new dead
name has one user reference.
</dl>
<p>
<dt> <var>name
</var>
<dd>
[out scalar]
The task's name for the port right. This can be any name
that wasn't in use.
</dl>
<h3>DESCRIPTION
</h3>
<p>
The
<strong>mach_port_allocate
</strong> function creates a new right
in the specified task. The new right's name is returned in name.
<p>
Ports that are allocated via this call do not support the full set of
Mach port semantics; in particular, the kernel will not provide no-more-senders
notification service requests on such ports. Any attempt to request no-more-senders
notification service
will generate an error. Use the
<strong>mach_port_allocate_full
</strong>
interface to allocate ports that support the full set of Mach port semantics.
<h3>NOTES
</h3>
<p>
This interface is machine word length specific because of the port name
parameter.
<h3>RETURN VALUES
</h3>
<dl>
<p>
<dt> <strong>KERN_NO_SPACE
</strong>
<dd>
There was no room in task's IPC name space for another right.
</dl>
<h3>RELATED INFORMATION
</h3>
<p>
Functions:
<a href=
"mach_port_allocate_name.html"><strong>mach_port_allocate_name
</strong></a>,
<a href=
"mach_port_deallocate.html"><strong>mach_port_deallocate
</strong></a>,
<a href=
"mach_port_insert_right.html"><strong>mach_port_insert_right
</strong></a>,
<a href=
"mach_port_extract_right.html"><strong>mach_port_extract_right
</strong></a>.