[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 1

select Subroutine Interface for Data Link Control (DLC) Devices

Purpose

Allows data to be sent using a file descriptor.

Syntax

#include <sys/select.h>
int select (nfdsmsgs, readlist, writelist, exceptlist, timeout)
int nfdsmsgs;
struct sellist *readlist, *writelist, *exceptlist;
struct timeval *timeout;

Description

The select subroutine checks the specified file descriptor and message queues to see if they are ready for reading (receiving) or writing (sending), or if they have an exception condition pending.

Note: Generic data link control (GDLC) does not support transmit for nonblocked notification in the full sense. If the writelist parameter is specified in the select call, GDLC always returns as if transmit is available. There is no checking to see if internal buffering is available or if internal control-block locks are free. These resources are much too dynamic, and tests for their availability can be done reasonably only at the time of use.

The readlist and exceptlist parameters are fully supported. Whenever the selection criteria specified by the SelType parameter is true, the file system returns a value that indicates the total number of file descriptors and message queues that satisfy the selection criteria. The fdsmask bit masks are modified so that bits set to a value of 1 indicate file descriptors that meet the criteria. The msgids arrays are altered so that message queue identifiers that do not meet the criteria are replaced with a value of -1. If the selection is not satisfied, the calling process is put to sleep waiting on a selwakeup subroutine at a later time.

Parameters

nfdsmsgs Specifies the number of file descriptors and message queues to check.
sellist The readlist, writelist, and exceptlist parameters specify what to check for during reading, writing, and exceptions, respectively. Each sellist is a structure that contains a file descriptor bit mask (fdsmask) and message queue identifiers (msgids).

The writelist criterion is always set to True by GDLC.

timeout Points to a structure that specifies the maximum length of time to wait for at least one of the selection criteria to be met (if the timeout parameter is not a null pointer).

Return Values

Upon successful completion, the select subroutine returns a value that indicates the total number of file descriptors and message queues that satisfy the selection criteria. The return value is similar to the nfdsmsgs parameter in that the low-order 16 bits give the number of file descriptors. Also, the high-order 16 bits give the number of message queue identifiers. These values indicate the sum total that meet each of the read and exception criteria.

If the time limit specified by the timeout parameter expires, then the select subroutine returns a value of 0 (zero).

If an error occurs, a value of -1 is returned with one of the following error values available using the errno global variable, as defined in the /usr/include/sys/errno.h file:

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 one of the parameters contained an invalid value.

Implementation Specifics

Each GDLC supports the select subroutine interface via its dlcselect entry point. This subroutine can be called from the process environment only.

Related Information

The select subroutine.

Select/Poll Logic for ddwrite and ddread Routines in AIX Version 4.3 Technical Reference: Kernel and Subsystems Volume 1.

Generic Data Link Control (GDLC) Environment Overview in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]