aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Peter S. Mazinger <ps.m@gmx.net>2011-04-16 02:55:23 +0200
committerGravatar Peter S. Mazinger <ps.m@gmx.net>2011-04-16 02:56:01 +0200
commit099ecfb6536497eed33a30307b0ba52daab3ccef (patch)
treecd2d8d916f0c48bd3a19bb3092dded83778f56f9
parentc5732ee5c2a87838c612422caa185e20ab34ea92 (diff)
parentc344a3557e9de9cc0585622515b6eecf924177c6 (diff)
downloaduClibc-ldso-future.tar.gz
uClibc-ldso-future.tar.bz2
Merge branch 'future' of ssh://git.uclibc.org/git/uClibc into ldso-futureldso-future
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
-rw-r--r--include/errno.h2
-rw-r--r--include/fcntl.h1
-rw-r--r--include/signal.h10
-rw-r--r--include/sys/poll.h1
-rw-r--r--libc/inet/addr.c14
-rw-r--r--libc/inet/resolv.c10
-rw-r--r--libc/signal/allocrtsig.c1
-rw-r--r--libc/signal/killpg.c1
-rw-r--r--libc/signal/raise.c2
-rw-r--r--libc/signal/sigaction.c8
-rw-r--r--libc/signal/sigaddset.c5
-rw-r--r--libc/signal/sigblock.c1
-rw-r--r--libc/signal/sigdelset.c5
-rw-r--r--libc/signal/sigempty.c9
-rw-r--r--libc/signal/sigfillset.c9
-rw-r--r--libc/signal/siggetmask.c1
-rw-r--r--libc/signal/sighold.c1
-rw-r--r--libc/signal/sigignore.c4
-rw-r--r--libc/signal/sigintr.c8
-rw-r--r--libc/signal/sigismem.c5
-rw-r--r--libc/signal/sigjmp.c2
-rw-r--r--libc/signal/signal.c2
-rw-r--r--libc/signal/sigpause.c13
-rw-r--r--libc/signal/sigrelse.c1
-rw-r--r--libc/signal/sigset.c3
-rw-r--r--libc/signal/sigsetmask.c1
-rw-r--r--libc/signal/sigsetops.h33
-rw-r--r--libc/signal/sigwait.c8
-rw-r--r--libc/signal/sysv_signal.c2
-rw-r--r--libc/stdio/_stdio.c5
-rw-r--r--libc/stdio/fseeko.c2
-rw-r--r--libc/stdio/ftello.c2
-rw-r--r--libc/sysdeps/linux/Makefile.commonarch2
-rw-r--r--libc/sysdeps/linux/arm/mmap64.S4
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl64.c10
-rw-r--r--libc/sysdeps/linux/common/alarm.c4
-rw-r--r--libc/sysdeps/linux/common/arch_prctl.c2
-rw-r--r--libc/sysdeps/linux/common/bits/getopt.h38
-rw-r--r--libc/sysdeps/linux/common/capget.c3
-rw-r--r--libc/sysdeps/linux/common/capset.c2
-rw-r--r--libc/sysdeps/linux/common/creat64.c4
-rw-r--r--libc/sysdeps/linux/common/fchdir.c3
-rw-r--r--libc/sysdeps/linux/common/fstat64.c17
-rw-r--r--libc/sysdeps/linux/common/fstatat64.c9
-rw-r--r--libc/sysdeps/linux/common/ftruncate.c1
-rw-r--r--libc/sysdeps/linux/common/ftruncate64.c43
-rw-r--r--libc/sysdeps/linux/common/getdents.c28
-rw-r--r--libc/sysdeps/linux/common/getdents64.c17
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c7
-rw-r--r--libc/sysdeps/linux/common/getrlimit64.c7
-rw-r--r--libc/sysdeps/linux/common/init_module.c5
-rw-r--r--libc/sysdeps/linux/common/llseek.c21
-rw-r--r--libc/sysdeps/linux/common/lseek.c25
-rw-r--r--libc/sysdeps/linux/common/lstat64.c9
-rw-r--r--libc/sysdeps/linux/common/mmap64.c38
-rw-r--r--libc/sysdeps/linux/common/open64.c6
-rw-r--r--libc/sysdeps/linux/common/openat.c12
-rw-r--r--libc/sysdeps/linux/common/openat64.c17
-rw-r--r--libc/sysdeps/linux/common/pause.c4
-rw-r--r--libc/sysdeps/linux/common/pivot_root.c2
-rw-r--r--libc/sysdeps/linux/common/poll.c9
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c2
-rw-r--r--libc/sysdeps/linux/common/ppoll.c11
-rw-r--r--libc/sysdeps/linux/common/prctl.c3
-rw-r--r--libc/sysdeps/linux/common/rename.c13
-rw-r--r--libc/sysdeps/linux/common/sched_getaffinity.c21
-rw-r--r--libc/sysdeps/linux/common/sched_setaffinity.c26
-rw-r--r--libc/sysdeps/linux/common/sendfile.c15
-rw-r--r--libc/sysdeps/linux/common/sendfile64.c10
-rw-r--r--libc/sysdeps/linux/common/setgroups.c16
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c18
-rw-r--r--libc/sysdeps/linux/common/setrlimit64.c7
-rw-r--r--libc/sysdeps/linux/common/stat64.c14
-rw-r--r--libc/sysdeps/linux/common/stubs.c11
-rw-r--r--libc/sysdeps/linux/common/truncate.c1
-rw-r--r--libc/sysdeps/linux/common/truncate64.c47
-rw-r--r--libc/sysdeps/linux/frv/fstat64.c4
-rw-r--r--libc/sysdeps/linux/frv/lstat64.c4
-rw-r--r--libc/sysdeps/linux/frv/stat64.c4
-rw-r--r--libc/sysdeps/linux/i386/mmap64.S5
-rw-r--r--libc/sysdeps/linux/i386/posix_fadvise64.S3
-rw-r--r--libc/sysdeps/linux/i386/sysdep.h5
-rw-r--r--libc/sysdeps/linux/mips/posix_fadvise64.c2
-rw-r--r--libpthread/linuxthreads.old/internals.h2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c4
-rw-r--r--librt/timer_create.c5
86 files changed, 305 insertions, 469 deletions
diff --git a/include/errno.h b/include/errno.h
index 01de5e252..563afcad8 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -48,7 +48,7 @@ extern int errno;
#endif
#ifdef _LIBC
-extern const char *__progname, __progname_full;
+extern const char *__progname, *__progname_full;
#endif
#if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
diff --git a/include/fcntl.h b/include/fcntl.h
index fc7136862..f2b46290c 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -135,7 +135,6 @@ extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag,
extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
__nonnull ((2));
-libc_hidden_proto(openat64)
#endif
/* Create and open FILE, with mode MODE. This takes an `int' MODE
diff --git a/include/signal.h b/include/signal.h
index a95ad1519..ca3e8ac18 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -195,7 +195,6 @@ extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s);
This function is a cancellation point and therefore not marked with
__THROW. */
extern int __sigpause (int __sig_or_mask, int __is_sig);
-libc_hidden_proto(__sigpause)
#ifdef __FAVOR_BSD
/* Set the mask of blocked signals to MASK,
@@ -255,11 +254,9 @@ typedef __sighandler_t sig_t;
/* Clear all signals from SET. */
extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
-libc_hidden_proto(sigemptyset)
/* Set all signals in SET. */
extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
-libc_hidden_proto(sigfillset)
/* Add SIGNO to SET. */
extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
@@ -483,6 +480,13 @@ extern int __libc_current_sigrtmin (void) __THROW;
/* Return number of available real-time signal with lowest priority. */
extern int __libc_current_sigrtmax (void) __THROW;
+#ifdef _LIBC
+extern sigset_t _sigintr attribute_hidden;
+/* simplified version without parameter checking */
+# include <string.h>
+# undef __sigemptyset
+# define __sigemptyset(ss) (memset(ss, '\0', sizeof(sigset_t)), 0)
+#endif
#endif /* signal.h */
__END_DECLS
diff --git a/include/sys/poll.h b/include/sys/poll.h
index 53ba6e2eb..1f5e12c61 100644
--- a/include/sys/poll.h
+++ b/include/sys/poll.h
@@ -68,7 +68,6 @@ libc_hidden_proto(poll)
extern int ppoll (struct pollfd *__fds, nfds_t __nfds,
__const struct timespec *__timeout,
__const __sigset_t *__ss);
-libc_hidden_proto(ppoll)
#endif
__END_DECLS
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index 363adb65d..cd7151a45 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -151,18 +151,18 @@ libc_hidden_def(inet_ntoa)
*/
struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host)
{
- in_addr_t addr;
+ struct in_addr in;
if (net < 128)
- addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+ in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
else if (net < 65536)
- addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+ in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
else if (net < 16777216UL)
- addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+ in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
else
- addr = net | host;
- addr = htonl(addr);
- return *(struct in_addr *)&addr;
+ in.s_addr = net | host;
+ in.s_addr = htonl(in.s_addr);
+ return in;
}
libc_hidden_def(inet_makeaddr)
#endif
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 6cdd6e030..7c3921c9a 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1771,7 +1771,7 @@ int getnameinfo(const struct sockaddr *sa,
unsigned flags)
{
int serrno = errno;
- unsigned ok;
+ bool ok = 0;
struct hostent *hoste = NULL;
char domain[256];
@@ -1781,16 +1781,15 @@ int getnameinfo(const struct sockaddr *sa,
if (sa == NULL || addrlen < sizeof(sa_family_t))
return EAI_FAMILY;
- ok = sa->sa_family;
- if (ok == AF_LOCAL) /* valid */;
+ if (sa->sa_family == AF_LOCAL) /* valid */;
#ifdef __UCLIBC_HAS_IPV4__
- else if (ok == AF_INET) {
+ else if (sa->sa_family == AF_INET) {
if (addrlen < sizeof(struct sockaddr_in))
return EAI_FAMILY;
}
#endif
#ifdef __UCLIBC_HAS_IPV6__
- else if (ok == AF_INET6) {
+ else if (sa->sa_family == AF_INET6) {
if (addrlen < sizeof(struct sockaddr_in6))
return EAI_FAMILY;
}
@@ -1798,7 +1797,6 @@ int getnameinfo(const struct sockaddr *sa,
else
return EAI_FAMILY;
- ok = 0;
if (host != NULL && hostlen > 0)
switch (sa->sa_family) {
case AF_INET:
diff --git a/libc/signal/allocrtsig.c b/libc/signal/allocrtsig.c
index 05f3d6c90..2b2098f56 100644
--- a/libc/signal/allocrtsig.c
+++ b/libc/signal/allocrtsig.c
@@ -20,7 +20,6 @@
#include <features.h>
#include <signal.h>
-#include <sys/types.h>
#include <sys/syscall.h>
/* Only enable rt signals when it is supported at compile time */
diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c
index c2dc713d9..73f48ec3a 100644
--- a/libc/signal/killpg.c
+++ b/libc/signal/killpg.c
@@ -19,7 +19,6 @@
#include <errno.h>
#include <signal.h>
-
/* Send SIG to all processes in process group PGRP.
If PGRP is zero, send SIG to all processes in
the current process's process group. */
diff --git a/libc/signal/raise.c b/libc/signal/raise.c
index aed9b46d7..d9dbab672 100644
--- a/libc/signal/raise.c
+++ b/libc/signal/raise.c
@@ -3,9 +3,7 @@
*/
#include <unistd.h>
-#include <string.h>
#include <signal.h>
-#include <sys/types.h>
int raise(int signo)
{
diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c
index 7a31e06bb..9630df711 100644
--- a/libc/signal/sigaction.c
+++ b/libc/signal/sigaction.c
@@ -16,14 +16,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <features.h>
-#include <errno.h>
#include <signal.h>
-#include <string.h>
#include <sys/syscall.h>
-#include <bits/kernel_sigaction.h>
-
#if defined __NR_rt_sigaction
/* If ACT is not NULL, change the action for SIG to *ACT.
@@ -42,6 +37,9 @@ __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
}
#else
+# define __need_NULL
+# include <stddef.h>
+# include <bits/kernel_sigaction.h>
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c
index 7577d37c2..94fcc80e2 100644
--- a/libc/signal/sigaddset.c
+++ b/libc/signal/sigaddset.c
@@ -16,7 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
/* Add SIGNO to SET. */
int
diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c
index ad3acb0be..c3ce36307 100644
--- a/libc/signal/sigblock.c
+++ b/libc/signal/sigblock.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#define __UCLIBC_HIDE_DEPRECATED__
-#include <errno.h>
#include <signal.h>
#include "sigset-cvt-mask.h"
diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c
index ff30303ea..9262b1a65 100644
--- a/libc/signal/sigdelset.c
+++ b/libc/signal/sigdelset.c
@@ -16,7 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
/* Add SIGNO to SET. */
int sigdelset (sigset_t *set, int signo)
diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c
index b4f180bbc..adbded62a 100644
--- a/libc/signal/sigempty.c
+++ b/libc/signal/sigempty.c
@@ -16,10 +16,12 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <errno.h>
#include <signal.h>
-#include <string.h>
-
+#if 0
+#define __need_NULL
+#include <stddef.h>
+#include <errno.h>
+#endif
/* Clear all signals from SET. */
int sigemptyset (sigset_t *set)
@@ -36,4 +38,3 @@ int sigemptyset (sigset_t *set)
return 0;
}
-libc_hidden_def(sigemptyset)
diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c
index 951e76b79..ef60f1005 100644
--- a/libc/signal/sigfillset.c
+++ b/libc/signal/sigfillset.c
@@ -16,10 +16,12 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <errno.h>
#include <signal.h>
-#include <string.h>
-
+#if 0
+#define __need_NULL
+#include <stddef.h>
+#include <errno.h>
+#endif
/* Set all signals in SET. */
int
@@ -46,4 +48,3 @@ sigfillset (sigset_t *set)
return 0;
}
-libc_hidden_def(sigfillset)
diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c
index 3992a7a0a..833de969e 100644
--- a/libc/signal/siggetmask.c
+++ b/libc/signal/siggetmask.c
@@ -20,7 +20,6 @@
#define __UCLIBC_HIDE_DEPRECATED__
#include <signal.h>
-
int
siggetmask (void)
{
diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c
index 6a2e718cd..2b1ecd14f 100644
--- a/libc/signal/sighold.c
+++ b/libc/signal/sighold.c
@@ -22,7 +22,6 @@
#include <stddef.h>
#include <signal.h>
-
int sighold (int sig)
{
sigset_t set;
diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c
index a74c10522..984fd854b 100644
--- a/libc/signal/sigignore.c
+++ b/libc/signal/sigignore.c
@@ -18,12 +18,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <errno.h>
#define __need_NULL
#include <stddef.h>
#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
-
+#include <string.h>
int sigignore (int sig)
{
diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c
index 10567e939..210d493ca 100644
--- a/libc/signal/sigintr.c
+++ b/libc/signal/sigintr.c
@@ -16,16 +16,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <stddef.h>
#include <signal.h>
-#include <errno.h>
-
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
calls be restarted after signal SIG. */
#ifdef SA_RESTART
-extern sigset_t _sigintr attribute_hidden; /* Defined in signal.c. */
+# define __need_NULL
+# include <stddef.h>
+#else
+# include <errno.h>
#endif
int siginterrupt (int sig, int interrupt)
diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c
index b546f626f..334a06f82 100644
--- a/libc/signal/sigismem.c
+++ b/libc/signal/sigismem.c
@@ -16,7 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
/* Return 1 if SIGNO is in SET, 0 if not. */
int sigismember (const sigset_t *set, int signo)
diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c
index a96d6623b..cf2be682e 100644
--- a/libc/signal/sigjmp.c
+++ b/libc/signal/sigjmp.c
@@ -16,11 +16,11 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define __need_NULL
#include <stddef.h>
#include <setjmp.h>
#include <signal.h>
-
/* This function is called by the `sigsetjmp' macro
before doing a `__setjmp' on ENV[0].__jmpbuf.
Always return zero. */
diff --git a/libc/signal/signal.c b/libc/signal/signal.c
index 644617c15..d82e421ec 100644
--- a/libc/signal/signal.c
+++ b/libc/signal/signal.c
@@ -22,7 +22,7 @@
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
-sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */
+sigset_t _sigintr; /* Set by siginterrupt. */
/* Set the handler for the signal SIG to HANDLER,
returning the old handler, or SIG_ERR on error. */
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
index 0856ba2e6..ebd7af3b9 100644
--- a/libc/signal/sigpause.c
+++ b/libc/signal/sigpause.c
@@ -22,7 +22,8 @@
#include <errno.h>
#define __FAVOR_BSD
#include <signal.h>
-#include <stddef.h> /* For NULL. */
+#define __need_NULL
+#include <stddef.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
#include <sysdep-cancel.h>
#endif
@@ -31,7 +32,7 @@
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
-int __sigpause (int sig_or_mask, int is_sig)
+static int __internal_sigpause (int sig_or_mask, int is_sig)
{
sigset_t set;
@@ -51,7 +52,7 @@ int __sigpause (int sig_or_mask, int is_sig)
to do anything here. */
return sigsuspend (&set);
}
-libc_hidden_def(__sigpause)
+strong_alias(__internal_sigpause,__sigpause)
#undef sigpause
@@ -62,16 +63,16 @@ int sigpause (int mask)
{
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
if (SINGLE_THREAD_P)
- return __sigpause (mask, 0);
+ return __internal_sigpause (mask, 0);
int oldtype = LIBC_CANCEL_ASYNC ();
- int result = __sigpause (mask, 0);
+ int result = __internal_sigpause (mask, 0);
LIBC_CANCEL_RESET (oldtype);
return result;
#else
- return __sigpause (mask, 0);
+ return __internal_sigpause (mask, 0);
#endif
}
diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c
index 07e7fddf3..b5136482e 100644
--- a/libc/signal/sigrelse.c
+++ b/libc/signal/sigrelse.c
@@ -22,7 +22,6 @@
#include <stddef.h>
#include <signal.h>
-
int sigrelse (int sig)
{
sigset_t set;
diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c
index b91ce8083..3b162df31 100644
--- a/libc/signal/sigset.c
+++ b/libc/signal/sigset.c
@@ -20,8 +20,7 @@
#define __need_NULL
#include <stddef.h>
#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
-
+#include <string.h>
/* Set the disposition for SIG. */
__sighandler_t sigset (int sig, __sighandler_t disp)
diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c
index 64c8ad687..0a731795d 100644
--- a/libc/signal/sigsetmask.c
+++ b/libc/signal/sigsetmask.c
@@ -17,7 +17,6 @@
02111-1307 USA. */
#define __UCLIBC_HIDE_DEPRECATED__
-#include <errno.h>
#include <signal.h>
#include "sigset-cvt-mask.h"
diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h
deleted file mode 100644
index 52081c2ba..000000000
--- a/libc/signal/sigsetops.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* Definitions relevant to functions that operate on `sigset_t's. */
-
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-
-#define BITS (_NSIG - 1)
-#define ELT(signo) (((signo) - 1) / BITS)
-#define MASK(signo) (1 << (((signo) - 1) % BITS))
-
-#undef sigemptyset
-#undef sigfillset
-#undef sigaddset
-#undef sigdelset
-#undef sigismember
diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c
index 634a18dc5..5e9c4275f 100644
--- a/libc/signal/sigwait.c
+++ b/libc/signal/sigwait.c
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA. */
-#include <errno.h>
+#define __need_NULL
+#include <stddef.h>
#include <signal.h>
-#include <string.h>
-#include <unistd.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
# include <sysdep-cancel.h>
# ifdef __NR_rt_sigtimedwait
+# include <string.h>
/* Return any pending signal or wait for one for the given time. */
static int do_sigwait(const sigset_t *set, int *sig)
@@ -104,6 +104,8 @@ int sigwait (const sigset_t *set, int *sig)
}
# else /* __UCLIBC_HAS_REALTIME__ */
+# include <errno.h>
+# include <unistd.h> /* smallint */
/* variant without REALTIME extensions */
static smallint was_sig; /* obviously not thread-safe */
diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c
index a696a5426..65d8190d0 100644
--- a/libc/signal/sysv_signal.c
+++ b/libc/signal/sysv_signal.c
@@ -18,8 +18,6 @@
#include <errno.h>
#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
-
/* Tolerate non-threads versions of Posix */
#ifndef SA_ONESHOT
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c
index 61b01c82d..b66c41f8d 100644
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -7,7 +7,6 @@
#include "_stdio.h"
-
/* This is pretty much straight from uClibc, but with one important
* difference.
*
@@ -277,10 +276,6 @@ void _stdio_init(void)
#error Assumption violated about __MASK_READING and __FLAG_UNGOT
#endif
-#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
-#endif
-
#ifndef NDEBUG
void _stdio_validate_FILE(const FILE *stream)
diff --git a/libc/stdio/fseeko.c b/libc/stdio/fseeko.c
index 3caf1ac79..16b0c043a 100644
--- a/libc/stdio/fseeko.c
+++ b/libc/stdio/fseeko.c
@@ -77,5 +77,5 @@ int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
libc_hidden_def(fseeko64)
#else
libc_hidden_def(fseek)
-strong_alias(fseek,fseeko)
+strong_alias_untyped(fseek,fseeko)
#endif
diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c
index e8ff36533..219b6996a 100644
--- a/libc/stdio/ftello.c
+++ b/libc/stdio/ftello.c
@@ -53,5 +53,5 @@ OFFSET_TYPE FTELL(register FILE *stream)
libc_hidden_def(ftello64)
#else
libc_hidden_def(ftell)
-strong_alias(ftell,ftello)
+strong_alias_untyped(ftell,ftello)
#endif
diff --git a/libc/sysdeps/linux/Makefile.commonarch b/libc/sysdeps/linux/Makefile.commonarch
index 4e4815949..c1bc5df30 100644
--- a/libc/sysdeps/linux/Makefile.commonarch
+++ b/libc/sysdeps/linux/Makefile.commonarch
@@ -36,6 +36,6 @@ $(ARCH_HEADERS_OUT):
headers-y += $(ARCH_HEADERS_OUT)
headers_clean-y += HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
- $(RM) $(ARCH_HEADERS_OUT)
+ $(do_rm) $(ARCH_HEADERS_OUT)
endif
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index 707154124..bc9d4f152 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -16,13 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <features.h>
+#include <_lfs_64.h>
#define _ERRNO_H
#include <bits/errno.h>
#include <sys/syscall.h>
#include <bits/arm_asm.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
+#ifdef __NR_mmap2
/* The mmap2 system call takes six arguments, all in registers. */
.text
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c
index e8782e967..09291e5d7 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl64.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c
@@ -7,13 +7,13 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
-
-#define __NR___syscall_fcntl64 __NR_fcntl64
+#ifdef __NR_fcntl64
+# include <stdarg.h>
+# include <fcntl.h>
+# define __NR___syscall_fcntl64 __NR_fcntl64
static __inline__ _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg)
int fcntl64(int fd, int cmd, ...)
{
diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c
index cfd68fe1b..a2dd77be4 100644
--- a/libc/sysdeps/linux/common/alarm.c
+++ b/libc/sysdeps/linux/common/alarm.c
@@ -10,12 +10,10 @@
#include <sys/syscall.h>
#include <unistd.h>
-
#ifdef __NR_alarm
_syscall1(unsigned int, alarm, unsigned int, seconds)
#else
-#include <sys/time.h>
-
+# include <sys/time.h>
unsigned int alarm(unsigned int seconds)
{
diff --git a/libc/sysdeps/linux/common/arch_prctl.c b/libc/sysdeps/linux/common/arch_prctl.c
index 5816f5394..9fc59485c 100644
--- a/libc/sysdeps/linux/common/arch_prctl.c
+++ b/libc/sysdeps/linux/common/arch_prctl.c
@@ -10,6 +10,6 @@
#include <sys/syscall.h>
#ifdef __NR_arch_prctl
-extern int arch_prctl(int code, unsigned long addr);
+int arch_prctl(int code, unsigned long addr);
_syscall2(int, arch_prctl, int, code, unsigned long, addr)
#endif
diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h
index 7edb7bb44..eb1a1dbf2 100644
--- a/libc/sysdeps/linux/common/bits/getopt.h
+++ b/libc/sysdeps/linux/common/bits/getopt.h
@@ -26,31 +26,7 @@
# define _GETOPT_H 1
#endif
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
- standalone, or this is the first header included in the source file.
- If we are being used with glibc, we need to include <features.h>, but
- that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
- not defined, include <ctype.h>, which will pull in <features.h> for us
- if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
- doesn't flood the namespace with stuff the way some other headers do.) */
-#if !defined __GNU_LIBRARY__ && !defined __UCLIBC__
-# include <ctype.h>
-#endif
-
-#ifndef __THROW
-# ifndef __GNUC_PREREQ
-# define __GNUC_PREREQ(maj, min) (0)
-# endif
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
-# define __THROW throw ()
-# else
-# define __THROW
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
@@ -147,17 +123,9 @@ struct option
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
-#if defined __GNU_LIBRARY__ || defined __UCLIBC__
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW;
libc_hidden_proto(getopt)
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-libc_hidden_proto(getopt)
-#endif /* __GNU_LIBRARY__ */
#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
#ifndef __need_getopt
@@ -173,9 +141,7 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
#endif
#endif
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c
index c3e8c5771..e420f6a1f 100644
--- a/libc/sysdeps/linux/common/capget.c
+++ b/libc/sysdeps/linux/common/capget.c
@@ -8,7 +8,8 @@
*/
#include <sys/syscall.h>
-int capget(void *header, void *data);
+
#ifdef __NR_capget
+int capget(void *header, void *data);
_syscall2(int, capget, void *, header, void *, data)
#endif
diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c
index c0cf5deb0..493cf1449 100644
--- a/libc/sysdeps/linux/common/capset.c
+++ b/libc/sysdeps/linux/common/capset.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
-int capset(void *header, const void *data);
#ifdef __NR_capset
+int capset(void *header, const void *data);
_syscall2(int, capset, void *, header, const void *, data)
#endif
diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c
index 577ad14b5..550e88aab 100644
--- a/libc/sysdeps/linux/common/creat64.c
+++ b/libc/sysdeps/linux/common/creat64.c
@@ -17,14 +17,10 @@
02111-1307 USA. */
#include <_lfs_64.h>
-
-#ifdef __UCLIBC_HAS_LFS__
#include <fcntl.h>
-#include <sys/types.h>
/* Create FILE with protections MODE. */
int creat64(const char *file, mode_t mode)
{
return open64(file, O_WRONLY|O_CREAT|O_TRUNC, mode);
}
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c
index 4d54ef821..05e9890c8 100644
--- a/libc/sysdeps/linux/common/fchdir.c
+++ b/libc/sysdeps/linux/common/fchdir.c
@@ -10,6 +10,7 @@
#include <sys/syscall.h>
#include <unistd.h>
-
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
_syscall1(int, fchdir, int, fd)
libc_hidden_def(fchdir)
+#endif
diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c
index 60613433b..7460c26f6 100644
--- a/libc/sysdeps/linux/common/fstat64.c
+++ b/libc/sysdeps/linux/common/fstat64.c
@@ -7,17 +7,16 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64
-#include <unistd.h>
-#include <sys/stat.h>
-#include "xstatconv.h"
-
-
-#define __NR___syscall_fstat64 __NR_fstat64
-static __inline__ _syscall2(int, __syscall_fstat64,
- int, filedes, struct kernel_stat64 *, buf)
+#ifdef __NR_fstat64
+# include <unistd.h>
+# include <sys/stat.h>
+# include "xstatconv.h"
+# define __NR___syscall_fstat64 __NR_fstat64
+static __always_inline _syscall2(int, __syscall_fstat64,
+ int, filedes, struct kernel_stat64 *, buf)
int fstat64(int fd, struct stat64 *buf)
{
diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
index 95627afaf..6be8ba4b5 100644
--- a/libc/sysdeps/linux/common/fstatat64.c
+++ b/libc/sysdeps/linux/common/fstatat64.c
@@ -6,11 +6,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
-#include "xstatconv.h"
-
-#ifdef __UCLIBC_HAS_LFS__
/* 64bit ports tend to favor newfstatat() */
#ifdef __NR_newfstatat
@@ -18,6 +15,8 @@
#endif
#ifdef __NR_fstatat64
+# include <sys/stat.h>
+# include "xstatconv.h"
int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
{
int ret;
@@ -32,5 +31,3 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
#else
/* should add emulation with fstat64() and /proc/self/fd/ ... */
#endif
-
-#endif
diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c
index 3bdef3f46..ea4dfc0f6 100644
--- a/libc/sysdeps/linux/common/ftruncate.c
+++ b/libc/sysdeps/linux/common/ftruncate.c
@@ -10,6 +10,5 @@
#include <sys/syscall.h>
#include <unistd.h>
-
_syscall2(int, ftruncate, int, fd, __off_t, length)
libc_hidden_def(ftruncate)
diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c
index c5a616007..012a1f4ed 100644
--- a/libc/sysdeps/linux/common/ftruncate64.c
+++ b/libc/sysdeps/linux/common/ftruncate64.c
@@ -10,47 +10,42 @@
* just the macro we need to order things, __LONG_LONG_PAIR.
*/
-#include <features.h>
+#include <_lfs_64.h>
+#include <sys/syscall.h>
+#include <unistd.h>
-#ifdef __UCLIBC_HAS_LFS__
+#ifdef __NR_ftruncate64
+# include <bits/wordsize.h>
-# include <unistd.h>
-# include <errno.h>
-# include <endian.h>
-# include <stdint.h>
-# include <sys/types.h>
-# include <sys/syscall.h>
-
-
-# ifdef __NR_ftruncate64
-
-# if __WORDSIZE == 64
+# if __WORDSIZE == 64
/* For a 64 bit machine, life is simple... */
_syscall2(int, ftruncate64, int, fd, __off64_t, length)
-# elif __WORDSIZE == 32
+# elif __WORDSIZE == 32
+# include <endian.h>
+# include <stdint.h>
/* The exported ftruncate64 function. */
int ftruncate64 (int fd, __off64_t length)
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
-# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
+# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
return INLINE_SYSCALL(ftruncate64,
4, fd, 0, __LONG_LONG_PAIR (high, low));
-# else
+# else
return INLINE_SYSCALL(ftruncate64, 3, fd,
__LONG_LONG_PAIR (high, low));
-# endif
+# endif
}
-# else /* __WORDSIZE */
-# error Your machine is not 64 bit or 32 bit, I am dazed and confused.
-# endif /* __WORDSIZE */
-
-# else /* __NR_ftruncate64 */
+# else /* __WORDSIZE */
+# error Your machine is not 64 bit or 32 bit, I am dazed and confused.
+# endif /* __WORDSIZE */
+#else /* __NR_ftruncate64 */
+# include <errno.h>
int ftruncate64 (int fd, __off64_t length)
{
@@ -65,7 +60,5 @@ int ftruncate64 (int fd, __off64_t length)
return -1;
}
-# endif /* __NR_ftruncate64 */
+#endif /* __NR_ftruncate64 */
libc_hidden_def(ftruncate64)
-
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index f321aeae6..f4fb7476e 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -4,22 +4,17 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <assert.h>
-#include <errno.h>
+#include <sys/syscall.h>
+#include <bits/wordsize.h>
+
+#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
+
#include <dirent.h>
-#include <stddef.h>
-#include <stdint.h>
#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/param.h>
#include <sys/types.h>
-#include <sys/syscall.h>
#include <bits/kernel_types.h>
#include <bits/kernel-features.h>
-#include <bits/uClibc_alloc.h>
-#if !(defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 && __WORDSIZE == 64)
/* If the condition above is met, __getdents is defined as an alias
* for __getdents64 (see getdents64.c). Otherwise...
*/
@@ -31,10 +26,6 @@
* version / arch details.
*/
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
struct kernel_dirent
{
long int d_ino;
@@ -77,6 +68,13 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
+# include <assert.h>
+# include <stddef.h>
+# include <errno.h>
+# include <unistd.h>
+# include <sys/param.h>
+# include <bits/uClibc_alloc.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -138,6 +136,8 @@ ssize_t __getdents (int fd, char *buf, size_t nbytes)
#elif __WORDSIZE == 32
+# include <stddef.h>
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c
index e1133fffa..aacbe97cc 100644
--- a/libc/sysdeps/linux/common/getdents64.c
+++ b/libc/sysdeps/linux/common/getdents64.c
@@ -4,7 +4,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <features.h>
+#include <_lfs_64.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_getdents64
+
#include <assert.h>
#include <errno.h>
#include <dirent.h>
@@ -12,19 +16,10 @@
#include <stdint.h>
#include <string.h>
#include <unistd.h>
-#include <dirent.h>
#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <bits/kernel_types.h>
+#include <bits/wordsize.h>
#include <bits/uClibc_alloc.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
-
-# ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-# endif
-
struct kernel_dirent64
{
uint64_t d_ino;
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index f9d70f37b..3b2ce3b37 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -8,8 +8,8 @@
*/
#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/resource.h>
+#include <bits/wordsize.h>
/* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */
@@ -22,14 +22,14 @@ _syscall2(int, __syscall_ugetrlimit, enum __rlimit_resource, resource,
struct rlimit *, rlim)
int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
- return (__syscall_ugetrlimit(resource, rlimits));
+ return __syscall_ugetrlimit(resource, rlimits);
}
#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
/* We don't need to wrap getrlimit() */
_syscall2(int, getrlimit, __rlimit_resource_t, resource,
- struct rlimit *, rlim)
+ struct rlimit *, rlim)
#else
@@ -56,7 +56,6 @@ int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
return result;
}
#endif
-
libc_hidden_def(getrlimit)
#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c
index d537241eb..2945e6da7 100644
--- a/libc/sysdeps/linux/common/getrlimit64.c
+++ b/libc/sysdeps/linux/common/getrlimit64.c
@@ -17,15 +17,12 @@
02111-1307 USA. */
#include <_lfs_64.h>
-
-#include <sys/types.h>
-#include <sys/resource.h>
#include <bits/wordsize.h>
/* the regular getrlimit will work just fine for 64bit users */
+#if __WORDSIZE == 32
-#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
-
+# include <sys/resource.h>
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
Returns 0 if successful, -1 if not (and sets errno). */
diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c
index cf6d74721..a2a3e02f5 100644
--- a/libc/sysdeps/linux/common/init_module.c
+++ b/libc/sysdeps/linux/common/init_module.c
@@ -8,12 +8,13 @@
*/
#include <sys/syscall.h>
-int init_module(void *first, void *second, void *third, void *fourth, void *fifth);
+
#ifdef __NR_init_module
+int init_module(void *first, void *second, void *third, void *fourth, void *fifth);
/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
* (for 2.2 and 2.4 kernels). Use the greatest common denominator,
* and let the kernel cope with whatever it gets. It's good at that. */
_syscall5(int, init_module, void *, first, void *, second, void *, third,
- void *, fourth, void *, fifth)
+ void *, fourth, void *, fifth)
#endif
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index cd150ad9f..d04a5ec7a 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -7,28 +7,23 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/syscall.h>
-#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
-
-loff_t lseek64(int fd, loff_t offset, int whence)
+#ifdef __NR__llseek
+off64_t lseek64(int fd, off64_t offset, int whence)
{
- loff_t result;
- return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32),
- (off_t) (offset & 0xffffffff), &result, whence) ?: result);
+ off64_t result;
+ return (off64_t)INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32),
+ (off_t) (offset & 0xffffffff), &result, whence) ?: result;
}
-
#else
-
-loff_t lseek64(int fd, loff_t offset, int whence)
+off64_t lseek64(int fd, off64_t offset, int whence)
{
- return (loff_t)(lseek(fd, (off_t) (offset), whence));
+ return (off64_t)lseek(fd, (off_t) (offset), whence);
}
-
#endif
-
#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(lseek64)
#else
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index 9ff424048..1ed956e84 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -12,12 +12,33 @@
#ifdef __NR_lseek
_syscall3(__off_t, lseek, int, fildes, __off_t, offset, int, whence)
-#else
-
+#elif defined __UCLIBC_HAS_LFS__ && defined __NR__llseek /* avoid circular dependency */
__off_t lseek(int fildes, __off_t offset, int whence)
{
return lseek64(fildes, offset, whence);
}
+#else
+# include <errno.h>
+__off_t lseek(int fildes, __off_t offset attribute_unused, int whence)
+{
+ if (fildes < 0) {
+ __set_errno(EBADF);
+ return -1;
+ }
+
+ switch(whence) {
+ case SEEK_SET:
+ case SEEK_CUR:
+ case SEEK_END:
+ break;
+ default:
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ __set_errno(ENOSYS);
+ return -1;
+}
#endif
#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(lseek)
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 235b76d4a..85e269819 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -7,17 +7,17 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
+#ifdef __NR_lstat64
# include <unistd.h>
# include <sys/stat.h>
# include "xstatconv.h"
-
# define __NR___syscall_lstat64 __NR_lstat64
-static __inline__ _syscall2(int, __syscall_lstat64, const char *, file_name,
- struct kernel_stat64 *, buf)
+static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name,
+ struct kernel_stat64 *, buf)
int lstat64(const char *file_name, struct stat64 *buf)
{
@@ -31,5 +31,4 @@ int lstat64(const char *file_name, struct stat64 *buf)
return result;
}
libc_hidden_def(lstat64)
-
#endif
diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c
index 4ef039710..65a7381b6 100644
--- a/libc/sysdeps/linux/common/mmap64.c
+++ b/libc/sysdeps/linux/common/mmap64.c
@@ -6,17 +6,11 @@
/* Massivly hacked up for uClibc by Erik Andersen */
#include <_lfs_64.h>
-
-#ifdef __UCLIBC_HAS_LFS__
-
#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
#include <sys/syscall.h>
-#include <bits/uClibc_page.h>
-
+#include <sys/mman.h>
-# if !defined __NR_mmap2
+#ifndef __NR_mmap2
/*
* This version is a stub that just chops off everything at the mmap 32 bit
@@ -26,7 +20,7 @@
*
*/
-__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
+void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset)
{
if (offset != (off_t) offset ||
(offset + len) != (off_t) (offset + len)) {
@@ -37,36 +31,36 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
return mmap(addr, len, prot, flags, fd, (off_t) offset);
}
-# else
+#else
+# include <bits/uClibc_page.h>
-# define __NR___syscall_mmap2 __NR_mmap2
-static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+# define __NR___syscall_mmap2 __NR_mmap2
+static __inline__ _syscall6(void *, __syscall_mmap2, void *, addr,
size_t, len, int, prot, int, flags, int, fd,
off_t, offset)
-/* Some architectures always use 12 as page shift for mmap2() eventhough the
+/* Some architectures always use 12 as page shift for mmap2() even though the
* real PAGE_SHIFT != 12. Other architectures use the same value as
* PAGE_SHIFT...
*/
-# ifndef MMAP2_PAGE_SHIFT
-# define MMAP2_PAGE_SHIFT 12
-# endif
+# ifndef MMAP2_PAGE_SHIFT
+# define MMAP2_PAGE_SHIFT 12
+# endif
-__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
+void *mmap64(void *addr, size_t len, int prot, int flags, int fd, __off64_t offset)
{
if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
__set_errno(EINVAL);
return MAP_FAILED;
}
-# ifdef __USE_FILE_OFFSET64
+# if 0 /*def __USE_FILE_OFFSET64 can't happen due to _lfs_64.h */
return __syscall_mmap2(addr, len, prot, flags,
fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
-# else
+# else
return __syscall_mmap2(addr, len, prot, flags,
fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
-# endif
+# endif
}
-# endif
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index c1f5400b8..91931fa70 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -4,7 +4,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <features.h>
+#include <_lfs_64.h>
#include <fcntl.h>
#include <stdarg.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -12,8 +12,6 @@
#include <sysdep-cancel.h>
#endif
-#ifdef __UCLIBC_HAS_LFS__
-
#ifndef O_LARGEFILE
# define O_LARGEFILE 0100000
#endif
@@ -53,5 +51,3 @@ libc_hidden_def(open64)
libc_hidden_weak(open64)
strong_alias(open64,__libc_open64)
#endif
-
-#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c
index 8380ec687..f6032da2c 100644
--- a/libc/sysdeps/linux/common/openat.c
+++ b/libc/sysdeps/linux/common/openat.c
@@ -6,19 +6,13 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define openat __xx_openat
#include <sys/syscall.h>
#include <fcntl.h>
-#undef openat
#ifdef __NR_openat
-/* The openat() prototype is varargs based, but we don't care about that
- * here, so need to provide our own dedicated signature.
- */
-extern int openat(int fd, const char *file, int oflag, mode_t mode);
-libc_hidden_proto(openat)
-
-_syscall4(int, openat, int, fd, const char *, file, int, oflag, mode_t, mode)
+# define __NR___syscall_openat __NR_openat
+static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode)
+strong_alias_untyped(__syscall_openat,openat)
libc_hidden_def(openat)
#else
/* should add emulation with open() and /proc/self/fd/ ... */
diff --git a/libc/sysdeps/linux/common/openat64.c b/libc/sysdeps/linux/common/openat64.c
index 06a5819d7..eda3e7db1 100644
--- a/libc/sysdeps/linux/common/openat64.c
+++ b/libc/sysdeps/linux/common/openat64.c
@@ -6,27 +6,16 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define openat64 __xx_openat
+#include <_lfs_64.h>
#include <sys/syscall.h>
#include <fcntl.h>
-#undef openat64
-
-#ifdef __UCLIBC_HAS_LFS__
#ifdef __NR_openat
-/* The openat() prototype is varargs based, but we don't care about that
- * here, so need to provide our own dedicated signature.
- */
-extern int openat64(int fd, const char *file, int oflag, mode_t mode);
-libc_hidden_proto(openat64)
-
-int openat64(int fd, const char *file, int oflag, mode_t mode)
+static int __openat64(int fd, const char *file, int oflag, mode_t mode)
{
return openat(fd, file, oflag | O_LARGEFILE, mode);
}
-libc_hidden_def(openat64)
+strong_alias_untyped(__openat64,openat64)
#else
/* should add emulation with open() and /proc/self/fd/ ... */
#endif
-
-#endif
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index ab16fa73c..a77c4d581 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -7,8 +7,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define __UCLIBC_HIDE_DEPRECATED__
-#include <sys/syscall.h>
+#define __need_NULL
+#include <stddef.h>
#include <unistd.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c
index 0e738d53f..78f71efa4 100644
--- a/libc/sysdeps/linux/common/pivot_root.c
+++ b/libc/sysdeps/linux/common/pivot_root.c
@@ -9,7 +9,7 @@
#include <sys/syscall.h>
-int pivot_root(const char *new_root, const char *put_old);
#ifdef __NR_pivot_root
+int pivot_root(const char *new_root, const char *put_old);
_syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
#endif
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c
index 3895e0da7..92c90da66 100644
--- a/libc/sysdeps/linux/common/poll.c
+++ b/libc/sysdeps/linux/common/poll.c
@@ -27,13 +27,11 @@
#define SINGLE_THREAD_P 1
#endif
-libc_hidden_proto(poll)
-
#if defined __ASSUME_POLL_SYSCALL && defined __NR_poll
#define __NR___syscall_poll __NR_poll
-static inline _syscall3(int, __syscall_poll, struct pollfd *, fds,
- unsigned long int, nfds, int, timeout);
+static _syscall3(int, __syscall_poll, struct pollfd *, fds,
+ unsigned long int, nfds, int, timeout);
int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
@@ -57,9 +55,6 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
#include <sys/param.h>
#include <unistd.h>
-libc_hidden_proto(getdtablesize)
-libc_hidden_proto(select)
-
/* uClinux 2.0 doesn't have poll, emulate it using select */
/* Poll the file descriptors described by the NFDS structures starting at
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index de813ba15..067085430 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -16,7 +16,7 @@
# define __NR_fadvise64_64 __NR_arm_fadvise64_64
#endif
-#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
+#if defined __NR_fadvise64_64 && __WORDSIZE == 32
# include <fcntl.h>
# include <endian.h>
diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c
index 09b2b1539..3ca3f7333 100644
--- a/libc/sysdeps/linux/common/ppoll.c
+++ b/libc/sysdeps/linux/common/ppoll.c
@@ -17,13 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <signal.h>
#include <sys/syscall.h>
-#include <sys/poll.h>
-#define __need_NULL
-#include <stddef.h>
-#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__
+#if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+# define __need_NULL
+# include <stddef.h>
+# include <signal.h>
+# include <sys/poll.h>
# ifdef __UCLIBC_HAS_THREADS_NATIVE__
# include <sysdep-cancel.h>
# else
@@ -51,5 +51,4 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
return result;
# endif
}
-libc_hidden_def(ppoll)
#endif
diff --git a/libc/sysdeps/linux/common/prctl.c b/libc/sysdeps/linux/common/prctl.c
index 39c0d4fb0..67732bb90 100644
--- a/libc/sysdeps/linux/common/prctl.c
+++ b/libc/sysdeps/linux/common/prctl.c
@@ -8,10 +8,9 @@
*/
#include <sys/syscall.h>
-#include <stdarg.h>
/* psm: including sys/prctl.h would depend on kernel headers */
#ifdef __NR_prctl
-extern int prctl (int, long, long, long, long);
+int prctl (int, long, long, long, long);
_syscall5(int, prctl, int, option, long, _a2, long, _a3, long, _a4, long, _a5)
#endif
diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c
index 9d8397a8f..6183cf494 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -8,17 +8,6 @@
*/
#include <sys/syscall.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/param.h>
#include <stdio.h>
-#define __NR___syscall_rename __NR_rename
-static __inline__ _syscall2(int, __syscall_rename, const char *, oldpath,
- const char *, newpath)
-
-int rename(const char * oldpath, const char * newpath)
-{
- return __syscall_rename(oldpath, newpath);
-}
-
+_syscall2(int, rename, const char *, oldpath, const char *, newpath)
diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c
index 8982582cc..08545161a 100644
--- a/libc/sysdeps/linux/common/sched_getaffinity.c
+++ b/libc/sysdeps/linux/common/sched_getaffinity.c
@@ -16,20 +16,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <features.h>
-#ifdef __USE_GNU
-
-#include <sched.h>
-#include <sys/types.h>
#include <sys/syscall.h>
-#include <string.h>
-#include <sys/param.h>
-
-#if defined __NR_sched_getaffinity
-#define __NR___syscall_sched_getaffinity __NR_sched_getaffinity
-static __inline__ _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid,
- size_t, cpusetsize, cpu_set_t *, cpuset)
+#if defined __NR_sched_getaffinity && defined __USE_GNU
+# include <sched.h>
+# include <string.h>
+# include <sys/types.h>
+# include <sys/param.h>
+# define __NR___syscall_sched_getaffinity __NR_sched_getaffinity
+static __always_inline _syscall3(int, __syscall_sched_getaffinity, __kernel_pid_t, pid,
+ size_t, cpusetsize, cpu_set_t *, cpuset)
int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
{
@@ -45,4 +41,3 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
return res;
}
#endif
-#endif
diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c
index 980c44199..e239cd794 100644
--- a/libc/sysdeps/linux/common/sched_setaffinity.c
+++ b/libc/sysdeps/linux/common/sched_setaffinity.c
@@ -16,22 +16,17 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include <features.h>
-#ifdef __USE_GNU
-
-#include <sched.h>
-#include <sys/types.h>
#include <sys/syscall.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <alloca.h>
-
-#if defined __NR_sched_setaffinity
-#define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
-static __inline__ _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid,
- size_t, cpusetsize, cpu_set_t *, cpuset)
+#if defined __NR_sched_setaffinity && defined __USE_GNU
+# include <sched.h>
+# include <sys/types.h>
+# include <string.h>
+# include <unistd.h>
+# include <alloca.h>
+# define __NR___syscall_sched_setaffinity __NR_sched_setaffinity
+static __always_inline _syscall3(int, __syscall_sched_setaffinity, __kernel_pid_t, pid,
+ size_t, cpusetsize, const cpu_set_t *, cpuset)
static size_t __kernel_cpumask_size;
@@ -68,7 +63,6 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
return -1;
}
- return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset);
+ return __syscall_sched_setaffinity(pid, cpusetsize, cpuset);
}
#endif
-#endif /* __USE_GNU */
diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index 89bab9f35..64c200eb2 100644
--- a/libc/sysdeps/linux/common/sendfile.c
+++ b/libc/sysdeps/linux/common/sendfile.c
@@ -8,16 +8,13 @@
*/
#include <sys/syscall.h>
-#include <unistd.h>
-#include <sys/sendfile.h>
#ifdef __NR_sendfile
-
+# include <sys/sendfile.h>
+# include <bits/wordsize.h>
_syscall4(ssize_t, sendfile, int, out_fd, int, in_fd, __off_t *, offset,
- size_t, count)
-
-#if ! defined __NR_sendfile64 && defined __UCLIBC_HAS_LFS__
-strong_alias(sendfile,sendfile64)
+ size_t, count)
+# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_sendfile64 || __WORDSIZE == 64)
+strong_alias_untyped(sendfile,sendfile64)
+# endif
#endif
-
-#endif /* __NR_sendfile */
diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c
index fc5155fd2..705e6fdee 100644
--- a/libc/sysdeps/linux/common/sendfile64.c
+++ b/libc/sysdeps/linux/common/sendfile64.c
@@ -10,15 +10,11 @@
* just the macro we need to order things, __LONG_LONG_PAIR.
*/
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/sendfile.h>
+#include <_lfs_64.h>
#include <sys/syscall.h>
#include <bits/wordsize.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_sendfile64
+#if defined __NR_sendfile64 && __WORDSIZE != 64
+# include <sys/sendfile.h>
_syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count)
#endif
diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c
index 72c987837..d97859f0d 100644
--- a/libc/sysdeps/linux/common/setgroups.c
+++ b/libc/sysdeps/linux/common/setgroups.c
@@ -8,12 +8,9 @@
*/
#include <sys/syscall.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <grp.h>
#ifdef __USE_BSD
-
+#include <grp.h>
#if defined(__NR_setgroups32)
# undef __NR_setgroups
@@ -24,11 +21,14 @@ _syscall2(int, setgroups, size_t, size, const gid_t *, list)
_syscall2(int, setgroups, size_t, size, const gid_t *, list)
#else
+# include <errno.h>
+# include <stdlib.h>
+# include <unistd.h>
+# include <sys/types.h>
-
-#define __NR___syscall_setgroups __NR_setgroups
-static __inline__ _syscall2(int, __syscall_setgroups,
- size_t, size, const __kernel_gid_t *, list)
+# define __NR___syscall_setgroups __NR_setgroups
+static __always_inline _syscall2(int, __syscall_setgroups,
+ size_t, size, const __kernel_gid_t *, list)
int setgroups(size_t size, const gid_t *groups)
{
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index 6817a9c92..d96700aec 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -8,8 +8,8 @@
*/
#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/resource.h>
+#include <bits/wordsize.h>
/* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */
@@ -22,7 +22,7 @@ _syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource,
const struct rlimit *, rlim)
int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
- return (__syscall_usetrlimit(resource, rlimits));
+ return __syscall_usetrlimit(resource, rlimits);
}
#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
@@ -33,6 +33,11 @@ _syscall2(int, setrlimit, __rlimit_resource_t, resource,
#else
+# define __need_NULL
+# include <stddef.h>
+# include <errno.h>
+# include <sys/param.h>
+
/* we have to handle old style setrlimit() */
# define __NR___syscall_setrlimit __NR_setrlimit
static __always_inline
@@ -49,16 +54,13 @@ int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
/* We might have to correct the limits values. Since the old values
* were signed the new values might be too large. */
-# define RMIN(x, y) ((x) < (y) ? (x) : (y))
- rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur,
+ rlimits_small.rlim_cur = MIN((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 1);
- rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max,
+ rlimits_small.rlim_max = MIN((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 1);
-#undef RMIN
- return (__syscall_setrlimit(resource, &rlimits_small));
+ return __syscall_setrlimit(resource, &rlimits_small);
}
#endif
-
libc_hidden_def(setrlimit)
#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c
index 8705c6f59..8ec6e5842 100644
--- a/libc/sysdeps/linux/common/setrlimit64.c
+++ b/libc/sysdeps/linux/common/setrlimit64.c
@@ -17,15 +17,12 @@
02111-1307 USA. */
#include <_lfs_64.h>
-
-#include <sys/types.h>
-#include <sys/resource.h>
#include <bits/wordsize.h>
/* the regular setrlimit will work just fine for 64bit users */
+#if __WORDSIZE == 32
-#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
-
+# include <sys/resource.h>
/* Set the soft and hard limits for RESOURCE to *RLIMITS.
Only the super-user can increase hard limits.
diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c
index a76f182d4..ef34faf7d 100644
--- a/libc/sysdeps/linux/common/stat64.c
+++ b/libc/sysdeps/linux/common/stat64.c
@@ -7,17 +7,15 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64
-
-# define __NR___syscall_stat64 __NR_stat64
-# include <unistd.h>
+#ifdef __NR_stat64
+# include <sys/stat.h>
# include "xstatconv.h"
-
-static __inline__ _syscall2(int, __syscall_stat64,
- const char *, file_name, struct kernel_stat64 *, buf)
+# define __NR___syscall_stat64 __NR_stat64
+static __always_inline _syscall2(int, __syscall_stat64,
+ const char *, file_name, struct kernel_stat64 *, buf)
int stat64(const char *file_name, struct stat64 *buf)
{
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 883bd34ee..4c4f6266e 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -219,6 +219,17 @@ make_stub(lutimes)
# endif
#endif
+#ifndef __NR_openat
+make_stub(openat)
+# ifdef __UCLIBC_HAS_LFS__
+make_stub(openat64)
+# endif
+#endif
+
+#ifndef __NR_renameat
+make_stub(renameat)
+#endif
+
#ifndef __NR_fadvise64
make_ret_stub(posix_fadvise)
#endif
diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c
index 2331bddb1..fe7bda9e2 100644
--- a/libc/sysdeps/linux/common/truncate.c
+++ b/libc/sysdeps/linux/common/truncate.c
@@ -10,6 +10,5 @@
#include <sys/syscall.h>
#include <unistd.h>
-
_syscall2(int, truncate, const char *, path, __off_t, length)
libc_hidden_def(truncate)
diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c
index 1f6c4596a..6dfdc4c07 100644
--- a/libc/sysdeps/linux/common/truncate64.c
+++ b/libc/sysdeps/linux/common/truncate64.c
@@ -10,46 +10,36 @@
* just the macro we need to order things, __LONG_LONG_PAIR.
*/
-#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
+#include <_lfs_64.h>
#include <sys/syscall.h>
+#include <unistd.h>
-#if defined __UCLIBC_HAS_LFS__
-
-#if defined __NR_truncate64
-
-#if __WORDSIZE == 64
+#ifdef __NR_truncate64
+# include <bits/wordsize.h>
-/* For a 64 bit machine, life is simple... */
+# if __WORDSIZE == 64
_syscall2(int, truncate64, const char *, path, __off64_t, length)
-
-#elif __WORDSIZE == 32
-
-/* The exported truncate64 function. */
+# elif __WORDSIZE == 32
+# include <endian.h>
+# include <stdint.h>
int truncate64(const char * path, __off64_t length)
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
-#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
+# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
return INLINE_SYSCALL(truncate64, 4, path, 0,
__LONG_LONG_PAIR(high, low));
-#else
+# else
return INLINE_SYSCALL(truncate64, 3, path,
__LONG_LONG_PAIR(high, low));
-#endif
+# endif
}
+# else
+# error Your machine is not 64 bit nor 32 bit, I am dazed and confused.
+# endif
-#else /* __WORDSIZE */
-#error Your machine is not 64 bit nor 32 bit, I am dazed and confused.
-#endif /* __WORDSIZE */
-
-#else /* __NR_truncate64 */
-
-
+#else
+# include <errno.h>
int truncate64(const char * path, __off64_t length)
{
__off_t x = (__off_t) length;
@@ -62,7 +52,4 @@ int truncate64(const char * path, __off64_t length)
return -1;
}
-
-#endif /* __NR_truncate64 */
-
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
diff --git a/libc/sysdeps/linux/frv/fstat64.c b/libc/sysdeps/linux/frv/fstat64.c
index f795342ff..75383b272 100644
--- a/libc/sysdeps/linux/frv/fstat64.c
+++ b/libc/sysdeps/linux/frv/fstat64.c
@@ -9,11 +9,9 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/stat.h>
-#ifdef __UCLIBC_HAS_LFS__
_syscall2(int, fstat64, int, fd, struct stat64 *, buf)
libc_hidden_def(fstat64)
-#endif
diff --git a/libc/sysdeps/linux/frv/lstat64.c b/libc/sysdeps/linux/frv/lstat64.c
index f038fb0e3..e84581c1e 100644
--- a/libc/sysdeps/linux/frv/lstat64.c
+++ b/libc/sysdeps/linux/frv/lstat64.c
@@ -9,11 +9,9 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/stat.h>
-#ifdef __UCLIBC_HAS_LFS__
_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf)
libc_hidden_def(lstat64)
-#endif
diff --git a/libc/sysdeps/linux/frv/stat64.c b/libc/sysdeps/linux/frv/stat64.c
index 675e6349a..a13d1c35d 100644
--- a/libc/sysdeps/linux/frv/stat64.c
+++ b/libc/sysdeps/linux/frv/stat64.c
@@ -9,11 +9,9 @@
* Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
*/
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#include <unistd.h>
#include <sys/stat.h>
-#ifdef __UCLIBC_HAS_LFS__
_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf)
libc_hidden_def(stat64)
-#endif
diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S
index a6b4aa042..33f7db7bb 100644
--- a/libc/sysdeps/linux/i386/mmap64.S
+++ b/libc/sysdeps/linux/i386/mmap64.S
@@ -17,13 +17,12 @@
02111-1307 USA. */
+#include <_lfs_64.h>
#define _ERRNO_H 1
-#include <features.h>
#include <bits/errno.h>
#include <sys/syscall.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
-
+#ifdef __NR_mmap2
#define LINKAGE 4
#define PTR_SIZE 4
diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S
index 5f966a5f0..4b171c057 100644
--- a/libc/sysdeps/linux/i386/posix_fadvise64.S
+++ b/libc/sysdeps/linux/i386/posix_fadvise64.S
@@ -17,9 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <_lfs_64.h>
#include <sys/syscall.h>
-#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__
+#ifdef __NR_fadvise64_64
.text
.global posix_fadvise64
diff --git a/libc/sysdeps/linux/i386/sysdep.h b/libc/sysdeps/linux/i386/sysdep.h
index b06d392a2..4137b9705 100644
--- a/libc/sysdeps/linux/i386/sysdep.h
+++ b/libc/sysdeps/linux/i386/sysdep.h
@@ -150,10 +150,6 @@ __x86.get_pc_thunk.reg: \
#undef __i686
#endif /* __ASSEMBLER__ */
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -444,6 +440,7 @@ __x86.get_pc_thunk.reg: \
# define PTR_DEMANGLE(reg) rorl $9, reg; \
xorl %gs:POINTER_GUARD, reg
# else
+# include <stddef.h>
# define PTR_MANGLE(var) __asm__ ("xorl %%gs:%c2, %0\n" \
"roll $9, %0" \
: "=r" (var) \
diff --git a/libc/sysdeps/linux/mips/posix_fadvise64.c b/libc/sysdeps/linux/mips/posix_fadvise64.c
index f97dab97d..02244aaab 100644
--- a/libc/sysdeps/linux/mips/posix_fadvise64.c
+++ b/libc/sysdeps/linux/mips/posix_fadvise64.c
@@ -13,7 +13,7 @@
#include <bits/wordsize.h>
/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
-#if defined __NR_fadvise64 && defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
+#if defined __NR_fadvise64 && __WORDSIZE == 32
# include <fcntl.h>
# include <endian.h>
diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h
index 83f6b5076..4d6bb86c4 100644
--- a/libpthread/linuxthreads.old/internals.h
+++ b/libpthread/linuxthreads.old/internals.h
@@ -506,7 +506,7 @@ extern __typeof(pthread_mutex_init) __pthread_mutex_init attribute_hidden;
extern __typeof(pthread_mutex_destroy) __pthread_mutex_destroy attribute_hidden;
extern __typeof(pthread_mutex_lock) __pthread_mutex_lock attribute_hidden;
extern __typeof(pthread_mutex_trylock) __pthread_mutex_trylock attribute_hidden;
-extern __typeof(pthread_mutex_unlock) __pthread_mutex_attribute_hidden;
+extern __typeof(pthread_mutex_unlock) __pthread_mutex_unlock attribute_hidden;
/* Prototypes for some of the new semaphore functions. */
extern int __new_sem_post (sem_t * sem);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index 1664af5cf..2f33e9981 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -49,7 +49,7 @@ timer_sigev_thread (void *arg)
surprising for user code, although valid. We unblock all
signals. */
sigset_t ss;
- sigemptyset (&ss);
+ __sigemptyset (&ss);
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
@@ -75,7 +75,7 @@ timer_helper_thread (void *arg)
/* Wait for the SIGTIMER signal, allowing the setXid signal, and
none else. */
sigset_t ss;
- sigemptyset (&ss);
+ __sigemptyset (&ss);
__sigaddset (&ss, SIGTIMER);
/* Endless loop of waiting for signals. The loop is only ended when
diff --git a/librt/timer_create.c b/librt/timer_create.c
index 9298a37c7..f52a36ff9 100644
--- a/librt/timer_create.c
+++ b/librt/timer_create.c
@@ -2,6 +2,7 @@
* timer_create.c - create a per-process timer.
*/
+#include <stddef.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
@@ -13,10 +14,6 @@
#ifdef __NR_timer_create
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
#define __NR___syscall_timer_create __NR_timer_create
static __inline__ _syscall3(int, __syscall_timer_create, clockid_t, clock_id,
struct sigevent *, evp, kernel_timer_t *, ktimerid);