include/sys/select.h File Reference

#include <sys/time.h>
#include <signal.h>

Include dependency graph for select.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fd_set
 File descriptor set structure for select and pselect. More...

Defines

#define _ABLE_CLIB_SYS_SELECT_H   1
#define FD_SETSIZE   32
 Maximum number of file descriptors in fd_set.
#define NFDBITS   (8 * sizeof(fd_mask))
 Number of bits per entry in fd_set.
#define __FDS_BITS(set)   ((set)->fds_bits)
#define __FDELT(x)   ((x) / NFDBITS)
#define __FDMASK(x)   ((fd_mask) 1 << ((x) % NFDBITS))
#define FD_ZERO(fdsetp)
 Clear the FD set pointed to by fdsetp.
#define FD_SET(fd, fdsetp)   (__FDS_BITS(fdsetp)[__FDELT(fd)] |= __FDMASK(fd))
 Set a file descriptor in a fd set.
#define FD_CLR(fd, fdsetp)   (__FDS_BITS(fdsetp)[__FDELT(fd)] &= ~__FDMASK(fd))
 Clear a file descriptor in a fd set.
#define FD_ISSET(fd, fdsetp)   ((__FDS_BITS(fdsetp)[__FDELT(fd)] & __FDMASK(fd)) != 0)
 Check if a file descriptor is set in a fd set.

Typedefs

typedef unsigned long fd_mask
 Define the fd_mask type for the entries in fd_set.

Functions

int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
 Wait for an event on one or more file descriptors in a set.
int pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask)
 Wait for an event on one or more file descriptors in a set.


Define Documentation

#define __FDELT (  )     ((x) / NFDBITS)

#define __FDMASK (  )     ((fd_mask) 1 << ((x) % NFDBITS))

#define __FDS_BITS ( set   )     ((set)->fds_bits)

#define _ABLE_CLIB_SYS_SELECT_H   1

#define FD_CLR ( fd,
fdsetp   )     (__FDS_BITS(fdsetp)[__FDELT(fd)] &= ~__FDMASK(fd))

Clear a file descriptor in a fd set.

#define FD_ISSET ( fd,
fdsetp   )     ((__FDS_BITS(fdsetp)[__FDELT(fd)] & __FDMASK(fd)) != 0)

Check if a file descriptor is set in a fd set.

#define FD_SET ( fd,
fdsetp   )     (__FDS_BITS(fdsetp)[__FDELT(fd)] |= __FDMASK(fd))

Set a file descriptor in a fd set.

#define FD_SETSIZE   32

Maximum number of file descriptors in fd_set.

#define FD_ZERO ( fdsetp   ) 

Value:

do {                                                                   \
        unsigned int __bit;                                                \
        fd_set *__arr = (fdsetp);                                          \
        for (__bit = 0; __bit < sizeof(fd_set) / sizeof(fd_mask); ++__bit) \
            __FDS_BITS(__arr)[__bit] = 0;                                  \
    } while (0)
Clear the FD set pointed to by fdsetp.

#define NFDBITS   (8 * sizeof(fd_mask))

Number of bits per entry in fd_set.

The name is dictated by convention rather than standard.


Typedef Documentation

typedef unsigned long fd_mask

Define the fd_mask type for the entries in fd_set.

Convention dictates that both the type, as unsigned long, and the name as fd_mask.


Function Documentation

int pselect ( int  nfds,
fd_set readfds,
fd_set writefds,
fd_set exceptfds,
const struct timespec timeout,
const sigset_t sigmask 
)

Wait for an event on one or more file descriptors in a set.

Wait for events to occur on the file descriptors listed in readfds writefds and exceptfds, returning the set of events which have occurred. A timeout can be provided to limit how long to wait for events.

Parameters:
nfds The Maximum number of file descriptors to examine.
readfds The set of file descriptors to examine for read readyness.
writefds The set of file descriptors to examine for write readyness.
exceptfds The set of file descriptors to examine for exceptions.
timeout The length of time to wait for an event or NULL for no timeout.
sigmask Signal mask to set during call.
Returns:
The number of fd which have pending events.

int select ( int  nfds,
fd_set readfds,
fd_set writefds,
fd_set exceptfds,
struct timeval timeout 
)

Wait for an event on one or more file descriptors in a set.

Wait for events to occur on the file descriptors listed in readfds writefds and exceptfds, returning the set of events which have occurred. A timeout can be provided to limit how long to wait for events.

Parameters:
nfds The Maximum number of file descriptors to examine.
readfds The set of file descriptors to examine for read readyness.
writefds The set of file descriptors to examine for write readyness.
exceptfds The set of file descriptors to examine for exceptions.
timeout The length of time to wait for an event or NULL for no timeout.
Returns:
The number of fd which have pending events.


Generated on Tue Jan 20 14:28:59 2009 for ABLE LIBC by  doxygen 1.5.6