Combining the various suggestions, I now have this:

Index: sys/sys/select.h
===================================================================
RCS file: /cvs/src/sys/sys/select.h,v
retrieving revision 1.13
diff -u -p -r1.13 select.h
--- sys/sys/select.h    29 Oct 2013 02:44:52 -0000      1.13
+++ sys/sys/select.h    3 Dec 2013 21:51:08 -0000
@@ -76,8 +76,17 @@ typedef      struct fd_set {
        ((p)->fds_bits[(n) / __NFDBITS] &= ~(1U << ((n) % __NFDBITS)))
 #define        FD_ISSET(n, p) \
        ((p)->fds_bits[(n) / __NFDBITS] & (1U << ((n) % __NFDBITS)))
-#define        FD_COPY(f, t)   memcpy(t, f, sizeof(*(f)))
-#define        FD_ZERO(p)      memset(p, 0, sizeof(*(p)))
+
+#if __BSD_VISIBLE
+#define        FD_COPY(f, t)   (void)(*(t) = *(f))
+#endif
+#define        FD_ZERO(p) do                                   \
+       fd_set *_p = (p);                               \
+       __size_t _n = __howmany(FD_SETSIZE, __NFDBITS); \
+                                                       \
+       while (_n > 0)                                  \
+               _p->fds_bits[--_n] = 0;                 \
+} while (0)
 
 #if __BSD_VISIBLE
 #define        NBBY    __NBBY
Index: lib/libc/sys/select.2
===================================================================
RCS file: /cvs/src/lib/libc/sys/select.2,v
retrieving revision 1.32
diff -u -p -r1.32 select.2
--- lib/libc/sys/select.2       2 Nov 2013 17:25:34 -0000       1.32
+++ lib/libc/sys/select.2       3 Dec 2013 21:43:17 -0000
@@ -38,10 +38,7 @@
 .Nm pselect
 .Nd synchronous I/O multiplexing
 .Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/time.h>
-.Fd #include <string.h>
-.Fd #include <unistd.h>
+.In sys/select.h
 .Ft int
 .Fn select "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set *exceptfds" 
"struct timeval *timeout"
 .Ft int
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to