summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-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
31 files changed, 104 insertions, 300 deletions
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 */