]> Git Repo - uclibc-ng.git/commitdiff
remove __FAVOR_BSD
authorWaldemar Brodkorb <[email protected]>
Thu, 22 Jun 2017 20:20:20 +0000 (22:20 +0200)
committerWaldemar Brodkorb <[email protected]>
Thu, 22 Jun 2017 21:47:24 +0000 (23:47 +0200)
Remove __FAVOR_BSD and sync with GNU C library

Some issues compiling knock application fixed.

Reported-By: Thomas Petazzoni <[email protected]>
include/features.h
include/netinet/tcp.h
include/netinet/udp.h
include/setjmp.h
include/signal.h
include/unistd.h

index 3a99593600d4f7dfb1434bcbfe01292b4339dda1..7dc913f3337d5d9505e9a09fa20bcbcf00585982 100644 (file)
@@ -78,7 +78,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
 # define _DEFAULT_SOURCE       1
 #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 _XOPEN_SOURCE_EXTENDED || \
-      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  _ISOC99_SOURCE
index 04032bb68117c6ed3c08792e6e635f41446b3336..ade01cd0d293b8ff07cae4c2e839a4e2c2e84111 100644 (file)
 #ifdef __USE_MISC
 # include <sys/types.h>
 # include <sys/socket.h>
+# include <stdint.h>
 
-# ifdef __FAVOR_BSD
-typedef        u_int32_t tcp_seq;
+typedef        uint32_t tcp_seq;
 /*
  * TCP header.
  * Per RFC 793, September, 1981.
  */
 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
+      {
+       uint16_t th_sport;      /* source port */
+       uint16_t th_dport;      /* destination port */
+       tcp_seq th_seq;         /* sequence number */
+       tcp_seq th_ack;         /* acknowledgement number */
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+       uint8_t th_x2:4;        /* (unused) */
+       uint8_t th_off:4;       /* data offset */
+# endif
+# if __BYTE_ORDER == __BIG_ENDIAN
+       uint8_t th_off:4;       /* data offset */
+       uint8_t th_x2:4;        /* (unused) */
+# endif
+       uint8_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
+       uint16_t th_win;        /* window */
+       uint16_t th_sum;        /* checksum */
+       uint16_t th_urp;        /* urgent pointer */
+      };
+      struct
+      {
+       uint16_t source;
+       uint16_t dest;
+       uint32_t seq;
+       uint32_t ack_seq;
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+       uint16_t res1:4;
+       uint16_t doff:4;
+       uint16_t fin:1;
+       uint16_t syn:1;
+       uint16_t rst:1;
+       uint16_t psh:1;
+       uint16_t ack:1;
+       uint16_t urg:1;
+       uint16_t res2:2;
+# elif __BYTE_ORDER == __BIG_ENDIAN
+       uint16_t doff:4;
+       uint16_t res1:4;
+       uint16_t res2:2;
+       uint16_t urg:1;
+       uint16_t ack:1;
+       uint16_t psh:1;
+       uint16_t rst:1;
+       uint16_t syn:1;
+       uint16_t fin:1;
+# else
+#  error "Adjust your <bits/endian.h> defines"
+# endif
+       uint16_t window;
+       uint16_t check;
+       uint16_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 7d49768854df50ca5c988fb0a82bb9e762279403..ac6f23413c540f8a1ac679ca2acd1c6094072c57 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
+    {
+      uint16_t uh_sport;       /* source port */
+      uint16_t uh_dport;       /* destination port */
+      uint16_t uh_ulen;                /* udp length */
+      uint16_t uh_sum;         /* udp checksum */
+    };
+    struct
+    {
+      uint16_t source;
+      uint16_t dest;
+      uint16_t len;
+      uint16_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
index 71c1d35cb21021fcc58086731bdb9ff357fa41ae..27cac9500a1551ca1d0b5396f6f9e960e563e5da 100644 (file)
@@ -59,21 +59,13 @@ __END_NAMESPACE_STD
 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 38292a7152f9611a8b5adcc7af7abce560d02477..d2d5e4aa67beba65bbbd2389cc8684b9dd7bcfec 100644 (file)
@@ -191,27 +191,15 @@ 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.
+   number.  We go with the X/Open version.
 
    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__;
-# define sigpause(mask) __sigpause ((mask), 0)*/
-/* uClibc note: BSD sigpause is available as __bsd_sigpause.
- * It is intentionally not prototyped */
-#else
-# ifdef __USE_XOPEN
+
+# ifdef __USE_XOPEN_EXTENDED
 /* Remove a signal from the signal mask and suspend the process.  */
 extern int sigpause(int __sig);
-/*#  define sigpause(sig) __sigpause ((sig), 1)*/
 # endif
-#endif
 #endif /* __UCLIBC_SUSV4_LEGACY__ */
 
 #if 0 /*def __USE_BSD*/
index 8e4daf687beb2d2dcca45d5f1a9a785e50261b0c..f48ce21b37b5575e23f739730ae72ba09c306cc9 100644 (file)
@@ -673,17 +673,8 @@ libc_hidden_proto(getpid)
 /* 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;
@@ -698,7 +689,7 @@ extern __pid_t getpgid (__pid_t __pid) __THROW;
 extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
 libc_hidden_proto(setpgid)
 
-#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* Both System V and BSD have `setpgrp' functions, but with different
    calling conventions.  The BSD function is the same as POSIX.1 `setpgid'
    (above).  The System V function takes no arguments and puts the calling
@@ -706,26 +697,13 @@ libc_hidden_proto(setpgid)
 
    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.  */
+#endif /* Use misc or X/Open.  */
 
 /* Create a new session with the calling process as its leader.
    The process group IDs of the session and the calling process
This page took 0.039295 seconds and 4 git commands to generate.