KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Functions
select.h File Reference

Definitions for the select() function. More...

#include <sys/cdefs.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>

Go to the source code of this file.

Functions

int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)
 Wait for activity on a group of file descriptors. More...
 

Detailed Description

Definitions for the select() function.

This file contains the definitions needed for using the select() function, as directed by the POSIX 2008 standard (aka The Open Group Base Specifications Issue 7). Currently the functionality defined herein only really works for sockets, and that is likely how it will stay for some time.

Author
Lawrence Sebald

Function Documentation

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

Wait for activity on a group of file descriptors.

This function will check the specfied group of file descriptors for activity and wait for activity (up to the timeout specified) if there is not any pending events already.

Parameters
nfdsThe maximum fd specified in any of the sets, plus 1.
readfdsFile descriptors to check for the ability to read without blocking.
writefdsFile descriptors to check for the ability to write without blocking.
errorfdsFile descriptors to check for error/exceptional conditions.
timeoutMaximum amount of time to block. Passing a 0 timeout will make the funciton not block, Passing NULL here will make the function block indefinitely.
Returns
-1 on error (sets errno as appropriate), or the number of bits set in the fd sets on success (this may be 0 if the timeout expires).