Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2002 09:54:58 -0500
From:      Mike Barcroft <mike@FreeBSD.org>
To:        Marc Recht <marc@informatik.uni-bremen.de>
Cc:        Garrett Wollman <wollman@lcs.mit.edu>, current@freebsd.org
Subject:   Re: addition to cdefs
Message-ID:  <20021111095458.F52940@espresso.q9media.com>
In-Reply-To: <1037017897.779.20.camel@leeloo.intern.geht.de>; from marc@informatik.uni-bremen.de on Mon, Nov 11, 2002 at 01:31:36PM %2B0100
References:  <1037017897.779.20.camel@leeloo.intern.geht.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--1LKvkjL3sHcu1TtY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Marc Recht <marc@informatik.uni-bremen.de> writes:
> Hi!
> 
> I've made a small patch to make it possible to enable BSD extensions
> although _POSIX_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE has been
> defined. This is made with a new define _BSD_SOURCE right after the 
> XOPEN_SOURCE handling. It sets __XSI_VISIBLE 600 and __BSD_VISIBLE 1.
> This is needed for some programs. For example for Python 2.3cvs sets
> (among others) _POSIX_C_SOURCE 199506L, but also expects to have chroot
> and friends.

It looks like <unistd.h> has some XSI bugs.  Is _XOPEN_SOURCE defined
anywhere?  If so, try the attached patch.  If not, this is a bug in
Python (since POSIX doesn't specify chroot()) and should be fixed at
their end and in the ports collection.

_BSD_SOURCE provides mostly the same visibility as not defining any
standards constants, so it isn't very useful.

Best regards,
Mike Barcroft

--1LKvkjL3sHcu1TtY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="unistd.diff"

Index: unistd.h
===================================================================
RCS file: /work/repo/src/include/unistd.h,v
retrieving revision 1.63
diff -u -r1.63 unistd.h
--- unistd.h	28 Oct 2002 00:15:43 -0000	1.63
+++ unistd.h	11 Nov 2002 14:48:50 -0000
@@ -361,7 +361,7 @@
 ssize_t	 write(int, const void *, size_t);
 
 /* 1003.2-1992 */
-#if __POSIX_VISIBLE >= 199209
+#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
 size_t	 confstr(int, char *, size_t);
 int	 getopt(int, char * const [], const char *);
 
@@ -370,7 +370,7 @@
 #endif
 
 /* ISO/IEC 9945-1: 1996 */
-#if __POSIX_VISIBLE >= 199506
+#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
 int	 fsync(int);
 
 /*
@@ -381,13 +381,18 @@
 #define	_FTRUNCATE_DECLARED
 int	 ftruncate(int, off_t);
 #endif
+#endif
 
+#if __POSIX_VISIBLE >= 199506
 int	 getlogin_r(char *, int);
 #endif
 
 /* 1003.1-2001 */
-#if __POSIX_VISIBLE >= 200112
+#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
 int	 fchown(int, uid_t, gid_t);
+int	 readlink(const char *, char *, int);
+#endif
+#if __POSIX_VISIBLE >= 200112
 int	 gethostname(char *, int /* socklen_t */);
 int	 setegid(gid_t);
 int	 seteuid(uid_t);
@@ -408,6 +413,7 @@
 /* char	*ctermid(char *); */		/* XXX ??? */
 int	 encrypt(char *, int);
 int	 fchdir(int);
+long	 gethostid(void);
 int	 getpgid(pid_t _pid);
 int	 getsid(pid_t _pid);
 char	*getwd(char *);			/* LEGACY: obsoleted by getcwd() */
@@ -432,13 +438,20 @@
 #endif
 #endif /* __XSI_VISIBLE */
 
+#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
+int	 brk(const void *);
+int	 chroot(const char *);
+int	 getdtablesize(void);
+int	 getpagesize(void) __pure2;
+char	*getpass(const char *);
+void	*sbrk(intptr_t);
+#endif
+
 #if __BSD_VISIBLE
 struct timeval;				/* select(2) */
 int	 acct(const char *);
 int	 async_daemon(void);
-int	 brk(const void *);
 int	 check_utility_compat(const char *);
-int	 chroot(const char *);
 const char *
 	 crypt_get_format(void);
 int	 crypt_set_format(const char *);
@@ -448,12 +461,8 @@
 int	 exect(const char *, char * const *, char * const *);
 char	*fflagstostr(u_long);
 int	 getdomainname(char *, int);
-int	 getdtablesize(void);
 int	 getgrouplist(const char *, gid_t, gid_t *, int *);
-long	 gethostid(void);
 mode_t	 getmode(const void *, mode_t);
-int	 getpagesize(void) __pure2;
-char	*getpass(const char *);
 int	 getpeereid(int, uid_t *, gid_t *);
 int	 getresgid(gid_t *, gid_t *, gid_t *);
 int	 getresuid(uid_t *, uid_t *, uid_t *);
@@ -483,7 +492,6 @@
 		const char *, const char *, const char *);
 char	*re_comp(const char *);
 int	 re_exec(const char *);
-int	 readlink(const char *, char *, int);
 int	 reboot(int);
 int	 revoke(const char *);
 pid_t	 rfork(int);
@@ -491,7 +499,6 @@
 int	 rresvport(int *);
 int	 rresvport_af(int *, int);
 int	 ruserok(const char *, int, const char *, const char *);
-void	*sbrk(intptr_t);
 #if __BSD_VISIBLE
 #ifndef _SELECT_DECLARED
 #define	_SELECT_DECLARED

--1LKvkjL3sHcu1TtY--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021111095458.F52940>