All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waldemar Brodkorb <wbx@openadk.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] uclibc: fix knock build issue
Date: Fri, 23 Jun 2017 00:07:23 +0200	[thread overview]
Message-ID: <20170622220723.GA20213@waldemar-brodkorb.de> (raw)

This patch sync's with GNU C library and removes __FAVOR_BSD.

Fixes:
  http://autobuild.buildroot.net/results/908/90863b5adb769a346acd3dc4bbe8d5fa497a0581/build-end.log

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 package/uclibc/0001-remove-__FAVOR_BSD.patch | 373 +++++++++++++++++++++++++++
 1 file changed, 373 insertions(+)
 create mode 100644 package/uclibc/0001-remove-__FAVOR_BSD.patch

diff --git a/package/uclibc/0001-remove-__FAVOR_BSD.patch b/package/uclibc/0001-remove-__FAVOR_BSD.patch
new file mode 100644
index 0000000..d65c36d
--- /dev/null
+++ b/package/uclibc/0001-remove-__FAVOR_BSD.patch
@@ -0,0 +1,373 @@
+From 58a5ba12bffad5916d9897c2870fc483f1db8282 Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx@openadk.org>
+Date: Thu, 22 Jun 2017 22:20:20 +0200
+Subject: [PATCH] remove __FAVOR_BSD
+
+Remove __FAVOR_BSD and sync with GNU C library
+
+Some issues compiling knock application fixed.
+
+Reported-By: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+---
+ include/features.h    |  10 ----
+ include/netinet/tcp.h | 123 ++++++++++++++++++++++++++------------------------
+ include/netinet/udp.h |  33 +++++++-------
+ include/setjmp.h      |  10 +---
+ include/signal.h      |  18 ++------
+ include/unistd.h      |  30 ++----------
+ 6 files changed, 88 insertions(+), 136 deletions(-)
+
+diff --git a/include/features.h b/include/features.h
+index 3a99593..7dc913f 100644
+--- a/include/features.h
++++ b/include/features.h
+@@ -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
+@@ -115,7 +114,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
+@@ -155,14 +153,6 @@
+ # 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
+diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
+index 04032bb..ade01cd 100644
+--- a/include/netinet/tcp.h
++++ b/include/netinet/tcp.h
+@@ -65,75 +65,78 @@
+ #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,
+diff --git a/include/netinet/udp.h b/include/netinet/udp.h
+index 7d49768..ac6f234 100644
+--- a/include/netinet/udp.h
++++ b/include/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
++    {
++      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
+diff --git a/include/setjmp.h b/include/setjmp.h
+index 71c1d35..27cac95 100644
+--- a/include/setjmp.h
++++ b/include/setjmp.h
+@@ -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
+ 
+diff --git a/include/signal.h b/include/signal.h
+index 38292a7..d2d5e4a 100644
+--- a/include/signal.h
++++ b/include/signal.h
+@@ -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*/
+diff --git a/include/unistd.h b/include/unistd.h
+index 8e4daf6..f48ce21 100644
+--- a/include/unistd.h
++++ b/include/unistd.h
+@@ -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
+-- 
+2.1.4
+
-- 
2.1.4

             reply	other threads:[~2017-06-22 22:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 22:07 Waldemar Brodkorb [this message]
2017-06-23 19:06 ` [Buildroot] [PATCH] uclibc: fix knock build issue Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170622220723.GA20213@waldemar-brodkorb.de \
    --to=wbx@openadk.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.