select.h

Overview

Related Modules:

IO

Description:

Provides functions and structures related to I/O multiplexing.

These functions can be used to implement I/O multiplexing.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

fd_set

Defines a file descriptor set.

Macros

Macro Name and Value

Description

FD_SETSIZE   1024

Defines the size of fd_set, that is, the maximum number of monitored files.

FD_ZERO(s)   do { int i; unsigned long *b=(s)->fds_bits; for(i=sizeof (fd_set)/sizeof (long); i; i—) *b++=0; } while(0)

Clears all elements in the file descriptor set.

FD_SET(d, s)   ((s)->fds_bits[(d)/(8sizeof(long))] |= (1UL<<((d)%(8sizeof(long)))))

Adds a file descriptor to a set.

FD_CLR(d, s)   ((s)->fds_bits[(d)/(8sizeof(long))] &= ~(1UL<<((d)%(8sizeof(long)))))

Removes a file descriptor from a set.

FD_ISSET(d, s)   !!((s)->fds_bits[(d)/(8sizeof(long))] & (1UL<<((d)%(8sizeof(long)))))

Checks whether a file descriptor is in a set.

Typedefs

Typedef Name

Description

fd_mask

typedef unsigned long 

Defines fd_set as the alias of the element type.

Functions

Function Name

Description

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

int 

Monitors the I/O events of multiple file descriptors.