From 65cf1bf2f073bede63c3fa66a7e822c166ce93e8 Mon Sep 17 00:00:00 2001 From: Mike Barcroft Date: Sun, 17 Nov 2002 16:22:18 +0000 Subject: [PATCH] 1. Hide the internals of struct fd_set in standard namespaces. 2. Avoid referencing bcopy() and bzero(), since they may not be in scope. Request by: bde (1) Submitted by: wollman (2) Reviewed by: archie, bde PR: 43270 --- sys/sys/select.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/sys/select.h b/sys/sys/select.h index 67553605b877..b9ca53116a99 100644 --- a/sys/sys/select.h +++ b/sys/sys/select.h @@ -79,18 +79,28 @@ typedef __sigset_t sigset_t; #endif typedef struct fd_set { - __fd_mask fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; + __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; } fd_set; +#if __BSD_VISIBLE +#define fds_bits __fds_bits +#endif -#define __fdset_mask(n) ((fd_mask)1 << ((n) % _NFDBITS)) +#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) #define FD_CLR(n, p) ((p)->fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) #if __BSD_VISIBLE -/* XXX bcopy() not in scope, so is required; see also FD_ZERO(). */ -#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define FD_COPY(f, t) (void)(*(t) = *(f)) #endif #define FD_ISSET(n, p) ((p)->fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) #define FD_SET(n, p) ((p)->fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) -#define FD_ZERO(p) bzero(p, sizeof(*(p))) +#define FD_ZERO(p) do { \ + fd_set *_p; \ + __size_t _n; \ + \ + _p = (p); \ + _n = _howmany(FD_SETSIZE, _NFDBITS); \ + while (_n > 0) \ + _p->__fds_bits[--_n] = 0; \ +} while (0) #ifndef _KERNEL struct timeval;