svcadm(1M)을 검색하려면 섹션에서 1M 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
port_create(3c)
Standard C Library Functions port_create(3C)
NAME
port_create - create a port
SYNOPSIS
#include <port.h>
int port_create(void);
DESCRIPTION
The port_create() function establishes a queue that multiplexes events
from disjoint sources. Each source has a corresponding object type and
source-specific mechanism for associating an object with a port.
tab(); lw(1.83i) lw(1.83i) lw(1.83i) lw(1.83i) lw(1.83i) lw(1.83i)
sourceobject typeassociation mechanism _ PORT_SOURCE_AIOstruct aiocbT{
aio_read(3C), aio_write(3C), lio_listio(3C) T} PORT_SOURCE_FDfile
descriptorport_associate(3C)PORT_SOURCE_MQmqd_tmq_notify(3C)PORT_SOURCE_TIMERtimer_ttimer_create(3C) PORT_SOURCE_USERu‐
intptr_tport_send(3C)PORT_SOURCE_ALERTuintptr_tport_alert(3C)PORT_SOURCE_FILEfile_obj_tport_associate(3C) PORT_SOURCE_POSTWAIT‐
postwk_obj_tport_associate(3C) PORT_SOURCE_SIGNALsignal numberport_as‐
sociate(3C)
PORT_SOURCE_AIO events represent the completion of an asynchronous I/O
transaction. An asynchronous I/O transaction is associated with a port
by specifying SIGEV_PORT as its notification mechanism. See
aio_read(3C), aio_write(3C), lio_listio(3C), and aio.h(3HEAD) for
details.
PORT_SOURCE_FD events represent a transition in the poll(2) status of a
given file descriptor. Once an event is delivered, the file descriptor
is no longer associated with the port. A file descriptor is associated
(or re-associated) with a port using the port_associate(3C) function.
PORT_SOURCE_MQ events represent a message queue transition from empty
to non-empty. A message queue is associated with a port by specifying
SIGEV_PORT as its notification mechanism. See mq_notify(3C) for more
information.
PORT_SOURCE_TIMER events represent one or more timer expirations for a
given timer. A timer is associated with a port by specifying SIGEV_PORT
as its notification mechanism. See timer_create(3C) for more informa‐
tion.
PORT_SOURCE_USER events represent user-defined events. These events are
generated by port_send(3C) or port_sendn(3C).
PORT_SOURCE_ALERT events indicate that the port itself is in alert
mode. The mode of the port is changed with port_alert(3C). The
port_create() function returns a file descriptor that represents a
newly created port. The close(2) function destroys the port and frees
all allocated resources.
PORT_SOURCE_FILE events represent file/directory status change. Once an
event is delivered, the file object associated with the port is no
longer active. It has to be reassociated to activate. A file object is
associated or reassociated with a port using the port_associate(3C).
PORT_SOURCE_SIGNAL events indicate the delivery of a signal to a given
process. Once the event is delivered, the signal:ev-ent-port associa‐
tion is invalid. It has to be reassociated. This event mechanism does
not change the existing signal generation, delivery and handling mecha‐
nism in any way.
The port_get(3C) and port_getn(3C) functions retrieve events from a
port. They ignore non retrievable events (non-own or non-sharable
events).
As a port is represented by a file descriptor, ports are shared between
child and parent processes after fork(). Both can continue to associate
sources with the port, both can receive events from the port, and
events associated with and/or generated by either process are retriev‐
able in the other. Since some events might not have meaning in both
parent and child, care must be taken when using ports after fork().
If a port is exported to other processes, the port is destroyed on last
close.
PORT_SOURCE_USER and PORT_SOURCE_ALERT events can be distributed across
processes. PORT_SOURCE_FD events can only be shared between processes
when child processes inherit opened file descriptors from the parent
process. See fork(2). PORT_SOURCE_TIMER, PORT_SOURCE_AIO and
PORT_SOURCE_SIGNAL cannot be shared between processes.
PORT_SOURCE_POSTWAIT events are the post events, part of the post-wait
mechanism, submitted by postwait_post(3C), postwait_postn(3C), and
postwait_post_deferred(3C) calls. The key specified in the postwk_obj_t
argument is associated with a port using port_associate(3C). The asso‐
ciation remains active until a port_dissociate(3C) call or the port is
closed.
RETURN VALUES
Upon successful completion, the port_create() function returns a non-
negative value, the port identifier. Otherwise, −1 is returned and
errno is set to indicate the error.
ERRORS
The port_create() function will fail if:
EAGAIN The maximum allowable number of ports is currently open in
the system. The maximum allowable number of ports is the min‐
imum value of the project.max-port-ids resource control. See
setrctl(2) and rctladm(8) for information on using resource
controls.
EMFILE The process has too many open descriptors.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Architectureall _ Availabilitysystem/core-os, sys‐
tem/header _ Interface StabilityCommitted _ MT-LevelSafe
SEE ALSO
close(2), exit(2), fork(2), poll(2), setrctl(2), aio_read(3C),
aio_write(3C), lio_listio(3C), mq_notify(3C), port_associate(3C),
port_get(3C), timer_create(3C), aio.h(3HEAD), attributes(7), rctladm(8)
Oracle Solaris 11.4 11 May 2021 port_create(3C)