## task_set_special_port

Function - Set the indicated special port.

### SYNOPSIS

    kern_return_t   task_set_special_port
                    (task_t                                    task,
                     int                                 which_port,
                     mach_port_t                       special_port);

    Macro forms:

    kern_return_t   task_set_bootstrap_port
                    (task_t                                    task,
                     int                                 which_port,
                     mach_port_t                       special_port);

    kern_return_t   task_set_kernel_port
                    (task_t                                    task,
                     int                                 which_port,
                     mach_port_t                       special_port);

    kern_return_t   task_set_host_name_port
                    (task_t                                    task,
                     mach_port_t                       special_port);

### PARAMETERS

task
  [in task send right] The port for the task for which to set the port.

which_port
  [in scalar] The special port to be set. Valid values are:

  TASK_BOOTSTRAP_PORT
    [bootstrap send right] The task's bootstrap port. Used to send messages requesting return of other system service ports.

  TASK_KERNEL_PORT
    [task-self send right] The task's kernel port. Used by the kernel to receive messages to manipulate the task. This is the movable task port and different from the one returned by mach_task_self (immovable). Setting this special port does not change the identity of the kernel port that names the task; this simply changes the value returned as the kernel special port.

  TASK_HOST_NAME_PORT
    [host-self send right] The task's host self port. Used by the task to request information about its containing host. This is the port returned by mach_host_self. Setting this special port does not change the identity of the kernel port that names the host; this simply changes the value returned as the host special port.

  TASK_WIRED_LEDGER_PORT
    [ledger send right] The resource ledger from which the task draws its wired kernel memory. Setting this special port does not change the ledger from which the task draws its resources; this simply changes the value returned as the ledger special port.

  TASK_PAGED_LEDGER_PORT
    [ledger send right] The resource ledger from which the task draws its default memory managed memory. Setting this special port does not change the ledger from which the task draws its resources; this simply changes the value returned as the ledger special port.

special_port
  [in task-special send right] The value for the port.

### DESCRIPTION

The task_set_special_port function sets a special port belonging to task.

### NOTES

The current implementation does not support the TASK_HOST_NAME_PORT features associated with this interface.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: task_create, task_get_special_port, mach_task_self, thread_get_special_port, thread_set_special_port, mach_host_self.