Remove __FAVOR_BSD.
authorJoseph Myers <joseph@codesourcery.com>
Tue, 17 Dec 2013 18:05:42 +0000 (18:05 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 17 Dec 2013 18:05:57 +0000 (18:05 +0000)
ChangeLog
NEWS
include/features.h
manual/creature.texi
manual/job.texi
posix/unistd.h
setjmp/setjmp.h
signal/signal.h
sysdeps/gnu/netinet/tcp.h
sysdeps/gnu/netinet/udp.h

index 4291b1c32311a89ca415e2bedda07c29729fffb7..a035dc9fe74200fb69845733aadacb4f7d8e6b1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-12-17  Joseph Myers  <joseph@codesourcery.com>
+
+       * include/features.h (__FAVOR_BSD): Do not define.
+       * manual/creature.texi (_BSD_SOURCE): Do not document as enabling
+       features conflicting with POSIX.
+       (_GNU_SOURCE): Do not mention interaction with _BSD_SOURCE.
+       (_BSD_SOURCE): Remove description of not being a subset of other
+       feature test macros.
+       * manual/job.texi (getpgrp): Do not document BSD version.
+       (getpgid): Do not document by reference to BSD getpgrp.
+       * posix/unistd.h [__FAVOR_BSD]: Remove conditional code.
+       * setjmp/setjmp.h [__FAVOR_BSD]: Likewise.
+       * signal/signal.h [__FAVOR_BSD]: Likewise.
+       * sysdeps/gnu/netinet/tcp.h (struct tcphdr): Use anonymous unions
+       instead of making contents conditional on [__FAVOR_BSD].
+       * sysdeps/gnu/netinet/udp.h (struct udphdr): Likewise.
+
 2013-12-17  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
        * sysdeps/powerpc/fpu/libm-test-ulps: Update.
diff --git a/NEWS b/NEWS
index 7bb8ebf1beb08be0aa0c37a2f8f5a51b4df16722..32c8f0885a402b6e13b930033182e16f1aeab129 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -100,6 +100,9 @@ Version 2.19
 * The soft-float powerpc port now supports e500 processors.
 
 * Support for STT_GNU_IFUNC symbols added for ppc32/power4+ and ppc64.
+
+* The _BSD_SOURCE feature test macro no longer enables BSD interfaces that
+  conflict with POSIX.
 \f
 Version 2.18
 
index c9be10a63e35fb84159aa8f56f710e491c0d5a4d..cff8bfcf8ea074ca1b63d1fe4dcb5681eef5eef8 100644 (file)
@@ -80,7 +80,6 @@
    __USE_GNU           Define GNU extensions.
    __USE_REENTRANT     Define reentrant/thread-safe *_r functions.
    __USE_FORTIFY_LEVEL Additional security measures used, according to level.
-   __FAVOR_BSD         Favor 4.3BSD things in cases of conflict.
 
    The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
    defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
 #undef __USE_GNU
 #undef __USE_REENTRANT
 #undef __USE_FORTIFY_LEVEL
-#undef __FAVOR_BSD
 #undef __KERNEL_STRICT_NAMES
 
 /* Suppress kernel-name space pollution unless user expressedly asks
 #endif
 
 
-/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX.  */
-#if defined _BSD_SOURCE && \
-    !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
-      defined _XOPEN_SOURCE || defined _GNU_SOURCE || defined _SVID_SOURCE)
-# define __FAVOR_BSD   1
-#endif
-
 /* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
 #ifdef _GNU_SOURCE
 # undef  _ISOC95_SOURCE
index 1bf53147ee05fa0a9dfd21423ccb2be0f1150f5f..3b7e77c78bbeaf9491804e1b3fba584df3f2d14d 100644 (file)
@@ -77,24 +77,6 @@ edition is made available.
 @defvr Macro _BSD_SOURCE
 If you define this macro, functionality derived from 4.3 BSD Unix is
 included as well as the @w{ISO C}, POSIX.1, and POSIX.2 material.
-
-Some of the features derived from 4.3 BSD Unix conflict with the
-corresponding features specified by the POSIX.1 standard.  If this
-macro is defined, the 4.3 BSD definitions take precedence over the
-POSIX definitions.
-
-Due to the nature of some of the conflicts between 4.3 BSD and POSIX.1,
-you need to use a special @dfn{BSD compatibility library} when linking
-programs compiled for BSD compatibility.  This is because some functions
-must be defined in two different ways, one of them in the normal C
-library, and one of them in the compatibility library.  If your program
-defines @code{_BSD_SOURCE}, you must give the option @samp{-lbsd-compat}
-to the compiler or linker when linking the program, to tell it to find
-functions in this special compatibility library before looking for them in
-the normal C library.
-@pindex -lbsd-compat
-@pindex bsd-compat
-@cindex BSD compatibility library.
 @end defvr
 
 @comment (none)
@@ -204,21 +186,6 @@ If you define this macro, everything is included: @w{ISO C89}, @w{ISO
 C99}, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions.  In
 the cases where POSIX.1 conflicts with BSD, the POSIX definitions take
 precedence.
-
-If you want to get the full effect of @code{_GNU_SOURCE} but make the
-BSD definitions take precedence over the POSIX definitions, use this
-sequence of definitions:
-
-@smallexample
-#define _GNU_SOURCE
-#define _BSD_SOURCE
-#define _SVID_SOURCE
-@end smallexample
-
-Note that if you do this, you must link your program with the BSD
-compatibility library by passing the @samp{-lbsd-compat} option to the
-compiler or linker.  @strong{NB:} If you forget to do this, you may
-get very strange errors at run time.
 @end defvr
 
 @comment (none)
@@ -248,11 +215,3 @@ those features.  For example, if you define @code{_POSIX_C_SOURCE}, then
 defining @code{_POSIX_SOURCE} as well has no effect.  Likewise, if you
 define @code{_GNU_SOURCE}, then defining either @code{_POSIX_SOURCE} or
 @code{_POSIX_C_SOURCE} or @code{_SVID_SOURCE} as well has no effect.
-
-Note, however, that the features of @code{_BSD_SOURCE} are not a subset of
-any of the other feature test macros supported.  This is because it defines
-BSD features that take precedence over the POSIX features that are
-requested by the other macros.  For this reason, defining
-@code{_BSD_SOURCE} in addition to the other feature test macros does have
-an effect: it causes the BSD features to take priority over the conflicting
-POSIX features.
index 4efeed3451c616f508505540c37110c86ab98991..d58dcd8c8f603811e01de820c9f6e0c633d066ba 100644 (file)
@@ -1118,39 +1118,18 @@ from the calling process.
 @end table
 @end deftypefun
 
-The @code{getpgrp} function has two definitions: one derived from BSD
-Unix, and one from the POSIX.1 standard.  The feature test macros you
-have selected (@pxref{Feature Test Macros}) determine which definition
-you get.  Specifically, you get the BSD version if you define
-@code{_BSD_SOURCE}; otherwise, you get the POSIX version if you define
-@code{_POSIX_SOURCE} or @code{_GNU_SOURCE}.  Programs written for old
-BSD systems will not include @file{unistd.h}, which defines
-@code{getpgrp} specially under @code{_BSD_SOURCE}.  You must link such
-programs with the @code{-lbsd-compat} option to get the BSD definition.@refill
-@pindex -lbsd-compat
-@pindex bsd-compat
-@cindex BSD compatibility library
-
 @comment unistd.h
 @comment POSIX.1
-@deftypefn {POSIX.1 Function} pid_t getpgrp (void)
-The POSIX.1 definition of @code{getpgrp} returns the process group ID of
+@deftypefun pid_t getpgrp (void)
+The @code{getpgrp} function returns the process group ID of
 the calling process.
-@end deftypefn
-
-@comment unistd.h
-@comment BSD
-@deftypefn {BSD Function} pid_t getpgrp (pid_t @var{pid})
-The BSD definition of @code{getpgrp} returns the process group ID of the
-process @var{pid}.  You can supply a value of @code{0} for the @var{pid}
-argument to get information about the calling process.
-@end deftypefn
+@end deftypefun
 
 @comment unistd.h
-@comment SVID
-@deftypefn {System V Function} int getpgid (pid_t @var{pid})
+@comment POSIX.1
+@deftypefun int getpgid (pid_t @var{pid})
 
-@code{getpgid} is the same as the BSD function @code{getpgrp}.  It
+The @code{getpgid} function
 returns the process group ID of the process @var{pid}.  You can supply a
 value of @code{0} for the @var{pid} argument to get information about
 the calling process.
@@ -1166,7 +1145,7 @@ different sessions, and the implementation doesn't allow to access the
 process group ID of the process with ID @var{pid} from the calling
 process.
 @end table
-@end deftypefn
+@end deftypefun
 
 @comment unistd.h
 @comment POSIX.1
index d4eeaf1433cd2f7ce1fd6691cecc50dfeb7e288d..f37dce7b46133d9b5dd23a190f9585b1cb7fb517 100644 (file)
@@ -630,17 +630,8 @@ extern __pid_t getpid (void) __THROW;
 /* Get the process ID of the calling process's parent.  */
 extern __pid_t getppid (void) __THROW;
 
-/* Get the process group ID of the calling process.
-   This function is different on old BSD. */
-#ifndef __FAVOR_BSD
+/* Get the process group ID of the calling process.  */
 extern __pid_t getpgrp (void) __THROW;
-#else
-# ifdef __REDIRECT_NTH
-extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
-# else
-#  define getpgrp __getpgid
-# endif
-#endif
 
 /* Get the process group ID of process PID.  */
 extern __pid_t __getpgid (__pid_t __pid) __THROW;
@@ -662,25 +653,12 @@ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
 
    New programs should always use `setpgid' instead.
 
-   The default in GNU is to provide the System V function.  The BSD
-   function is available under -D_BSD_SOURCE.  */
-
-# ifndef __FAVOR_BSD
+   GNU provides the POSIX.1 function.  */
 
 /* Set the process group ID of the calling process to its own PID.
    This is exactly the same as `setpgid (0, 0)'.  */
 extern int setpgrp (void) __THROW;
 
-# else
-
-/* Another name for `setpgid' (above).  */
-#  ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
-#  else
-#   define setpgrp setpgid
-#  endif
-
-# endif        /* Favor BSD.  */
 #endif /* Use SVID or BSD.  */
 
 /* Create a new session with the calling process as its leader.
index 67de76c6b117ad19036e062acb77083651240d02..8e6b5b49d1695e311278e8da04ebb95191202e21 100644 (file)
@@ -58,20 +58,13 @@ __END_NAMESPACE_STD
    This is the internal name for `sigsetjmp'.  */
 extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
 
-#ifndef        __FAVOR_BSD
 /* Store the calling environment in ENV, not saving the signal mask.
    Return 0.  */
 extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
 
 /* Do not save the signal mask.  This is equivalent to the `_setjmp'
    BSD function.  */
-# define setjmp(env)   _setjmp (env)
-#else
-/* We are in 4.3 BSD-compatibility mode in which `setjmp'
-   saves the signal mask like `sigsetjmp (ENV, 1)'.  We have to
-   define a macro since ISO C says `setjmp' is one.  */
-# define setjmp(env)   setjmp (env)
-#endif /* Favor BSD.  */
+#define setjmp(env)    _setjmp (env)
 
 
 __BEGIN_NAMESPACE_STD
index ec28b3101ba6f62d4bb97da44ac9136f40637939..b698d14bb688868997e75260e29d9750bb6d3cba 100644 (file)
@@ -158,28 +158,20 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
 
 
 
-/* The `sigpause' function has two different interfaces.  The original
-   BSD definition defines the argument as a mask of the signal, while
-   the more modern interface in X/Open defines it as the signal
-   number.  We go with the BSD version unless the user explicitly
-   selects the X/Open version.
+/* The `sigpause' function in X/Open defines the argument as the
+   signal number.  This requires redirecting to another function
+   because the default version in glibc uses an old BSD interface.
 
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern int __sigpause (int __sig_or_mask, int __is_sig);
 
-#ifdef __FAVOR_BSD
-/* Set the mask of blocked signals to MASK,
-   wait for a signal to arrive, and then restore the mask.  */
-extern int sigpause (int __mask) __THROW __attribute_deprecated__;
-#else
-# ifdef __USE_XOPEN
-#  ifdef __GNUC__
+#ifdef __USE_XOPEN
+# ifdef __GNUC__
 extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
-#  else
+# else
 /* Remove a signal from the signal mask and suspend the process.  */
-#   define sigpause(sig) __sigpause ((sig), 1)
-#  endif
+#  define sigpause(sig) __sigpause ((sig), 1)
 # endif
 #endif
 
index b7bf9b38d4a13fb17253a3106403554f3c5defaf..f6602ecfdeaee90b1f77924a453c81e99cc3727d 100644 (file)
@@ -66,7 +66,6 @@
 # include <sys/types.h>
 # include <sys/socket.h>
 
-# ifdef __FAVOR_BSD
 typedef        u_int32_t tcp_seq;
 /*
  * TCP header.
@@ -74,66 +73,69 @@ typedef     u_int32_t tcp_seq;
  */
 struct tcphdr
   {
-    u_int16_t th_sport;                /* source port */
-    u_int16_t th_dport;                /* destination port */
-    tcp_seq th_seq;            /* sequence number */
-    tcp_seq th_ack;            /* acknowledgement number */
-#  if __BYTE_ORDER == __LITTLE_ENDIAN
-    u_int8_t th_x2:4;          /* (unused) */
-    u_int8_t th_off:4;         /* data offset */
-#  endif
-#  if __BYTE_ORDER == __BIG_ENDIAN
-    u_int8_t th_off:4;         /* data offset */
-    u_int8_t th_x2:4;          /* (unused) */
-#  endif
-    u_int8_t th_flags;
-#  define TH_FIN       0x01
-#  define TH_SYN       0x02
-#  define TH_RST       0x04
-#  define TH_PUSH      0x08
-#  define TH_ACK       0x10
-#  define TH_URG       0x20
-    u_int16_t th_win;          /* window */
-    u_int16_t th_sum;          /* checksum */
-    u_int16_t th_urp;          /* urgent pointer */
+    __extension__ union
+    {
+      struct
+      {
+       u_int16_t th_sport;             /* source port */
+       u_int16_t th_dport;             /* destination port */
+       tcp_seq th_seq;         /* sequence number */
+       tcp_seq th_ack;         /* acknowledgement number */
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+       u_int8_t th_x2:4;               /* (unused) */
+       u_int8_t th_off:4;              /* data offset */
+# endif
+# if __BYTE_ORDER == __BIG_ENDIAN
+       u_int8_t th_off:4;              /* data offset */
+       u_int8_t th_x2:4;               /* (unused) */
+# endif
+       u_int8_t th_flags;
+# define TH_FIN        0x01
+# define TH_SYN        0x02
+# define TH_RST        0x04
+# define TH_PUSH       0x08
+# define TH_ACK        0x10
+# define TH_URG        0x20
+       u_int16_t th_win;               /* window */
+       u_int16_t th_sum;               /* checksum */
+       u_int16_t th_urp;               /* urgent pointer */
+      };
+      struct
+      {
+       u_int16_t source;
+       u_int16_t dest;
+       u_int32_t seq;
+       u_int32_t ack_seq;
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+       u_int16_t res1:4;
+       u_int16_t doff:4;
+       u_int16_t fin:1;
+       u_int16_t syn:1;
+       u_int16_t rst:1;
+       u_int16_t psh:1;
+       u_int16_t ack:1;
+       u_int16_t urg:1;
+       u_int16_t res2:2;
+# elif __BYTE_ORDER == __BIG_ENDIAN
+       u_int16_t doff:4;
+       u_int16_t res1:4;
+       u_int16_t res2:2;
+       u_int16_t urg:1;
+       u_int16_t ack:1;
+       u_int16_t psh:1;
+       u_int16_t rst:1;
+       u_int16_t syn:1;
+       u_int16_t fin:1;
+# else
+#  error "Adjust your <bits/endian.h> defines"
+# endif
+       u_int16_t window;
+       u_int16_t check;
+       u_int16_t urg_ptr;
+      };
+    };
 };
 
-# else /* !__FAVOR_BSD */
-struct tcphdr
-  {
-    u_int16_t source;
-    u_int16_t dest;
-    u_int32_t seq;
-    u_int32_t ack_seq;
-#  if __BYTE_ORDER == __LITTLE_ENDIAN
-    u_int16_t res1:4;
-    u_int16_t doff:4;
-    u_int16_t fin:1;
-    u_int16_t syn:1;
-    u_int16_t rst:1;
-    u_int16_t psh:1;
-    u_int16_t ack:1;
-    u_int16_t urg:1;
-    u_int16_t res2:2;
-#  elif __BYTE_ORDER == __BIG_ENDIAN
-    u_int16_t doff:4;
-    u_int16_t res1:4;
-    u_int16_t res2:2;
-    u_int16_t urg:1;
-    u_int16_t ack:1;
-    u_int16_t psh:1;
-    u_int16_t rst:1;
-    u_int16_t syn:1;
-    u_int16_t fin:1;
-#  else
-#   error "Adjust your <bits/endian.h> defines"
-#  endif
-    u_int16_t window;
-    u_int16_t check;
-    u_int16_t urg_ptr;
-};
-# endif /* __FAVOR_BSD */
-
 enum
 {
   TCP_ESTABLISHED = 1,
index 3beb3715b863858c48b16094aee88d79cb1fd923..0bf8696acfc9bc823e27c0a668d367374f88b0f7 100644 (file)
 
 
 /* UDP header as specified by RFC 768, August 1980. */
-#ifdef __FAVOR_BSD
 
 struct udphdr
 {
-  u_int16_t uh_sport;          /* source port */
-  u_int16_t uh_dport;          /* destination port */
-  u_int16_t uh_ulen;           /* udp length */
-  u_int16_t uh_sum;            /* udp checksum */
+  __extension__ union
+  {
+    struct
+    {
+      u_int16_t uh_sport;              /* source port */
+      u_int16_t uh_dport;              /* destination port */
+      u_int16_t uh_ulen;               /* udp length */
+      u_int16_t uh_sum;                /* udp checksum */
+    };
+    struct
+    {
+      u_int16_t source;
+      u_int16_t dest;
+      u_int16_t len;
+      u_int16_t check;
+    };
+  };
 };
 
-#else
-
-struct udphdr
-{
-  u_int16_t source;
-  u_int16_t dest;
-  u_int16_t len;
-  u_int16_t check;
-};
-#endif
-
 /* UDP socket options */
 #define UDP_CORK       1       /* Never send partially complete segments.  */
 #define UDP_ENCAP      100     /* Set the socket to accept