Created
June 1, 2011 16:49
-
-
Save OrangeTide/1002727 to your computer and use it in GitHub Desktop.
fast copy of select's fd_set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 700 | |
#include <sys/select.h> | |
static void copyfdset(fd_set *d, fd_set *s, unsigned fd_max) { | |
unsigned i; | |
unsigned n = (fd_max + 1 + __NFDBITS - 1) / __NFDBITS; | |
for(i = 0; i < n; i++) { | |
d->fds_bits[i] = s->fds_bits[i]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment