Next: Port Rights, Previous: Port Destruction, Up: Port Manipulation Interface [Contents][Index]
The function mach_port_names returns information about
task’s port name space. For each name, it also returns what type
of rights task holds. (The same information returned by
mach_port_type.) names and types are arrays that are
automatically allocated when the reply message is received. The user
should vm_deallocate them when the data is no longer needed.
mach_port_names will return in names the names of the
ports, port sets, and dead names in the task’s port name space, in no
particular order and in ncount the number of names returned. It
will return in types the type of each corresponding name, which
indicates what kind of rights the task holds with that name.
tcount should be the same as ncount.
The function returns KERN_SUCCESS if the call succeeded,
KERN_INVALID_TASK if task was invalid,
KERN_RESOURCE_SHORTAGE if the kernel ran out of memory.
The mach_port_names 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.
The function mach_port_type returns information about
task’s rights for a specific name in its port name space. The
returned ptype is a bitmask indicating what rights task
holds for the port, port set or dead name. The bitmask is composed of
the following bits:
MACH_PORT_TYPE_SENDThe name denotes a send right.
MACH_PORT_TYPE_RECEIVEThe name denotes a receive right.
MACH_PORT_TYPE_SEND_ONCEThe name denotes a send-once right.
MACH_PORT_TYPE_PORT_SETThe name denotes a port set.
MACH_PORT_TYPE_DEAD_NAMEThe name is a dead name.
MACH_PORT_TYPE_DNREQUESTA dead-name request has been registered for the right.
MACH_PORT_TYPE_MAREQUESTA msg-accepted request for the right is pending.
MACH_PORT_TYPE_COMPATThe port right was created in the compatibility mode.
The function returns KERN_SUCCESS if the call succeeded,
KERN_INVALID_TASK if task was invalid and
KERN_INVALID_NAME if name did not denote a right.
The mach_port_type 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.
The function mach_port_rename changes the name by which a port,
port set, or dead name is known to task. old_name is the
original name and new_name the new name for the port right.
new_name must not already be in use, and it can’t be the
distinguished values MACH_PORT_NULL and MACH_PORT_DEAD.
The function returns KERN_SUCCESS if the call succeeded,
KERN_INVALID_TASK if task was invalid,
KERN_INVALID_NAME if old_name did not denote a right,
KERN_INVALID_VALUE if new_name was MACH_PORT_NULL or
MACH_PORT_DEAD, KERN_NAME_EXISTS if new_name
already denoted a right and KERN_RESOURCE_SHORTAGE if the kernel
ran out of memory.
The mach_port_rename 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.
Next: Port Rights, Previous: Port Destruction, Up: Port Manipulation Interface [Contents][Index]