net-snmp 5.7
|
Macro's and functions for manipulation of large file descriptor sets. More...
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/types.h>
Go to the source code of this file.
Defines | |
#define | NETSNMP_LARGE_FD_SET(fd, fdset) netsnmp_large_fd_setfd(fd, fdset) |
Add socket fd to the set *fdset if not yet present. | |
#define | NETSNMP_LARGE_FD_CLR(fd, fdset) netsnmp_large_fd_clr(fd, fdset) |
Remove socket fd from the set *fdset. | |
#define | NETSNMP_LARGE_FD_ISSET(fd, fdset) netsnmp_large_fd_is_set(fd, fdset) |
Test whether set *fdset contains socket fd. | |
#define | NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits) |
Size of a single element of the array with file descriptor bitmasks. | |
#define | NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE) |
Number of bits in one element of the fd_set::fds_bits array. | |
#define | NETSNMP_FD_SET_ELEM_COUNT(setsize) (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK |
Number of elements needed for the fds_bits array. | |
#define | NETSNMP_FD_SET_BYTES(setsize) (NETSNMP_FD_SET_ELEM_COUNT(setsize) * NETSNMP_FD_MASK_SIZE) |
Number of bytes needed to store setsize file descriptors. | |
#define | NETSNMP_LARGE_FD_ZERO(fdset) |
Remove all file descriptors from the set *fdset. | |
Functions | |
void | netsnmp_large_fd_setfd (int fd, netsnmp_large_fd_set *fdset) |
void | netsnmp_large_fd_clr (int fd, netsnmp_large_fd_set *fdset) |
int | netsnmp_large_fd_is_set (int fd, netsnmp_large_fd_set *fdset) |
NETSNMP_IMPORT void | netsnmp_large_fd_set_init (netsnmp_large_fd_set *fdset, int setsize) |
Initialize a netsnmp_large_fd_set structure. | |
void | netsnmp_large_fd_set_resize (netsnmp_large_fd_set *fdset, int setsize) |
Modify the size of a file descriptor set and preserve the first min(fdset->lfs_setsize, setsize) file descriptors. | |
NETSNMP_IMPORT int | netsnmp_large_fd_set_select (int numfds, netsnmp_large_fd_set *readfds, netsnmp_large_fd_set *writefds, netsnmp_large_fd_set *exceptfds, struct timeval *timeout) |
Synchronous I/O multiplexing for large file descriptor sets. | |
NETSNMP_IMPORT void | netsnmp_large_fd_set_cleanup (netsnmp_large_fd_set *fdset) |
Deallocate the memory allocated by netsnmp_large_fd_set_init. | |
void | netsnmp_copy_fd_set_to_large_fd_set (netsnmp_large_fd_set *dst, const fd_set *src) |
Copy an fd_set to a netsnmp_large_fd_set structure. | |
int | netsnmp_copy_large_fd_set_to_fd_set (fd_set *dst, const netsnmp_large_fd_set *src) |
Copy a netsnmp_large_fd_set structure into an fd_set. |
Macro's and functions for manipulation of large file descriptor sets.
Definition in file large_fd_set.h.
#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE) |
Number of bits in one element of the fd_set::fds_bits array.
Definition at line 80 of file large_fd_set.h.
#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits) |
Size of a single element of the array with file descriptor bitmasks.
According to SUSv2, this array must have the name fds_bits. See also The Single UNIX Specification, Version 2, <sys/time.h>.
Definition at line 77 of file large_fd_set.h.
#define NETSNMP_FD_SET_BYTES | ( | setsize | ) | (NETSNMP_FD_SET_ELEM_COUNT(setsize) * NETSNMP_FD_MASK_SIZE) |
Number of bytes needed to store setsize file descriptors.
Definition at line 87 of file large_fd_set.h.
#define NETSNMP_FD_SET_ELEM_COUNT | ( | setsize | ) | (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK |
Number of elements needed for the fds_bits array.
Definition at line 83 of file large_fd_set.h.
#define NETSNMP_LARGE_FD_CLR | ( | fd, | |
fdset | |||
) | netsnmp_large_fd_clr(fd, fdset) |
Remove socket fd from the set *fdset.
Do nothing if fd is not present in *fdset. Do nothing if fd >= fdset->lfs_setsize.
Definition at line 42 of file large_fd_set.h.
#define NETSNMP_LARGE_FD_ISSET | ( | fd, | |
fdset | |||
) | netsnmp_large_fd_is_set(fd, fdset) |
Test whether set *fdset contains socket fd.
Do nothing if fd >= fdset->lfs_setsize.
Definition at line 49 of file large_fd_set.h.
#define NETSNMP_LARGE_FD_SET | ( | fd, | |
fdset | |||
) | netsnmp_large_fd_setfd(fd, fdset) |
Add socket fd to the set *fdset if not yet present.
Enlarges the set if necessary.
Definition at line 34 of file large_fd_set.h.
#define NETSNMP_LARGE_FD_ZERO | ( | fdset | ) |
do { \ int __i; \ fd_set *__arr = &(fdset)->lfs_set; \ __i = NETSNMP_FD_SET_ELEM_COUNT((fdset)->lfs_setsize); \ for ( ; __i > 0; __i--) \ __arr->fds_bits[__i - 1] = 0; \ } while (0)
Remove all file descriptors from the set *fdset.
Definition at line 91 of file large_fd_set.h.
void netsnmp_copy_fd_set_to_large_fd_set | ( | netsnmp_large_fd_set * | dst, |
const fd_set * | src | ||
) |
Copy an fd_set to a netsnmp_large_fd_set structure.
Definition at line 191 of file large_fd_set.c.
int netsnmp_copy_large_fd_set_to_fd_set | ( | fd_set * | dst, |
const netsnmp_large_fd_set * | src | ||
) |
Copy a netsnmp_large_fd_set structure into an fd_set.
Definition at line 199 of file large_fd_set.c.
NETSNMP_IMPORT void netsnmp_large_fd_set_cleanup | ( | netsnmp_large_fd_set * | fdset | ) |
Deallocate the memory allocated by netsnmp_large_fd_set_init.
Definition at line 183 of file large_fd_set.c.
NETSNMP_IMPORT void netsnmp_large_fd_set_init | ( | netsnmp_large_fd_set * | fdset, |
int | setsize | ||
) |
Initialize a netsnmp_large_fd_set structure.
Note: this function only initializes the lfs_setsize and lfs_setptr members of netsnmp_large_fd_set, not the file descriptor set itself. The file descriptor set must be initialized separately, e.g. via NETSNMP_LARGE_FD_CLR().
Definition at line 113 of file large_fd_set.c.
void netsnmp_large_fd_set_resize | ( | netsnmp_large_fd_set * | fdset, |
int | setsize | ||
) |
Modify the size of a file descriptor set and preserve the first min(fdset->lfs_setsize, setsize) file descriptors.
Definition at line 143 of file large_fd_set.c.
NETSNMP_IMPORT int netsnmp_large_fd_set_select | ( | int | numfds, |
netsnmp_large_fd_set * | readfds, | ||
netsnmp_large_fd_set * | writefds, | ||
netsnmp_large_fd_set * | exceptfds, | ||
struct timeval * | timeout | ||
) |
Synchronous I/O multiplexing for large file descriptor sets.
On POSIX systems, any file descriptor set with size below numfds will be resized before invoking select().
Definition at line 121 of file large_fd_set.c.