Create an IO port.
#include <zircon/syscalls.h>
zx_status_t zx_port_create(uint32_t options, zx_handle_t* out);
zx_port_create()
creates a port: a waitable object that can be used to read
packets queued by kernel or by user-mode.
If you need this port to be bound to an interrupt, pass ZX_PORT_BIND_TO_INTERRUPT to options, otherwise it should be 0.
In the case where a port is bound to an interrupt, the interrupt packets are delivered via a dedicated queue on ports and are higher priority than other non-interrupt packets.
The returned handle will have:
ZX_RIGHT_TRANSFER
: allowing them to be sent to another process throughzx_channel_write()
.ZX_RIGHT_WRITE
: allowing packets to be queued.ZX_RIGHT_READ
: allowing packets to be read.ZX_RIGHT_DUPLICATE
: allowing them to be duplicated.
Caller job policy must allow ZX_POL_NEW_PORT.
zx_port_create()
returns ZX_OK and a valid IO port handle via out on
success. In the event of failure, an error value is returned.
ZX_ERR_INVALID_ARGS options has an invalid value, or out is an invalid pointer or NULL.
ZX_ERR_NO_MEMORY Failure due to lack of memory. There is no good way for userspace to handle this (unlikely) error. In a future builds this error will no longer occur.