Skip Navigation Links | |
Exit Print View | |
![]() |
man pages section 3: Basic Library Functions Oracle Solaris 11 Express 11/10 |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- send a user-defined event to a port or list of ports
#include <port.h> int port_send(int port, int events, void *user);
int port_sendn(int ports[], int errors[], uint_t nent, int events, void *user);
The port_send() function submits a user-defined event to a specified port. The port argument is a file descriptor that represents a port. The sent event has its portev_events member set to the value specified in the events parameter and its portev_user member set to the value specified in the user parameter. The portev_object member of an event sent with port_send() is unspecified.
The port_sendn() function submits a user-defined event to multiple ports. The ports argument is an array of file descriptors that represents ports (see port_create(3C)). The nent argument specifies the number of file descriptors in the ports[] array. An event is submitted to each specified port. Each event has its portev_events member set to the value specified in the events parameter and its portev_user member set to the value specified in the user parameter. The portev_object member of events sent with port_sendn() is unspecified.
A port that is in alert mode can be sent an event, but that event will not be retrievable until the port has resumed normal operation. See port_alert(3C).
Upon successful completion, the port_send() function returns 0. Otherwise, it returns -1 and sets errno to indicate the error.
The port_sendn() function returns the number of successfully submitted events. A non-negative return value less than the nent argument indicates that at least one error occurred. In this case, each element of the errors[] array is filled in. An element of the errors[] array is set to 0 if the event was successfully sent to the corresponding port in the ports[] array, or is set to indicate the error if the event was not successfully sent. If an error occurs, the port_sendn() function returns -1 and sets errno to indicate the error.
The port_send() and port_sendn() functions will fail if:
The maximum number of events per port is exceeded. The maximum allowable number of events per port is the minimum value of the process.max-port-events resource control at the time port_create(3C) was used to create the port.
The port file descriptor is not valid.
The port argument is not an event port file descriptor.
There is not enough memory available to satisfy the request.
The port_sendn() function will fail if:
The ports[] pointer or errors[] pointer is not reasonable.
The value of the nent argument is 0.
Example 1 Use port_send() to send a user event (PORT_SOURCE_USER) to a port.
The following example uses port_send() to send a user event (PORT_SOURCE_USER) to a port and port_get() to retrieve it. The portev_user and portev_events members of the port_event_t structure are the same as the corresponding user and events arguments of the port_send() function.
#include <port.h> int myport; port_event_t pe; struct timespec timeout; int ret; void *user; myport = port_create(); if (myport) { /* port creation failed ... */ ... return(...); } ... events = 0x01; /* own event definition(s) */ user = <my_own_value>; ret = port_send(myport, events, user); if (ret == -1) { /* error detected ... */ ... close(myport); return (...); } /* * The following code could also be executed from another thread or * process. */ timeout.tv_sec = 1; /* user defined */ timeout.tv_nsec = 0; ret = port_get(myport, &pe, &timeout); if (ret == -1) { /* * error detected : * - EINTR or ETIME : log error code and try again ... * - Other kind of errors : may have to close the port ... */ return(...); } /* * After port_get() returns successfully, the port_event_t * structure will be filled with: * pe.portev_source = PORT_SOURCE_USER * pe.portev_events = 0x01 * pe.portev_object = unspecified * pe.portev_user = <my_own_value> */ ... close(myport);
See setrctl(2) and rctladm(1M) for information on using resource controls.
See attributes(5) for descriptions of the following attributes:
|
rctladm(1M), setrctl(2), port_alert(3C), port_associate(3C), port_create(3C), port_get(3C), attributes(5)