KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
select.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  sys/select.h
4  Copyright (C) 2012 Lawrence Sebald
5 
6 */
7 
8 /** \file select.h
9  \brief Definitions for the select() function.
10 
11  This file contains the definitions needed for using the select() function,
12  as directed by the POSIX 2008 standard (aka The Open Group Base
13  Specifications Issue 7). Currently the functionality defined herein only
14  really works for sockets, and that is likely how it will stay for some time.
15 
16  \author Lawrence Sebald
17 */
18 
19 #ifndef __SYS_SELECT_H
20 #define __SYS_SELECT_H
21 
22 #include <sys/cdefs.h>
23 #include <sys/types.h>
24 
25 __BEGIN_DECLS
26 
27 #include <time.h>
28 #include <sys/time.h>
29 
30 /* <sys/types.h> defines fd_set and friends for us, so there's really not much
31  that we have to do here... */
32 
33 /** \brief Wait for activity on a group of file descriptors.
34 
35  This function will check the specfied group of file descriptors for activity
36  and wait for activity (up to the timeout specified) if there is not any
37  pending events already.
38 
39  \param nfds The maximum fd specified in any of the sets, plus 1.
40  \param readfds File descriptors to check for the ability to read
41  without blocking.
42  \param writefds File descriptors to check for the ability to write
43  without blocking.
44  \param errorfds File descriptors to check for error/exceptional
45  conditions.
46  \param timeout Maximum amount of time to block. Passing a 0 timeout
47  will make the funciton not block, Passing NULL here will
48  make the function block indefinitely.
49  \return -1 on error (sets errno as appropriate), or the number
50  of bits set in the fd sets on success (this may be 0 if
51  the timeout expires).
52 */
53 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
54  struct timeval *timeout);
55 
56 __END_DECLS
57 
58 #endif /* !__SYS_SELECT_H */
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.