From owner-freebsd-current Mon Nov 11 8:30:22 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D30337B401 for ; Mon, 11 Nov 2002 08:30:20 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1A2643E7B for ; Mon, 11 Nov 2002 08:30:19 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id C0ECC9BC3; Mon, 11 Nov 2002 11:21:28 -0500 (EST) Date: Mon, 11 Nov 2002 11:21:28 -0500 From: Mike Barcroft To: Marc Recht Cc: Garrett Wollman , current@FreeBSD.ORG Subject: Re: addition to cdefs Message-ID: <20021111112128.G52940@espresso.q9media.com> References: <1037017897.779.20.camel@leeloo.intern.geht.de> <20021111095458.F52940@espresso.q9media.com> <1037029019.779.87.camel@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tqI+Z3u+9OQ7kwn0" Content-Disposition: inline In-Reply-To: <1037029019.779.87.camel@leeloo.intern.geht.de>; from marc@informatik.uni-bremen.de on Mon, Nov 11, 2002 at 04:36:58PM +0100 Organization: The FreeBSD Project Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --tqI+Z3u+9OQ7kwn0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Marc Recht writes: > Thanks! > > > It looks like has some XSI bugs. Is _XOPEN_SOURCE defined > > anywhere? If so, try the attached patch. If not, this is a bug in > Yes, _XOPEN_SOURCE is defined. So, it solves some of the problems. > > > Python (since POSIX doesn't specify chroot()) and should be fixed at > > their end and in the ports collection. > But, there still some problems left. Like fd_set being not defined in > sys/select if _BSD_VISIBLE isn't given. I've had the attached patch in my tree for a while. I'll try and get it and the patch committed today. > > _BSD_SOURCE provides mostly the same visibility as not defining any > > standards constants, so it isn't very useful. > IMO it would be nice to have a clean way to toggle __BSD_VISIBLE from > the outside. In the default environment I have > #define __POSIX_VISIBLE 200112 > #define __XSI_VISIBLE 600 > #define __BSD_VISIBLE 1 > #define __ISO_C_VISIBLE 1999 > > But, Python for example, wants _POSIX_C_SOURCE 199506,_XOPEN_SOURCE 500 > _and_ __BSD_VISIBLE 1. I know, I could also just do a -D__BSD_VISIBLE=1, > but I think thats not The Right Thing to do. The whole point of the standards constants is to specify a strict environment. If you want a BSD environment don't specify a particular standard, it's simple. Best regards, Mike Barcroft --tqI+Z3u+9OQ7kwn0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="select.diff" 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 21 Oct 2002 21:49:23 -0000 @@ -79,18 +79,30 @@ #endif typedef struct fd_set { +#if __BSD_VISIBLE || __XSI_VISIBLE <= 500 __fd_mask fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; +#else + __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; +#endif } fd_set; -#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; --tqI+Z3u+9OQ7kwn0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message