summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/arm/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/arm/sigaction.c2
-rw-r--r--libc/sysdeps/linux/common/__socketcall.c3
-rw-r--r--libc/sysdeps/linux/common/__syscall_ipc.c3
-rw-r--r--libc/sysdeps/linux/common/__syscall_rt_sigaction.c4
-rw-r--r--libc/sysdeps/linux/common/__syscall_sigaction.c4
-rw-r--r--libc/sysdeps/linux/common/capget.c1
-rw-r--r--libc/sysdeps/linux/common/capset.c1
-rw-r--r--libc/sysdeps/linux/common/close.c1
-rw-r--r--libc/sysdeps/linux/common/create_module.c3
-rw-r--r--libc/sysdeps/linux/common/delete_module.c1
-rw-r--r--libc/sysdeps/linux/common/fork.c1
-rw-r--r--libc/sysdeps/linux/common/fsync.c1
-rw-r--r--libc/sysdeps/linux/common/get_kernel_syms.c1
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c1
-rw-r--r--libc/sysdeps/linux/common/getpgid.c1
-rw-r--r--libc/sysdeps/linux/common/getpid.c1
-rw-r--r--libc/sysdeps/linux/common/getresgid.c1
-rw-r--r--libc/sysdeps/linux/common/getresuid.c1
-rw-r--r--libc/sysdeps/linux/common/init_module.c1
-rw-r--r--libc/sysdeps/linux/common/ioperm.c1
-rw-r--r--libc/sysdeps/linux/common/iopl.c1
-rw-r--r--libc/sysdeps/linux/common/klogctl.c1
-rw-r--r--libc/sysdeps/linux/common/llseek.c2
-rw-r--r--libc/sysdeps/linux/common/longjmp.c3
-rw-r--r--libc/sysdeps/linux/common/madvise.c1
-rw-r--r--libc/sysdeps/linux/common/mincore.c1
-rw-r--r--libc/sysdeps/linux/common/modify_ldt.c1
-rw-r--r--libc/sysdeps/linux/common/msync.c1
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c2
-rw-r--r--libc/sysdeps/linux/common/noophooks.c2
-rw-r--r--libc/sysdeps/linux/common/open64.c1
-rw-r--r--libc/sysdeps/linux/common/pause.c1
-rw-r--r--libc/sysdeps/linux/common/pivot_root.c1
-rw-r--r--libc/sysdeps/linux/common/prctl.c3
-rw-r--r--libc/sysdeps/linux/common/pread_write.c7
-rw-r--r--libc/sysdeps/linux/common/query_module.c2
-rw-r--r--libc/sysdeps/linux/common/read.c1
-rw-r--r--libc/sysdeps/linux/common/reboot.c1
-rw-r--r--libc/sysdeps/linux/common/ssp-local.c4
-rw-r--r--libc/sysdeps/linux/common/ssp.c10
-rw-r--r--libc/sysdeps/linux/common/sysctl.c4
-rw-r--r--libc/sysdeps/linux/common/uselib.c1
-rw-r--r--libc/sysdeps/linux/common/wait.c2
-rw-r--r--libc/sysdeps/linux/common/waitpid.c3
-rw-r--r--libc/sysdeps/linux/common/write.c1
-rw-r--r--libc/sysdeps/linux/common/xattr.c3
-rw-r--r--libc/sysdeps/linux/hppa/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/i386/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/i386/sigaction.c1
-rw-r--r--libc/sysdeps/linux/m68k/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/mips/__longjmp.c2
-rw-r--r--libc/sysdeps/linux/mips/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/mips/sigaction.c3
-rw-r--r--libc/sysdeps/linux/powerpc/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/sparc/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/x86_64/__syscall_error.c3
-rw-r--r--libc/sysdeps/linux/x86_64/sigaction.c4
58 files changed, 99 insertions, 28 deletions
diff --git a/libc/sysdeps/linux/arm/__syscall_error.c b/libc/sysdeps/linux/arm/__syscall_error.c
index 32f32e19d..2b642e816 100644
--- a/libc/sysdeps/linux/arm/__syscall_error.c
+++ b/libc/sysdeps/linux/arm/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(int err_no)
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
{
__set_errno(-err_no);
return -1;
diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c
index 90797ba29..07de18420 100644
--- a/libc/sysdeps/linux/arm/sigaction.c
+++ b/libc/sysdeps/linux/arm/sigaction.c
@@ -29,6 +29,8 @@
extern void __default_sa_restorer(void);
extern void __default_rt_sa_restorer(void);
+extern __typeof(sigaction) __libc_sigaction;
+
/* When RT signals are in use we need to use a different return stub. */
#ifdef __NR_rt_sigreturn
#define choose_restorer(flags) \
diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c
index 3e20f54f8..e3807cf06 100644
--- a/libc/sysdeps/linux/common/__socketcall.c
+++ b/libc/sysdeps/linux/common/__socketcall.c
@@ -10,5 +10,6 @@
#include "syscalls.h"
#ifdef __NR_socketcall
#define __NR___socketcall __NR_socketcall
-attribute_hidden _syscall2(int, __socketcall, int, call, unsigned long *, args);
+int __socketcall(int __call, unsigned long *__args) attribute_hidden;
+_syscall2(int, __socketcall, int, call, unsigned long *, args);
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_ipc.c b/libc/sysdeps/linux/common/__syscall_ipc.c
index 6d1bb4b80..decc65ae5 100644
--- a/libc/sysdeps/linux/common/__syscall_ipc.c
+++ b/libc/sysdeps/linux/common/__syscall_ipc.c
@@ -11,6 +11,7 @@
#ifdef __NR_ipc
#define __NR___syscall_ipc __NR_ipc
-attribute_hidden _syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
+#include "../../../misc/sysvipc/ipc.h"
+_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
third, void *, ptr);
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
index 598761f01..cbf963633 100644
--- a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
@@ -12,9 +12,9 @@
#ifdef __NR_rt_sigaction
#include <signal.h>
+int __syscall_rt_sigaction (int __signum, const struct sigaction *__act, struct sigaction *__oldact, size_t __size) attribute_hidden;
#define __NR___syscall_rt_sigaction __NR_rt_sigaction
-#undef sigaction
-attribute_hidden _syscall4(int, __syscall_rt_sigaction, int, signum,
+_syscall4(int, __syscall_rt_sigaction, int, signum,
const struct sigaction *, act, struct sigaction *, oldact,
size_t, size);
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_sigaction.c b/libc/sysdeps/linux/common/__syscall_sigaction.c
index bb04b85bb..73d3b645f 100644
--- a/libc/sysdeps/linux/common/__syscall_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_sigaction.c
@@ -12,8 +12,8 @@
#ifndef __NR_rt_sigaction
#define __NR___syscall_sigaction __NR_sigaction
#include <signal.h>
-#undef sigaction
-attribute_hidden _syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
+int __syscall_sigaction (int __signum, const struct sigaction *__act, struct sigaction *__oldact) attribute_hidden;
+_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
act, struct sigaction *, oldact);
#endif
diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c
index 4cdd7c210..8c28e51a5 100644
--- a/libc/sysdeps/linux/common/capget.c
+++ b/libc/sysdeps/linux/common/capget.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+int capget(void *header, void *data);
#ifdef __NR_capget
_syscall2(int, capget, void *, header, void *, data);
#else
diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c
index 77b7ad9cb..bee720f92 100644
--- a/libc/sysdeps/linux/common/capset.c
+++ b/libc/sysdeps/linux/common/capset.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+int capset(void *header, const void *data);
#ifdef __NR_capset
_syscall2(int, capset, void *, header, const void *, data);
#else
diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c
index bc4cc7e74..52566acda 100644
--- a/libc/sysdeps/linux/common/close.c
+++ b/libc/sysdeps/linux/common/close.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(close) __libc_close;
#define __NR___libc_close __NR_close
_syscall1(int, __libc_close, int, fd);
libc_hidden_proto(close)
diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
index 461ba5bc5..9a5c2d267 100644
--- a/libc/sysdeps/linux/common/create_module.c
+++ b/libc/sysdeps/linux/common/create_module.c
@@ -13,6 +13,8 @@
#ifdef __NR_create_module
+unsigned long create_module(const char *name, size_t size);
+
#if defined(__UCLIBC_BROKEN_CREATE_MODULE__)
# define __NR___create_module __NR_create_module
static inline _syscall2(long, __create_module, const char *, name, size_t, size);
@@ -46,6 +48,7 @@ _syscall2(unsigned long, create_module, const char *, name, size_t, size);
#endif
#else /* !__NR_create_module */
+caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused);
caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused)
{
__set_errno(ENOSYS);
diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c
index 96f5ab492..66a1610d3 100644
--- a/libc/sysdeps/linux/common/delete_module.c
+++ b/libc/sysdeps/linux/common/delete_module.c
@@ -7,6 +7,7 @@
*/
#include "syscalls.h"
+int delete_module(const char *name);
#ifdef __NR_delete_module
_syscall1(int, delete_module, const char *, name);
#else
diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c
index eb4001f7e..a4e623900 100644
--- a/libc/sysdeps/linux/common/fork.c
+++ b/libc/sysdeps/linux/common/fork.c
@@ -12,6 +12,7 @@
#ifdef __ARCH_HAS_MMU__
#ifdef __NR_fork
+extern __typeof(fork) __libc_fork;
#define __NR___libc_fork __NR_fork
_syscall0(pid_t, __libc_fork);
libc_hidden_proto(fork)
diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c
index 6db63527a..677f3e3d6 100644
--- a/libc/sysdeps/linux/common/fsync.c
+++ b/libc/sysdeps/linux/common/fsync.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(fsync) __libc_fsync;
#define __NR___libc_fsync __NR_fsync
_syscall1(int, __libc_fsync, int, fd);
weak_alias(__libc_fsync, fsync)
diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c
index d00152686..2c2d9c028 100644
--- a/libc/sysdeps/linux/common/get_kernel_syms.c
+++ b/libc/sysdeps/linux/common/get_kernel_syms.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
struct kernel_sym;
+int get_kernel_syms(struct kernel_sym *table attribute_unused);
#ifdef __NR_get_kernel_syms
_syscall1(int, get_kernel_syms, struct kernel_sym *, table);
#else
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 1f2937bb6..4a35d0775 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -25,6 +25,7 @@ libc_hidden_proto(__pagesize)
/* Return the system page size. */
/* couldn't make __getpagesize hidden, because shm.h uses it in a macro */
+extern __typeof(getpagesize) __getpagesize;
int __getpagesize(void)
{
if (__pagesize != 0)
diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c
index c71be810b..6cdaef172 100644
--- a/libc/sysdeps/linux/common/getpgid.c
+++ b/libc/sysdeps/linux/common/getpgid.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+#include <unistd.h>
#define __NR___syscall_getpgid __NR_getpgid
static inline _syscall1(__kernel_pid_t, __syscall_getpgid, __kernel_pid_t, pid);
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index d2e5a33e6..a966a531e 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(getpid) __libc_getpid;
#if defined __NR_getxpid
# define __NR_getpid __NR_getxpid
#endif
diff --git a/libc/sysdeps/linux/common/getresgid.c b/libc/sysdeps/linux/common/getresgid.c
index d6ad980a2..b7f1cbc6c 100644
--- a/libc/sysdeps/linux/common/getresgid.c
+++ b/libc/sysdeps/linux/common/getresgid.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+#include <unistd.h>
#ifdef __NR_getresgid
# define __NR___syscall_getresgid __NR_getresgid
diff --git a/libc/sysdeps/linux/common/getresuid.c b/libc/sysdeps/linux/common/getresuid.c
index 7e087d8dd..37b5191c1 100644
--- a/libc/sysdeps/linux/common/getresuid.c
+++ b/libc/sysdeps/linux/common/getresuid.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+#include <unistd.h>
#ifdef __NR_getresuid
# define __NR___syscall_getresuid __NR_getresuid
diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c
index 558a59708..3fb566961 100644
--- a/libc/sysdeps/linux/common/init_module.c
+++ b/libc/sysdeps/linux/common/init_module.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+int init_module(void *first, void *second, void *third, void *fourth, void *fifth);
#ifdef __NR_init_module
/* 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,
diff --git a/libc/sysdeps/linux/common/ioperm.c b/libc/sysdeps/linux/common/ioperm.c
index 61794bb1b..d4795f526 100644
--- a/libc/sysdeps/linux/common/ioperm.c
+++ b/libc/sysdeps/linux/common/ioperm.c
@@ -9,5 +9,6 @@
#include "syscalls.h"
#if defined __ARCH_HAS_MMU__ && defined __NR_ioperm
+#include <sys/perm.h>
_syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on);
#endif
diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c
index 5d5cffb16..4f21b55f5 100644
--- a/libc/sysdeps/linux/common/iopl.c
+++ b/libc/sysdeps/linux/common/iopl.c
@@ -10,5 +10,6 @@
#include "syscalls.h"
/* Tuns out the m68k unistd.h kernel header is broken */
#if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
+#include <sys/perm.h>
_syscall1(int, iopl, int, level);
#endif
diff --git a/libc/sysdeps/linux/common/klogctl.c b/libc/sysdeps/linux/common/klogctl.c
index a77e4cb96..5e36104f1 100644
--- a/libc/sysdeps/linux/common/klogctl.c
+++ b/libc/sysdeps/linux/common/klogctl.c
@@ -9,6 +9,7 @@
#include "syscalls.h"
#include <unistd.h>
+#include <sys/klog.h>
#define __NR__syslog __NR_syslog
static inline _syscall3(int, _syslog, int, type, char *, buf, int, len);
int klogctl(int type, char *buf, int len)
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index 429a58212..6a8d000d2 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -10,6 +10,8 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(lseek64) __libc_lseek64;
+
#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
# ifndef INLINE_SYSCALL
diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c
index c3ed98a7a..a54f01f48 100644
--- a/libc/sysdeps/linux/common/longjmp.c
+++ b/libc/sysdeps/linux/common/longjmp.c
@@ -25,10 +25,11 @@ libc_hidden_proto(sigprocmask)
extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
libc_hidden_proto(__longjmp)
+extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
/* Set the signal mask to the one specified in ENV, and jump
to the position specified in ENV, causing the setjmp
call there to return VAL, or 1 if VAL is 0. */
-void attribute_noreturn __libc_longjmp (sigjmp_buf env, int val)
+void __libc_longjmp (sigjmp_buf env, int val)
{
#if 0
/* Perform any cleanups needed by the frames being unwound. */
diff --git a/libc/sysdeps/linux/common/madvise.c b/libc/sysdeps/linux/common/madvise.c
index fa4f38046..70ed9c4cb 100644
--- a/libc/sysdeps/linux/common/madvise.c
+++ b/libc/sysdeps/linux/common/madvise.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+#include <sys/mman.h>
#ifdef __NR_madvise
_syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);
#endif
diff --git a/libc/sysdeps/linux/common/mincore.c b/libc/sysdeps/linux/common/mincore.c
index 530f7b67d..0e3ade1ce 100644
--- a/libc/sysdeps/linux/common/mincore.c
+++ b/libc/sysdeps/linux/common/mincore.c
@@ -8,6 +8,7 @@
#include "syscalls.h"
#include <unistd.h>
+#include <sys/mman.h>
#ifdef __NR_mincore
_syscall3(int, mincore, void *, start, size_t, length, unsigned char *, vec);
diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c
index 3df6379b0..9ebb68b3c 100644
--- a/libc/sysdeps/linux/common/modify_ldt.c
+++ b/libc/sysdeps/linux/common/modify_ldt.c
@@ -9,6 +9,7 @@
#include "syscalls.h"
+int modify_ldt (int func, void *ptr, unsigned long bytecount);
#ifdef __NR_modify_ldt
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount);
#endif
diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c
index d9d733466..494d4afd3 100644
--- a/libc/sysdeps/linux/common/msync.c
+++ b/libc/sysdeps/linux/common/msync.c
@@ -11,6 +11,7 @@
#include <unistd.h>
#include <sys/mman.h>
+extern __typeof(msync) __libc_msync;
#define __NR___libc_msync __NR_msync
_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags);
weak_alias(__libc_msync,msync)
diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c
index e400a06c5..1724540ed 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -10,7 +10,7 @@
#include "syscalls.h"
#include <time.h>
-
+extern __typeof(nanosleep) __libc_nanosleep;
#define __NR___libc_nanosleep __NR_nanosleep
_syscall2(int, __libc_nanosleep, const struct timespec *, req,
struct timespec *, rem);
diff --git a/libc/sysdeps/linux/common/noophooks.c b/libc/sysdeps/linux/common/noophooks.c
index b8c33eeac..a6c9d7673 100644
--- a/libc/sysdeps/linux/common/noophooks.c
+++ b/libc/sysdeps/linux/common/noophooks.c
@@ -21,6 +21,8 @@
#include <libc-internal.h>
void
+__cyg_profile_func_enter (attribute_unused void *this_fn, attribute_unused void *call_site);
+void
__cyg_profile_func_enter (attribute_unused void *this_fn, attribute_unused void *call_site)
{
}
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index 3fca783cd..cd4ce64ec 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -14,6 +14,7 @@
# define O_LARGEFILE 0100000
#endif
+extern __typeof(open64) __libc_open64;
extern __typeof(open) __libc_open;
libc_hidden_proto(__libc_open)
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index ac39105a1..751b6b6a9 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -11,6 +11,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(pause) __libc_pause;
#ifdef __NR_pause
#define __NR___libc_pause __NR_pause
_syscall0(int, __libc_pause);
diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c
index a182df9b4..f5d1f1d7f 100644
--- a/libc/sysdeps/linux/common/pivot_root.c
+++ b/libc/sysdeps/linux/common/pivot_root.c
@@ -9,6 +9,7 @@
#include "syscalls.h"
+int pivot_root(const char *new_root, const char *put_old);
#ifdef __NR_pivot_root
_syscall2(int, pivot_root, const char *, new_root, const char *, put_old);
#else
diff --git a/libc/sysdeps/linux/common/prctl.c b/libc/sysdeps/linux/common/prctl.c
index a75ac2cf5..479c9657a 100644
--- a/libc/sysdeps/linux/common/prctl.c
+++ b/libc/sysdeps/linux/common/prctl.c
@@ -9,5 +9,6 @@
#include "syscalls.h"
#include <stdarg.h>
-//#include <sys/prctl.h>
+/* psm: including sys/prctl.h would depend on kernel headers */
+extern int prctl (int, int, int, int, int);
_syscall5(int, prctl, int, a, int, b, int, c, int, d, int, e);
diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
index f1b6cb867..119abe9ea 100644
--- a/libc/sysdeps/linux/common/pread_write.c
+++ b/libc/sysdeps/linux/common/pread_write.c
@@ -17,6 +17,13 @@
#include <unistd.h>
#include <stdint.h>
+extern __typeof(pread) __libc_pread;
+extern __typeof(pwrite) __libc_pwrite;
+#ifdef __UCLIBC_HAS_LFS__
+extern __typeof(pread64) __libc_pread64;
+extern __typeof(pwrite64) __libc_pwrite64;
+#endif
+
#ifdef __NR_pread
# define __NR___syscall_pread __NR_pread
diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c
index e65e32d7f..ac77f7e18 100644
--- a/libc/sysdeps/linux/common/query_module.c
+++ b/libc/sysdeps/linux/common/query_module.c
@@ -8,6 +8,8 @@
*/
#include "syscalls.h"
+int query_module(const char *name attribute_unused, int which attribute_unused,
+ void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused);
#ifdef __NR_query_module
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t *, ret);
diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c
index 769814c0c..9dfac1939 100644
--- a/libc/sysdeps/linux/common/read.c
+++ b/libc/sysdeps/linux/common/read.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(read) __libc_read;
#define __NR___libc_read __NR_read
_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count);
libc_hidden_proto(read)
diff --git a/libc/sysdeps/linux/common/reboot.c b/libc/sysdeps/linux/common/reboot.c
index 8347ebfe8..a015d40ad 100644
--- a/libc/sysdeps/linux/common/reboot.c
+++ b/libc/sysdeps/linux/common/reboot.c
@@ -8,6 +8,7 @@
*/
#include "syscalls.h"
+#include <sys/reboot.h>
#define __NR__reboot __NR_reboot
static inline _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
int reboot(int flag)
diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c
index 091c34c5d..202d956a5 100644
--- a/libc/sysdeps/linux/common/ssp-local.c
+++ b/libc/sysdeps/linux/common/ssp-local.c
@@ -28,8 +28,8 @@ extern void __stack_chk_fail (void) attribute_noreturn;
/* On some architectures, this helps needless PIC pointer setup
that would be needed just for the __stack_chk_fail call. */
-void attribute_noreturn attribute_hidden
-__stack_chk_fail_local (void)
+void __stack_chk_fail_local (void) attribute_noreturn attribute_hidden;
+void __stack_chk_fail_local (void)
{
__stack_chk_fail ();
}
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 33d84e5eb..16b9f9c10 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -80,8 +80,8 @@ static attribute_noreturn void terminate(void)
_exit(127);
}
-void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
-void attribute_noreturn __stack_smash_handler(char func[], int damaged)
+void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn;
+void __stack_smash_handler(char func[], int damaged)
{
static const char message[] = ": stack smashing attack in function ";
@@ -94,7 +94,8 @@ void attribute_noreturn __stack_smash_handler(char func[], int damaged)
terminate();
}
-void attribute_noreturn __stack_chk_fail(void)
+void __stack_chk_fail(void) attribute_noreturn;
+void __stack_chk_fail(void)
{
static const char msg1[] = "stack smashing detected: ";
static const char msg3[] = " terminated";
@@ -109,7 +110,8 @@ void attribute_noreturn __stack_chk_fail(void)
}
#if 0
-void attribute_noreturn __chk_fail(void)
+void __chk_fail(void) attribute_noreturn;
+void __chk_fail(void)
{
static const char msg1[] = "buffer overflow detected: ";
static const char msg3[] = " terminated";
diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c
index 8359577bc..0d6f49185 100644
--- a/libc/sysdeps/linux/common/sysctl.c
+++ b/libc/sysdeps/linux/common/sysctl.c
@@ -8,6 +8,10 @@
*/
#include "syscalls.h"
+/* psm: including sys/sysctl.h would depend on kernel headers */
+extern int sysctl (int *__name, int __nlen, void *__oldval,
+ size_t *__oldlenp, void *__newval, size_t __newlen) __THROW;
+
struct __sysctl_args {
int *name;
int nlen;
diff --git a/libc/sysdeps/linux/common/uselib.c b/libc/sysdeps/linux/common/uselib.c
index 952169f90..3ccde1de4 100644
--- a/libc/sysdeps/linux/common/uselib.c
+++ b/libc/sysdeps/linux/common/uselib.c
@@ -10,5 +10,6 @@
#include "syscalls.h"
#include <unistd.h>
#ifdef __NR_uselib
+int uselib (const char *library);
_syscall1(int, uselib, const char *, library);
#endif
diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c
index 3d30d3d0f..39d0e47b9 100644
--- a/libc/sysdeps/linux/common/wait.c
+++ b/libc/sysdeps/linux/common/wait.c
@@ -12,6 +12,8 @@
libc_hidden_proto(wait4)
+extern __typeof(wait) __libc_wait;
+
/* Wait for a child to die. When one does, put its status in *STAT_LOC
* and return its process ID. For errors, return (pid_t) -1. */
__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc)
diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c
index ae3aa5d34..c9ca97c53 100644
--- a/libc/sysdeps/linux/common/waitpid.c
+++ b/libc/sysdeps/linux/common/waitpid.c
@@ -11,7 +11,8 @@
#include <sys/resource.h>
libc_hidden_proto(wait4)
-
+
+extern __typeof(waitpid) __libc_waitpid;
__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options)
{
return wait4(pid, wait_stat, options, NULL);
diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c
index 67e50cc20..680a5d130 100644
--- a/libc/sysdeps/linux/common/write.c
+++ b/libc/sysdeps/linux/common/write.c
@@ -10,6 +10,7 @@
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(write) __libc_write;
#define __NR___libc_write __NR_write
_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count);
libc_hidden_proto(write)
diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c
index 259ccc155..6e4e7fa92 100644
--- a/libc/sysdeps/linux/common/xattr.c
+++ b/libc/sysdeps/linux/common/xattr.c
@@ -23,6 +23,7 @@
#include "syscalls.h"
#include <unistd.h>
+#include <sys/xattr.h>
/* sets */
#ifdef __NR_setxattr
@@ -122,7 +123,7 @@ ssize_t llistxattr(__const char *__path, char *__list, size_t __size)
#endif
#ifdef __NR_flistxattr
-_syscall3(size_t, flistxattr, int, filedes, char *, list, size_t, size);
+_syscall3(ssize_t, flistxattr, int, filedes, char *, list, size_t, size);
#else
ssize_t flistxattr(int __fd, char *__list, size_t __size)
{
diff --git a/libc/sysdeps/linux/hppa/__syscall_error.c b/libc/sysdeps/linux/hppa/__syscall_error.c
index 7d24ed233..5e109a83b 100644
--- a/libc/sysdeps/linux/hppa/__syscall_error.c
+++ b/libc/sysdeps/linux/hppa/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(int err_no)
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
{
__set_errno(err_no);
return -1;
diff --git a/libc/sysdeps/linux/i386/__syscall_error.c b/libc/sysdeps/linux/i386/__syscall_error.c
index 63540540e..7509d4409 100644
--- a/libc/sysdeps/linux/i386/__syscall_error.c
+++ b/libc/sysdeps/linux/i386/__syscall_error.c
@@ -25,7 +25,8 @@
#include <errno.h>
#include <features.h>
-int attribute_hidden __syscall_error(void)
+int __syscall_error(void) attribute_hidden;
+int __syscall_error(void)
{
register int edx __asm__ ("%edx");
__asm__ ("mov %eax, %edx\n\t"
diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c
index 8d7ba2127..edabe3f9d 100644
--- a/libc/sysdeps/linux/i386/sigaction.c
+++ b/libc/sysdeps/linux/i386/sigaction.c
@@ -27,6 +27,7 @@
#define SA_RESTORER 0x04000000
+extern __typeof(sigaction) __libc_sigaction;
#if defined __NR_rt_sigaction
libc_hidden_proto(memcpy)
diff --git a/libc/sysdeps/linux/m68k/__syscall_error.c b/libc/sysdeps/linux/m68k/__syscall_error.c
index c0aa33b16..5cfdead8b 100644
--- a/libc/sysdeps/linux/m68k/__syscall_error.c
+++ b/libc/sysdeps/linux/m68k/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(void)
+int __syscall_error(void) attribute_hidden;
+int __syscall_error(void)
{
register int err_no asm("%d0");
__set_errno(-err_no);
diff --git a/libc/sysdeps/linux/mips/__longjmp.c b/libc/sysdeps/linux/mips/__longjmp.c
index 7366fc22d..ee9c455cc 100644
--- a/libc/sysdeps/linux/mips/__longjmp.c
+++ b/libc/sysdeps/linux/mips/__longjmp.c
@@ -28,7 +28,7 @@
extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
libc_hidden_proto(__longjmp)
-void attribute_noreturn __longjmp (__jmp_buf env, int val_arg)
+void __longjmp (__jmp_buf env, int val_arg)
{
/* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
the hack around it); force it to use $a1 for the longjmp value.
diff --git a/libc/sysdeps/linux/mips/__syscall_error.c b/libc/sysdeps/linux/mips/__syscall_error.c
index 7d24ed233..5e109a83b 100644
--- a/libc/sysdeps/linux/mips/__syscall_error.c
+++ b/libc/sysdeps/linux/mips/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(int err_no)
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
{
__set_errno(err_no);
return -1;
diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c
index f881fac5d..85cdabe79 100644
--- a/libc/sysdeps/linux/mips/sigaction.c
+++ b/libc/sysdeps/linux/mips/sigaction.c
@@ -27,8 +27,9 @@
#define SA_RESTORER 0x04000000
+extern __typeof(sigaction) __libc_sigaction;
-#if defined __NR_rt_sigaction
+#ifdef __NR_rt_sigaction
libc_hidden_proto(memcpy)
diff --git a/libc/sysdeps/linux/powerpc/__syscall_error.c b/libc/sysdeps/linux/powerpc/__syscall_error.c
index 7d24ed233..5e109a83b 100644
--- a/libc/sysdeps/linux/powerpc/__syscall_error.c
+++ b/libc/sysdeps/linux/powerpc/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(int err_no)
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
{
__set_errno(err_no);
return -1;
diff --git a/libc/sysdeps/linux/sparc/__syscall_error.c b/libc/sysdeps/linux/sparc/__syscall_error.c
index 7d24ed233..5e109a83b 100644
--- a/libc/sysdeps/linux/sparc/__syscall_error.c
+++ b/libc/sysdeps/linux/sparc/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(int err_no)
+int __syscall_error(int err_no) attribute_hidden;
+int __syscall_error(int err_no)
{
__set_errno(err_no);
return -1;
diff --git a/libc/sysdeps/linux/x86_64/__syscall_error.c b/libc/sysdeps/linux/x86_64/__syscall_error.c
index 0b82faacb..ff2d9f64c 100644
--- a/libc/sysdeps/linux/x86_64/__syscall_error.c
+++ b/libc/sysdeps/linux/x86_64/__syscall_error.c
@@ -10,7 +10,8 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int attribute_hidden __syscall_error(void)
+int __syscall_error(void) attribute_hidden;
+int __syscall_error(void)
{
register int err_no asm("%rax");
__set_errno(-err_no);
diff --git a/libc/sysdeps/linux/x86_64/sigaction.c b/libc/sysdeps/linux/x86_64/sigaction.c
index 63d146136..b8d3861a4 100644
--- a/libc/sysdeps/linux/x86_64/sigaction.c
+++ b/libc/sysdeps/linux/x86_64/sigaction.c
@@ -33,7 +33,9 @@
/* We do not globally define the SA_RESTORER flag so do it here. */
#define SA_RESTORER 0x04000000
-#if defined __NR_rt_sigaction
+extern __typeof(sigaction) __libc_sigaction;
+
+#ifdef __NR_rt_sigaction
/* Using the hidden attribute here does not change the code but it
helps to avoid warnings. */
extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;