summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-22 19:35:08 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-22 19:35:08 +0000
commitdf31d32b411022d130b078de177cfa40b7bf6cde (patch)
tree0604126022fcad298f377155a756b42e28882177 /libc
parentd98307c5af70386c4480deff87c7c9921d801c7c (diff)
Enable _GNU_SOURCE build wide, trying to get consistent interfaces, else IMA is a useless attempt
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/addr.c1
-rw-r--r--libc/inet/gai_strerror.c1
-rw-r--r--libc/inet/getaddrinfo.c1
-rw-r--r--libc/inet/getproto.c1
-rw-r--r--libc/inet/getservice.c1
-rw-r--r--libc/inet/if_index.c1
-rw-r--r--libc/inet/ifaddrs.c1
-rw-r--r--libc/inet/rpc/rcmd.c2
-rw-r--r--libc/inet/rpc/svc.c1
-rw-r--r--libc/inet/rpc/svc_auth_unix.c1
-rw-r--r--libc/inet/rpc/svc_run.c1
-rw-r--r--libc/inet/rpc/svc_simple.c1
-rw-r--r--libc/inet/rpc/svc_tcp.c1
-rw-r--r--libc/inet/rpc/svc_udp.c1
-rw-r--r--libc/inet/rpc/xdr.c1
-rw-r--r--libc/inet/rpc/xdr_array.c1
-rw-r--r--libc/inet/rpc/xdr_float.c1
-rw-r--r--libc/inet/rpc/xdr_mem.c1
-rw-r--r--libc/inet/rpc/xdr_rec.c1
-rw-r--r--libc/inet/rpc/xdr_reference.c1
-rw-r--r--libc/misc/ctype/ctype.c1
-rw-r--r--libc/misc/error/err.c1
-rw-r--r--libc/misc/file/lockf64.c2
-rw-r--r--libc/misc/fnmatch/fnmatch.c5
-rw-r--r--libc/misc/fnmatch/fnmatch_old.c5
-rw-r--r--libc/misc/ftw/ftw.c1
-rw-r--r--libc/misc/glob/glob.c1
-rw-r--r--libc/misc/glob/glob64.c1
-rw-r--r--libc/misc/locale/locale.c2
-rw-r--r--libc/misc/pthread/no-tsd.c1
-rw-r--r--libc/misc/pthread/weaks.c1
-rw-r--r--libc/misc/regex/regex.c1
-rw-r--r--libc/misc/regex/regex_old.c4
-rw-r--r--libc/misc/search/hsearch.c4
-rw-r--r--libc/misc/search/hsearch_r.c4
-rw-r--r--libc/misc/search/insremque.c4
-rw-r--r--libc/misc/search/tsearch.c1
-rw-r--r--libc/misc/statfs/fstatvfs.c2
-rw-r--r--libc/misc/statfs/fstatvfs64.c1
-rw-r--r--libc/misc/statfs/statvfs.c2
-rw-r--r--libc/misc/statfs/statvfs64.c1
-rw-r--r--libc/misc/syslog/syslog.c1
-rw-r--r--libc/misc/time/time.c1
-rw-r--r--libc/misc/ttyent/getttyent.c1
-rw-r--r--libc/misc/wchar/wchar.c1
-rw-r--r--libc/misc/wchar/wstdio.c1
-rw-r--r--libc/misc/wctype/wctype.c1
-rw-r--r--libc/misc/wordexp/wordexp.c1
-rw-r--r--libc/pwd_grp/pwd_grp.c1
-rw-r--r--libc/pwd_grp/pwd_grp_internal.c1
-rw-r--r--libc/signal/sigandset.c1
-rw-r--r--libc/signal/sighold.c1
-rw-r--r--libc/signal/sigignore.c1
-rw-r--r--libc/signal/sigisempty.c1
-rw-r--r--libc/signal/sigorset.c1
-rw-r--r--libc/signal/sigpause.c2
-rw-r--r--libc/signal/sigrelse.c1
-rw-r--r--libc/signal/sigset.c1
-rw-r--r--libc/stdio/_stdio.h2
-rw-r--r--libc/stdio/old_vfprintf.c1
-rw-r--r--libc/stdio/scanf.c1
-rw-r--r--libc/stdio/vfprintf.c1
-rw-r--r--libc/stdlib/abort.c1
-rw-r--r--libc/stdlib/atexit.c1
-rw-r--r--libc/stdlib/getpt.c1
-rw-r--r--libc/stdlib/lldiv.c1
-rw-r--r--libc/stdlib/malloc-simple/alloc.c1
-rw-r--r--libc/stdlib/malloc-standard/malloc.c1
-rw-r--r--libc/stdlib/ptsname.c1
-rw-r--r--libc/stdlib/random.c1
-rw-r--r--libc/stdlib/random_r.c1
-rw-r--r--libc/stdlib/setenv.c1
-rw-r--r--libc/stdlib/stdlib.c1
-rw-r--r--libc/stdlib/strtod.c1
-rw-r--r--libc/string/__xpg_strerror_r.c3
-rw-r--r--libc/string/_string.h1
-rw-r--r--libc/string/generic/memmem.c1
-rw-r--r--libc/string/generic/mempcpy.c1
-rw-r--r--libc/string/generic/memrchr.c1
-rw-r--r--libc/string/generic/rawmemchr.c1
-rw-r--r--libc/string/generic/strchrnul.c1
-rw-r--r--libc/string/generic/strnlen.c1
-rw-r--r--libc/string/generic/strtok_r.c1
-rw-r--r--libc/string/i386/strnlen.c1
-rw-r--r--libc/string/psignal.c1
-rw-r--r--libc/string/strsignal.c1
-rw-r--r--libc/sysdeps/linux/common/_exit.c1
-rw-r--r--libc/sysdeps/linux/common/bits/errno.h6
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_stdio.h2
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c1
-rw-r--r--libc/sysdeps/linux/common/clock_gettime.c1
-rw-r--r--libc/sysdeps/linux/common/clock_settime.c1
-rw-r--r--libc/sysdeps/linux/common/getdnnm.c10
-rw-r--r--libc/sysdeps/linux/common/getpriority.c2
-rw-r--r--libc/sysdeps/linux/common/getsid.c2
-rw-r--r--libc/sysdeps/linux/common/llseek.c13
-rw-r--r--libc/sysdeps/linux/common/pread_write.c43
-rw-r--r--libc/sysdeps/linux/common/setegid.c5
-rw-r--r--libc/sysdeps/linux/common/seteuid.c5
-rw-r--r--libc/sysdeps/linux/common/setresgid.c2
-rw-r--r--libc/sysdeps/linux/common/setresuid.c2
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c2
-rw-r--r--libc/sysdeps/linux/common/sync.c1
-rw-r--r--libc/sysdeps/linux/common/syscalls.h1
-rw-r--r--libc/sysdeps/linux/common/ulimit.c15
-rw-r--r--libc/sysdeps/linux/common/xstatconv.c20
-rw-r--r--libc/sysdeps/linux/frv/crtreloc.c9
-rw-r--r--libc/sysdeps/linux/frv/dl-iterate-phdr.c3
-rw-r--r--libc/sysdeps/linux/frv/fstat.c23
-rw-r--r--libc/sysdeps/linux/frv/fstat64.c25
-rw-r--r--libc/sysdeps/linux/frv/lstat.c23
-rw-r--r--libc/sysdeps/linux/frv/lstat64.c25
-rw-r--r--libc/sysdeps/linux/frv/stat.c23
-rw-r--r--libc/sysdeps/linux/frv/stat64.c25
-rw-r--r--libc/sysdeps/linux/mips/pread_write.c39
-rw-r--r--libc/sysdeps/linux/powerpc/pread_write.c42
-rw-r--r--libc/sysdeps/linux/sh/pread_write.c32
-rw-r--r--libc/termios/tcgetattr.c1
-rw-r--r--libc/termios/tcgetsid.c1
-rw-r--r--libc/unistd/exec.c1
-rw-r--r--libc/unistd/getopt-susv3.c1
-rw-r--r--libc/unistd/getsubopt.c1
-rw-r--r--libc/unistd/ualarm.c1
-rw-r--r--libc/unistd/usershell.c1
124 files changed, 107 insertions, 419 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index f871d5efc..6434466c4 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -16,7 +16,6 @@
* Changed to use _int10tostr.
*/
-#define _GNU_SOURCE
#define __FORCE_GLIBC
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/gai_strerror.c b/libc/inet/gai_strerror.c
index 56fb57684..c1c7b767f 100644
--- a/libc/inet/gai_strerror.c
+++ b/libc/inet/gai_strerror.c
@@ -17,7 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#define __FORCE_GLIBC
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index 0aa86f1ab..1c593fc4f 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -49,7 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If these license terms cause you a real problem, contact the author. */
-#define _GNU_SOURCE
#define __FORCE_GLIBC
#include <features.h>
#include <assert.h>
diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c
index 0871d17c6..a54532ede 100644
--- a/libc/inet/getproto.c
+++ b/libc/inet/getproto.c
@@ -52,7 +52,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c
index 9a2df8c12..7f4939bbd 100644
--- a/libc/inet/getservice.c
+++ b/libc/inet/getservice.c
@@ -52,7 +52,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/libc/inet/if_index.c b/libc/inet/if_index.c
index 2a687bb89..fdb30f00a 100644
--- a/libc/inet/if_index.c
+++ b/libc/inet/if_index.c
@@ -22,7 +22,6 @@
#define __FORCE_GLIBC
#include <features.h>
-#define __USE_GNU
#include <string.h>
#include <alloca.h>
#include <errno.h>
diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
index d2d0cb8ce..b9f3cbd0e 100644
--- a/libc/inet/ifaddrs.c
+++ b/libc/inet/ifaddrs.c
@@ -19,7 +19,6 @@
#define __FORCE_GLIBC
#include <features.h>
-#define __USE_GNU
#include <alloca.h>
#include <assert.h>
#include <errno.h>
diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c
index df824f30d..1bd511d26 100644
--- a/libc/inet/rpc/rcmd.c
+++ b/libc/inet/rpc/rcmd.c
@@ -38,8 +38,6 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#define __UCLIBC_HIDE_DEPRECATED__
#define __FORCE_GLIBC
#include <features.h>
-
-#define __USE_GNU
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c
index d3ae65b6a..d41d7644c 100644
--- a/libc/inet/rpc/svc.c
+++ b/libc/inet/rpc/svc.c
@@ -37,7 +37,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
diff --git a/libc/inet/rpc/svc_auth_unix.c b/libc/inet/rpc/svc_auth_unix.c
index 220e92b70..3afcfc5d4 100644
--- a/libc/inet/rpc/svc_auth_unix.c
+++ b/libc/inet/rpc/svc_auth_unix.c
@@ -39,7 +39,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/svc_run.c b/libc/inet/rpc/svc_run.c
index 5ec4715bd..50e5fcd79 100644
--- a/libc/inet/rpc/svc_run.c
+++ b/libc/inet/rpc/svc_run.c
@@ -32,7 +32,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
diff --git a/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c
index 37637f485..a40f2b7b4 100644
--- a/libc/inet/rpc/svc_simple.c
+++ b/libc/inet/rpc/svc_simple.c
@@ -39,7 +39,6 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c
index 1ae0dedcd..135ad65fd 100644
--- a/libc/inet/rpc/svc_tcp.c
+++ b/libc/inet/rpc/svc_tcp.c
@@ -42,7 +42,6 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c
index 7494bdac6..4be2782fa 100644
--- a/libc/inet/rpc/svc_udp.c
+++ b/libc/inet/rpc/svc_udp.c
@@ -40,7 +40,6 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/xdr.c b/libc/inet/rpc/xdr.c
index 031fe9bcb..34787a898 100644
--- a/libc/inet/rpc/xdr.c
+++ b/libc/inet/rpc/xdr.c
@@ -42,7 +42,6 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c
index fc926026f..ddafc63b7 100644
--- a/libc/inet/rpc/xdr_array.c
+++ b/libc/inet/rpc/xdr_array.c
@@ -41,7 +41,6 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/xdr_float.c b/libc/inet/rpc/xdr_float.c
index e78cd2915..03632c5ca 100644
--- a/libc/inet/rpc/xdr_float.c
+++ b/libc/inet/rpc/xdr_float.c
@@ -42,7 +42,6 @@ static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c
index e4f5fc237..191672ec4 100644
--- a/libc/inet/rpc/xdr_mem.c
+++ b/libc/inet/rpc/xdr_mem.c
@@ -39,7 +39,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c
index 11c4ced7c..4534a83e7 100644
--- a/libc/inet/rpc/xdr_rec.c
+++ b/libc/inet/rpc/xdr_rec.c
@@ -45,7 +45,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c
index bf175404c..842d54426 100644
--- a/libc/inet/rpc/xdr_reference.c
+++ b/libc/inet/rpc/xdr_reference.c
@@ -41,7 +41,6 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c
index c6195d89f..70a014438 100644
--- a/libc/misc/ctype/ctype.c
+++ b/libc/misc/ctype/ctype.c
@@ -26,7 +26,6 @@
*
* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
-#define _GNU_SOURCE
#define __NO_CTYPE
#include <ctype.h>
diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c
index 6c1238ff6..f8da16334 100644
--- a/libc/misc/error/err.c
+++ b/libc/misc/error/err.c
@@ -5,7 +5,6 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c
index 5c728d731..6c081ae1e 100644
--- a/libc/misc/file/lockf64.c
+++ b/libc/misc/file/lockf64.c
@@ -31,8 +31,6 @@
#endif
#endif
-#define __USE_GNU
-
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c
index b70cfd46e..5ddfdc333 100644
--- a/libc/misc/fnmatch/fnmatch.c
+++ b/libc/misc/fnmatch/fnmatch.c
@@ -21,11 +21,6 @@
# include <config.h>
#endif
-/* Enable GNU extensions in fnmatch.h. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
#include <features.h>
#ifdef __UCLIBC__
# undef _LIBC
diff --git a/libc/misc/fnmatch/fnmatch_old.c b/libc/misc/fnmatch/fnmatch_old.c
index 47075e914..577e35676 100644
--- a/libc/misc/fnmatch/fnmatch_old.c
+++ b/libc/misc/fnmatch/fnmatch_old.c
@@ -19,11 +19,6 @@ Cambridge, MA 02139, USA. */
# include <config.h>
#endif
-/* Enable GNU extensions in fnmatch.h. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c
index b2c0c4ee4..092a3757a 100644
--- a/libc/misc/ftw/ftw.c
+++ b/libc/misc/ftw/ftw.c
@@ -22,7 +22,6 @@
# include <config.h>
#endif
-#define _GNU_SOURCE
#define _XOPEN_SOURCE 500
#include <features.h>
#ifdef __UCLIBC__
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c
index 8cb9a3ae5..009fe0b6a 100644
--- a/libc/misc/glob/glob.c
+++ b/libc/misc/glob/glob.c
@@ -15,7 +15,6 @@ License along with this library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#define _GNU_SOURCE
#include <features.h>
#include <stdlib.h>
#include <string.h>
diff --git a/libc/misc/glob/glob64.c b/libc/misc/glob/glob64.c
index 8c19e81bb..927ab6390 100644
--- a/libc/misc/glob/glob64.c
+++ b/libc/misc/glob/glob64.c
@@ -4,7 +4,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#ifdef __UCLIBC_HAS_LFS__
diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c
index 690e61398..69cc08bfd 100644
--- a/libc/misc/locale/locale.c
+++ b/libc/misc/locale/locale.c
@@ -46,8 +46,6 @@
* locale support had (8-bit codesets only).
*/
-#define _GNU_SOURCE
-
#define __CTYPE_HAS_8_BIT_LOCALES 1
#include <string.h>
diff --git a/libc/misc/pthread/no-tsd.c b/libc/misc/pthread/no-tsd.c
index 1fabaae68..ef79cb832 100644
--- a/libc/misc/pthread/no-tsd.c
+++ b/libc/misc/pthread/no-tsd.c
@@ -17,7 +17,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _GNU_SOURCE
#include <bits/libc-tsd.h>
/* This file provides uinitialized (common) definitions for the
diff --git a/libc/misc/pthread/weaks.c b/libc/misc/pthread/weaks.c
index 20a98a3fe..141e74696 100644
--- a/libc/misc/pthread/weaks.c
+++ b/libc/misc/pthread/weaks.c
@@ -17,7 +17,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _GNU_SOURCE
#include <libc-internal.h>
/* Weaks for internal library use only.
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index 56737b7bc..3e53a2ea6 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -23,7 +23,6 @@
#endif
/* uClibc addons */
-#define _GNU_SOURCE
#include <features.h>
#ifdef __UCLIBC__
diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c
index bb8aa762a..0ff756ff5 100644
--- a/libc/misc/regex/regex_old.c
+++ b/libc/misc/regex/regex_old.c
@@ -22,7 +22,6 @@
/* To exclude some unwanted junk.... */
#undef emacs
-#define _GNU_SOURCE
#include <features.h>
#ifdef __UCLIBC__
# undef _LIBC
@@ -49,9 +48,6 @@ libc_hidden_proto(abort)
#pragma alloca
#endif
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/libc/misc/search/hsearch.c b/libc/misc/search/hsearch.c
index 3370545fd..b1228e2ee 100644
--- a/libc/misc/search/hsearch.c
+++ b/libc/misc/search/hsearch.c
@@ -17,10 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <search.h>
libc_hidden_proto(hdestroy_r)
diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c
index e7ded795f..7933f2d6f 100644
--- a/libc/misc/search/hsearch_r.c
+++ b/libc/misc/search/hsearch_r.c
@@ -17,10 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#include <errno.h>
#include <malloc.h>
#include <string.h>
diff --git a/libc/misc/search/insremque.c b/libc/misc/search/insremque.c
index 29e547ff3..32edf7a4e 100644
--- a/libc/misc/search/insremque.c
+++ b/libc/misc/search/insremque.c
@@ -17,11 +17,7 @@
Boston, MA 02111-1307, USA. */
#include <features.h>
-#define __USE_GNU
#include <stddef.h>
-#ifndef _SVID_SOURCE
-#define _SVID_SOURCE 1
-#endif
#include <search.h>
#ifdef L_insque
diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c
index d66a5c422..01ecb288b 100644
--- a/libc/misc/search/tsearch.c
+++ b/libc/misc/search/tsearch.c
@@ -28,7 +28,6 @@ Cambridge, MA 02139, USA. */
*/
/*LINTLIBRARY*/
-#define _GNU_SOURCE
#include <search.h>
#include <stdlib.h>
diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c
index a3d0ef97c..a8c23992a 100644
--- a/libc/misc/statfs/fstatvfs.c
+++ b/libc/misc/statfs/fstatvfs.c
@@ -18,8 +18,6 @@
02111-1307 USA. */
#include <features.h>
-
-#define __USE_GNU
#include <errno.h>
#include <mntent.h>
#include <paths.h>
diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c
index fdc6d6f94..2e25fda2f 100644
--- a/libc/misc/statfs/fstatvfs64.c
+++ b/libc/misc/statfs/fstatvfs64.c
@@ -30,7 +30,6 @@
# define __USE_LARGEFILE64 1
#endif
-#define __USE_GNU
#include <errno.h>
#include <mntent.h>
#include <paths.h>
diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c
index 795126a7b..006b791ae 100644
--- a/libc/misc/statfs/statvfs.c
+++ b/libc/misc/statfs/statvfs.c
@@ -18,8 +18,6 @@
02111-1307 USA. */
#include <features.h>
-
-#define __USE_GNU
#include <errno.h>
#include <mntent.h>
#include <paths.h>
diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c
index ac92fbc7e..eec14983e 100644
--- a/libc/misc/statfs/statvfs64.c
+++ b/libc/misc/statfs/statvfs64.c
@@ -32,7 +32,6 @@
#endif
#endif
-#define __USE_GNU
#include <errno.h>
#include <mntent.h>
#include <paths.h>
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 698d1971d..10b8e6e58 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -59,7 +59,6 @@
*/
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index ea28e1a4f..b6dce44ea 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -129,7 +129,6 @@
* differs (intentionally) from glibc's behavior.
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c
index 4388744b2..13cbd6c84 100644
--- a/libc/misc/ttyent/getttyent.c
+++ b/libc/misc/ttyent/getttyent.c
@@ -27,7 +27,6 @@
* SUCH DAMAGE.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <ttyent.h>
#include <stdio.h>
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 7beef1595..099769c2f 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -98,7 +98,6 @@
* Manuel
*/
-#define _GNU_SOURCE
#define _ISOC99_SOURCE
#include <errno.h>
#include <stddef.h>
diff --git a/libc/misc/wchar/wstdio.c b/libc/misc/wchar/wstdio.c
index 00311a41d..84d98b64a 100644
--- a/libc/misc/wchar/wstdio.c
+++ b/libc/misc/wchar/wstdio.c
@@ -49,7 +49,6 @@
* Should auto_wr_transition init the mbstate object?
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <wchar.h>
#include <limits.h>
diff --git a/libc/misc/wctype/wctype.c b/libc/misc/wctype/wctype.c
index 8f56f4556..a7d111039 100644
--- a/libc/misc/wctype/wctype.c
+++ b/libc/misc/wctype/wctype.c
@@ -26,7 +26,6 @@
*
* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
-#define _GNU_SOURCE
#define __NO_CTYPE
#include <wctype.h>
diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c
index 3713ac2e5..1693d8b8a 100644
--- a/libc/misc/wordexp/wordexp.c
+++ b/libc/misc/wordexp/wordexp.c
@@ -19,7 +19,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c
index bf0a65015..2ade07150 100644
--- a/libc/pwd_grp/pwd_grp.c
+++ b/libc/pwd_grp/pwd_grp.c
@@ -18,7 +18,6 @@
*
*/
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/libc/pwd_grp/pwd_grp_internal.c b/libc/pwd_grp/pwd_grp_internal.c
index fd42b1ebd..acb9a183a 100644
--- a/libc/pwd_grp/pwd_grp_internal.c
+++ b/libc/pwd_grp/pwd_grp_internal.c
@@ -18,7 +18,6 @@
*
*/
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/libc/signal/sigandset.c b/libc/signal/sigandset.c
index 4e1abd969..a25225bad 100644
--- a/libc/signal/sigandset.c
+++ b/libc/signal/sigandset.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#include <errno.h>
-#define __USE_GNU
#include <signal.h>
#define __need_NULL
#include <stddef.h>
diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c
index d51ac1243..335af4a34 100644
--- a/libc/signal/sighold.c
+++ b/libc/signal/sighold.c
@@ -20,7 +20,6 @@
#define __need_NULL
#include <stddef.h>
-#define _GNU_SOURCE
#include <signal.h>
libc_hidden_proto(sigprocmask)
diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c
index f44784b93..c4d347f8d 100644
--- a/libc/signal/sigignore.c
+++ b/libc/signal/sigignore.c
@@ -18,7 +18,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <errno.h>
#define __need_NULL
#include <stddef.h>
diff --git a/libc/signal/sigisempty.c b/libc/signal/sigisempty.c
index 6d1de45a8..22baa0038 100644
--- a/libc/signal/sigisempty.c
+++ b/libc/signal/sigisempty.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#include <errno.h>
-#define __USE_GNU
#include <signal.h>
#define __need_NULL
#include <stddef.h>
diff --git a/libc/signal/sigorset.c b/libc/signal/sigorset.c
index ffabf3704..7d7bf863d 100644
--- a/libc/signal/sigorset.c
+++ b/libc/signal/sigorset.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#include <errno.h>
-#define __USE_GNU
#include <signal.h>
#define __need_NULL
#include <stddef.h>
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
index f7efa692e..2164c5076 100644
--- a/libc/signal/sigpause.c
+++ b/libc/signal/sigpause.c
@@ -18,6 +18,8 @@
02111-1307 USA. */
#define __UCLIBC_HIDE_DEPRECATED__
+/* psm: need the BSD version of sigpause here */
+#undef _GNU_SOURCE
#define _BSD_SOURCE
#include <errno.h>
#include <signal.h>
diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c
index a0f55d419..a1d5a8849 100644
--- a/libc/signal/sigrelse.c
+++ b/libc/signal/sigrelse.c
@@ -20,7 +20,6 @@
#define __need_NULL
#include <stddef.h>
-#define _GNU_SOURCE
#include <signal.h>
libc_hidden_proto(sigprocmask)
diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c
index d2a395bcf..5d8c0d0bd 100644
--- a/libc/signal/sigset.c
+++ b/libc/signal/sigset.c
@@ -19,7 +19,6 @@
#include <errno.h>
#define __need_NULL
#include <stddef.h>
-#define __USE_XOPEN_EXTENDED
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h
index 7c8176ecc..1c31647cc 100644
--- a/libc/stdio/_stdio.h
+++ b/libc/stdio/_stdio.h
@@ -5,8 +5,6 @@
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
-#define _GNU_SOURCE
-
#include <features.h>
#include <assert.h>
#include <errno.h>
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index ec71f8f1a..f81ef8688 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -128,7 +128,6 @@
/**************************************************************************/
#define _ISOC99_SOURCE /* for ULLONG primarily... */
-#define _GNU_SOURCE /* for strnlen */
#include "_stdio.h"
/* #include <stdio.h> */
#include <stdarg.h>
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index b6fc1a699..df78e7ad3 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -44,7 +44,6 @@
*/
#define _ISOC99_SOURCE /* for LLONG_MAX primarily... */
-#define _GNU_SOURCE
#include <features.h>
#include "_stdio.h"
#include <stdlib.h>
diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c
index 7794c6e39..a32960f2e 100644
--- a/libc/stdio/vfprintf.c
+++ b/libc/stdio/vfprintf.c
@@ -89,7 +89,6 @@
*/
#define _ISOC99_SOURCE /* for ULLONG primarily... */
-#define _GNU_SOURCE
#include <features.h>
#include "_stdio.h"
#include <stdlib.h>
diff --git a/libc/stdlib/abort.c b/libc/stdlib/abort.c
index c9ad78237..cce9c3be0 100644
--- a/libc/stdlib/abort.c
+++ b/libc/stdlib/abort.c
@@ -18,7 +18,6 @@ Cambridge, MA 02139, USA. */
/* Hacked up for uClibc by Erik Andersen */
-#define _GNU_SOURCE
#include <features.h>
#include <signal.h>
#include <stdio.h>
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 4289c72b5..d6bac6eee 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -37,7 +37,6 @@
*
*/
-#define _GNU_SOURCE
#include <features.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c
index 7005bee71..cab96bb06 100644
--- a/libc/stdlib/getpt.c
+++ b/libc/stdlib/getpt.c
@@ -17,7 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
diff --git a/libc/stdlib/lldiv.c b/libc/stdlib/lldiv.c
index 09cadc691..ff670174c 100644
--- a/libc/stdlib/lldiv.c
+++ b/libc/stdlib/lldiv.c
@@ -17,7 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <features.h>
#include <stdlib.h>
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index 595142526..dc4d5494f 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -6,7 +6,6 @@
* Parts of the memalign code were stolen from malloc-930716.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c
index 7025e8335..b4b1216ed 100644
--- a/libc/stdlib/malloc-standard/malloc.c
+++ b/libc/stdlib/malloc-standard/malloc.c
@@ -14,7 +14,6 @@
Hacked up for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#define _GNU_SOURCE
#include "malloc.h"
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c
index 5184c8f82..b41f6a118 100644
--- a/libc/stdlib/ptsname.c
+++ b/libc/stdlib/ptsname.c
@@ -18,7 +18,6 @@
02111-1307 USA. */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <paths.h>
diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index 38c3ea4d2..9f1977ee3 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -22,7 +22,6 @@
* Rewritten to use reentrant functions by Ulrich Drepper, 1995.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <limits.h>
#include <stddef.h>
diff --git a/libc/stdlib/random_r.c b/libc/stdlib/random_r.c
index faf5cf42e..e95653545 100644
--- a/libc/stdlib/random_r.c
+++ b/libc/stdlib/random_r.c
@@ -22,7 +22,6 @@
* Rewritten to be reentrant by Ulrich Drepper, 1995
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <limits.h>
diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c
index 3b02cec43..bf154035e 100644
--- a/libc/stdlib/setenv.c
+++ b/libc/stdlib/setenv.c
@@ -19,7 +19,6 @@
modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <stdlib.h>
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index ac6b49cb7..b8b8e4eb5 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -33,7 +33,6 @@
*/
#define _ISOC99_SOURCE /* for ULLONG primarily... */
-#define _GNU_SOURCE
#include <limits.h>
#include <stdint.h>
#include <inttypes.h>
diff --git a/libc/stdlib/strtod.c b/libc/stdlib/strtod.c
index b0dfad62a..c4447d9ea 100644
--- a/libc/stdlib/strtod.c
+++ b/libc/stdlib/strtod.c
@@ -96,7 +96,6 @@
/**********************************************************************/
#define _ISOC99_SOURCE 1
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
diff --git a/libc/string/__xpg_strerror_r.c b/libc/string/__xpg_strerror_r.c
index 6536995e6..d146d35ac 100644
--- a/libc/string/__xpg_strerror_r.c
+++ b/libc/string/__xpg_strerror_r.c
@@ -1,11 +1,10 @@
/*
* Copyright (C) 2002 Manuel Novoa III
- * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <string.h>
diff --git a/libc/string/_string.h b/libc/string/_string.h
index 4ecde30a7..67f17b1ff 100644
--- a/libc/string/_string.h
+++ b/libc/string/_string.h
@@ -8,7 +8,6 @@
#ifndef __STRING_H
#define __STRING_H
-#define _GNU_SOURCE
#include <features.h>
#include <string.h>
#include <limits.h>
diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c
index 386cb5e02..c2e8547be 100644
--- a/libc/string/generic/memmem.c
+++ b/libc/string/generic/memmem.c
@@ -16,7 +16,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <string.h>
#include <stddef.h>
diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c
index ac91541a5..7c251914d 100644
--- a/libc/string/generic/mempcpy.c
+++ b/libc/string/generic/mempcpy.c
@@ -5,7 +5,6 @@
/* Ditch the glibc version and just wrap memcpy. */
-#define _GNU_SOURCE
#include <string.h>
libc_hidden_proto(mempcpy)
diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c
index 7cb5b2246..f63efa46b 100644
--- a/libc/string/generic/memrchr.c
+++ b/libc/string/generic/memrchr.c
@@ -22,7 +22,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <limits.h>
diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c
index 3c1cc01de..85fc09836 100644
--- a/libc/string/generic/rawmemchr.c
+++ b/libc/string/generic/rawmemchr.c
@@ -21,7 +21,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <limits.h>
diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c
index 3616341a7..e699a6dfa 100644
--- a/libc/string/generic/strchrnul.c
+++ b/libc/string/generic/strchrnul.c
@@ -21,7 +21,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c
index c5da906ef..31b5ba8e0 100644
--- a/libc/string/generic/strnlen.c
+++ b/libc/string/generic/strnlen.c
@@ -21,7 +21,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c
index 566538fd5..0ab18b35e 100644
--- a/libc/string/generic/strtok_r.c
+++ b/libc/string/generic/strtok_r.c
@@ -17,7 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <string.h>
libc_hidden_proto(strtok_r)
diff --git a/libc/string/i386/strnlen.c b/libc/string/i386/strnlen.c
index 6b565dbd8..af512f10a 100644
--- a/libc/string/i386/strnlen.c
+++ b/libc/string/i386/strnlen.c
@@ -30,7 +30,6 @@
* -Erik
*/
-#define _GNU_SOURCE
#include <string.h>
libc_hidden_proto(strnlen)
diff --git a/libc/string/psignal.c b/libc/string/psignal.c
index 64b52c98b..c47277701 100644
--- a/libc/string/psignal.c
+++ b/libc/string/psignal.c
@@ -5,7 +5,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
#include <string.h>
diff --git a/libc/string/strsignal.c b/libc/string/strsignal.c
index bb5ada716..f8b6a9e9f 100644
--- a/libc/string/strsignal.c
+++ b/libc/string/strsignal.c
@@ -13,7 +13,6 @@
/* TODO: make a threadsafe version? */
-#define _GNU_SOURCE
#include <features.h>
#include <string.h>
#include <bits/uClibc_uintmaxtostr.h>
diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c
index d86aca009..02c951152 100644
--- a/libc/sysdeps/linux/common/_exit.c
+++ b/libc/sysdeps/linux/common/_exit.c
@@ -7,7 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h
index 679600e5e..45a0ec0d1 100644
--- a/libc/sysdeps/linux/common/bits/errno.h
+++ b/libc/sysdeps/linux/common/bits/errno.h
@@ -37,15 +37,13 @@ extern int errno;
/* Function to get address of global `errno' variable. */
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-# if defined _LIBC
-#ifdef IS_IN_libc
+# if defined _LIBC && ( defined IS_IN_libc || defined NOT_IN_libc )
libc_hidden_proto(__errno_location)
-#endif
/* We wouldn't need a special macro anymore but it is history. */
# define __set_errno(val) ((errno) = (val))
# endif /* _LIBC */
-# if defined __UCLIBC_HAS_THREADS__
+# ifdef __UCLIBC_HAS_THREADS__
/* When using threads, errno is a per-thread value. */
# define errno (*__errno_location ())
# endif
diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
index 3c12a74dc..5b6b35496 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
@@ -237,7 +237,7 @@ typedef struct {
__io_close_fn *close;
} _IO_cookie_io_functions_t;
-#if defined(_LIBC) || defined(_GNU_SOURCE)
+#ifdef __USE_GNU
typedef __io_read_fn cookie_read_function_t;
typedef __io_write_fn cookie_write_function_t;
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c
index 41d5079b9..8ee782845 100644
--- a/libc/sysdeps/linux/common/clock_getres.c
+++ b/libc/sysdeps/linux/common/clock_getres.c
@@ -7,7 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c
index 703399406..c6b4111fe 100644
--- a/libc/sysdeps/linux/common/clock_gettime.c
+++ b/libc/sysdeps/linux/common/clock_gettime.c
@@ -8,7 +8,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c
index 93e1b72a7..6ad7872ae 100644
--- a/libc/sysdeps/linux/common/clock_settime.c
+++ b/libc/sysdeps/linux/common/clock_settime.c
@@ -7,7 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c
index ab33dc01a..d4caec6ad 100644
--- a/libc/sysdeps/linux/common/getdnnm.c
+++ b/libc/sysdeps/linux/common/getdnnm.c
@@ -4,11 +4,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <features.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#define __USE_GNU
#include <sys/utsname.h>
libc_hidden_proto(getdomainname)
@@ -29,11 +29,19 @@ getdomainname(char *name, size_t len)
if (uname(&uts) == -1) return -1;
+#ifdef __USE_GNU
if (strlen(uts.domainname)+1 > len) {
+#else
+ if (strlen(uts.__domainname)+1 > len) {
+#endif
__set_errno(EINVAL);
return -1;
}
+#ifdef __USE_GNU
strcpy(name, uts.domainname);
+#else
+ strcpy(name, uts.__domainname);
+#endif
return 0;
}
libc_hidden_def(getdomainname)
diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c
index 96156841b..41cc3eb49 100644
--- a/libc/sysdeps/linux/common/getpriority.c
+++ b/libc/sysdeps/linux/common/getpriority.c
@@ -19,7 +19,7 @@ static inline _syscall2(int, __syscall_getpriority,
/* The return value of __syscall_getpriority is biased by this value
* to avoid returning negative values. */
#define PZERO 20
-int getpriority(enum __priority_which which, id_t who)
+int getpriority(__priority_which_t which, id_t who)
{
int res;
diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c
index 1a574441c..aaac0ceb9 100644
--- a/libc/sysdeps/linux/common/getsid.c
+++ b/libc/sysdeps/linux/common/getsid.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+#ifdef __USE_XOPEN_EXTENDED
libc_hidden_proto(getsid)
#define __NR___syscall_getsid __NR_getsid
@@ -20,3 +21,4 @@ pid_t getsid(pid_t pid)
return (__syscall_getsid(pid));
}
libc_hidden_def(getsid)
+#endif
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index 33cbe46c2..7b39a3064 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -7,19 +7,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-#include <errno.h>
+#include "syscalls.h"
#include <unistd.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
index 327a9c785..45a94cfb8 100644
--- a/libc/sysdeps/linux/common/pread_write.c
+++ b/libc/sysdeps/linux/common/pread_write.c
@@ -13,26 +13,13 @@
* from GNU libc 2.2.5, but reworked considerably...
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "syscalls.h"
#include <unistd.h>
#include <stdint.h>
#ifdef __NR_pread
-#define __NR___syscall_pread __NR_pread
+# define __NR___syscall_pread __NR_pread
static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
@@ -42,7 +29,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -50,14 +37,13 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pread */
-
#ifdef __NR_pwrite
-#define __NR___syscall_pwrite __NR_pwrite
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
@@ -67,7 +53,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -75,11 +61,9 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pwrite */
-
-
#if ! defined __NR_pread || ! defined __NR_pwrite
libc_hidden_proto(read)
libc_hidden_proto(write)
@@ -123,7 +107,7 @@ static ssize_t __fake_pread_write(int fd, void *buf,
return(result);
}
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
static ssize_t __fake_pread_write64(int fd, void *buf,
size_t count, off64_t offset, int do_pwrite)
{
@@ -158,7 +142,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
__set_errno (save_errno);
return result;
}
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
#ifndef __NR_pread
@@ -168,16 +152,15 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, buf, count, offset, 0));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pread */
-
#ifndef __NR_pwrite
ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
{
@@ -187,11 +170,11 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pwrite */
diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c
index 759c9b0f3..92ef3a05d 100644
--- a/libc/sysdeps/linux/common/setegid.c
+++ b/libc/sysdeps/linux/common/setegid.c
@@ -4,7 +4,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -12,7 +11,7 @@
#include <sys/types.h>
#include <sys/syscall.h>
-#ifdef __NR_setresgid
+#if defined __NR_setresgid && defined __USE_GNU
libc_hidden_proto(setresgid)
#endif
libc_hidden_proto(setregid)
@@ -27,7 +26,7 @@ int setegid(gid_t gid)
return -1;
}
-#ifdef __NR_setresgid
+#if defined __NR_setresgid && defined __USE_GNU
result = setresgid(-1, gid, -1);
if (result == -1 && errno == ENOSYS)
/* Will also set the saved group ID if egid != gid,
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
index dc4b82c4c..6d8c9ae3e 100644
--- a/libc/sysdeps/linux/common/seteuid.c
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -4,7 +4,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -14,7 +13,9 @@
libc_hidden_proto(seteuid)
+#if defined __NR_setresuid && defined __USE_GNU
libc_hidden_proto(setresuid)
+#endif
libc_hidden_proto(setreuid)
int seteuid(uid_t uid)
@@ -27,7 +28,7 @@ int seteuid(uid_t uid)
return -1;
}
-#ifdef __NR_setresuid
+#if defined __NR_setresuid && defined __USE_GNU
result = setresuid(-1, uid, -1);
if (result == -1 && errno == ENOSYS)
/* Will also set the saved user ID if euid != uid,
diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c
index aa331e3bb..40e9e8a11 100644
--- a/libc/sysdeps/linux/common/setresgid.c
+++ b/libc/sysdeps/linux/common/setresgid.c
@@ -10,7 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
-#ifdef __NR_setresgid
+#if defined __NR_setresgid && defined __USE_GNU
libc_hidden_proto(setresgid)
#define __NR___syscall_setresgid __NR_setresgid
diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c
index 7e23774ac..dd1915706 100644
--- a/libc/sysdeps/linux/common/setresuid.c
+++ b/libc/sysdeps/linux/common/setresuid.c
@@ -10,7 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
-#ifdef __NR_setresuid
+#if defined __NR_setresuid && defined __USE_GNU
libc_hidden_proto(setresuid)
#define __NR___syscall_setresuid __NR_setresuid
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index 2e62a5e1d..7a53e043f 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -36,7 +36,7 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
#undef RMIN
#else /* We don't need to wrap setrlimit */
-_syscall2(int, setrlimit, unsigned int, resource,
+_syscall2(int, setrlimit, __rlimit_resource_t, resource,
const struct rlimit *, rlim);
#endif
libc_hidden_def(setrlimit)
diff --git a/libc/sysdeps/linux/common/sync.c b/libc/sysdeps/linux/common/sync.c
index 7bfea0d70..48fac63ea 100644
--- a/libc/sysdeps/linux/common/sync.c
+++ b/libc/sysdeps/linux/common/sync.c
@@ -7,7 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <sys/types.h>
diff --git a/libc/sysdeps/linux/common/syscalls.h b/libc/sysdeps/linux/common/syscalls.h
index d3f7fea51..af015246a 100644
--- a/libc/sysdeps/linux/common/syscalls.h
+++ b/libc/sysdeps/linux/common/syscalls.h
@@ -7,7 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#include <features.h>
#include <errno.h>
diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c
index 523beae47..75d7a8237 100644
--- a/libc/sysdeps/linux/common/ulimit.c
+++ b/libc/sysdeps/linux/common/ulimit.c
@@ -5,21 +5,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include "syscalls.h"
#ifdef __NR_ulimit
-#include <sys/types.h>
-#include <sys/syscall.h>
-
_syscall2(long, ulimit, int, cmd, int, arg);
#else
@@ -27,7 +16,6 @@ _syscall2(long, ulimit, int, cmd, int, arg);
#include <stdarg.h>
#include <unistd.h>
#include <ulimit.h>
-#include <errno.h>
#include <sys/resource.h>
libc_hidden_proto(sysconf)
@@ -68,4 +56,3 @@ long int ulimit(int cmd, ...)
return result;
}
#endif
-
diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
index 407f32496..58e05c437 100644
--- a/libc/sysdeps/linux/common/xstatconv.c
+++ b/libc/sysdeps/linux/common/xstatconv.c
@@ -20,15 +20,7 @@
Modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include "syscalls.h"
#include <sys/stat.h>
#include "xstatconv.h"
@@ -55,16 +47,16 @@ void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
#endif
}
-#if defined(__UCLIBC_HAS_LFS__)
+#ifdef __UCLIBC_HAS_LFS__
void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
{
/* Convert to current kernel version of `struct stat64'. */
buf->st_dev = kbuf->st_dev;
buf->st_ino = kbuf->st_ino;
-#ifdef _HAVE_STAT64___ST_INO
+# ifdef _HAVE_STAT64___ST_INO
buf->__st_ino = kbuf->__st_ino;
-#endif
+# endif
buf->st_mode = kbuf->st_mode;
buf->st_nlink = kbuf->st_nlink;
buf->st_uid = kbuf->st_uid;
@@ -76,11 +68,11 @@ void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *
buf->st_atime = kbuf->st_atime;
buf->st_mtime = kbuf->st_mtime;
buf->st_ctime = kbuf->st_ctime;
-#ifdef STAT_HAVE_NSEC
+# ifdef STAT_HAVE_NSEC
buf->st_atimensec = kbuf->st_atime_nsec;
buf->st_mtimensec = kbuf->st_mtime_nsec;
buf->st_ctimensec = kbuf->st_ctime_nsec;
-#endif
+# endif
}
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/frv/crtreloc.c b/libc/sysdeps/linux/frv/crtreloc.c
index de67bc312..1a86728a3 100644
--- a/libc/sysdeps/linux/frv/crtreloc.c
+++ b/libc/sysdeps/linux/frv/crtreloc.c
@@ -26,15 +26,12 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#define _GNU_SOURCE
#include <sys/types.h>
#include <link.h>
/* This file is to be compiled into crt object files, to enable
executables to easily self-relocate. */
-#define hidden __attribute__((__visibility__("hidden")))
-
/* Compute the runtime address of pointer in the range [p,e), and then
map the pointer pointed by it. */
inline static void ***
@@ -65,7 +62,7 @@ reloc_range_indirect (void ***p, void ***e,
/* Call __reloc_range_indirect for the given range except for the last
entry, whose contents are only relocated. It's expected to hold
the GOT value. */
-void* hidden
+void* attribute_hidden
__self_reloc (const struct elf32_fdpic_loadmap *map,
void ***p, void ***e)
{
@@ -96,7 +93,7 @@ reloc_range (void **p, void **e,
/* Remap p, adjust e by the same offset, then map the pointers in the
range determined by them. */
-void hidden
+void attribute_hidden
__reloc_range (const struct elf32_fdpic_loadmap *map,
void **p, void **e)
{
@@ -110,7 +107,7 @@ __reloc_range (const struct elf32_fdpic_loadmap *map,
/* Remap p, adjust e by the same offset, then map pointers referenced
by the (unadjusted) pointers in the range. Return the relocated
value of the last pointer in the range. */
-void* hidden
+void* attribute_hidden
__reloc_range_indirect (const struct elf32_fdpic_loadmap *map,
void ***p, void ***e)
{
diff --git a/libc/sysdeps/linux/frv/dl-iterate-phdr.c b/libc/sysdeps/linux/frv/dl-iterate-phdr.c
index ebb3b9c4a..144e4c145 100644
--- a/libc/sysdeps/linux/frv/dl-iterate-phdr.c
+++ b/libc/sysdeps/linux/frv/dl-iterate-phdr.c
@@ -16,10 +16,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#define _GNU_SOURCE
#include <link.h>
-extern int __attribute__((__weak__))
+extern int weak_function
__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
size_t size, void *data),
void *data);
diff --git a/libc/sysdeps/linux/frv/fstat.c b/libc/sysdeps/linux/frv/fstat.c
index c1b524b26..a1d343cb8 100644
--- a/libc/sysdeps/linux/frv/fstat.c
+++ b/libc/sysdeps/linux/frv/fstat.c
@@ -9,27 +9,10 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#define __NR___syscall_fstat __NR_fstat
-static inline _syscall2(int, __syscall_fstat, int, fd, struct stat *, buf);
libc_hidden_proto(fstat)
-strong_alias(__syscall_fstat,fstat)
+_syscall2(int, fstat, int, fd, struct stat *, buf);
libc_hidden_def(fstat)
diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c
index 98c02e72d..e07a28471 100644
--- a/libc/sysdeps/linux/frv/fstat64.c
+++ b/libc/sysdeps/linux/frv/fstat64.c
@@ -9,29 +9,12 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#if defined __UCLIBC_HAS_LFS__
-#define __NR___syscall_fstat64 __NR_fstat64
-static inline _syscall2(int, __syscall_fstat64, int, fd, struct stat64 *, buf);
+#ifdef __UCLIBC_HAS_LFS__
libc_hidden_proto(fstat64)
-strong_alias(__syscall_fstat64,fstat64)
+_syscall2(int, fstat64, int, fd, struct stat64 *, buf);
libc_hidden_def(fstat64)
#endif
diff --git a/libc/sysdeps/linux/frv/lstat.c b/libc/sysdeps/linux/frv/lstat.c
index 9fe65a71c..b178af76b 100644
--- a/libc/sysdeps/linux/frv/lstat.c
+++ b/libc/sysdeps/linux/frv/lstat.c
@@ -9,27 +9,10 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#define __NR___syscall_lstat __NR_lstat
-static inline _syscall2(int, __syscall_lstat, const char *, file_name, struct stat *, buf);
libc_hidden_proto(lstat)
-strong_alias(__syscall_lstat,lstat)
+_syscall2(int, lstat, const char *, file_name, struct stat *, buf);
libc_hidden_def(lstat)
diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c
index 50e62969f..9a6236b14 100644
--- a/libc/sysdeps/linux/frv/lstat64.c
+++ b/libc/sysdeps/linux/frv/lstat64.c
@@ -9,29 +9,12 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#if defined __UCLIBC_HAS_LFS__
-#define __NR___syscall_lstat64 __NR_lstat64
-static inline _syscall2(int, __syscall_lstat64, const char *, file_name, struct stat64 *, buf);
+#ifdef __UCLIBC_HAS_LFS__
libc_hidden_proto(lstat64)
-strong_alias(__syscall_lstat64,lstat64)
+_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf);
libc_hidden_def(lstat64)
#endif
diff --git a/libc/sysdeps/linux/frv/stat.c b/libc/sysdeps/linux/frv/stat.c
index cde54aecc..56cb668db 100644
--- a/libc/sysdeps/linux/frv/stat.c
+++ b/libc/sysdeps/linux/frv/stat.c
@@ -9,27 +9,10 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#define __NR___syscall_stat __NR_stat
-static inline _syscall2(int, __syscall_stat, const char *, file_name, struct stat *, buf);
libc_hidden_proto(stat)
-strong_alias(__syscall_stat,stat)
+_syscall2(int, stat, const char *, file_name, struct stat *, buf);
libc_hidden_def(stat)
diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c
index 97abf240a..641644ffd 100644
--- a/libc/sysdeps/linux/frv/stat64.c
+++ b/libc/sysdeps/linux/frv/stat64.c
@@ -9,29 +9,12 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <endian.h>
-
+#include "../common/syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
-#if defined __UCLIBC_HAS_LFS__
-#define __NR___syscall_stat64 __NR_stat64
-static inline _syscall2(int, __syscall_stat64, const char *, file_name, struct stat64 *, buf);
+#ifdef __UCLIBC_HAS_LFS__
libc_hidden_proto(stat64)
-strong_alias(__syscall_stat64,stat64)
+_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf);
libc_hidden_def(stat64)
#endif
diff --git a/libc/sysdeps/linux/mips/pread_write.c b/libc/sysdeps/linux/mips/pread_write.c
index 3ae4a98b7..0fa6c024c 100644
--- a/libc/sysdeps/linux/mips/pread_write.c
+++ b/libc/sysdeps/linux/mips/pread_write.c
@@ -12,20 +12,7 @@
* from GNU libc 2.2.5, but reworked considerably...
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "../common/syscalls.h"
#include <unistd.h>
#include <stdint.h>
@@ -38,10 +25,10 @@
#ifdef __NR_pread
-#ifdef __mips64
+# ifdef __mips64
_syscall4(ssize_t, pread, int, fd, void *, buf, size_t, count, off_t, offset);
-#else /* !__mips64 */
-#define __NR___syscall_pread __NR_pread
+# else /* !__mips64 */
+# define __NR___syscall_pread __NR_pread
static inline _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo);
@@ -51,7 +38,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -59,8 +46,8 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
-#endif /* !__mips64 */
+# endif /* __UCLIBC_HAS_LFS__ */
+# endif /* !__mips64 */
#endif /* __NR_pread */
@@ -75,10 +62,10 @@ strong_alias(__libc_pread64,pread64)
#ifdef __NR_pwrite
-#ifdef __mips64
+# ifdef __mips64
_syscall4(ssize_t, pwrite, int, fd, const void *, buf, size_t, count, off_t, offset);
-#else /* !__mips64 */
-#define __NR___syscall_pwrite __NR_pwrite
+# else /* !__mips64 */
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo);
@@ -88,7 +75,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -96,6 +83,6 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
-#endif /* !__mips64 */
+# endif /* __UCLIBC_HAS_LFS__ */
+# endif /* !__mips64 */
#endif /* __NR_pwrite */
diff --git a/libc/sysdeps/linux/powerpc/pread_write.c b/libc/sysdeps/linux/powerpc/pread_write.c
index b8d0caef4..8662c06fb 100644
--- a/libc/sysdeps/linux/powerpc/pread_write.c
+++ b/libc/sysdeps/linux/powerpc/pread_write.c
@@ -12,27 +12,15 @@
* from GNU libc 2.2.5, but reworked considerably...
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "../common/syscalls.h"
#include <unistd.h>
-#if ! defined __UCLIBC_HAS_LFS__
-#define off64_t off_t
+#ifndef __UCLIBC_HAS_LFS__
+# define off64_t off_t
#endif
#ifdef __NR_pread
-#define __NR___syscall_pread __NR_pread
+# define __NR___syscall_pread __NR_pread
static inline _syscall4(ssize_t, __syscall_pread, int, fd,
void *, buf, size_t, count, off64_t, offset);
@@ -42,18 +30,18 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
return(__syscall_pread(fd, buf, count, offset));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pread */
#ifdef __NR_pwrite
-#define __NR___syscall_pwrite __NR_pwrite
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall4(ssize_t, __syscall_pwrite, int, fd,
const void *, buf, size_t, count, off64_t, offset);
@@ -63,13 +51,13 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
return(__syscall_pwrite(fd, buf, count, offset));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pwrite */
@@ -117,7 +105,7 @@ static ssize_t __fake_pread_write(int fd, void *buf,
return(result);
}
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
static ssize_t __fake_pread_write64(int fd, void *buf,
size_t count, off64_t offset, int do_pwrite)
{
@@ -152,7 +140,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
__set_errno (save_errno);
return result;
}
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
#ifndef __NR_pread
@@ -162,13 +150,13 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, buf, count, offset, 0));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pread */
@@ -179,11 +167,11 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pwrite */
diff --git a/libc/sysdeps/linux/sh/pread_write.c b/libc/sysdeps/linux/sh/pread_write.c
index 4b6d57b08..437bbdaa6 100644
--- a/libc/sysdeps/linux/sh/pread_write.c
+++ b/libc/sysdeps/linux/sh/pread_write.c
@@ -12,20 +12,7 @@
* from GNU libc 2.2.5, but reworked considerably...
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "../common/syscalls.h"
#include <unistd.h>
#include <stdint.h>
@@ -37,9 +24,7 @@
#endif
#ifdef __NR_pread
-
-
-#define __NR___syscall_pread __NR_pread
+# define __NR___syscall_pread __NR_pread
static inline _syscall6(ssize_t, __syscall_pread, int, fd, void *, buf,
size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo);
@@ -49,7 +34,7 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -57,8 +42,7 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
return(__syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pread64,pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
-
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pread */
/**********************************************************************/
@@ -71,8 +55,7 @@ strong_alias(__libc_pread64,pread64)
#endif
#ifdef __NR_pwrite
-
-#define __NR___syscall_pwrite __NR_pwrite
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall6(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, int, dummy, off_t, offset_hi, off_t, offset_lo);
@@ -82,7 +65,7 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
}
strong_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
@@ -90,6 +73,5 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
return(__syscall_pwrite(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)));
}
strong_alias(__libc_pwrite64,pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
-
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pwrite */
diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c
index bc160248d..726c83a44 100644
--- a/libc/termios/tcgetattr.c
+++ b/libc/termios/tcgetattr.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#include <features.h>
-#define __USE_GNU
#include <string.h>
#include <termios.h>
#include <unistd.h>
diff --git a/libc/termios/tcgetsid.c b/libc/termios/tcgetsid.c
index c37023e8b..cae2feac0 100644
--- a/libc/termios/tcgetsid.c
+++ b/libc/termios/tcgetsid.c
@@ -20,7 +20,6 @@
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
-#define __USE_XOPEN_EXTENDED
#include <unistd.h>
libc_hidden_proto(ioctl)
diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
index 04549dd40..1e574825a 100644
--- a/libc/unistd/exec.c
+++ b/libc/unistd/exec.c
@@ -30,7 +30,6 @@
* to free the storage allocated for the copy. Better ideas anyone?
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c
index a73cdbc0a..b07016f58 100644
--- a/libc/unistd/getopt-susv3.c
+++ b/libc/unistd/getopt-susv3.c
@@ -30,7 +30,6 @@
* Initial version of a SUSv3 compliant getopt().
*/
-#define _GNU_SOURCE
#include <unistd.h>
#include <string.h>
#include <stdio.h>
diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c
index c6c078f6f..dca8144dc 100644
--- a/libc/unistd/getsubopt.c
+++ b/libc/unistd/getsubopt.c
@@ -18,7 +18,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
diff --git a/libc/unistd/ualarm.c b/libc/unistd/ualarm.c
index ef023e8f3..07bea2a50 100644
--- a/libc/unistd/ualarm.c
+++ b/libc/unistd/ualarm.c
@@ -4,7 +4,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c
index ab84fe9f5..e053d94b7 100644
--- a/libc/unistd/usershell.c
+++ b/libc/unistd/usershell.c
@@ -30,7 +30,6 @@
* November 2002, Erik Andersen <andersen@codepoet.org>
*/
-#define _GNU_SOURCE
#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>