summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-07-06 01:12:28 -0400
committerRich Felker <dalias@aerifal.cx>2013-07-06 01:12:28 -0400
commitca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b (patch)
tree0e000328e727baf07f60f8b9267e0876fa04d12c /include
parent6d861ac87491a207e4599c44b61d142f0a601c2d (diff)
downloadmusl-ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b.tar.gz
musl-ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b.tar.bz2
musl-ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b.tar.xz
musl-ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b.zip
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.
Diffstat (limited to 'include')
-rw-r--r--include/sys/select.h3
1 files changed, 3 insertions, 0 deletions
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
}