From: Rich Felker Date: Sat, 6 Jul 2013 05:12:28 +0000 (-0400) Subject: add NFDBITS in sys/select.h with appropriate feature tests X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b;ds=sidebyside add NFDBITS in sys/select.h with appropriate feature tests the main use for this macro seems to be knowing the correct allocation granularity for dynamic-sized fd_set objects. such usage is non-conforming and results in undefined behavior, but it is widespread in applications. --- diff --git a/include/sys/select.h b/include/sys/select.h index c5a2877f..e25257d2 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -32,6 +32,9 @@ typedef struct int select (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, struct timeval *__restrict); int pselect (int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define NFDBITS (8*(int)sizeof(long)) +#endif #ifdef __cplusplus }