Selects for asynchronous criteria from generic data link control (GDLC), such as receive data completion and exception conditions.
#include <sys/device.h>
#include <sys/poll.h>
#include <sys/gdlextcb.h>
int dlcselect (devno, events, reventp, chan)
The dlcselect entry point is called when a user application program invokes a select or poll subroutine. This allows the user to select receive data or exception conditions. The POLLOUT write-availability criteria is not supported. If no results are available at the time of a select subroutine, the user process is put to sleep until an event occurs.
If one or more events specified in the events parameter are true, the dlcselect routine updates the reventp (returned events) parameter (passed by reference) by setting the corresponding event bits that indicate which events are currently true.
If none of the requested events are true, the dlcselect routine sets the returned events parameter to a value of 0 (passed by reference using the reventp parameter) and checks the POLLSYNC flag in the events parameter. If this flag is true, the routine returns because the event request was a synchronous request. If the POLLSYNC flag is false, an internal flag is set for each event requested in the events parameter.
When one or more of the requested events become true, GDLC issues the selnotify kernel service to notify the kernel that a requested event or events have become true. The internal flag indicating that the event was requested is then reset to prevent renotification of the event.
If the port in use is in a closed state, implying that the requested event or events can never be satisfied, GDLC sets the returned events flags to a value of 1 for each event that can never be satisfied. This is done so that the select or poll subroutine does not wait indefinitely.
Kernel users do not call an fp_select kernel service since their receive data and exception notification functions are called directly by GDLC.
Each GDLC supports the dlcselect entry point as its switch table entry for the select or poll subroutines. The file system calls this entry point from the process environment only.
Item | Description |
---|---|
devno | Indicates major and minor device numbers. This is a dev_t device number that specifies both the major and minor device numbers of the GDLC device manager. One dev_t device number exists for each type of GDLC, such as Ethernet, Token-Ring, or SDLC. |
events | Identifies the events to check. The following events are:
|
reventp | Identifies a returned events pointer. This is a parameter passed by reference to indicate which of the selected events are true at the time of the call. See the preceding events parameter for possible values. |
chan | Specifies the channel ID assigned by GDLC in the dlcmpx routine at open time. |
The following return values are defined in the /usr/include/sys/errno.h file:
Value | Description |
---|---|
0 | Indicates a successful operation. |
EBADF | Indicates a bad file number. |
EINTR | Indicates that a signal interrupted the subroutine before it found any of the selected events. |
EINVAL | Indicates that the specified POLLOUT write selection is not supported. |