From owner-freebsd-standards Wed Nov 13 4:40:41 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9239237B401 for ; Wed, 13 Nov 2002 04:40:39 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9BB743E42 for ; Wed, 13 Nov 2002 04:40:38 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id BEF739BC3; Wed, 13 Nov 2002 07:31:43 -0500 (EST) Date: Wed, 13 Nov 2002 07:31:43 -0500 From: Mike Barcroft To: standards@FreeBSD.org Cc: Archie Cobbs Subject: select.diff for review Message-ID: <20021113073143.A98651@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I plan on committing the attached patch to soon. Comments appreciated. Best regards, Mike Barcroft --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="select.diff" 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) Index: select.h =================================================================== RCS file: /work/repo/src/sys/sys/select.h,v retrieving revision 1.15 diff -u -r1.15 select.h --- select.h 5 Oct 2002 05:40:48 -0000 1.15 +++ select.h 13 Nov 2002 12:30:23 -0000 @@ -79,18 +79,29 @@ #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) __fd_zero((p), FD_SETSIZE) + +static __inline void +__fd_zero(fd_set *_p, __size_t _n) +{ + + _n = _howmany(_n, _NFDBITS); + while (_n > 0) + _p->__fds_bits[--_n] = 0; +} #ifndef _KERNEL struct timeval; --bg08WKrSYDhXBjb5-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message