summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2002-11-17 16:22:18 +0000
committermike <mike@FreeBSD.org>2002-11-17 16:22:18 +0000
commita98b300bf38c0cb695bbfd14a0f5389699880f00 (patch)
tree528d7bc0d381229d2298be983e308b25e3d5d22e
parentdae2f5d5cd066524c19b83ae1d83293c48673e61 (diff)
downloadFreeBSD-src-a98b300bf38c0cb695bbfd14a0f5389699880f00.zip
FreeBSD-src-a98b300bf38c0cb695bbfd14a0f5389699880f00.tar.gz
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
-rw-r--r--sys/sys/select.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/sys/select.h b/sys/sys/select.h
index 6755360..b9ca531 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 <strings.h> 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;
OpenPOWER on IntegriCloud