Select implementation for RIOT.
More...
Select implementation for RIOT.
- See also
- The Open Group Base Specification Issue 7
- Todo:
Omitted from original specification for now:
- Inclusion of
<signal.h>
; no POSIX signal handling implemented in RIOT yet
pselect()
as it uses sigset_t
from <signal.h>
- handling of the
writefds
and errorfds
parameters of select()
Currently, only sockets are supported
◆ FD_SETSIZE
Maximum number of file descriptors in an fd_set
structure.
POSIX-compliant version.
Definition at line 75 of file select.h.
◆ FD_CLR()
static void FD_CLR |
( |
int |
fd, |
|
|
fd_set * |
fdsetp |
|
) |
| |
|
inlinestatic |
Removes a file descriptor from an fd_set
if it is a member.
- Parameters
-
[in] | fd | A file descriptor |
[in] | fdsetp | An fd_set |
Definition at line 91 of file select.h.
◆ FD_ISSET()
static int FD_ISSET |
( |
int |
fd, |
|
|
fd_set * |
fdsetp |
|
) |
| |
|
inlinestatic |
Checks if a file descriptor is a member of an fd_set
- Parameters
-
[in] | fd | A file descriptor |
[in] | fdsetp | An fd_set |
- Returns
- non-zero value, if
fd
is a member of fdsetp
-
0, if
fd
is not a member of fdsetp
Definition at line 105 of file select.h.
◆ FD_SET()
static void FD_SET |
( |
int |
fd, |
|
|
fd_set * |
fdsetp |
|
) |
| |
|
inlinestatic |
Adds a file descriptor from an fd_set
if it is not already a member.
- Parameters
-
[in] | fd | A file descriptor |
[in] | fdsetp | An fd_set |
Definition at line 117 of file select.h.
◆ FD_ZERO()
static void FD_ZERO |
( |
fd_set * |
fdsetp | ) |
|
|
inlinestatic |
Initializes the descriptor set as an empty set.
- Parameters
-
Definition at line 127 of file select.h.
◆ select()
Examines the given file descriptor sets if they are ready for their respective operation.
- Parameters
-
[in] | nfds | The range of descriptors tested. The first nfds descriptors shall be checked in each set; that is, the descriptors from zero through nfds - 1 in the descriptor sets shall be examined. |
[in,out] | readfds | The set of file descriptors to be checked for being ready to read. Indicates on output which file descriptors are ready to read. May be NULL to check no file descriptors. |
[in,out] | writefds | The set of file descriptors to be checked for being ready to write. Indicates on output which file descriptors are ready to write. May be NULL to check no file descriptors. As only sockets are supported for now, these will be ignored |
[in,out] | errorfds | The set of file descriptors to be checked for being error conditions pending. Indicates on output which file descriptors have error conditions pending. May be NULL to check no file descriptors. As only sockets are supported for now, these will be ignored |
[in] | timeout | Timeout for select to block until one or more of the checked file descriptors is ready. Set timeout to all-zero to return immediately without blocking. May be NULL to block indefinitely. |
- Returns
- number of members added to the file descriptor sets on success.
-
-1 on error,
errno
is set to indicate the error.