aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-17 18:05:42 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-17 18:05:57 +0000
commit7011c2622fe3e10a29dbe74f06aaebd07710127d (patch)
tree42987e63dc4500ac40585cba04f0392ea0ca3dc2
parent0f197fe5b65c6df1a3a0b6b36383d4babec85bd1 (diff)
downloadglibc-7011c2622fe3e10a29dbe74f06aaebd07710127d.zip
glibc-7011c2622fe3e10a29dbe74f06aaebd07710127d.tar.gz
glibc-7011c2622fe3e10a29dbe74f06aaebd07710127d.tar.bz2
Remove __FAVOR_BSD.
-rw-r--r--ChangeLog17
-rw-r--r--NEWS3
-rw-r--r--include/features.h9
-rw-r--r--manual/creature.texi41
-rw-r--r--manual/job.texi35
-rw-r--r--posix/unistd.h26
-rw-r--r--setjmp/setjmp.h9
-rw-r--r--signal/signal.h22
-rw-r--r--sysdeps/gnu/netinet/tcp.h120
-rw-r--r--sysdeps/gnu/netinet/udp.h33
10 files changed, 115 insertions, 200 deletions
diff --git a/ChangeLog b/ChangeLog
index 4291b1c3..a035dc9 100644
--- 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 7bb8ebf..32c8f08 100644
--- 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.
Version 2.18
diff --git a/include/features.h b/include/features.h
index c9be10a..cff8bfc 100644
--- a/include/features.h
+++ b/include/features.h
@@ -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
@@ -120,7 +119,6 @@
#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
@@ -144,13 +142,6 @@
#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
diff --git a/manual/creature.texi b/manual/creature.texi
index 1bf5314..3b7e77c 100644
--- a/manual/creature.texi
+++ b/manual/creature.texi
@@ -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.
diff --git a/manual/job.texi b/manual/job.texi
index 4efeed3..d58dcd8 100644
--- a/manual/job.texi
+++ b/manual/job.texi
@@ -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
diff --git a/posix/unistd.h b/posix/unistd.h
index d4eeaf1..f37dce7 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -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.
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index 67de76c..8e6b5b4 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -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
diff --git a/signal/signal.h b/signal/signal.h
index ec28b31..b698d14 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -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
diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h
index b7bf9b3..f6602ec 100644
--- a/sysdeps/gnu/netinet/tcp.h
+++ b/sysdeps/gnu/netinet/tcp.h
@@ -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,
diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h
index 3beb371..0bf8696 100644
--- a/sysdeps/gnu/netinet/udp.h
+++ b/sysdeps/gnu/netinet/udp.h
@@ -52,27 +52,28 @@
/* 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