summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/__rt_sigtimedwait.c2
-rw-r--r--libc/sysdeps/linux/common/__rt_sigwaitinfo.c2
-rw-r--r--libc/sysdeps/linux/common/__socketcall.c2
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl.c2
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl64.c4
-rw-r--r--libc/sysdeps/linux/common/__syscall_rt_sigaction.c6
-rw-r--r--libc/sysdeps/linux/common/__syscall_sigaction.c2
-rw-r--r--libc/sysdeps/linux/common/access.c2
-rw-r--r--libc/sysdeps/linux/common/acct.c2
-rw-r--r--libc/sysdeps/linux/common/adjtimex.c4
-rw-r--r--libc/sysdeps/linux/common/alarm.c2
-rw-r--r--libc/sysdeps/linux/common/arch_prctl.c2
-rw-r--r--libc/sysdeps/linux/common/bdflush.c2
-rw-r--r--libc/sysdeps/linux/common/bits/confname.h43
-rw-r--r--libc/sysdeps/linux/common/bits/dlfcn.h27
-rw-r--r--libc/sysdeps/linux/common/bits/errno.h35
-rw-r--r--libc/sysdeps/linux/common/bits/huge_val.h66
-rw-r--r--libc/sysdeps/linux/common/bits/local_lim.h28
-rw-r--r--libc/sysdeps/linux/common/bits/mathcalls.h80
-rw-r--r--libc/sysdeps/linux/common/bits/mathdef.h6
-rw-r--r--libc/sysdeps/linux/common/bits/posix1_lim.h1
-rw-r--r--libc/sysdeps/linux/common/bits/posix_opt.h194
-rw-r--r--libc/sysdeps/linux/common/bits/resource.h33
-rw-r--r--libc/sysdeps/linux/common/bits/shm.h1
-rw-r--r--libc/sysdeps/linux/common/bits/siginfo.h26
-rw-r--r--libc/sysdeps/linux/common/bits/signum.h4
-rw-r--r--libc/sysdeps/linux/common/bits/sigthread.h26
-rw-r--r--libc/sysdeps/linux/common/bits/socket.h17
-rw-r--r--libc/sysdeps/linux/common/bits/stat.h49
-rw-r--r--libc/sysdeps/linux/common/bits/syscalls.h4
-rw-r--r--libc/sysdeps/linux/common/bits/termios.h1
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_errno.h9
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_local_lim.h7
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_mutex.h58
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_stdio.h111
-rw-r--r--libc/sysdeps/linux/common/bits/uio.h2
-rw-r--r--libc/sysdeps/linux/common/bits/waitstatus.h18
-rw-r--r--libc/sysdeps/linux/common/capget.c2
-rw-r--r--libc/sysdeps/linux/common/capset.c2
-rw-r--r--libc/sysdeps/linux/common/chdir.c2
-rw-r--r--libc/sysdeps/linux/common/chmod.c2
-rw-r--r--libc/sysdeps/linux/common/chown.c17
-rw-r--r--libc/sysdeps/linux/common/chroot.c2
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c15
-rw-r--r--libc/sysdeps/linux/common/clock_gettime.c2
-rw-r--r--libc/sysdeps/linux/common/clock_settime.c2
-rw-r--r--libc/sysdeps/linux/common/close.c2
-rw-r--r--libc/sysdeps/linux/common/creat64.c9
-rw-r--r--libc/sysdeps/linux/common/delete_module.c2
-rw-r--r--libc/sysdeps/linux/common/dup.c2
-rw-r--r--libc/sysdeps/linux/common/dup2.c2
-rw-r--r--libc/sysdeps/linux/common/epoll.c2
-rw-r--r--libc/sysdeps/linux/common/execve.c2
-rw-r--r--libc/sysdeps/linux/common/fchdir.c2
-rw-r--r--libc/sysdeps/linux/common/fchmod.c2
-rw-r--r--libc/sysdeps/linux/common/fchown.c16
-rw-r--r--libc/sysdeps/linux/common/fdatasync.c2
-rw-r--r--libc/sysdeps/linux/common/flock.c2
-rw-r--r--libc/sysdeps/linux/common/fork.c16
-rw-r--r--libc/sysdeps/linux/common/fpu_control.h2
-rw-r--r--libc/sysdeps/linux/common/fstat.c2
-rw-r--r--libc/sysdeps/linux/common/fstat64.c2
-rw-r--r--libc/sysdeps/linux/common/fstatfs.c28
-rw-r--r--libc/sysdeps/linux/common/fsync.c2
-rw-r--r--libc/sysdeps/linux/common/ftruncate.c2
-rw-r--r--libc/sysdeps/linux/common/get_kernel_syms.c2
-rw-r--r--libc/sysdeps/linux/common/getcwd.c10
-rw-r--r--libc/sysdeps/linux/common/getdents.c44
-rw-r--r--libc/sysdeps/linux/common/getdents64.c3
-rw-r--r--libc/sysdeps/linux/common/getdirname.c2
-rw-r--r--libc/sysdeps/linux/common/getdtablesize.c3
-rw-r--r--libc/sysdeps/linux/common/getegid.c2
-rw-r--r--libc/sysdeps/linux/common/geteuid.c2
-rw-r--r--libc/sysdeps/linux/common/getgid.c8
-rw-r--r--libc/sysdeps/linux/common/getgroups.c5
-rw-r--r--libc/sysdeps/linux/common/getitimer.c2
-rw-r--r--libc/sysdeps/linux/common/getpgid.c5
-rw-r--r--libc/sysdeps/linux/common/getpgrp.c3
-rw-r--r--libc/sysdeps/linux/common/getpid.c2
-rw-r--r--libc/sysdeps/linux/common/getppid.c2
-rw-r--r--libc/sysdeps/linux/common/getpriority.c2
-rw-r--r--libc/sysdeps/linux/common/getresgid.c2
-rw-r--r--libc/sysdeps/linux/common/getresuid.c2
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c4
-rw-r--r--libc/sysdeps/linux/common/getrusage.c2
-rw-r--r--libc/sysdeps/linux/common/getsid.c2
-rw-r--r--libc/sysdeps/linux/common/gettimeofday.c2
-rw-r--r--libc/sysdeps/linux/common/getuid.c10
-rw-r--r--libc/sysdeps/linux/common/init_module.c2
-rw-r--r--libc/sysdeps/linux/common/inotify.c2
-rw-r--r--libc/sysdeps/linux/common/ioctl.c2
-rw-r--r--libc/sysdeps/linux/common/ioperm.c2
-rw-r--r--libc/sysdeps/linux/common/iopl.c2
-rw-r--r--libc/sysdeps/linux/common/kill.c2
-rw-r--r--libc/sysdeps/linux/common/klogctl.c2
-rw-r--r--libc/sysdeps/linux/common/lchown.c17
-rw-r--r--libc/sysdeps/linux/common/link.c2
-rw-r--r--libc/sysdeps/linux/common/llseek.c4
-rw-r--r--libc/sysdeps/linux/common/lseek.c11
-rw-r--r--libc/sysdeps/linux/common/lstat.c2
-rw-r--r--libc/sysdeps/linux/common/lstat64.c2
-rw-r--r--libc/sysdeps/linux/common/madvise.c2
-rw-r--r--libc/sysdeps/linux/common/mincore.c6
-rw-r--r--libc/sysdeps/linux/common/mkdir.c2
-rw-r--r--libc/sysdeps/linux/common/mknod.c2
-rw-r--r--libc/sysdeps/linux/common/mlock.c2
-rw-r--r--libc/sysdeps/linux/common/mlockall.c2
-rw-r--r--libc/sysdeps/linux/common/mmap.c31
-rw-r--r--libc/sysdeps/linux/common/mmap64.c8
-rw-r--r--libc/sysdeps/linux/common/modify_ldt.c2
-rw-r--r--libc/sysdeps/linux/common/mount.c2
-rw-r--r--libc/sysdeps/linux/common/mprotect.c5
-rw-r--r--libc/sysdeps/linux/common/mremap.c7
-rw-r--r--libc/sysdeps/linux/common/msync.c2
-rw-r--r--libc/sysdeps/linux/common/munlock.c2
-rw-r--r--libc/sysdeps/linux/common/munlockall.c6
-rw-r--r--libc/sysdeps/linux/common/munmap.c2
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c2
-rw-r--r--libc/sysdeps/linux/common/nice.c2
-rw-r--r--libc/sysdeps/linux/common/open.c28
-rw-r--r--libc/sysdeps/linux/common/open64.c15
-rw-r--r--libc/sysdeps/linux/common/pause.c3
-rw-r--r--libc/sysdeps/linux/common/personality.c2
-rw-r--r--libc/sysdeps/linux/common/pipe.c2
-rw-r--r--libc/sysdeps/linux/common/pivot_root.c2
-rw-r--r--libc/sysdeps/linux/common/poll.c6
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c22
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c21
-rw-r--r--libc/sysdeps/linux/common/prctl.c5
-rw-r--r--libc/sysdeps/linux/common/pread_write.c77
-rw-r--r--libc/sysdeps/linux/common/ptrace.c7
-rw-r--r--libc/sysdeps/linux/common/query_module.c2
-rw-r--r--libc/sysdeps/linux/common/quotactl.c5
-rw-r--r--libc/sysdeps/linux/common/read.c2
-rw-r--r--libc/sysdeps/linux/common/readlink.c7
-rw-r--r--libc/sysdeps/linux/common/readv.c4
-rw-r--r--libc/sysdeps/linux/common/reboot.c2
-rw-r--r--libc/sysdeps/linux/common/rename.c2
-rw-r--r--libc/sysdeps/linux/common/rmdir.c2
-rw-r--r--libc/sysdeps/linux/common/sbrk.c7
-rw-r--r--libc/sysdeps/linux/common/sched_get_priority_max.c2
-rw-r--r--libc/sysdeps/linux/common/sched_get_priority_min.c2
-rw-r--r--libc/sysdeps/linux/common/sched_getparam.c3
-rw-r--r--libc/sysdeps/linux/common/sched_getscheduler.c3
-rw-r--r--libc/sysdeps/linux/common/sched_rr_get_interval.c3
-rw-r--r--libc/sysdeps/linux/common/sched_setparam.c3
-rw-r--r--libc/sysdeps/linux/common/sched_setscheduler.c3
-rw-r--r--libc/sysdeps/linux/common/sched_yield.c2
-rw-r--r--libc/sysdeps/linux/common/select.c2
-rw-r--r--libc/sysdeps/linux/common/sendfile.c6
-rw-r--r--libc/sysdeps/linux/common/setdomainname.c2
-rw-r--r--libc/sysdeps/linux/common/seteuid.c5
-rw-r--r--libc/sysdeps/linux/common/setfsgid.c16
-rw-r--r--libc/sysdeps/linux/common/setfsuid.c16
-rw-r--r--libc/sysdeps/linux/common/setgid.c16
-rw-r--r--libc/sysdeps/linux/common/setgroups.c5
-rw-r--r--libc/sysdeps/linux/common/sethostname.c2
-rw-r--r--libc/sysdeps/linux/common/setitimer.c2
-rw-r--r--libc/sysdeps/linux/common/setpgid.c5
-rw-r--r--libc/sysdeps/linux/common/setpriority.c2
-rw-r--r--libc/sysdeps/linux/common/setregid.c17
-rw-r--r--libc/sysdeps/linux/common/setresgid.c12
-rw-r--r--libc/sysdeps/linux/common/setresuid.c14
-rw-r--r--libc/sysdeps/linux/common/setreuid.c17
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c2
-rw-r--r--libc/sysdeps/linux/common/setsid.c2
-rw-r--r--libc/sysdeps/linux/common/settimeofday.c2
-rw-r--r--libc/sysdeps/linux/common/setuid.c16
-rw-r--r--libc/sysdeps/linux/common/sigaltstack.c6
-rw-r--r--libc/sysdeps/linux/common/sigpending.c5
-rw-r--r--libc/sysdeps/linux/common/sigprocmask.c14
-rw-r--r--libc/sysdeps/linux/common/sigqueue.c4
-rw-r--r--libc/sysdeps/linux/common/sigsuspend.c8
-rw-r--r--libc/sysdeps/linux/common/ssp.c4
-rw-r--r--libc/sysdeps/linux/common/stat.c2
-rw-r--r--libc/sysdeps/linux/common/stat64.c2
-rw-r--r--libc/sysdeps/linux/common/statfs.c14
-rw-r--r--libc/sysdeps/linux/common/stime.c2
-rw-r--r--libc/sysdeps/linux/common/swapoff.c7
-rw-r--r--libc/sysdeps/linux/common/swapon.c7
-rw-r--r--libc/sysdeps/linux/common/symlink.c4
-rw-r--r--libc/sysdeps/linux/common/sync.c7
-rw-r--r--libc/sysdeps/linux/common/syscalls.h1
-rw-r--r--libc/sysdeps/linux/common/sysctl.c17
-rw-r--r--libc/sysdeps/linux/common/sysfs.c5
-rw-r--r--libc/sysdeps/linux/common/sysinfo.c2
-rw-r--r--libc/sysdeps/linux/common/time.c4
-rw-r--r--libc/sysdeps/linux/common/times.c2
-rw-r--r--libc/sysdeps/linux/common/truncate.c2
-rw-r--r--libc/sysdeps/linux/common/truncate64.c2
-rw-r--r--libc/sysdeps/linux/common/ulimit.c2
-rw-r--r--libc/sysdeps/linux/common/umask.c2
-rw-r--r--libc/sysdeps/linux/common/umount.c5
-rw-r--r--libc/sysdeps/linux/common/umount2.c7
-rw-r--r--libc/sysdeps/linux/common/uname.c2
-rw-r--r--libc/sysdeps/linux/common/unlink.c2
-rw-r--r--libc/sysdeps/linux/common/uselib.c5
-rw-r--r--libc/sysdeps/linux/common/ustat.c2
-rw-r--r--libc/sysdeps/linux/common/utime.c9
-rw-r--r--libc/sysdeps/linux/common/utimes.c3
-rw-r--r--libc/sysdeps/linux/common/vfork.c4
-rw-r--r--libc/sysdeps/linux/common/vhangup.c2
-rw-r--r--libc/sysdeps/linux/common/wait3.c5
-rw-r--r--libc/sysdeps/linux/common/wait4.c4
-rw-r--r--libc/sysdeps/linux/common/write.c2
-rw-r--r--libc/sysdeps/linux/common/writev.c7
-rw-r--r--libc/sysdeps/linux/common/xattr.c2
-rw-r--r--libc/sysdeps/linux/common/xstatconv.c11
209 files changed, 1171 insertions, 719 deletions
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index 4aaebefa0..554c6b9cb 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -8,7 +8,7 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <signal.h>
#include <string.h>
diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
index d7ec55402..5a35a5d49 100644
--- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
+++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c
@@ -8,7 +8,7 @@
* GNU Library General Public License (LGPL) version 2 or later.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <signal.h>
#include <string.h>
diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c
index e3807cf06..5a959a63c 100644
--- a/libc/sysdeps/linux/common/__socketcall.c
+++ b/libc/sysdeps/linux/common/__socketcall.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __NR_socketcall
#define __NR___socketcall __NR_socketcall
int __socketcall(int __call, unsigned long *__args) attribute_hidden;
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
index 56a282a6a..6a966d7df 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -8,7 +8,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdarg.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
#include <sysdep-cancel.h> /* Must come before <fcntl.h>. */
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c
index a1daa7375..4c5495c24 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl64.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdarg.h>
#include <fcntl.h>
@@ -24,8 +24,8 @@ int __libc_fcntl64(int fd, int cmd, ...)
va_start(list, cmd);
arg = va_arg(list, long);
-
va_end(list);
+
return (__syscall_fcntl64(fd, cmd, arg));
}
libc_hidden_def(__libc_fcntl64)
diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
index da0f84dc0..981bb19b0 100644
--- a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
@@ -7,14 +7,14 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __NR_rt_sigaction
#include <signal.h>
+#include <bits/kernel_sigaction.h>
-int __syscall_rt_sigaction (int __signum, const struct sigaction *__act, struct sigaction *__oldact, size_t __size);
#define __NR___syscall_rt_sigaction __NR_rt_sigaction
_syscall4(int, __syscall_rt_sigaction, int, signum,
- const struct sigaction *, act, struct sigaction *, oldact,
+ const struct kernel_sigaction *, act, struct kernel_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 73d3b645f..c39b49d00 100644
--- a/libc/sysdeps/linux/common/__syscall_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_sigaction.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifndef __NR_rt_sigaction
#define __NR___syscall_sigaction __NR_sigaction
diff --git a/libc/sysdeps/linux/common/access.c b/libc/sysdeps/linux/common/access.c
index 0b8c3fe3a..85533bde6 100644
--- a/libc/sysdeps/linux/common/access.c
+++ b/libc/sysdeps/linux/common/access.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
_syscall2(int, access, const char *, pathname, int, mode);
diff --git a/libc/sysdeps/linux/common/acct.c b/libc/sysdeps/linux/common/acct.c
index 2e7d1c600..74156d4de 100644
--- a/libc/sysdeps/linux/common/acct.c
+++ b/libc/sysdeps/linux/common/acct.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
_syscall1(int, acct, const char *, filename);
diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c
index f6cfda9cb..280f90e5a 100644
--- a/libc/sysdeps/linux/common/adjtimex.c
+++ b/libc/sysdeps/linux/common/adjtimex.c
@@ -7,11 +7,13 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/timex.h>
libc_hidden_proto(adjtimex)
_syscall1(int, adjtimex, struct timex *, buf);
libc_hidden_def(adjtimex)
+#if defined __UCLIBC_NTP_LEGACY__
strong_alias(adjtimex,ntp_adjtime)
+#endif
diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c
index 4179d3416..8b499861c 100644
--- a/libc/sysdeps/linux/common/alarm.c
+++ b/libc/sysdeps/linux/common/alarm.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(alarm)
diff --git a/libc/sysdeps/linux/common/arch_prctl.c b/libc/sysdeps/linux/common/arch_prctl.c
index 4b35322a6..6d9927a01 100644
--- a/libc/sysdeps/linux/common/arch_prctl.c
+++ b/libc/sysdeps/linux/common/arch_prctl.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __NR_arch_prctl
extern int arch_prctl(int code, unsigned long addr);
diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c
index 9d3118875..6cf007759 100644
--- a/libc/sysdeps/linux/common/bdflush.c
+++ b/libc/sysdeps/linux/common/bdflush.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/kdaemon.h>
#ifdef __NR_bdflush
diff --git a/libc/sysdeps/linux/common/bits/confname.h b/libc/sysdeps/linux/common/bits/confname.h
index a66f85aac..ab7fdee9d 100644
--- a/libc/sysdeps/linux/common/bits/confname.h
+++ b/libc/sysdeps/linux/common/bits/confname.h
@@ -63,8 +63,10 @@ enum
#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN
_PC_ALLOC_SIZE_MIN,
#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN
- _PC_SYMLINK_MAX
+ _PC_SYMLINK_MAX,
#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX
+ _PC_2_SYMLINKS
+#define _PC_2_SYMLINKS _PC_2_SYMLINKS
};
/* Values for the argument to `sysconf'. */
@@ -459,8 +461,45 @@ enum
#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER
_SC_TRACE_INHERIT,
#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT
- _SC_TRACE_LOG
+ _SC_TRACE_LOG,
#define _SC_TRACE_LOG _SC_TRACE_LOG
+
+ _SC_LEVEL1_ICACHE_SIZE,
+#define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE
+ _SC_LEVEL1_ICACHE_ASSOC,
+#define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC
+ _SC_LEVEL1_ICACHE_LINESIZE,
+#define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE
+ _SC_LEVEL1_DCACHE_SIZE,
+#define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE
+ _SC_LEVEL1_DCACHE_ASSOC,
+#define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC
+ _SC_LEVEL1_DCACHE_LINESIZE,
+#define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE
+ _SC_LEVEL2_CACHE_SIZE,
+#define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE
+ _SC_LEVEL2_CACHE_ASSOC,
+#define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC
+ _SC_LEVEL2_CACHE_LINESIZE,
+#define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE
+ _SC_LEVEL3_CACHE_SIZE,
+#define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE
+ _SC_LEVEL3_CACHE_ASSOC,
+#define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC
+ _SC_LEVEL3_CACHE_LINESIZE,
+#define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE
+ _SC_LEVEL4_CACHE_SIZE,
+#define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE
+ _SC_LEVEL4_CACHE_ASSOC,
+#define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC
+ _SC_LEVEL4_CACHE_LINESIZE,
+#define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE
+ /* Leave room here, maybe we need a few more cache levels some day. */
+
+ _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
+#define _SC_IPV6 _SC_IPV6
+ _SC_RAW_SOCKETS
+#define _SC_RAW_SOCKETS _SC_RAW_SOCKETS
};
#if (defined __USE_POSIX2 || defined __USE_UNIX98 \
diff --git a/libc/sysdeps/linux/common/bits/dlfcn.h b/libc/sysdeps/linux/common/bits/dlfcn.h
index 75122a98a..4bfbbff04 100644
--- a/libc/sysdeps/linux/common/bits/dlfcn.h
+++ b/libc/sysdeps/linux/common/bits/dlfcn.h
@@ -1,5 +1,5 @@
/* System dependent definitions for run-time dynamic loading.
- Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2004 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
@@ -24,8 +24,11 @@
/* The MODE argument to `dlopen' contains one of the following: */
#define RTLD_LAZY 0x00001 /* Lazy function call binding. */
#define RTLD_NOW 0x00002 /* Immediate function call binding. */
+#if 0 /* uClibc doesnt support these */
#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
#define RTLD_NOLOAD 0x00004 /* Do not load the object. */
+#define RTLD_DEEPBIND 0x00008 /* Use deep binding. */
+#endif
/* If the following bit is set in the MODE argument to `dlopen',
the symbols of the loaded object and its dependencies are made
@@ -40,3 +43,25 @@
/* Do not delete object when closed. */
#define RTLD_NODELETE 0x01000
+#if 0 /*def __USE_GNU*/
+/* To support profiling of shared objects it is a good idea to call
+ the function found using `dlsym' using the following macro since
+ these calls do not use the PLT. But this would mean the dynamic
+ loader has no chance to find out when the function is called. The
+ macro applies the necessary magic so that profiling is possible.
+ Rewrite
+ foo = (*fctp) (arg1, arg2);
+ into
+ foo = DL_CALL_FCT (fctp, (arg1, arg2));
+*/
+# define DL_CALL_FCT(fctp, args) \
+ (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
+
+__BEGIN_DECLS
+
+/* This function calls the profiling functions. */
+extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
+
+__END_DECLS
+
+#endif
diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h
index f5831ef4d..a5ac1a47f 100644
--- a/libc/sysdeps/linux/common/bits/errno.h
+++ b/libc/sysdeps/linux/common/bits/errno.h
@@ -1,5 +1,5 @@
/* Error constants. Linux specific version.
- Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2005 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
@@ -19,26 +19,41 @@
#ifdef _ERRNO_H
-#include <bits/errno_values.h>
+# undef EDOM
+# undef EILSEQ
+# undef ERANGE
+# include <linux/errno.h>
-#ifndef ENOTSUP
+/* Linux has no ENOTSUP error code. */
# define ENOTSUP EOPNOTSUPP
-#endif
-#ifndef ECANCELED
-# define ECANCELED 125
-#endif
+/* Older Linux versions also had no ECANCELED error code. */
+# ifndef ECANCELED
+# define ECANCELED 125
+# endif
-# ifndef __ASSEMBLER__
+/* Support for error codes to support robust mutexes was added later, too. */
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 130
+# define ENOTRECOVERABLE 131
+# endif
+# ifndef __ASSEMBLER__
/* Function to get address of global `errno' variable. */
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-# if !defined _LIBC || defined __UCLIBC_HAS_THREADS__
+# ifdef __UCLIBC_HAS_THREADS__
/* When using threads, errno is a per-thread value. */
# define errno (*__errno_location ())
# endif
-
# endif /* !__ASSEMBLER__ */
#endif /* _ERRNO_H */
+#if !defined _ERRNO_H && defined __need_Emath
+/* This is ugly but the kernel header is not clean enough. We must
+ define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
+ defined. */
+# define EDOM 33 /* Math argument out of domain of function. */
+# define EILSEQ 84 /* Illegal byte sequence. */
+# define ERANGE 34 /* Math result not representable. */
+#endif /* !_ERRNO_H && __need_Emath */
diff --git a/libc/sysdeps/linux/common/bits/huge_val.h b/libc/sysdeps/linux/common/bits/huge_val.h
index b33974364..11ca11f18 100644
--- a/libc/sysdeps/linux/common/bits/huge_val.h
+++ b/libc/sysdeps/linux/common/bits/huge_val.h
@@ -1,6 +1,7 @@
-/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
+/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
Used by <stdlib.h> and <math.h> functions for overflow.
- Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004
+ 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
@@ -22,25 +23,19 @@
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
#endif
-#include <features.h>
-
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
-#ifdef __GNUC__
-
-# if __GNUC_PREREQ(2,96)
-
-# define HUGE_VAL (__extension__ 0x1.0p2047)
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VAL (__builtin_huge_val())
+#elif __GNUC_PREREQ(2,96)
+# define HUGE_VAL (__extension__ 0x1.0p2047)
+#elif defined __GNUC__
-# else
-
-# define HUGE_VAL \
+# define HUGE_VAL \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
{ __l: 0x7ff0000000000000ULL }).__d)
-# endif
-
#else /* not GCC */
# include <endian.h>
@@ -58,46 +53,3 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
# define HUGE_VAL (__huge_val.__d)
#endif /* GCC. */
-
-
-/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
-
-#ifdef __USE_ISOC99
-
-# ifdef __GNUC__
-
-# if __GNUC_PREREQ(2,96)
-
-# define HUGE_VALF (__extension__ 0x1.0p255f)
-
-# else
-
-# define HUGE_VALF \
- (__extension__ \
- ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
- { __l: 0x7f800000UL }).__d)
-
-# endif
-
-# else /* not GCC */
-
-typedef union { unsigned char __c[4]; float __f; } __huge_valf_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-# define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
-# endif
-
-static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-# define HUGE_VALF (__huge_valf.__f)
-
-# endif /* GCC. */
-
-
-/* Generally there is no separate `long double' format and it is the
- same as `double'. */
-# define HUGE_VALL HUGE_VAL
-
-#endif /* __USE_ISOC99. */
diff --git a/libc/sysdeps/linux/common/bits/local_lim.h b/libc/sysdeps/linux/common/bits/local_lim.h
index d4671e4a8..023ebf3d0 100644
--- a/libc/sysdeps/linux/common/bits/local_lim.h
+++ b/libc/sysdeps/linux/common/bits/local_lim.h
@@ -1,11 +1,11 @@
/* Minimum guaranteed maximum values for system limits. Linux version.
- Copyright (C) 1993-1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1993-1998,2000,2002,2003,2004 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.
+ 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
@@ -13,9 +13,9 @@
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. */
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* The kernel header pollutes the namespace with the NR_OPEN symbol
and defines LINK_MAX although filesystems have different maxima. A
@@ -63,16 +63,17 @@
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
-/* This is the value this implementation supports. */
-#define PTHREAD_THREADS_MAX 1024
-
-/* Minimum size for a thread. We are free to choose a reasonable value. */
-#define PTHREAD_STACK_MIN 16384
/* Maximum amount by which a process can descrease its asynchronous I/O
priority level. */
#define AIO_PRIO_DELTA_MAX 20
+/* Minimum size for a thread. We are free to choose a reasonable value. */
+#define PTHREAD_STACK_MIN 16384
+
+/* Maximum number of timer expiration overruns. */
+#define DELAYTIMER_MAX 2147483647
+
/* Maximum tty name length. */
#define TTY_NAME_MAX 32
@@ -84,6 +85,3 @@
/* Maximum message queue priority level. */
#define MQ_PRIO_MAX 32768
-
-/* Maximum number of POSIX timers available. */
-#define TIMER_MAX 256
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index c1181f737..c02007284 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -1,5 +1,5 @@
/* Prototype declarations for math functions; helper file for <math.h>.
- Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003, 2006 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
@@ -44,12 +44,13 @@
NAME, to make token pasting work with -traditional. */
#ifndef _MATH_H
- #error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
+# error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
#endif
/* Trigonometric functions. */
+_Mdouble_BEGIN_NAMESPACE
/* Arc cosine of X. */
__MATHCALL (acos,, (_Mdouble_ __x));
/* Arc sine of X. */
@@ -66,12 +67,6 @@ __MATHCALL (sin,, (_Mdouble_ __x));
/* Tangent of X. */
__MATHCALL (tan,, (_Mdouble_ __x));
-#ifdef __USE_GNU
-/* Cosine and sine of X. */
-__MATHDECL (void,sincos,,
- (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
-#endif
-
/* Hyperbolic functions. */
/* Hyperbolic cosine of X. */
@@ -80,28 +75,31 @@ __MATHCALL (cosh,, (_Mdouble_ __x));
__MATHCALL (sinh,, (_Mdouble_ __x));
/* Hyperbolic tangent of X. */
__MATHCALL (tanh,, (_Mdouble_ __x));
+_Mdouble_END_NAMESPACE
+
+#if 0 /*def __USE_GNU*/
+/* Cosine and sine of X. */
+__MATHDECL (void,sincos,,
+ (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
+#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Hyperbolic arc cosine of X. */
__MATHCALL (acosh,, (_Mdouble_ __x));
/* Hyperbolic arc sine of X. */
__MATHCALL (asinh,, (_Mdouble_ __x));
/* Hyperbolic arc tangent of X. */
__MATHCALL (atanh,, (_Mdouble_ __x));
+__END_NAMESPACE_C99
#endif
/* Exponential and logarithmic functions. */
+_Mdouble_BEGIN_NAMESPACE
/* Exponential function of X. */
__MATHCALL (exp,, (_Mdouble_ __x));
-#ifdef __USE_GNU
-/* A function missing in all standards: compute exponent to base ten. */
-__MATHCALL (exp10,, (_Mdouble_ __x));
-/* Another name occasionally used. */
-__MATHCALL (pow10,, (_Mdouble_ __x));
-#endif
-
/* Break VALUE into a normalized fraction and an integral power of 2. */
__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
@@ -116,8 +114,17 @@ __MATHCALL (log10,, (_Mdouble_ __x));
/* Break VALUE into integral and fractional parts. */
__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+_Mdouble_END_NAMESPACE
+
+#if 0 /*def __USE_GNU*/
+/* A function missing in all standards: compute exponent to base ten. */
+__MATHCALL (exp10,, (_Mdouble_ __x));
+/* Another name occasionally used. */
+__MATHCALL (pow10,, (_Mdouble_ __x));
+#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return exp(X) - 1. */
__MATHCALL (expm1,, (_Mdouble_ __x));
@@ -126,46 +133,56 @@ __MATHCALL (log1p,, (_Mdouble_ __x));
/* Return the base 2 signed integral exponent of X. */
__MATHCALL (logb,, (_Mdouble_ __x));
+__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Compute base-2 exponential of X. */
__MATHCALL (exp2,, (_Mdouble_ __x));
/* Compute base-2 logarithm of X. */
__MATHCALL (log2,, (_Mdouble_ __x));
+__END_NAMESPACE_C99
#endif
/* Power functions. */
+_Mdouble_BEGIN_NAMESPACE
/* Return X to the Y power. */
__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
/* Return the square root of X. */
__MATHCALL (sqrt,, (_Mdouble_ __x));
+_Mdouble_END_NAMESPACE
#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return `sqrt(X*X + Y*Y)'. */
__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+__END_NAMESPACE_C99
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return the cube root of X. */
__MATHCALL (cbrt,, (_Mdouble_ __x));
+__END_NAMESPACE_C99
#endif
/* Nearest integer, absolute value, and remainder functions. */
+_Mdouble_BEGIN_NAMESPACE
/* Smallest integral value not less than X. */
-__MATHCALL (ceil,, (_Mdouble_ __x));
+__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
/* Absolute value of X. */
__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
/* Largest integer not greater than X. */
-__MATHCALL (floor,, (_Mdouble_ __x));
+__MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
/* Floating-point modulo remainder of X/Y. */
__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
@@ -177,6 +194,7 @@ __MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
/* Return nonzero if VALUE is finite and not NaN. */
__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
+_Mdouble_END_NAMESPACE
#ifdef __USE_MISC
/* Return 0 if VALUE is finite or NaN, +1 if it
@@ -195,13 +213,17 @@ __MATHCALL (significand,, (_Mdouble_ __x));
#endif /* Use misc. */
#if defined __USE_MISC || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return X with its signed changed to Y's. */
__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return representation of NaN for double type. */
__MATHCALLX (nan,, (__const char *__tagb), (__const__));
+__END_NAMESPACE_C99
#endif
@@ -223,14 +245,19 @@ __MATHCALL (yn,, (int, _Mdouble_));
#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Error and gamma functions. */
__MATHCALL (erf,, (_Mdouble_));
__MATHCALL (erfc,, (_Mdouble_));
__MATHCALL (lgamma,, (_Mdouble_));
+__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+/* True gamma function. */
__MATHCALL (tgamma,, (_Mdouble_));
+__END_NAMESPACE_C99
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -247,24 +274,20 @@ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
/* Return the integer nearest X in the direction of the
prevailing rounding mode. */
__MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# ifdef __USE_ISOC99
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
# endif
/* Return the remainder of integer divison X / Y with infinite precision. */
__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-/* Return X times (2 to the Nth power). */
-__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
-# endif
-
# if defined __USE_MISC || defined __USE_ISOC99
/* Return X times (2 to the Nth power). */
__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
@@ -284,7 +307,7 @@ __MATHCALL (nearbyint,, (_Mdouble_ __x));
/* Round X to nearest integral value, rounding halfway cases away from
zero. */
-__MATHCALL (round,, (_Mdouble_ __x));
+__MATHCALLX (round,, (_Mdouble_ __x), (__const__));
/* Round X to the integral value in floating-point format nearest but
not larger in magnitude. */
@@ -331,3 +354,12 @@ __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
/* Multiply-add function computed as a ternary operation. */
__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
#endif /* Use ISO C99. */
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__END_NAMESPACE_C99
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
+#endif
diff --git a/libc/sysdeps/linux/common/bits/mathdef.h b/libc/sysdeps/linux/common/bits/mathdef.h
index d08dc3820..00c67241a 100644
--- a/libc/sysdeps/linux/common/bits/mathdef.h
+++ b/libc/sysdeps/linux/common/bits/mathdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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
@@ -30,10 +30,6 @@ typedef double float_t; /* `float' expressions are evaluated as
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
-/* Define `INFINITY' as value of type `float'. */
-# define INFINITY HUGE_VALF
-
-
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN 2147483647
diff --git a/libc/sysdeps/linux/common/bits/posix1_lim.h b/libc/sysdeps/linux/common/bits/posix1_lim.h
index 71c58f760..3c86dcec1 100644
--- a/libc/sysdeps/linux/common/bits/posix1_lim.h
+++ b/libc/sysdeps/linux/common/bits/posix1_lim.h
@@ -151,6 +151,7 @@
/* Get the implementation-specific values for the above. */
#include <bits/local_lim.h>
+#include <bits/uClibc_local_lim.h>
#ifndef SSIZE_MAX
diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h
index ce416c9dd..dfe259b7c 100644
--- a/libc/sysdeps/linux/common/bits/posix_opt.h
+++ b/libc/sysdeps/linux/common/bits/posix_opt.h
@@ -1,11 +1,11 @@
/* Define POSIX options for Linux.
- Copyright (C) 1996,1997,1999,2000,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2002, 2003, 2004 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.
+ 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
@@ -13,16 +13,12 @@
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. */
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-/*
- * Never include this file directly; use <unistd.h> instead.
- */
-
-#ifndef _BITS_POSIX_OPT_H
-#define _BITS_POSIX_OPT_H 1
+#ifndef _POSIX_OPT_H
+#define _POSIX_OPT_H 1
/* Job control is supported. */
#define _POSIX_JOB_CONTROL 1
@@ -43,31 +39,13 @@
#define _POSIX_MAPPED_FILES 200112L
/* Locking of all memory is supported. */
-#ifdef __ARCH_USE_MMU__
-# define _POSIX_MEMLOCK 200112L
-#else
-# undef _POSIX_MEMLOCK
-#endif
+#define _POSIX_MEMLOCK 200112L
/* Locking of ranges of memory is supported. */
-#ifdef __ARCH_USE_MMU__
-# define _POSIX_MEMLOCK_RANGE 200112L
-#else
-# define _POSIX_MEMLOCK_RANGE
-#endif
+#define _POSIX_MEMLOCK_RANGE 200112L
/* Setting of memory protections is supported. */
-#ifdef __ARCH_USE_MMU__
-# define _POSIX_MEMORY_PROTECTION 200112L
-#else
-# undef _POSIX_MEMORY_PROTECTION
-#endif
-
-/* Implementation supports `poll' function. */
-#define _POSIX_POLL 1
-
-/* Implementation supports `select' and `pselect' functions. */
-#define _POSIX_SELECT 1
+#define _POSIX_MEMORY_PROTECTION 200112L
/* Only root can change owner of file. */
#define _POSIX_CHOWN_RESTRICTED 1
@@ -82,139 +60,121 @@
/* X/Open realtime support is available. */
#define _XOPEN_REALTIME 1
-/* X/Open realtime thread support is available. */
-#ifdef __UCLIBC_HAS_THREADS__
-# define _XOPEN_REALTIME_THREADS 1
-#else
-# undef _XOPEN_REALTIME_THREADS
-#endif
-
/* XPG4.2 shared memory is supported. */
#define _XOPEN_SHM 1
/* Tell we have POSIX threads. */
-#ifdef __UCLIBC_HAS_THREADS__
-# define _POSIX_THREADS 1
-#else
-# undef _POSIX_THREADS
-#endif
+#define _POSIX_THREADS 200112L
/* We have the reentrant functions described in POSIX. */
-#ifdef __UCLIBC_HAS_THREADS__
-# define _POSIX_REENTRANT_FUNCTIONS 1
-# define _POSIX_THREAD_SAFE_FUNCTIONS 1
-#else
-# undef _POSIX_REENTRANT_FUNCTIONS
-# undef _POSIX_THREAD_SAFE_FUNCTIONS
-#endif
+#define _POSIX_REENTRANT_FUNCTIONS 1
+#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
/* We provide priority scheduling for threads. */
-#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
+#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
/* We support user-defined stack sizes. */
-#define _POSIX_THREAD_ATTR_STACKSIZE 1
+#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
/* We support user-defined stacks. */
-#define _POSIX_THREAD_ATTR_STACKADDR 1
+#define _POSIX_THREAD_ATTR_STACKADDR 200112L
-/* We support POSIX.1b semaphores, but only the non-shared form for now. */
-#ifdef __UCLIBC_HAS_THREADS__
-# define _POSIX_SEMAPHORES 1
-#else
-# undef _POSIX_SEMAPHORES
-#endif
+/* We support POSIX.1b semaphores. */
+#define _POSIX_SEMAPHORES 200112L
/* Real-time signals are supported. */
#define _POSIX_REALTIME_SIGNALS 200112L
/* We support asynchronous I/O. */
-#define _POSIX_ASYNCHRONOUS_IO 1
+#define _POSIX_ASYNCHRONOUS_IO 200112L
#define _POSIX_ASYNC_IO 1
/* Alternative name for Unix98. */
#define _LFS_ASYNCHRONOUS_IO 1
+/* Support for prioritization is also available. */
+#define _POSIX_PRIORITIZED_IO 200112L
/* The LFS support in asynchronous I/O is also available. */
-#ifdef __UCLIBC_HAS_LFS__
-# define _LFS64_ASYNCHRONOUS_IO 1
-#else
-# undef _LFS64_ASYNCHRONOUS_IO
-#endif
+#define _LFS64_ASYNCHRONOUS_IO 1
-/* The rest of the LFS is also available. */
#ifdef __UCLIBC_HAS_LFS__
-# define _LFS_LARGEFILE 1
-# define _LFS64_LARGEFILE 1
-# define _LFS64_STDIO 1
-#else
-# undef _LFS_LARGEFILE
-# undef _LFS64_LARGEFILE
-# undef _LFS64_STDIO
+/* The rest of the LFS is also available. */
+#define _LFS_LARGEFILE 1
+#define _LFS64_LARGEFILE 1
+#define _LFS64_STDIO 1
#endif
-/* POSIX timers are available. */
-#define _POSIX_TIMERS 200112L
-
/* POSIX shared memory objects are implemented. */
#define _POSIX_SHARED_MEMORY_OBJECTS 200112L
-#if defined(__i386__)
-/* CPU-time clocks supported. */
-# define _POSIX_CPUTIME 200912L
-
-/* We support the clock also in threads. */
-# define _POSIX_THREAD_CPUTIME 200912L
-#endif
-
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
/* CPU-time clocks support needs to be checked at runtime. */
-#define _POSIX_CPUTIME 0
+#define _POSIX_CPUTIME 0
/* Clock support in threads must be also checked at runtime. */
-#define _POSIX_THREAD_CPUTIME 0
-#endif
-
-/* Reader/Writer locks are available. */
-#define _POSIX_READER_WRITER_LOCKS 200912L
+#define _POSIX_THREAD_CPUTIME 0
/* GNU libc provides regular expression handling. */
-#ifdef __UCLIBC_HAS_REGEX__
-# define _POSIX_REGEXP 1
-#else
-# undef _POSIX_REGEXP
-#endif
+#define _POSIX_REGEXP 1
+
+/* Reader/Writer locks are available. */
+#define _POSIX_READER_WRITER_LOCKS 200112L
/* We have a POSIX shell. */
#define _POSIX_SHELL 1
-/* The `spawn' function family is supported. */
-#define _POSIX_SPAWN 200912L
-
/* We support the Timeouts option. */
-#define _POSIX_TIMEOUTS 200912L
+#define _POSIX_TIMEOUTS 200112L
/* We support spinlocks. */
-#define _POSIX_SPIN_LOCKS 200912L
+#define _POSIX_SPIN_LOCKS 200112L
+
+/* The `spawn' function family is supported. */
+#define _POSIX_SPAWN 200112L
+
+/* We have POSIX timers. */
+#define _POSIX_TIMERS 200112L
/* The barrier functions are available. */
-#define _POSIX_BARRIERS 200912L
+#define _POSIX_BARRIERS 200112L
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
/* POSIX message queues are available. */
-# define _POSIX_MESSAGE_PASSING 200112L
-#else
-/* POSIX message queues are not yet supported. */
-# undef _POSIX_MESSAGE_PASSING
-#endif
+#define _POSIX_MESSAGE_PASSING 200112L
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
/* Thread process-shared synchronization is supported. */
-#define _POSIX_THREAD_PROCESS_SHARED 200112L
+#define _POSIX_THREAD_PROCESS_SHARED 200112L
/* The monotonic clock might be available. */
-#define _POSIX_MONOTONIC_CLOCK 0
+#define _POSIX_MONOTONIC_CLOCK 0
/* The clock selection interfaces are available. */
-#define _POSIX_CLOCK_SELECTION 200112L
-#endif
+#define _POSIX_CLOCK_SELECTION 200112L
+
+/* Advisory information interfaces are available. */
+#define _POSIX_ADVISORY_INFO 200112L
+
+/* IPv6 support is available. */
+#define _POSIX_IPV6 200112L
+
+/* Raw socket support is available. */
+#define _POSIX_RAW_SOCKETS 200112L
+
+/* We have at least one terminal. */
+#define _POSIX2_CHAR_TERM 200112L
+
+/* Neither process nor thread sporadic server interfaces is available. */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER -1
+
+/* trace.h is not available. */
+#define _POSIX_TRACE -1
+#define _POSIX_TRACE_EVENT_FILTER -1
+#define _POSIX_TRACE_INHERIT -1
+#define _POSIX_TRACE_LOG -1
+
+/* Typed memory objects are not available. */
+#define _POSIX_TYPED_MEMORY_OBJECTS -1
+
+/* No support for priority inheritance or protection so far. */
+#define _POSIX_THREAD_PRIO_INHERIT -1
+#define _POSIX_THREAD_PRIO_PROTECT -1
-#endif /* bits/posix_opt.h */
+#endif /* posix_opt.h */
diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h
index 1d438122e..526cdaf53 100644
--- a/libc/sysdeps/linux/common/bits/resource.h
+++ b/libc/sysdeps/linux/common/bits/resource.h
@@ -81,7 +81,26 @@ enum __rlimit_resource
__RLIMIT_LOCKS = 10,
#define RLIMIT_LOCKS __RLIMIT_LOCKS
- __RLIMIT_NLIMITS = 11,
+ /* Maximum number of pending signals. */
+ __RLIMIT_SIGPENDING = 11,
+#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING
+
+ /* Maximum bytes in POSIX message queues. */
+ __RLIMIT_MSGQUEUE = 12,
+#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
+
+ /* Maximum nice priority allowed to raise to.
+ Nice levels 19 .. -20 correspond to 0 .. 39
+ values of this resource limit. */
+ __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+ /* Maximum realtime priority allowed for non-priviledged
+ processes. */
+ __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+ __RLIMIT_NLIMITS = 15,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
@@ -89,13 +108,13 @@ enum __rlimit_resource
/* Value to indicate that there is no limit. */
#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
+# define RLIM_INFINITY ((unsigned long int)(~0UL))
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
+# define RLIM_INFINITY 0xffffffffffffffffuLL
#endif
#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+# define RLIM64_INFINITY 0xffffffffffffffffuLL
#endif
/* We can represent all limits. */
@@ -139,12 +158,8 @@ enum __rusage_who
#define RUSAGE_SELF RUSAGE_SELF
/* All of its terminated child processes. */
- RUSAGE_CHILDREN = -1,
+ RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-
- /* Both. */
- RUSAGE_BOTH = -2
-#define RUSAGE_BOTH RUSAGE_BOTH
};
#define __need_timeval
diff --git a/libc/sysdeps/linux/common/bits/shm.h b/libc/sysdeps/linux/common/bits/shm.h
index 225b89db2..318d601ae 100644
--- a/libc/sysdeps/linux/common/bits/shm.h
+++ b/libc/sysdeps/linux/common/bits/shm.h
@@ -73,6 +73,7 @@ struct shmid_ds
# define SHM_DEST 01000 /* segment will be destroyed on last detach */
# define SHM_LOCKED 02000 /* segment will not be swapped */
# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
+# define SHM_NORESERVE 010000 /* don't check for reservations */
struct shminfo
{
diff --git a/libc/sysdeps/linux/common/bits/siginfo.h b/libc/sysdeps/linux/common/bits/siginfo.h
index 4e9fd6ab4..4ce319dc9 100644
--- a/libc/sysdeps/linux/common/bits/siginfo.h
+++ b/libc/sysdeps/linux/common/bits/siginfo.h
@@ -1,5 +1,5 @@
-/* siginfo_t, sigevent and constants. Linux/SPARC version.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* siginfo_t, sigevent and constants. Linux version.
+ Copyright (C) 1997-2002, 2003 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
@@ -69,8 +69,9 @@ typedef struct siginfo
/* POSIX.1b timers. */
struct
{
- unsigned int _timer1;
- unsigned int _timer2;
+ int si_tid; /* Timer ID. */
+ int si_overrun; /* Overrun count. */
+ sigval_t si_sigval; /* Signal value. */
} _timer;
/* POSIX.1b signals. */
@@ -110,8 +111,8 @@ typedef struct siginfo
/* X/Open requires some more fields with fixed names. */
# define si_pid _sifields._kill.si_pid
# define si_uid _sifields._kill.si_uid
-# define si_timer1 _sifields._timer._timer1
-# define si_timer2 _sifields._timer._timer2
+# define si_timerid _sifields._timer.si_tid
+# define si_overrun _sifields._timer.si_overrun
# define si_status _sifields._sigchld.si_status
# define si_utime _sifields._sigchld.si_utime
# define si_stime _sifields._sigchld.si_stime
@@ -269,9 +270,6 @@ enum
# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
# endif
-/* Forward declaration of the `pthread_attr_t' type. */
-struct __pthread_attr_s;
-
typedef struct sigevent
{
sigval_t sigev_value;
@@ -282,10 +280,14 @@ typedef struct sigevent
{
int _pad[__SIGEV_PAD_SIZE];
+ /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
+ thread to receive the signal. */
+ __pid_t _tid;
+
struct
{
- void (*_function) (sigval_t); /* Function to start. */
- struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
+ void (*_function) (sigval_t); /* Function to start. */
+ void *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
@@ -305,7 +307,7 @@ enum
# define SIGEV_THREAD SIGEV_THREAD
SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */
-#define SIGEV_THREAD_ID SIGEV_THREAD_ID
+#define SIGEV_THREAD_ID SIGEV_THREAD_ID
};
#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/common/bits/signum.h b/libc/sysdeps/linux/common/bits/signum.h
index 74259b492..a18ac113a 100644
--- a/libc/sysdeps/linux/common/bits/signum.h
+++ b/libc/sysdeps/linux/common/bits/signum.h
@@ -1,5 +1,5 @@
/* Signal number definitions. Linux version.
- Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,1997,1998,1999,2003 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
@@ -66,7 +66,7 @@
#define SIGSYS 31 /* Bad system call. */
#define SIGUNUSED 31
-#define _NSIG 64 /* Biggest signal number + 1
+#define _NSIG 65 /* Biggest signal number + 1
(including real-time signals). */
#define SIGRTMIN (__libc_current_sigrtmin ())
diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h
index 9e6b62e4b..960bde18a 100644
--- a/libc/sysdeps/linux/common/bits/sigthread.h
+++ b/libc/sysdeps/linux/common/bits/sigthread.h
@@ -1,11 +1,11 @@
-/* Signal handling function for threaded programs. Generic version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+/* Signal handling function for threaded programs.
+ Copyright (C) 1998, 1999, 2000, 2002 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.
+ 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
@@ -13,9 +13,9 @@
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. */
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifndef _BITS_SIGTHREAD_H
#define _BITS_SIGTHREAD_H 1
@@ -24,15 +24,15 @@
# error "Never include this file directly. Use <pthread.h> instead"
#endif
-/* Modify the signal mask for the calling thread. The arguments have the
- same meaning as for sigprocmask; in fact, this and sigprocmask might be
- the same function. We declare this the same on all platforms, since it
- doesn't use any thread-related types. */
+/* Functions for handling signals. */
+
+/* Modify the signal mask for the calling thread. The arguments have
+ the same meaning as for sigprocmask(2). */
extern int pthread_sigmask (int __how,
__const __sigset_t *__restrict __newmask,
__sigset_t *__restrict __oldmask)__THROW;
/* Send signal SIGNO to the given thread. */
-extern int pthread_kill (pthread_t __thread_id, int __signo) __THROW;
+extern int pthread_kill (pthread_t __threadid, int __signo) __THROW;
#endif /* bits/sigthread.h */
diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h
index 2466c0cd1..2f3dc797b 100644
--- a/libc/sysdeps/linux/common/bits/socket.h
+++ b/libc/sysdeps/linux/common/bits/socket.h
@@ -1,5 +1,5 @@
/* System-specific socket constants and types. Linux version.
- Copyright (C) 1991,1992,1994-2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1991,1992,1994-2001,2004,2006 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
@@ -215,16 +215,26 @@ enum
/* Note: do not change these members to match glibc; these match the
SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
+/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
+ platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
struct msghdr
{
void *msg_name; /* Address to send to/receive from. */
socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
+#if __WORDSIZE == 32
int msg_iovlen; /* Number of elements in the vector. */
+#else
+ size_t msg_iovlen; /* Number of elements in the vector. */
+#endif
void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+#if __WORDSIZE == 32
socklen_t msg_controllen; /* Ancillary data buffer length. */
+#else
+ size_t msg_controllen; /* Ancillary data buffer length. */
+#endif
int msg_flags; /* Flags on received message. */
};
@@ -286,13 +296,12 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
<linux/socket.h>. */
enum
{
- SCM_RIGHTS = 0x01, /* Transfer file descriptors. */
+ SCM_RIGHTS = 0x01 /* Transfer file descriptors. */
#define SCM_RIGHTS SCM_RIGHTS
#ifdef __USE_BSD
- SCM_CREDENTIALS = 0x02, /* Credentials passing. */
+ , SCM_CREDENTIALS = 0x02 /* Credentials passing. */
# define SCM_CREDENTIALS SCM_CREDENTIALS
#endif
- __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */
};
/* User visible structure for SCM_CREDENTIALS message */
diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h
index 3e8e77f65..bd5aae267 100644
--- a/libc/sysdeps/linux/common/bits/stat.h
+++ b/libc/sysdeps/linux/common/bits/stat.h
@@ -20,9 +20,6 @@
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H
-
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -35,13 +32,15 @@
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
struct stat
-{
+ {
__dev_t st_dev; /* Device. */
- unsigned short int __pad1;
#ifndef __USE_FILE_OFFSET64
+ unsigned short int __pad1;
__ino_t st_ino; /* File serial number. */
#else
+ unsigned int __pad1;
__ino_t __st_ino; /* 32bit file serial number. */
#endif
__mode_t st_mode; /* File mode. */
@@ -49,10 +48,11 @@ struct stat
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
#ifndef __USE_FILE_OFFSET64
+ unsigned short int __pad2;
__off_t st_size; /* Size of file, in bytes. */
#else
+ unsigned int __pad2;
__off64_t st_size; /* Size of file, in bytes. */
#endif
__blksize_t st_blksize; /* Optimal block size for I/O. */
@@ -62,23 +62,38 @@ struct stat
#else
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
#ifndef __USE_FILE_OFFSET64
unsigned long int __unused4;
unsigned long int __unused5;
#else
__ino64_t st_ino; /* File serial number. */
#endif
-};
+ };
#ifdef __USE_LARGEFILE64
struct stat64
-{
+ {
__dev_t st_dev; /* Device. */
unsigned int __pad1;
@@ -93,17 +108,28 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#if 0 /*def __USE_MISC*/
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
__ino64_t st_ino; /* File serial number. */
-};
+ };
#endif
-
/* Tell code we have these members. */
#define _STATBUF_ST_BLKSIZE
#define _STATBUF_ST_RDEV
@@ -137,6 +163,3 @@ struct stat64
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
-
-#endif /* _BITS_STAT_H */
-
diff --git a/libc/sysdeps/linux/common/bits/syscalls.h b/libc/sysdeps/linux/common/bits/syscalls.h
index e891af8e5..4895c4fa0 100644
--- a/libc/sysdeps/linux/common/bits/syscalls.h
+++ b/libc/sysdeps/linux/common/bits/syscalls.h
@@ -5,6 +5,4 @@
* forbidden. Don't do it. It is bad for you.
*/
-
-#error You have not provided architecture specific _syscall[0-5] macros
-
+#error You have not provided architecture specific _syscall[0-6] macros
diff --git a/libc/sysdeps/linux/common/bits/termios.h b/libc/sysdeps/linux/common/bits/termios.h
index c71e4ad1f..b648d8000 100644
--- a/libc/sysdeps/linux/common/bits/termios.h
+++ b/libc/sysdeps/linux/common/bits/termios.h
@@ -154,6 +154,7 @@ struct termios
#ifdef __USE_MISC
# define CBAUDEX 0010000
#endif
+#define BOTHER 0010000
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
diff --git a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h
index 7b666e175..66186edbb 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_arch_features.h
@@ -23,9 +23,6 @@
/* does your target have to worry about older [gs]etrlimit() ? */
#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/common/bits/uClibc_errno.h b/libc/sysdeps/linux/common/bits/uClibc_errno.h
index 2add9e5c9..631e10c50 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_errno.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_errno.h
@@ -12,7 +12,7 @@
extern int _dl_errno; // attribute_hidden;
#elif defined __UCLIBC_HAS_THREADS__
# include <tls.h>
-# if USE___THREAD
+# if defined USE___THREAD && USE___THREAD
# undef errno
# ifndef NOT_IN_libc
# define errno __libc_errno
@@ -33,16 +33,11 @@ extern int *__errno_location (void) __THROW __attribute__ ((__const__))
;
# if defined __UCLIBC_HAS_THREADS__
# include <tls.h>
-# if USE___THREAD
+# if defined USE___THREAD && USE___THREAD
libc_hidden_proto(__errno_location)
# endif
# endif
-/* We now need a declaration of the `errno' variable. */
-# ifndef __UCLIBC_HAS_THREADS__
-/*extern int errno;*/
-libc_hidden_proto(errno)
-# endif
#endif /* !__ASSEMBLER__ */
#endif
diff --git a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
index 34575cb50..abfc86de5 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
@@ -11,12 +11,13 @@
#define _BITS_UCLIBC_LOCAL_LIM_H 1
/* This file works correctly only if local_lim.h is the NPTL version */
-#if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX
+#if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX
# error local_lim.h was incorrectly updated, use the NPTL version from glibc
#endif
-#if defined __UCLIBC_HAS_THREADS__
-# define PTHREAD_THREADS_MAX 16384
+/* This should really be moved to thread specific directories */
+#if defined __UCLIBC_HAS_THREADS__ && !defined __UCLIBC_HAS_THREADS_NATIVE__
+# define PTHREAD_THREADS_MAX 1024
# define TIMER_MAX 256
#endif
diff --git a/libc/sysdeps/linux/common/bits/uClibc_mutex.h b/libc/sysdeps/linux/common/bits/uClibc_mutex.h
index b202a6bd2..e31767787 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_mutex.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_mutex.h
@@ -12,8 +12,7 @@
#ifdef __UCLIBC_HAS_THREADS__
-#include <pthread.h>
-#include <bits/uClibc_pthread.h>
+#include <bits/pthreadtypes.h>
#define __UCLIBC_MUTEX_TYPE pthread_mutex_t
@@ -36,7 +35,7 @@
struct _pthread_cleanup_buffer __infunc_pthread_cleanup_buffer; \
if (C) { \
_pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer, \
- __uclibc_mutex_unlock, \
+ (void (*) (void *))__pthread_mutex_unlock, \
&(M)); \
__pthread_mutex_lock(&(M)); \
} \
@@ -62,6 +61,53 @@
#define __UCLIBC_MUTEX_UNLOCK(M) \
__UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1)
+#ifdef __USE_STDIO_FUTEXES__
+
+#include <bits/stdio-lock.h>
+
+#define __UCLIBC_IO_MUTEX(M) _IO_lock_t M
+#define __UCLIBC_IO_MUTEX_LOCK(M) _IO_lock_lock(M)
+#define __UCLIBC_IO_MUTEX_UNLOCK(M) _IO_lock_unlock(M)
+#define __UCLIBC_IO_MUTEX_TRYLOCK(M) _IO_lock_trylock(M)
+#define __UCLIBC_IO_MUTEX_INIT(M,I) _IO_lock_t M = I
+#define __UCLIBC_IO_MUTEX_EXTERN(M) extern _IO_lock_t M
+
+#define __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,C) \
+ if (C) { \
+ _IO_lock_lock(M); \
+ }
+
+#define __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,C) \
+ if (C) { \
+ _IO_lock_unlock(M); \
+ }
+
+#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V) \
+ __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,((A=(V))) == 0)
+
+#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A) \
+ __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,((A) ==0))
+
+#define __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE(M) \
+ __UCLIBC_IO_MUTEX_LOCK(M)
+#define __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(M) \
+ __UCLIBC_IO_MUTEX_UNLOCK(M)
+#define __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE(M) \
+ __UCLIBC_IO_MUTEX_TRYLOCK(M)
+
+#else
+#define __UCLIBC_IO_MUTEX(M) __UCLIBC_MUTEX(M)
+#define __UCLIBC_IO_MUTEX_LOCK(M) __UCLIBC_MUTEX_CONDITIONAL_LOCK(M, 1)
+#define __UCLIBC_IO_MUTEX_UNLOCK(M) __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1)
+#define __UCLIBC_IO_MUTEX_TRYLOCK(M) __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE
+#define __UCLIBC_IO_MUTEX_INIT(M,I) __UCLIBC_MUTEX_INIT(M,I)
+#define __UCLIBC_IO_MUTEX_EXTERN(M) __UCLIBC_MUTEX_EXTERN(M)
+
+#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V) __UCLIBC_MUTEX_AUTO_LOCK(M,A,V)
+#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A) __UCLIBC_MUTEX_AUTO_UNLOCK(M,A)
+
+#endif
+
#else
#define __UCLIBC_MUTEX(M) void *__UCLIBC_MUTEX_DUMMY_ ## M
@@ -83,6 +129,12 @@
#define __UCLIBC_MUTEX_LOCK(M) ((void)0)
#define __UCLIBC_MUTEX_UNLOCK(M) ((void)0)
+#define __UCLIBC_IO_MUTEX_LOCK(M) ((void)0)
+#define __UCLIBC_IO_MUTEX_UNLOCK(M) ((void)0)
+#define __UCLIBC_IO_MUTEX_TRYLOCK(M) ((void)0)
+#define __UCLIBC_IO_MUTEX_INIT(M,I) extern void *__UCLIBC_MUTEX_DUMMY_ ## M
+#define __UCLIBC_IO_MUTEX_EXTERN(M) extern void *__UCLIBC_MUTEX_DUMMY_ ## M
#endif
+
#endif /* _UCLIBC_MUTEX_H */
diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
index a75f971eb..0af2d5db5 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
@@ -55,7 +55,7 @@
/**********************************************************************/
/* Make sure defines related to large files are consistent. */
-#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
+#ifdef _LIBC
#ifdef __UCLIBC_HAS_LFS__
#undef __USE_LARGEFILE
@@ -116,12 +116,7 @@
#endif
/**********************************************************************/
-#ifdef __UCLIBC_HAS_THREADS__
-/* Need this for pthread_mutex_t. */
-#include <bits/pthreadtypes.h>
-#ifdef __USE_STDIO_FUTEXES__
-#include <bits/stdio-lock.h>
-#endif
+#include <bits/uClibc_mutex.h>
/* user_locking
* 0 : do auto locking/unlocking
@@ -135,70 +130,45 @@
* This way, we avoid calling the weak lock/unlock functions.
*/
-#define __STDIO_AUTO_THREADLOCK_VAR int __infunc_user_locking
+#define __STDIO_AUTO_THREADLOCK_VAR \
+ __UCLIBC_MUTEX_AUTO_LOCK_VAR(__infunc_user_locking)
-#ifdef __USE_STDIO_FUTEXES__
+#define __STDIO_AUTO_THREADLOCK(__stream) \
+ __UCLIBC_IO_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking, \
+ (__stream)->__user_locking)
-#define __STDIO_SET_USER_LOCKING(__stream) ((__stream)->__user_locking = 1)
-
-#define __STDIO_AUTO_THREADLOCK(__stream) \
- if ((__infunc_user_locking = (__stream)->__user_locking) == 0) { \
- _IO_lock_lock((__stream)->_lock); \
- }
+#define __STDIO_AUTO_THREADUNLOCK(__stream) \
+ __UCLIBC_IO_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking)
-#define __STDIO_AUTO_THREADUNLOCK(__stream) \
- if (__infunc_user_locking == 0) { \
- _IO_lock_unlock((__stream)->_lock); \
- }
+#define __STDIO_ALWAYS_THREADLOCK(__stream) \
+ __UCLIBC_IO_MUTEX_LOCK((__stream)->__lock)
-#define __STDIO_ALWAYS_THREADLOCK(__stream) \
- _IO_lock_lock((__stream)->_lock)
+#define __STDIO_ALWAYS_THREADUNLOCK(__stream) \
+ __UCLIBC_IO_MUTEX_UNLOCK((__stream)->__lock)
-#define __STDIO_ALWAYS_THREADTRYLOCK(__stream) \
- _IO_lock_trylock((__stream)->_lock)
+#define __STDIO_ALWAYS_THREADLOCK_CANCEL_UNSAFE(__stream) \
+ __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock)
-#define __STDIO_ALWAYS_THREADUNLOCK(__stream) \
- _IO_lock_unlock((__stream)->_lock)
-
-#else
+#define __STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(__stream) \
+ __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock)
-#define __STDIO_AUTO_THREADLOCK(__stream) \
- if ((__infunc_user_locking = (__stream)->__user_locking) == 0) { \
- __pthread_mutex_lock(&(__stream)->__lock); \
- }
-
-#define __STDIO_AUTO_THREADUNLOCK(__stream) \
- if (__infunc_user_locking == 0) { \
- __pthread_mutex_unlock(&(__stream)->__lock); \
- }
+#define __STDIO_ALWAYS_THREADUNLOCK_CANCEL_UNSAFE(__stream) \
+ __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock)
+#ifdef __UCLIBC_HAS_THREADS__
#define __STDIO_SET_USER_LOCKING(__stream) ((__stream)->__user_locking = 1)
-
-#define __STDIO_ALWAYS_THREADLOCK(__stream) \
- __pthread_mutex_lock(&(__stream)->__lock)
-
-#define __STDIO_ALWAYS_THREADTRYLOCK(__stream) \
- __pthread_mutex_trylock(&(__stream)->__lock)
-
-#define __STDIO_ALWAYS_THREADUNLOCK(__stream) \
- __pthread_mutex_unlock(&(__stream)->__lock)
-
-#endif
-
-#else /* __UCLIBC_HAS_THREADS__ */
-
-#define __STDIO_AUTO_THREADLOCK_VAR ((void)0)
-
-#define __STDIO_AUTO_THREADLOCK(__stream) ((void)0)
-#define __STDIO_AUTO_THREADUNLOCK(__stream) ((void)0)
-
+#else
#define __STDIO_SET_USER_LOCKING(__stream) ((void)0)
+#endif
-#define __STDIO_ALWAYS_THREADLOCK(__stream) ((void)0)
-#define __STDIO_ALWAYS_THREADTRYLOCK(__stream) (0) /* Always succeed. */
-#define __STDIO_ALWAYS_THREADUNLOCK(__stream) ((void)0)
+#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __USE_STDIO_FUTEXES__
+#define STDIO_INIT_MUTEX(M) _IO_lock_init(M)
+#else
+#define STDIO_INIT_MUTEX(M) __stdio_init_mutex(& M)
+#endif
+#endif
-#endif /* __UCLIBC_HAS_THREADS__ */
/**********************************************************************/
#define __STDIO_IOFBF 0 /* Fully buffered. */
@@ -313,11 +283,7 @@ struct __STDIO_FILE_STRUCT {
#endif
#ifdef __UCLIBC_HAS_THREADS__
int __user_locking;
-#ifdef __USE_STDIO_FUTEXES__
- _IO_lock_t _lock;
-#else
- pthread_mutex_t __lock;
-#endif
+ __UCLIBC_IO_MUTEX(__lock);
#endif
/* Everything after this is unimplemented... and may be trashed. */
#if __STDIO_BUILTIN_BUF_SIZE > 0
@@ -393,16 +359,14 @@ extern void _stdio_term(void) attribute_hidden;
extern struct __STDIO_FILE_STRUCT *_stdio_openlist;
#ifdef __UCLIBC_HAS_THREADS__
-#ifdef __USE_STDIO_FUTEXES__
-extern _IO_lock_t _stdio_openlist_lock;
-#else
-extern pthread_mutex_t _stdio_openlist_lock;
+__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_add_lock);
+#ifdef __STDIO_BUFFERS
+__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_del_lock);
+extern volatile int _stdio_openlist_use_count; /* _stdio_openlist_del_lock */
+extern int _stdio_openlist_del_count; /* _stdio_openlist_del_lock */
#endif
-extern int _stdio_openlist_delflag;
extern int _stdio_user_locking;
-/* #ifdef _LIBC */
-extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden;
-/* #endif */
+extern void __stdio_init_mutex(__UCLIBC_MUTEX_TYPE *m) attribute_hidden;
#endif
#endif
@@ -428,7 +392,8 @@ extern void __stdio_init_mutex(pthread_mutex_t *m) attribute_hidden;
extern int __fgetc_unlocked(FILE *__stream);
extern int __fputc_unlocked(int __c, FILE *__stream);
-/* First define the default definitions. They overriden below as necessary. */
+/* First define the default definitions.
+ They are overridden below as necessary. */
#define __FGETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))
#define __FGETC(__stream) (fgetc)((__stream))
#define __GETC_UNLOCKED_MACRO(__stream) (__fgetc_unlocked)((__stream))
diff --git a/libc/sysdeps/linux/common/bits/uio.h b/libc/sysdeps/linux/common/bits/uio.h
index 9873a1808..87f916d71 100644
--- a/libc/sysdeps/linux/common/bits/uio.h
+++ b/libc/sysdeps/linux/common/bits/uio.h
@@ -38,7 +38,7 @@
functionality even if the currently running kernel does not support
this large value the readv/writev call will not fail because of this. */
#define UIO_MAXIOV 1024
-#define UIO_FASTIOV 8
+#define UIO_FASTIOV 8
/* Structure for scatter/gather I/O. */
diff --git a/libc/sysdeps/linux/common/bits/waitstatus.h b/libc/sysdeps/linux/common/bits/waitstatus.h
index 982c9dbb2..699c22498 100644
--- a/libc/sysdeps/linux/common/bits/waitstatus.h
+++ b/libc/sysdeps/linux/common/bits/waitstatus.h
@@ -1,5 +1,5 @@
/* Definitions of status bits for `wait' et al.
- Copyright (C) 1992, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1992,1994,1996,1997,2000,2004 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
@@ -38,23 +38,25 @@
#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
/* Nonzero if STATUS indicates termination by a signal. */
-#ifdef __GNUC__
-# define __WIFSIGNALED(status) \
- (__extension__ ({ int __status = (status); \
- !__WIFSTOPPED(__status) && !__WIFEXITED(__status); }))
-#else /* Not GCC. */
-# define __WIFSIGNALED(status) (!__WIFSTOPPED(status) && !__WIFEXITED(status))
-#endif /* GCC. */
+#define __WIFSIGNALED(status) \
+ (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
/* Nonzero if STATUS indicates the child is stopped. */
#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
+/* Nonzero if STATUS indicates the child continued after a stop. We only
+ define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */
+#ifdef WCONTINUED
+# define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
+#endif
+
/* Nonzero if STATUS indicates the child dumped core. */
#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
/* Macros for constructing status values. */
#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#define __W_CONTINUED 0xffff
#define __WCOREFLAG 0x80
diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c
index 8c28e51a5..c8c83249c 100644
--- a/libc/sysdeps/linux/common/capget.c
+++ b/libc/sysdeps/linux/common/capget.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
int capget(void *header, void *data);
#ifdef __NR_capget
_syscall2(int, capget, void *, header, void *, data);
diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c
index bee720f92..7a28b0e16 100644
--- a/libc/sysdeps/linux/common/capset.c
+++ b/libc/sysdeps/linux/common/capset.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
int capset(void *header, const void *data);
#ifdef __NR_capset
_syscall2(int, capset, void *, header, const void *, data);
diff --git a/libc/sysdeps/linux/common/chdir.c b/libc/sysdeps/linux/common/chdir.c
index 7afccf20c..d67fa0c9c 100644
--- a/libc/sysdeps/linux/common/chdir.c
+++ b/libc/sysdeps/linux/common/chdir.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <string.h>
#include <unistd.h>
#include <sys/param.h>
diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c
index 03438c054..0b9e89426 100644
--- a/libc/sysdeps/linux/common/chmod.c
+++ b/libc/sysdeps/linux/common/chmod.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
libc_hidden_proto(chmod)
diff --git a/libc/sysdeps/linux/common/chown.c b/libc/sysdeps/linux/common/chown.c
index d6461394b..169ea3aea 100644
--- a/libc/sysdeps/linux/common/chown.c
+++ b/libc/sysdeps/linux/common/chown.c
@@ -7,12 +7,23 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
libc_hidden_proto(chown)
-#define __NR___syscall_chown __NR_chown
+#if (__WORDSIZE == 32 && defined(__NR_chown32)) || __WORDSIZE == 64
+# ifdef __NR_chown32
+# undef __NR_chown
+# define __NR_chown __NR_chown32
+# endif
+
+_syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group);
+
+#else
+
+# define __NR___syscall_chown __NR_chown
static inline _syscall3(int, __syscall_chown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group);
@@ -25,4 +36,6 @@ int chown(const char *path, uid_t owner, gid_t group)
}
return (__syscall_chown(path, owner, group));
}
+#endif
+
libc_hidden_def(chown)
diff --git a/libc/sysdeps/linux/common/chroot.c b/libc/sysdeps/linux/common/chroot.c
index 527310a15..5ea76ab0d 100644
--- a/libc/sysdeps/linux/common/chroot.c
+++ b/libc/sysdeps/linux/common/chroot.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c
index 8ee782845..0a3e1d16f 100644
--- a/libc/sysdeps/linux/common/clock_getres.c
+++ b/libc/sysdeps/linux/common/clock_getres.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
@@ -18,15 +18,18 @@ libc_hidden_proto(sysconf)
int clock_getres(clockid_t clock_id, struct timespec* res)
{
- long clk_tck;
int retval = -1;
switch (clock_id) {
case CLOCK_REALTIME:
- if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0)
- clk_tck = 100;
- res->tv_sec = 0;
- res->tv_nsec = 1000000000 / clk_tck;
+ if (res) {
+ long clk_tck;
+
+ if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0)
+ clk_tck = 100;
+ res->tv_sec = 0;
+ res->tv_nsec = 1000000000 / clk_tck;
+ }
retval = 0;
break;
diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c
index c6b4111fe..38f7ab7ba 100644
--- a/libc/sysdeps/linux/common/clock_gettime.c
+++ b/libc/sysdeps/linux/common/clock_gettime.c
@@ -8,7 +8,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c
index 6ad7872ae..8ebec7381 100644
--- a/libc/sysdeps/linux/common/clock_settime.c
+++ b/libc/sysdeps/linux/common/clock_settime.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c
index 9bd11c028..430fb34b7 100644
--- a/libc/sysdeps/linux/common/close.c
+++ b/libc/sysdeps/linux/common/close.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
extern __typeof(close) __libc_close;
diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c
index c1f250832..f5f00182c 100644
--- a/libc/sysdeps/linux/common/creat64.c
+++ b/libc/sysdeps/linux/common/creat64.c
@@ -22,11 +22,14 @@
#include <fcntl.h>
#include <sys/types.h>
-libc_hidden_proto(open64)
+extern __typeof(open64) __libc_open64;
+libc_hidden_proto(__libc_open64)
+extern __typeof(creat64) __libc_creat64;
/* Create FILE with protections MODE. */
-int creat64 (const char *file, mode_t mode)
+int __libc_creat64 (const char *file, mode_t mode)
{
- return open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
+ return __libc_open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
}
+weak_alias(__libc_creat64,creat64)
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c
index 66a1610d3..a93921411 100644
--- a/libc/sysdeps/linux/common/delete_module.c
+++ b/libc/sysdeps/linux/common/delete_module.c
@@ -6,7 +6,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
int delete_module(const char *name);
#ifdef __NR_delete_module
_syscall1(int, delete_module, const char *, name);
diff --git a/libc/sysdeps/linux/common/dup.c b/libc/sysdeps/linux/common/dup.c
index 01b467639..ea7f7d0b1 100644
--- a/libc/sysdeps/linux/common/dup.c
+++ b/libc/sysdeps/linux/common/dup.c
@@ -6,6 +6,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
_syscall1(int, dup, int, oldfd);
diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c
index 27d837608..16bcc4221 100644
--- a/libc/sysdeps/linux/common/dup2.c
+++ b/libc/sysdeps/linux/common/dup2.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(dup2)
diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c
index b2f06f9ef..27f5a7d61 100644
--- a/libc/sysdeps/linux/common/epoll.c
+++ b/libc/sysdeps/linux/common/epoll.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/epoll.h>
/*
diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c
index 7183f481f..6bc72dde9 100644
--- a/libc/sysdeps/linux/common/execve.c
+++ b/libc/sysdeps/linux/common/execve.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c
index 1c59bac00..15c7dbd73 100644
--- a/libc/sysdeps/linux/common/fchdir.c
+++ b/libc/sysdeps/linux/common/fchdir.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(fchdir)
diff --git a/libc/sysdeps/linux/common/fchmod.c b/libc/sysdeps/linux/common/fchmod.c
index f1eb170ce..72ec37a89 100644
--- a/libc/sysdeps/linux/common/fchmod.c
+++ b/libc/sysdeps/linux/common/fchmod.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
#define __NR___syscall_fchmod __NR_fchmod
diff --git a/libc/sysdeps/linux/common/fchown.c b/libc/sysdeps/linux/common/fchown.c
index fa8734284..e8d6eee48 100644
--- a/libc/sysdeps/linux/common/fchown.c
+++ b/libc/sysdeps/linux/common/fchown.c
@@ -2,24 +2,26 @@
/*
* fchown() for uClibc
*
- * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@codepoet.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
-#include <linux/version.h>
+#include <bits/wordsize.h>
-/* Linux 2.3.39 introduced 32bit UID/GIDs. Some platforms had 32
- bit type all along. */
-#if LINUX_VERSION_CODE >= 131879
+#if (__WORDSIZE == 32 && defined(__NR_fchown32)) || __WORDSIZE == 64
+# ifdef __NR_fchown32
+# undef __NR_fchown
+# define __NR_fchown __NR_fchown32
+# endif
_syscall3(int, fchown, int, fd, uid_t, owner, gid_t, group);
#else
-#define __NR___syscall_fchown __NR_fchown
+# define __NR___syscall_fchown __NR_fchown
static inline _syscall3(int, __syscall_fchown, int, fd,
__kernel_uid_t, owner, __kernel_gid_t, group);
diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c
index c15e47b42..774433f17 100644
--- a/libc/sysdeps/linux/common/fdatasync.c
+++ b/libc/sysdeps/linux/common/fdatasync.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __NR_osf_fdatasync
diff --git a/libc/sysdeps/linux/common/flock.c b/libc/sysdeps/linux/common/flock.c
index c08783ca9..8a4aa895d 100644
--- a/libc/sysdeps/linux/common/flock.c
+++ b/libc/sysdeps/linux/common/flock.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/file.h>
#define __NR___syscall_flock __NR_flock
diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c
index 884e986ab..b4fa3686d 100644
--- a/libc/sysdeps/linux/common/fork.c
+++ b/libc/sysdeps/linux/common/fork.c
@@ -7,10 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __ARCH_USE_MMU__
+
#ifdef __NR_fork
extern __typeof(fork) __libc_fork;
#define __NR___libc_fork __NR_fork
@@ -19,4 +20,17 @@ libc_hidden_proto(fork)
weak_alias(__libc_fork,fork)
libc_hidden_weak(fork)
#endif
+
+#elif defined __UCLIBC_HAS_STUBS__
+
+pid_t __libc_fork(void)
+{
+ __set_errno(ENOSYS);
+ return -1;
+}
+libc_hidden_proto(fork)
+weak_alias(__libc_fork,fork)
+libc_hidden_weak(fork)
+link_warning(fork, "fork: this function is not implemented on no-mmu systems")
+
#endif
diff --git a/libc/sysdeps/linux/common/fpu_control.h b/libc/sysdeps/linux/common/fpu_control.h
index 4a1b07d23..de261c2eb 100644
--- a/libc/sysdeps/linux/common/fpu_control.h
+++ b/libc/sysdeps/linux/common/fpu_control.h
@@ -33,7 +33,9 @@ typedef unsigned int fpu_control_t;
#define _FPU_GETCW(cw) 0
#define _FPU_SETCW(cw) do { } while (0)
+#if 0
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
+#endif
#endif /* _FPU_CONTROL_H */
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index c89d7e57c..437c2d16b 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -11,7 +11,7 @@
* will fail when __NR_fstat64 doesnt exist */
#define fstat64 __hidefstat64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c
index f992de20a..215868d89 100644
--- a/libc/sysdeps/linux/common/fstat64.c
+++ b/libc/sysdeps/linux/common/fstat64.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c
index 2a90a38ed..830de8103 100644
--- a/libc/sysdeps/linux/common/fstatfs.c
+++ b/libc/sysdeps/linux/common/fstatfs.c
@@ -7,10 +7,30 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/vfs.h>
-libc_hidden_proto(fstatfs)
+#if !defined __UCLIBC_LINUX_SPECIFIC__
+#ifndef __USE_FILE_OFFSET64
+extern int fstatfs (int __fildes, struct statfs *__buf)
+ __THROW __nonnull ((2));
+#else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf),
+ fstatfs64) __nonnull ((2));
+# else
+# define fstatfs fstatfs64
+# endif
+#endif
+#endif
+extern __typeof(fstatfs) __libc_fstatfs;
+libc_hidden_proto(__libc_fstatfs)
+#define __NR___libc_fstatfs __NR_fstatfs
+_syscall2(int, __libc_fstatfs, int, fd, struct statfs *, buf);
+libc_hidden_def(__libc_fstatfs)
-_syscall2(int, fstatfs, int, fd, struct statfs *, buf);
-libc_hidden_def(fstatfs)
+#if defined __UCLIBC_LINUX_SPECIFIC__
+libc_hidden_proto(fstatfs)
+weak_alias(__libc_fstatfs,fstatfs)
+libc_hidden_weak(fstatfs)
+#endif
diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c
index ecc203c74..be76b2d0d 100644
--- a/libc/sysdeps/linux/common/fsync.c
+++ b/libc/sysdeps/linux/common/fsync.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c
index 8c342e7fc..951720ba8 100644
--- a/libc/sysdeps/linux/common/ftruncate.c
+++ b/libc/sysdeps/linux/common/ftruncate.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(ftruncate)
diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c
index 2c2d9c028..4f4ee5167 100644
--- a/libc/sysdeps/linux/common/get_kernel_syms.c
+++ b/libc/sysdeps/linux/common/get_kernel_syms.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
struct kernel_sym;
int get_kernel_syms(struct kernel_sym *table attribute_unused);
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index 165ea317e..512a9e1ee 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -18,10 +18,10 @@
libc_hidden_proto(getcwd)
libc_hidden_proto(getpagesize)
-libc_hidden_proto(strcat)
-libc_hidden_proto(strcpy)
-libc_hidden_proto(strncpy)
-libc_hidden_proto(strlen)
+/* Experimentally off - libc_hidden_proto(strcat) */
+/* Experimentally off - libc_hidden_proto(strcpy) */
+/* Experimentally off - libc_hidden_proto(strncpy) */
+/* Experimentally off - libc_hidden_proto(strlen) */
libc_hidden_proto(opendir)
libc_hidden_proto(readdir)
libc_hidden_proto(closedir)
@@ -165,7 +165,7 @@ int __syscall_getcwd(char * buf, unsigned long size)
cwd = recurser(buf, size, st.st_dev, st.st_ino);
if (cwd) {
- len = strlen(buf);
+ len = strlen(buf) + 1;
__set_errno(olderrno);
}
return len;
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index 11c2570c4..55c8f85ee 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -15,10 +15,10 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/syscall.h>
+#include <bits/kernel_types.h>
/* With newer versions of linux, the getdents syscall returns d_type
- * information after the name field. Someday, we should add support for
- * that instead of always calling getdents64 ...
+ * information after the name field.
*
* See __ASSUME_GETDENTS32_D_TYPE in glibc's kernel-features.h for specific
* version / arch details.
@@ -38,14 +38,42 @@ struct kernel_dirent
ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden;
-#if ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
-
-libc_hidden_proto(memcpy)
-libc_hidden_proto(lseek)
-
#define __NR___syscall_getdents __NR_getdents
static inline _syscall3(int, __syscall_getdents, int, fd, unsigned char *, kdirp, size_t, count);
+#ifdef __ASSUME_GETDENTS32_D_TYPE
+ssize_t __getdents (int fd, char *buf, size_t nbytes)
+{
+ ssize_t retval;
+
+ retval = __syscall_getdents(fd, (unsigned char *)buf, nbytes);
+
+ /* The kernel added the d_type value after the name. Change
+ this now. */
+ if (retval != -1) {
+ union {
+ struct kernel_dirent k;
+ struct dirent u;
+ } *kbuf = (void *) buf;
+
+ while ((char *) kbuf < buf + retval) {
+ char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1);
+ memmove (kbuf->u.d_name, kbuf->k.d_name,
+ strlen (kbuf->k.d_name) + 1);
+ kbuf->u.d_type = d_type;
+
+ kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen);
+ }
+ }
+
+ return retval;
+}
+
+#elif ! defined __UCLIBC_HAS_LFS__ || ! defined __NR_getdents64
+
+/* Experimentally off - libc_hidden_proto(memcpy) */
+libc_hidden_proto(lseek)
+
ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
@@ -107,7 +135,7 @@ attribute_hidden strong_alias(__getdents,__getdents64)
#elif __WORDSIZE == 32
-libc_hidden_proto(memmove)
+/* Experimentally off - libc_hidden_proto(memmove) */
extern __typeof(__getdents) __getdents64 attribute_hidden;
ssize_t __getdents (int fd, char *buf, size_t nbytes)
diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c
index 57936d348..2328df29e 100644
--- a/libc/sysdeps/linux/common/getdents64.c
+++ b/libc/sysdeps/linux/common/getdents64.c
@@ -16,10 +16,11 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/syscall.h>
+#include <bits/kernel_types.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
-libc_hidden_proto(memcpy)
+/* Experimentally off - libc_hidden_proto(memcpy) */
libc_hidden_proto(lseek64)
# ifndef offsetof
diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c
index e196d1bd9..5938d7257 100644
--- a/libc/sysdeps/linux/common/getdirname.c
+++ b/libc/sysdeps/linux/common/getdirname.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
-libc_hidden_proto(strdup)
+/* Experimentally off - libc_hidden_proto(strdup) */
libc_hidden_proto(getcwd)
libc_hidden_proto(getenv)
#ifdef __UCLIBC_HAS_LFS__
diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c
index 4efd8280d..44d21862f 100644
--- a/libc/sysdeps/linux/common/getdtablesize.c
+++ b/libc/sysdeps/linux/common/getdtablesize.c
@@ -9,6 +9,8 @@
#include <sys/resource.h>
#include <limits.h>
+/* XXX: _BSD || _XOPEN_SOURCE >= 500 */
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
libc_hidden_proto(getdtablesize)
libc_hidden_proto(getrlimit)
@@ -27,3 +29,4 @@ int getdtablesize (void)
return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur;
}
libc_hidden_def(getdtablesize)
+#endif
diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c
index 466d63d89..7c34b6c09 100644
--- a/libc/sysdeps/linux/common/getegid.c
+++ b/libc/sysdeps/linux/common/getegid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(getegid)
diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c
index 247f1bfda..d10c350e4 100644
--- a/libc/sysdeps/linux/common/geteuid.c
+++ b/libc/sysdeps/linux/common/geteuid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(geteuid)
diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c
index 3f48c33c8..820ebf0e2 100644
--- a/libc/sysdeps/linux/common/getgid.c
+++ b/libc/sysdeps/linux/common/getgid.c
@@ -7,12 +7,18 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __NR_getxgid
+# undef __NR_getgid
# define __NR_getgid __NR_getxgid
#endif
+#ifdef __NR_getgid32
+# undef __NR_getgid
+# define __NR_getgid __NR_getgid32
+#endif
+
libc_hidden_proto(getgid)
_syscall0(gid_t, getgid);
libc_hidden_def(getgid)
diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c
index 6903ed14f..10da03ddd 100644
--- a/libc/sysdeps/linux/common/getgroups.c
+++ b/libc/sysdeps/linux/common/getgroups.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdlib.h>
#include <unistd.h>
#include <grp.h>
@@ -53,8 +53,7 @@ ret_error:
}
}
- if (kernel_groups)
- free(kernel_groups);
+ free(kernel_groups);
return ngids;
}
}
diff --git a/libc/sysdeps/linux/common/getitimer.c b/libc/sysdeps/linux/common/getitimer.c
index 0d2024dfc..b240f1c6e 100644
--- a/libc/sysdeps/linux/common/getitimer.c
+++ b/libc/sysdeps/linux/common/getitimer.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/time.h>
_syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c
index 6cdaef172..49f780adf 100644
--- a/libc/sysdeps/linux/common/getpgid.c
+++ b/libc/sysdeps/linux/common/getpgid.c
@@ -7,7 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_UNIX98
#include <unistd.h>
#define __NR___syscall_getpgid __NR_getpgid
@@ -17,3 +19,4 @@ pid_t getpgid(pid_t pid)
{
return (__syscall_getpgid(pid));
}
+#endif
diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c
index 9260e432a..a2fe44560 100644
--- a/libc/sysdeps/linux/common/getpgrp.c
+++ b/libc/sysdeps/linux/common/getpgrp.c
@@ -7,9 +7,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __NR_getpgrp
+/* According to the manpage the POSIX.1 version is favoured */
_syscall0(pid_t, getpgrp);
#endif
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index fd331bd62..56f1ddd66 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
extern __typeof(getpid) __libc_getpid;
diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c
index 6a68ad615..1630234cc 100644
--- a/libc/sysdeps/linux/common/getppid.c
+++ b/libc/sysdeps/linux/common/getppid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __NR_getppid
_syscall0(pid_t, getppid);
diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c
index 41cc3eb49..b66b1ea15 100644
--- a/libc/sysdeps/linux/common/getpriority.c
+++ b/libc/sysdeps/linux/common/getpriority.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/resource.h>
libc_hidden_proto(getpriority)
diff --git a/libc/sysdeps/linux/common/getresgid.c b/libc/sysdeps/linux/common/getresgid.c
index bc19b97ea..9c2d13ba9 100644
--- a/libc/sysdeps/linux/common/getresgid.c
+++ b/libc/sysdeps/linux/common/getresgid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __USE_GNU
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/getresuid.c b/libc/sysdeps/linux/common/getresuid.c
index b8d1788f6..dbc8df903 100644
--- a/libc/sysdeps/linux/common/getresuid.c
+++ b/libc/sysdeps/linux/common/getresuid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __USE_GNU
#include <unistd.h>
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index 2a4d05318..ecb09d1e2 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -8,7 +8,7 @@
*/
#define getrlimit64 __hide_getrlimit64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/resource.h>
#undef getrlimit64
@@ -17,7 +17,7 @@ libc_hidden_proto(getrlimit)
/* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */
-#if defined(__NR_ugetrlimit)
+#if defined __NR_ugetrlimit
/* just call ugetrlimit() */
# define __NR___syscall_ugetrlimit __NR_ugetrlimit
diff --git a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c
index 9b87cb1b4..03f524dff 100644
--- a/libc/sysdeps/linux/common/getrusage.c
+++ b/libc/sysdeps/linux/common/getrusage.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <wait.h>
_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);
diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c
index aaac0ceb9..398851873 100644
--- a/libc/sysdeps/linux/common/getsid.c
+++ b/libc/sysdeps/linux/common/getsid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __USE_XOPEN_EXTENDED
diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c
index 8e1cf57eb..697b2dd6c 100644
--- a/libc/sysdeps/linux/common/gettimeofday.c
+++ b/libc/sysdeps/linux/common/gettimeofday.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/time.h>
libc_hidden_proto(gettimeofday)
diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c
index 21c504d65..7d5a02bc6 100644
--- a/libc/sysdeps/linux/common/getuid.c
+++ b/libc/sysdeps/linux/common/getuid.c
@@ -7,12 +7,18 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __NR_getxuid
-# define __NR_getuid __NR_getxuid
+# undef __NR_getuid
+# define __NR_getuid __NR_getxuid
#endif
+#ifdef __NR_getuid32
+# undef __NR_getuid
+# define __NR_getuid __NR_getuid32
+#endif
+
libc_hidden_proto(getuid)
_syscall0(uid_t, getuid);
libc_hidden_def(getuid)
diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c
index 3fb566961..45f1fff23 100644
--- a/libc/sysdeps/linux/common/init_module.c
+++ b/libc/sysdeps/linux/common/init_module.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.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
diff --git a/libc/sysdeps/linux/common/inotify.c b/libc/sysdeps/linux/common/inotify.c
index 87cf4d71e..31bfb0c3b 100644
--- a/libc/sysdeps/linux/common/inotify.c
+++ b/libc/sysdeps/linux/common/inotify.c
@@ -8,7 +8,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/inotify.h>
#ifdef __NR_inotify_init
diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c
index 02393b98e..f27fb05e3 100644
--- a/libc/sysdeps/linux/common/ioctl.c
+++ b/libc/sysdeps/linux/common/ioctl.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdarg.h>
#include <sys/ioctl.h>
diff --git a/libc/sysdeps/linux/common/ioperm.c b/libc/sysdeps/linux/common/ioperm.c
index e9ca964cc..880842d97 100644
--- a/libc/sysdeps/linux/common/ioperm.c
+++ b/libc/sysdeps/linux/common/ioperm.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#if defined __ARCH_USE_MMU__ && defined __NR_ioperm
/* psm: can't #include <sys/io.h>, some archs miss it */
extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on) __THROW;
diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c
index 2a6b619d5..510e1a4f6 100644
--- a/libc/sysdeps/linux/common/iopl.c
+++ b/libc/sysdeps/linux/common/iopl.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#if defined __ARCH_USE_MMU__ && defined __NR_iopl
/* psm: can't #include <sys/io.h>, some archs miss it */
extern int iopl(int __level) __THROW;
diff --git a/libc/sysdeps/linux/common/kill.c b/libc/sysdeps/linux/common/kill.c
index 7e1b330a5..46eabf0c9 100644
--- a/libc/sysdeps/linux/common/kill.c
+++ b/libc/sysdeps/linux/common/kill.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <signal.h>
libc_hidden_proto(kill)
diff --git a/libc/sysdeps/linux/common/klogctl.c b/libc/sysdeps/linux/common/klogctl.c
index 5e36104f1..81451022e 100644
--- a/libc/sysdeps/linux/common/klogctl.c
+++ b/libc/sysdeps/linux/common/klogctl.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/klog.h>
#define __NR__syslog __NR_syslog
diff --git a/libc/sysdeps/linux/common/lchown.c b/libc/sysdeps/linux/common/lchown.c
index ffee39126..8095c941e 100644
--- a/libc/sysdeps/linux/common/lchown.c
+++ b/libc/sysdeps/linux/common/lchown.c
@@ -7,10 +7,21 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_lchown __NR_lchown
+#if (__WORDSIZE == 32 && defined(__NR_lchown32)) || __WORDSIZE == 64
+# ifdef __NR_lchown32
+# undef __NR_lchown
+# define __NR_lchown __NR_lchown32
+# endif
+
+_syscall3(int, lchown, const char *, path, uid_t, owner, gid_t, group);
+
+#else
+
+# define __NR___syscall_lchown __NR_lchown
static inline _syscall3(int, __syscall_lchown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group);
@@ -23,3 +34,5 @@ int lchown(const char *path, uid_t owner, gid_t group)
}
return __syscall_lchown(path, owner, group);
}
+
+#endif
diff --git a/libc/sysdeps/linux/common/link.c b/libc/sysdeps/linux/common/link.c
index 21d1f1413..a012cc2c3 100644
--- a/libc/sysdeps/linux/common/link.c
+++ b/libc/sysdeps/linux/common/link.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
_syscall2(int, link, const char *, oldpath, const char *, newpath);
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index 0cfbe1a46..ea72dc4f3 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
extern __typeof(lseek64) __libc_lseek64;
@@ -39,3 +40,4 @@ loff_t __libc_lseek64(int fd, loff_t offset, int whence)
libc_hidden_proto(lseek64)
weak_alias(__libc_lseek64,lseek64)
libc_hidden_weak(lseek64)
+//strong_alias(__libc_lseek64,_llseek)
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index 72833b81b..5ba5ad9c8 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -7,14 +7,23 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
extern __typeof(lseek) __libc_lseek;
libc_hidden_proto(__libc_lseek)
+#ifdef __NR_lseek
#define __NR___libc_lseek __NR_lseek
_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence);
+#else
+extern __typeof(lseek64) __libc_lseek64;
+libc_hidden_proto(__libc_lseek64)
+__off_t __libc_lseek(int fildes, __off_t offset, int whence)
+{
+ return __libc_lseek64(fildes, offset, whence);
+}
+#endif
libc_hidden_def(__libc_lseek)
libc_hidden_proto(lseek)
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index 06c7c5d90..379ffd30d 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -11,7 +11,7 @@
* will fail when __NR_lstat64 doesnt exist */
#define lstat64 __hidelstat64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 2dc06c692..1c392636f 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
# include <unistd.h>
diff --git a/libc/sysdeps/linux/common/madvise.c b/libc/sysdeps/linux/common/madvise.c
index 8c3918060..627bcdc59 100644
--- a/libc/sysdeps/linux/common/madvise.c
+++ b/libc/sysdeps/linux/common/madvise.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mman.h>
#if defined __NR_madvise && defined __USE_BSD
_syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);
diff --git a/libc/sysdeps/linux/common/mincore.c b/libc/sysdeps/linux/common/mincore.c
index 0e3ade1ce..1dc9a9a1a 100644
--- a/libc/sysdeps/linux/common/mincore.c
+++ b/libc/sysdeps/linux/common/mincore.c
@@ -6,10 +6,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __NR_mincore && (defined __USE_BSD || defined __USE_SVID)
#include <unistd.h>
#include <sys/mman.h>
-
-#ifdef __NR_mincore
_syscall3(int, mincore, void *, start, size_t, length, unsigned char *, vec);
#endif
diff --git a/libc/sysdeps/linux/common/mkdir.c b/libc/sysdeps/linux/common/mkdir.c
index 93b66ae40..1d7238456 100644
--- a/libc/sysdeps/linux/common/mkdir.c
+++ b/libc/sysdeps/linux/common/mkdir.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
libc_hidden_proto(mkdir)
diff --git a/libc/sysdeps/linux/common/mknod.c b/libc/sysdeps/linux/common/mknod.c
index b71541d95..02b3822f8 100644
--- a/libc/sysdeps/linux/common/mknod.c
+++ b/libc/sysdeps/linux/common/mknod.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
diff --git a/libc/sysdeps/linux/common/mlock.c b/libc/sysdeps/linux/common/mlock.c
index 3eb72bb07..55b77a5d5 100644
--- a/libc/sysdeps/linux/common/mlock.c
+++ b/libc/sysdeps/linux/common/mlock.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mman.h>
#if defined __ARCH_USE_MMU__ && defined __NR_mlock
_syscall2(int, mlock, const void *, addr, size_t, len);
diff --git a/libc/sysdeps/linux/common/mlockall.c b/libc/sysdeps/linux/common/mlockall.c
index 6e6d3bc36..d75e30fe7 100644
--- a/libc/sysdeps/linux/common/mlockall.c
+++ b/libc/sysdeps/linux/common/mlockall.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mman.h>
#if defined __ARCH_USE_MMU__ && defined __NR_mlockall
_syscall1(int, mlockall, int, flags);
diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c
index 6acb73980..f40554ebb 100644
--- a/libc/sysdeps/linux/common/mmap.c
+++ b/libc/sysdeps/linux/common/mmap.c
@@ -7,9 +7,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <bits/uClibc_page.h>
#ifdef __NR_mmap
@@ -41,4 +42,32 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot,
#endif
libc_hidden_def(mmap)
+
+#elif defined(__NR_mmap2)
+
+libc_hidden_proto(mmap)
+
+#define __NR___syscall_mmap2 __NR_mmap2
+static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, 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
+ * real PAGE_SHIFT != 12. Other architectures use the same value as
+ * PAGE_SHIFT...
+ */
+# ifndef MMAP2_PAGE_SHIFT
+# define MMAP2_PAGE_SHIFT 12
+# endif
+
+__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+{
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
+ __set_errno(EINVAL);
+ return MAP_FAILED;
+ }
+ return __syscall_mmap2(addr, len, prot, flags, fd, offset >> MMAP2_PAGE_SHIFT);
+}
+
+libc_hidden_def(mmap)
+
#endif
diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c
index 2cf200dc9..8c0518d1d 100644
--- a/libc/sysdeps/linux/common/mmap64.c
+++ b/libc/sysdeps/linux/common/mmap64.c
@@ -59,7 +59,13 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
return MAP_FAILED;
}
- return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
+# ifdef __USE_FILE_OFFSET64
+ return __syscall_mmap2(addr, len, prot, flags,
+ fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
+# else
+ return __syscall_mmap2(addr, len, prot, flags,
+ fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
+# endif
}
# endif
diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c
index 9ebb68b3c..d5f0105dd 100644
--- a/libc/sysdeps/linux/common/modify_ldt.c
+++ b/libc/sysdeps/linux/common/modify_ldt.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
int modify_ldt (int func, void *ptr, unsigned long bytecount);
#ifdef __NR_modify_ldt
diff --git a/libc/sysdeps/linux/common/mount.c b/libc/sysdeps/linux/common/mount.c
index 9cbefe4a8..a5a2c7fec 100644
--- a/libc/sysdeps/linux/common/mount.c
+++ b/libc/sysdeps/linux/common/mount.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mount.h>
_syscall5(int, mount, const char *, specialfile, const char *, dir,
const char *, filesystemtype, unsigned long, rwflag,
diff --git a/libc/sysdeps/linux/common/mprotect.c b/libc/sysdeps/linux/common/mprotect.c
index 7eab338d0..7122f0f2f 100644
--- a/libc/sysdeps/linux/common/mprotect.c
+++ b/libc/sysdeps/linux/common/mprotect.c
@@ -7,6 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mman.h>
+
+#if defined __ARCH_USE_MMU__ && defined __NR_mprotect
_syscall3(int, mprotect, void *, addr, size_t, len, int, prot);
+#endif
diff --git a/libc/sysdeps/linux/common/mremap.c b/libc/sysdeps/linux/common/mremap.c
index 5499c0975..04548d5ec 100644
--- a/libc/sysdeps/linux/common/mremap.c
+++ b/libc/sysdeps/linux/common/mremap.c
@@ -7,8 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+
+#ifdef __NR_mremap
+
#define mremap _hidemremap
#include <sys/mman.h>
#undef mremap
@@ -19,3 +22,5 @@ libc_hidden_proto(mremap)
_syscall5(void *, mremap, void *, old_address, size_t, old_size, size_t,
new_size, int, may_move, void *, new_address);
libc_hidden_def(mremap)
+
+#endif
diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c
index 8882a4c91..5d8bf73fd 100644
--- a/libc/sysdeps/linux/common/msync.c
+++ b/libc/sysdeps/linux/common/msync.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/mman.h>
diff --git a/libc/sysdeps/linux/common/munlock.c b/libc/sysdeps/linux/common/munlock.c
index 1d6870ecc..e901cc00a 100644
--- a/libc/sysdeps/linux/common/munlock.c
+++ b/libc/sysdeps/linux/common/munlock.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/mman.h>
#if defined __ARCH_USE_MMU__ && defined __NR_munlock
_syscall2(int, munlock, const void *, addr, size_t, len);
diff --git a/libc/sysdeps/linux/common/munlockall.c b/libc/sysdeps/linux/common/munlockall.c
index 4ee729292..39507715a 100644
--- a/libc/sysdeps/linux/common/munlockall.c
+++ b/libc/sysdeps/linux/common/munlockall.c
@@ -7,8 +7,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __NR_munlockall && defined __ARCH_USE_MMU__
#include <sys/mman.h>
-#if defined __ARCH_USE_MMU__
+
_syscall0(int, munlockall);
#endif
diff --git a/libc/sysdeps/linux/common/munmap.c b/libc/sysdeps/linux/common/munmap.c
index 7a82df632..5c948abfd 100644
--- a/libc/sysdeps/linux/common/munmap.c
+++ b/libc/sysdeps/linux/common/munmap.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/mman.h>
diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c
index 1e541500b..7e3349117 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/nice.c b/libc/sysdeps/linux/common/nice.c
index e6e80e7be..393ffef4e 100644
--- a/libc/sysdeps/linux/common/nice.c
+++ b/libc/sysdeps/linux/common/nice.c
@@ -8,7 +8,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/resource.h>
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 822ac4f63..b4bef3c63 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
@@ -15,26 +15,25 @@
#include <sys/param.h>
extern __typeof(open) __libc_open;
-libc_hidden_proto(__libc_open)
+extern __typeof(creat) __libc_creat;
#define __NR___syscall_open __NR_open
static inline _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode);
-int __libc_open(const char *file, int flags, ...)
+libc_hidden_proto(__libc_open)
+int __libc_open(const char *file, int oflag, ...)
{
- /* gcc may warn about mode being uninitialized.
- * Just ignore that, since gcc is wrong. */
- mode_t mode;
+ mode_t mode = 0;
- if (flags & O_CREAT) {
- va_list ap;
-
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
+ if (oflag & O_CREAT) {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
}
- return __syscall_open(file, flags, mode);
+
+ return __syscall_open(file, oflag, mode);
}
libc_hidden_def(__libc_open)
@@ -42,7 +41,8 @@ libc_hidden_proto(open)
weak_alias(__libc_open,open)
libc_hidden_weak(open)
-int creat(const char *file, mode_t mode)
+int __libc_creat(const char *file, mode_t mode)
{
return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
}
+weak_alias(__libc_creat,creat)
diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index 5c19d63b5..3f2ea344e 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -24,16 +24,17 @@ libc_hidden_proto(__libc_open)
/* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
a third argument is the file protection. */
+libc_hidden_proto(__libc_open64)
int __libc_open64 (const char *file, int oflag, ...)
{
- int mode = 0;
+ mode_t mode = 0;
- if (oflag & O_CREAT)
+ if (oflag & O_CREAT)
{
- va_list arg;
- va_start (arg, oflag);
- mode = va_arg (arg, int);
- va_end (arg);
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
}
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -51,6 +52,8 @@ int __libc_open64 (const char *file, int oflag, ...)
return __libc_open(file, oflag | O_LARGEFILE, mode);
#endif
}
+libc_hidden_def(__libc_open64)
+
libc_hidden_proto(open64)
weak_alias(__libc_open64,open64)
libc_hidden_weak(open64)
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index 74115b281..31d3563fb 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -7,7 +7,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <signal.h>
+#define __UCLIBC_HIDE_DEPRECATED__
+#include <sys/syscall.h>
#include <unistd.h>
#include <sysdep-cancel.h>
diff --git a/libc/sysdeps/linux/common/personality.c b/libc/sysdeps/linux/common/personality.c
index 39b15007f..149fb5f08 100644
--- a/libc/sysdeps/linux/common/personality.c
+++ b/libc/sysdeps/linux/common/personality.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/personality.h>
_syscall1(int, personality, unsigned long int, __persona);
diff --git a/libc/sysdeps/linux/common/pipe.c b/libc/sysdeps/linux/common/pipe.c
index 02a6975e9..789b23c40 100644
--- a/libc/sysdeps/linux/common/pipe.c
+++ b/libc/sysdeps/linux/common/pipe.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(pipe)
diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c
index f5d1f1d7f..154a37e2d 100644
--- a/libc/sysdeps/linux/common/pivot_root.c
+++ b/libc/sysdeps/linux/common/pivot_root.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
int pivot_root(const char *new_root, const char *put_old);
#ifdef __NR_pivot_root
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c
index 7ce1446f5..1267a30d1 100644
--- a/libc/sysdeps/linux/common/poll.c
+++ b/libc/sysdeps/linux/common/poll.c
@@ -17,7 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/poll.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -56,8 +56,8 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
#include <sys/param.h>
#include <unistd.h>
-libc_hidden_proto(memcpy)
-libc_hidden_proto(memset)
+/* Experimentally off - libc_hidden_proto(memcpy) */
+/* Experimentally off - libc_hidden_proto(memset) */
libc_hidden_proto(getdtablesize)
libc_hidden_proto(select)
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index 5fba19ffc..45734f9b2 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -12,16 +12,32 @@
* will fail when __NR_fadvise64_64 doesnt exist */
#define posix_fadvise64 __hideposix_fadvise64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <fcntl.h>
#undef posix_fadvise64
#ifdef __NR_fadvise64
#define __NR_posix_fadvise __NR_fadvise64
+/* get rid of following conditional when
+ all supported arches are having INTERNAL_SYSCALL defined
+*/
+#ifdef INTERNAL_SYSCALL
+int posix_fadvise(int fd, off_t offset, off_t len, int advice)
+{
+ INTERNAL_SYSCALL_DECL(err);
+ int ret = (int) (INTERNAL_SYSCALL(posix_fadvise, err, 5, fd,
+ __LONG_LONG_PAIR (offset >> 31, offset), len, advice));
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+}
+#else
_syscall4(int, posix_fadvise, int, fd, off_t, offset,
off_t, len, int, advice);
+#endif
+
#if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6)
extern __typeof(posix_fadvise) posix_fadvise64;
strong_alias(posix_fadvise,posix_fadvise64)
@@ -30,7 +46,7 @@ strong_alias(posix_fadvise,posix_fadvise64)
#else
int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
{
- __set_errno(ENOSYS);
- return -1;
+#warning This is not correct as far as SUSv3 is concerned.
+ return ENOSYS;
}
#endif
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index d931aff60..7944c4985 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -24,8 +24,25 @@
#if __WORDSIZE == 64
#define __NR_posix_fadvise64 __NR_fadvise64_64
+
+#ifdef INTERNAL_SYSCALL
+int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
+{
+ if (len != (off_t) len)
+ return EOVERFLOW;
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (posix_fadvise64, err, 5, fd,
+ __LONG_LONG_PAIR ((long) (offset >> 32),
+ (long) offset),
+ (off_t) len, advice);
+ if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return 0;
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+}
+#else
_syscall4(int, posix_fadvise64, int, fd, __off64_t, offset,
__off64_t, len, int, advice);
+#endif
/* 32 bit implementation is kind of a pita */
#elif __WORDSIZE == 32
@@ -57,8 +74,8 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
*/
int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
{
- __set_errno(ENOSYS);
- return -1;
+#warning This is not correct as far as SUSv3 is concerned.
+ return ENOSYS;
}
#endif /* __NR_fadvise64_64 */
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/prctl.c b/libc/sysdeps/linux/common/prctl.c
index 52d1e76e0..485386727 100644
--- a/libc/sysdeps/linux/common/prctl.c
+++ b/libc/sysdeps/linux/common/prctl.c
@@ -7,8 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#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);
_syscall5(int, prctl, int, option, long, arg2, long, arg3, long, arg4, long, arg5);
+#endif
diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
index 2509b7ab6..3c0df19a3 100644
--- a/libc/sysdeps/linux/common/pread_write.c
+++ b/libc/sysdeps/linux/common/pread_write.c
@@ -7,15 +7,16 @@
/*
* Based in part on the files
* ./sysdeps/unix/sysv/linux/pwrite.c,
- * ./sysdeps/unix/sysv/linux/pread.c,
+ * ./sysdeps/unix/sysv/linux/pread.c,
* sysdeps/posix/pread.c
* sysdeps/posix/pwrite.c
* from GNU libc 2.2.5, but reworked considerably...
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <stdint.h>
+#include <endian.h>
extern __typeof(pread) __libc_pread;
extern __typeof(pwrite) __libc_pwrite;
@@ -24,24 +25,26 @@ extern __typeof(pread64) __libc_pread64;
extern __typeof(pwrite64) __libc_pwrite64;
#endif
+#include <bits/kernel_types.h>
+
#ifdef __NR_pread
-# define __NR___syscall_pread __NR_pread
-static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
+# define __NR___syscall_pread __NR_pread
+static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
-{
- return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
+{
+ return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
}
weak_alias(__libc_pread,pread)
-# ifdef __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
-{
+{
uint32_t low = offset & 0xffffffff;
uint32_t high = offset >> 32;
- return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low)));
+ return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low));
}
weak_alias(__libc_pread64,pread64)
# endif /* __UCLIBC_HAS_LFS__ */
@@ -50,22 +53,22 @@ weak_alias(__libc_pread64,pread64)
#ifdef __NR_pwrite
-# define __NR___syscall_pwrite __NR_pwrite
-static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
+# define __NR___syscall_pwrite __NR_pwrite
+static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
-{
- return(__syscall_pwrite(fd,buf,count,__LONG_LONG_PAIR (offset >> 31, offset)));
+{
+ return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset));
}
weak_alias(__libc_pwrite,pwrite)
-# ifdef __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
-{
+{
uint32_t low = offset & 0xffffffff;
uint32_t high = offset >> 32;
- return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low)));
+ return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low));
}
weak_alias(__libc_pwrite64,pwrite64)
# endif /* __UCLIBC_HAS_LFS__ */
@@ -76,23 +79,23 @@ libc_hidden_proto(read)
libc_hidden_proto(write)
libc_hidden_proto(lseek)
-static ssize_t __fake_pread_write(int fd, void *buf,
+static ssize_t __fake_pread_write(int fd, void *buf,
size_t count, off_t offset, int do_pwrite)
{
int save_errno;
ssize_t result;
off_t old_offset;
- /* Since we must not change the file pointer preserve the
+ /* Since we must not change the file pointer preserve the
* value so that we can restore it later. */
if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
return -1;
/* Set to wanted position. */
- if (lseek (fd, offset, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
return -1;
- if (do_pwrite==1) {
+ if (do_pwrite == 1) {
/* Write the data. */
result = write(fd, buf, count);
} else {
@@ -100,7 +103,7 @@ static ssize_t __fake_pread_write(int fd, void *buf,
result = read(fd, buf, count);
}
- /* Now we have to restore the position. If this fails we
+ /* Now we have to restore the position. If this fails we
* have to return this as an error. */
save_errno = errno;
if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
@@ -113,26 +116,26 @@ static ssize_t __fake_pread_write(int fd, void *buf,
return(result);
}
-# ifdef __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
libc_hidden_proto(lseek64)
-static ssize_t __fake_pread_write64(int fd, void *buf,
+static ssize_t __fake_pread_write64(int fd, void *buf,
size_t count, off64_t offset, int do_pwrite)
{
int save_errno;
ssize_t result;
off64_t old_offset;
- /* Since we must not change the file pointer preserve the
+ /* Since we must not change the file pointer preserve the
* value so that we can restore it later. */
if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
return -1;
/* Set to wanted position. */
- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
- return -1;
+ if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
+ return -1;
- if (do_pwrite==1) {
+ if (do_pwrite == 1) {
/* Write the data. */
result = write(fd, buf, count);
} else {
@@ -142,7 +145,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
/* Now we have to restore the position. */
save_errno = errno;
- if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) {
+ if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
if (result == -1)
__set_errno (save_errno);
return -1;
@@ -156,14 +159,14 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
#ifndef __NR_pread
ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
{
- return(__fake_pread_write(fd, buf, count, offset, 0));
+ return __fake_pread_write(fd, buf, count, offset, 0);
}
weak_alias(__libc_pread,pread)
-# ifdef __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
-{
- return(__fake_pread_write64(fd, buf, count, offset, 0));
+{
+ return __fake_pread_write64(fd, buf, count, offset, 0);
}
weak_alias(__libc_pread64,pread64)
# endif /* __UCLIBC_HAS_LFS__ */
@@ -172,16 +175,16 @@ weak_alias(__libc_pread64,pread64)
#ifndef __NR_pwrite
ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
{
- /* we won't actually be modifying the buffer,
+ /* we won't actually be modifying the buffer,
*just cast it to get rid of warnings */
- return(__fake_pread_write(fd, (void*)buf, count, offset, 1));
+ return __fake_pread_write(fd, (void*)buf, count, offset, 1);
}
weak_alias(__libc_pwrite,pwrite)
-# ifdef __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
-{
- return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
+{
+ return __fake_pread_write64(fd, (void*)buf, count, offset, 1);
}
weak_alias(__libc_pwrite64,pwrite64)
# endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/ptrace.c b/libc/sysdeps/linux/common/ptrace.c
index fda2e9d84..9d6767374 100644
--- a/libc/sysdeps/linux/common/ptrace.c
+++ b/libc/sysdeps/linux/common/ptrace.c
@@ -4,15 +4,15 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <errno.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/ptrace.h>
-#include <sys/syscall.h>
#include <stdarg.h>
+#if defined __NR_ptrace && defined __USE_BSD && defined __USE_MISC
#define __NR___syscall_ptrace __NR_ptrace
-static inline _syscall4(long, __syscall_ptrace, enum __ptrace_request, request,
+static inline _syscall4(long, __syscall_ptrace, enum __ptrace_request, request,
__kernel_pid_t, pid, void*, addr, void*, data);
long int
@@ -40,3 +40,4 @@ ptrace (enum __ptrace_request request, ...)
return res;
}
+#endif
diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c
index ac77f7e18..b0b72dea9 100644
--- a/libc/sysdeps/linux/common/query_module.c
+++ b/libc/sysdeps/linux/common/query_module.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.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
diff --git a/libc/sysdeps/linux/common/quotactl.c b/libc/sysdeps/linux/common/quotactl.c
index 2982f4956..cb044a4e8 100644
--- a/libc/sysdeps/linux/common/quotactl.c
+++ b/libc/sysdeps/linux/common/quotactl.c
@@ -7,7 +7,10 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_BSD
#include <sys/quota.h>
_syscall4(int, quotactl, int, cmd, const char *, special,
int, id, caddr_t, addr);
+#endif
diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c
index 236029ac6..f837e9f07 100644
--- a/libc/sysdeps/linux/common/read.c
+++ b/libc/sysdeps/linux/common/read.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
extern __typeof(read) __libc_read;
diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c
index 73d5441c0..d68391302 100644
--- a/libc/sysdeps/linux/common/readlink.c
+++ b/libc/sysdeps/linux/common/readlink.c
@@ -2,15 +2,14 @@
/*
* readlink() for uClibc
*
- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2000-2007 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(readlink)
-
-_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz);
+_syscall3(ssize_t, readlink, const char *, path, char *, buf, size_t, bufsiz);
libc_hidden_def(readlink)
diff --git a/libc/sysdeps/linux/common/readv.c b/libc/sysdeps/linux/common/readv.c
index ebe73185f..20c87084d 100644
--- a/libc/sysdeps/linux/common/readv.c
+++ b/libc/sysdeps/linux/common/readv.c
@@ -5,10 +5,10 @@
* Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
* Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
*
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/uio.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/reboot.c b/libc/sysdeps/linux/common/reboot.c
index a015d40ad..44828ce64 100644
--- a/libc/sysdeps/linux/common/reboot.c
+++ b/libc/sysdeps/linux/common/reboot.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/reboot.h>
#define __NR__reboot __NR_reboot
static inline _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c
index 55de6b1d0..7e88bf346 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c
index 0aadd73f2..845b3e371 100644
--- a/libc/sysdeps/linux/common/rmdir.c
+++ b/libc/sysdeps/linux/common/rmdir.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(rmdir)
diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c
index f8b568262..734a4ce01 100644
--- a/libc/sysdeps/linux/common/sbrk.c
+++ b/libc/sysdeps/linux/common/sbrk.c
@@ -7,22 +7,21 @@
#include <unistd.h>
#include <errno.h>
-libc_hidden_proto(sbrk)
-
libc_hidden_proto(brk)
/* Defined in brk.c. */
-extern void *__curbrk;
+extern void *__curbrk attribute_hidden;
/* Extend the process's data space by INCREMENT.
If INCREMENT is negative, shrink data space by - INCREMENT.
Return start of new space allocated, or -1 for errors. */
+libc_hidden_proto(sbrk)
void * sbrk (intptr_t increment)
{
void *oldbrk;
if (__curbrk == NULL)
- if (brk (0) < 0) /* Initialize the break. */
+ if (brk (NULL) < 0) /* Initialize the break. */
return (void *) -1;
if (increment == 0)
diff --git a/libc/sysdeps/linux/common/sched_get_priority_max.c b/libc/sysdeps/linux/common/sched_get_priority_max.c
index c9292ffbd..a9ab24639 100644
--- a/libc/sysdeps/linux/common/sched_get_priority_max.c
+++ b/libc/sysdeps/linux/common/sched_get_priority_max.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sched.h>
_syscall1(int, sched_get_priority_max, int, policy);
diff --git a/libc/sysdeps/linux/common/sched_get_priority_min.c b/libc/sysdeps/linux/common/sched_get_priority_min.c
index 317911fc1..5a78f9393 100644
--- a/libc/sysdeps/linux/common/sched_get_priority_min.c
+++ b/libc/sysdeps/linux/common/sched_get_priority_min.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sched.h>
_syscall1(int, sched_get_priority_min, int, policy);
diff --git a/libc/sysdeps/linux/common/sched_getparam.c b/libc/sysdeps/linux/common/sched_getparam.c
index d9b3dcde5..117c6baa2 100644
--- a/libc/sysdeps/linux/common/sched_getparam.c
+++ b/libc/sysdeps/linux/common/sched_getparam.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <sched.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
#define __NR___syscall_sched_getparam __NR_sched_getparam
static inline _syscall2(int, __syscall_sched_getparam,
diff --git a/libc/sysdeps/linux/common/sched_getscheduler.c b/libc/sysdeps/linux/common/sched_getscheduler.c
index 13df2aefd..89ecdf911 100644
--- a/libc/sysdeps/linux/common/sched_getscheduler.c
+++ b/libc/sysdeps/linux/common/sched_getscheduler.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <sched.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
#define __NR___syscall_sched_getscheduler __NR_sched_getscheduler
static inline _syscall1(int, __syscall_sched_getscheduler, __kernel_pid_t, pid);
diff --git a/libc/sysdeps/linux/common/sched_rr_get_interval.c b/libc/sysdeps/linux/common/sched_rr_get_interval.c
index 0eb25016e..a87d27fd2 100644
--- a/libc/sysdeps/linux/common/sched_rr_get_interval.c
+++ b/libc/sysdeps/linux/common/sched_rr_get_interval.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <sched.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
#define __NR___syscall_sched_rr_get_interval __NR_sched_rr_get_interval
static inline _syscall2(int, __syscall_sched_rr_get_interval,
diff --git a/libc/sysdeps/linux/common/sched_setparam.c b/libc/sysdeps/linux/common/sched_setparam.c
index a0ff56840..94a3cee54 100644
--- a/libc/sysdeps/linux/common/sched_setparam.c
+++ b/libc/sysdeps/linux/common/sched_setparam.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <sched.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
#define __NR___syscall_sched_setparam __NR_sched_setparam
static inline _syscall2(int, __syscall_sched_setparam,
diff --git a/libc/sysdeps/linux/common/sched_setscheduler.c b/libc/sysdeps/linux/common/sched_setscheduler.c
index 14236e927..05ada79e5 100644
--- a/libc/sysdeps/linux/common/sched_setscheduler.c
+++ b/libc/sysdeps/linux/common/sched_setscheduler.c
@@ -7,8 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
#include <sched.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
#define __NR___syscall_sched_setscheduler __NR_sched_setscheduler
static inline _syscall3(int, __syscall_sched_setscheduler,
diff --git a/libc/sysdeps/linux/common/sched_yield.c b/libc/sysdeps/linux/common/sched_yield.c
index 3953d8d16..2ae5396c9 100644
--- a/libc/sysdeps/linux/common/sched_yield.c
+++ b/libc/sysdeps/linux/common/sched_yield.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sched.h>
_syscall0(int, sched_yield);
diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c
index 55f4c23fb..34b6e8260 100644
--- a/libc/sysdeps/linux/common/select.c
+++ b/libc/sysdeps/linux/common/select.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/select.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index af19617bb..18427e85b 100644
--- a/libc/sysdeps/linux/common/sendfile.c
+++ b/libc/sysdeps/linux/common/sendfile.c
@@ -11,15 +11,19 @@
* will fail when __NR_sendfile64 doesnt exist */
#define sendfile64 __hidesendfile64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/sendfile.h>
#undef sendfile64
+#ifdef __NR_sendfile
+
_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)
#endif
+
+#endif /* __NR_sendfile */
diff --git a/libc/sysdeps/linux/common/setdomainname.c b/libc/sysdeps/linux/common/setdomainname.c
index 3b9f535e5..e134b0d45 100644
--- a/libc/sysdeps/linux/common/setdomainname.c
+++ b/libc/sysdeps/linux/common/setdomainname.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
_syscall2(int, setdomainname, const char *, name, size_t, len);
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
index 35a68334d..5a6e9a25a 100644
--- a/libc/sysdeps/linux/common/seteuid.c
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -11,6 +11,11 @@
#include <sys/types.h>
#include <sys/syscall.h>
+#if !defined __UCLIBC_LINUX_SPECIFIC__
+#undef __NR_setresuid
+#undef __NR_setresuid32
+#endif
+
libc_hidden_proto(seteuid)
#if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU
diff --git a/libc/sysdeps/linux/common/setfsgid.c b/libc/sysdeps/linux/common/setfsgid.c
index 027dd11f6..b35006306 100644
--- a/libc/sysdeps/linux/common/setfsgid.c
+++ b/libc/sysdeps/linux/common/setfsgid.c
@@ -7,10 +7,21 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/fsuid.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_setfsgid __NR_setfsgid
+#if (__WORDSIZE == 32 && defined(__NR_setfsgid32)) || __WORDSIZE == 64
+# ifdef __NR_setfsgid32
+# undef __NR_setfsgid
+# define __NR_setfsgid __NR_setfsgid32
+# endif
+
+_syscall1(int, setfsgid, gid_t, gid);
+
+#else
+
+# define __NR___syscall_setfsgid __NR_setfsgid
static inline _syscall1(int, __syscall_setfsgid, __kernel_gid_t, gid);
int setfsgid(gid_t gid)
@@ -21,3 +32,4 @@ int setfsgid(gid_t gid)
}
return (__syscall_setfsgid(gid));
}
+#endif
diff --git a/libc/sysdeps/linux/common/setfsuid.c b/libc/sysdeps/linux/common/setfsuid.c
index 4bbc931cf..d302ad48c 100644
--- a/libc/sysdeps/linux/common/setfsuid.c
+++ b/libc/sysdeps/linux/common/setfsuid.c
@@ -7,10 +7,21 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/fsuid.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_setfsuid __NR_setfsuid
+#if (__WORDSIZE == 32 && defined(__NR_setfsuid32)) || __WORDSIZE == 64
+# ifdef __NR_setfsuid32
+# undef __NR_setfsuid
+# define __NR_setfsuid __NR_setfsuid32
+# endif
+
+_syscall1(int, setfsuid, uid_t, uid);
+
+#else
+
+# define __NR___syscall_setfsuid __NR_setfsuid
static inline _syscall1(int, __syscall_setfsuid, __kernel_uid_t, uid);
int setfsuid(uid_t uid)
@@ -21,3 +32,4 @@ int setfsuid(uid_t uid)
}
return (__syscall_setfsuid(uid));
}
+#endif
diff --git a/libc/sysdeps/linux/common/setgid.c b/libc/sysdeps/linux/common/setgid.c
index d0698f517..4a924a047 100644
--- a/libc/sysdeps/linux/common/setgid.c
+++ b/libc/sysdeps/linux/common/setgid.c
@@ -7,10 +7,21 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_setgid __NR_setgid
+#if (__WORDSIZE == 32 && defined(__NR_setgid32)) || __WORDSIZE == 64
+# ifdef __NR_setgid32
+# undef __NR_setgid
+# define __NR_setgid __NR_setgid32
+# endif
+
+_syscall1(int, setgid, gid_t, gid);
+
+#else
+
+# define __NR___syscall_setgid __NR_setgid
static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
int setgid(gid_t gid)
@@ -21,3 +32,4 @@ int setgid(gid_t gid)
}
return (__syscall_setgid(gid));
}
+#endif
diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c
index 49f3dc61f..eb5245d59 100644
--- a/libc/sysdeps/linux/common/setgroups.c
+++ b/libc/sysdeps/linux/common/setgroups.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdlib.h>
#include <unistd.h>
#include <grp.h>
@@ -56,8 +56,7 @@ ret_error:
}
i = __syscall_setgroups(size, kernel_groups);
- if (kernel_groups)
- free(kernel_groups);
+ free(kernel_groups);
return i;
}
}
diff --git a/libc/sysdeps/linux/common/sethostname.c b/libc/sysdeps/linux/common/sethostname.c
index 62867fc16..6bd4c2362 100644
--- a/libc/sysdeps/linux/common/sethostname.c
+++ b/libc/sysdeps/linux/common/sethostname.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
_syscall2(int, sethostname, const char *, name, size_t, len);
diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c
index fb6c6b1e6..ca9db82d2 100644
--- a/libc/sysdeps/linux/common/setitimer.c
+++ b/libc/sysdeps/linux/common/setitimer.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/time.h>
libc_hidden_proto(setitimer)
diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c
index 98289ff72..3447b999d 100644
--- a/libc/sysdeps/linux/common/setpgid.c
+++ b/libc/sysdeps/linux/common/setpgid.c
@@ -7,7 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_UNIX98 || defined __USE_SVID
#include <unistd.h>
libc_hidden_proto(setpgid)
@@ -21,3 +23,4 @@ int setpgid(pid_t pid, pid_t pgid)
return (__syscall_setpgid(pid, pgid));
}
libc_hidden_def(setpgid)
+#endif
diff --git a/libc/sysdeps/linux/common/setpriority.c b/libc/sysdeps/linux/common/setpriority.c
index d836153d5..6674494ab 100644
--- a/libc/sysdeps/linux/common/setpriority.c
+++ b/libc/sysdeps/linux/common/setpriority.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/resource.h>
libc_hidden_proto(setpriority)
diff --git a/libc/sysdeps/linux/common/setregid.c b/libc/sysdeps/linux/common/setregid.c
index a085ed2ab..d56c01f64 100644
--- a/libc/sysdeps/linux/common/setregid.c
+++ b/libc/sysdeps/linux/common/setregid.c
@@ -7,12 +7,23 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
libc_hidden_proto(setregid)
-#define __NR___syscall_setregid __NR_setregid
+#if (__WORDSIZE == 32 && defined(__NR_setregid32)) || __WORDSIZE == 64
+# ifdef __NR_setregid32
+# undef __NR_setregid
+# define __NR_setregid __NR_setregid32
+# endif
+
+_syscall2(int, setregid, gid_t, rgid, gid_t, egid);
+
+#else
+
+# define __NR___syscall_setregid __NR_setregid
static inline _syscall2(int, __syscall_setregid,
__kernel_gid_t, rgid, __kernel_gid_t, egid);
@@ -25,4 +36,6 @@ int setregid(gid_t rgid, gid_t egid)
}
return (__syscall_setregid(rgid, egid));
}
+#endif
+
libc_hidden_def(setregid)
diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c
index 07959e4af..3bb54e3aa 100644
--- a/libc/sysdeps/linux/common/setresgid.c
+++ b/libc/sysdeps/linux/common/setresgid.c
@@ -7,22 +7,25 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __USE_GNU
#include <unistd.h>
-libc_hidden_proto(setresgid)
-
#if defined(__NR_setresgid32)
# undef __NR_setresgid
# define __NR_setresgid __NR_setresgid32
+
+libc_hidden_proto(setresgid)
_syscall3(int, setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
+libc_hidden_def(setresgid)
#elif defined(__NR_setresgid)
+
# define __NR___syscall_setresgid __NR_setresgid
static inline _syscall3(int, __syscall_setresgid,
__kernel_gid_t, rgid, __kernel_gid_t, egid, __kernel_gid_t, sgid);
+libc_hidden_proto(setresgid)
int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
{
if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
@@ -33,7 +36,8 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
}
return (__syscall_setresgid(rgid, egid, sgid));
}
+libc_hidden_def(setresgid)
+
#endif
-libc_hidden_def(setresgid)
#endif
diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c
index 1249611a9..54b92465c 100644
--- a/libc/sysdeps/linux/common/setresuid.c
+++ b/libc/sysdeps/linux/common/setresuid.c
@@ -7,22 +7,25 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
-#ifdef __USE_GNU
+#include <sys/syscall.h>
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
#include <unistd.h>
-libc_hidden_proto(setresuid)
-
#if defined(__NR_setresuid32)
# undef __NR_setresuid
# define __NR_setresuid __NR_setresuid32
+
+libc_hidden_proto(setresuid)
_syscall3(int, setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
+libc_hidden_def(setresuid)
#elif defined(__NR_setresuid)
+
# define __NR___syscall_setresuid __NR_setresuid
static inline _syscall3(int, __syscall_setresuid,
__kernel_uid_t, rgid, __kernel_uid_t, egid, __kernel_uid_t, sgid);
+libc_hidden_proto(setresuid)
int setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
@@ -33,7 +36,8 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid)
}
return (__syscall_setresuid(ruid, euid, suid));
}
+libc_hidden_def(setresuid)
+
#endif
-libc_hidden_def(setresuid)
#endif
diff --git a/libc/sysdeps/linux/common/setreuid.c b/libc/sysdeps/linux/common/setreuid.c
index dcbe4adfe..7f908a333 100644
--- a/libc/sysdeps/linux/common/setreuid.c
+++ b/libc/sysdeps/linux/common/setreuid.c
@@ -7,12 +7,23 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
libc_hidden_proto(setreuid)
-#define __NR___syscall_setreuid __NR_setreuid
+#if (__WORDSIZE == 32 && defined(__NR_setreuid32)) || __WORDSIZE == 64
+# ifdef __NR_setreuid32
+# undef __NR_setreuid
+# define __NR_setreuid __NR_setreuid32
+# endif
+
+_syscall2(int, setreuid, uid_t, ruid, uid_t, euid);
+
+#else
+
+# define __NR___syscall_setreuid __NR_setreuid
static inline _syscall2(int, __syscall_setreuid,
__kernel_uid_t, ruid, __kernel_uid_t, euid);
@@ -25,4 +36,6 @@ int setreuid(uid_t ruid, uid_t euid)
}
return (__syscall_setreuid(ruid, euid));
}
+#endif
+
libc_hidden_def(setreuid)
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index ba2ea0728..ce9fe2275 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -8,7 +8,7 @@
*/
#define setrlimit64 __hide_setrlimit64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/resource.h>
#undef setrlimit64
diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c
index 042ee43a4..7e5bd33a4 100644
--- a/libc/sysdeps/linux/common/setsid.c
+++ b/libc/sysdeps/linux/common/setsid.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(setsid)
diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c
index a0ae95fa5..7f7c24d26 100644
--- a/libc/sysdeps/linux/common/settimeofday.c
+++ b/libc/sysdeps/linux/common/settimeofday.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/time.h>
#ifdef __USE_BSD
diff --git a/libc/sysdeps/linux/common/setuid.c b/libc/sysdeps/linux/common/setuid.c
index b4b2e1bd1..4036a3d09 100644
--- a/libc/sysdeps/linux/common/setuid.c
+++ b/libc/sysdeps/linux/common/setuid.c
@@ -7,10 +7,21 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_setuid __NR_setuid
+#if (__WORDSIZE == 32 && defined(__NR_setuid32)) || __WORDSIZE == 64
+# ifdef __NR_setuid32
+# undef __NR_setuid
+# define __NR_setuid __NR_setuid32
+# endif
+
+_syscall1(int, setuid, uid_t, uid);
+
+#else
+
+# define __NR___syscall_setuid __NR_setuid
static inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid);
int setuid(uid_t uid)
@@ -21,3 +32,4 @@ int setuid(uid_t uid)
}
return (__syscall_setuid(uid));
}
+#endif
diff --git a/libc/sysdeps/linux/common/sigaltstack.c b/libc/sysdeps/linux/common/sigaltstack.c
index af087ae57..0c9308408 100644
--- a/libc/sysdeps/linux/common/sigaltstack.c
+++ b/libc/sysdeps/linux/common/sigaltstack.c
@@ -7,7 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <signal.h>
+
+#if defined __NR_sigaltstack && (defined __USE_BSD || defined __USE_UNIX98)
+
_syscall2(int, sigaltstack, const struct sigaltstack *, ss,
struct sigaltstack *, oss);
+#endif
diff --git a/libc/sysdeps/linux/common/sigpending.c b/libc/sysdeps/linux/common/sigpending.c
index ea8fc40e6..fa272c0f5 100644
--- a/libc/sysdeps/linux/common/sigpending.c
+++ b/libc/sysdeps/linux/common/sigpending.c
@@ -7,7 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_POSIX
#include <signal.h>
#undef sigpending
@@ -22,3 +24,4 @@ int sigpending(sigset_t * set)
#else
_syscall1(int, sigpending, sigset_t *, set);
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c
index 58be06ea1..ac68b3a53 100644
--- a/libc/sysdeps/linux/common/sigprocmask.c
+++ b/libc/sysdeps/linux/common/sigprocmask.c
@@ -2,13 +2,14 @@
/*
* sigprocmask() for uClibc
*
- * Copyright (C) 2006 by Steven J. Hill <sjhill@uclibc.org>
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_POSIX
#include <signal.h>
#undef sigprocmask
@@ -17,7 +18,7 @@ libc_hidden_proto(sigprocmask)
#ifdef __NR_rt_sigprocmask
-#define __NR___rt_sigprocmask __NR_rt_sigprocmask
+# define __NR___rt_sigprocmask __NR_rt_sigprocmask
static inline
_syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
sigset_t *, oldset, size_t, size);
@@ -52,7 +53,7 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
#else
-#define __NR___syscall_sigprocmask __NR_sigprocmask
+# define __NR___syscall_sigprocmask __NR_sigprocmask
static inline
_syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
sigset_t *, oldset);
@@ -85,3 +86,4 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
}
#endif
libc_hidden_def(sigprocmask)
+#endif
diff --git a/libc/sysdeps/linux/common/sigqueue.c b/libc/sysdeps/linux/common/sigqueue.c
index 3d86414d9..5d8e852fe 100644
--- a/libc/sysdeps/linux/common/sigqueue.c
+++ b/libc/sysdeps/linux/common/sigqueue.c
@@ -22,10 +22,11 @@
#include <string.h>
#include <sys/syscall.h>
+#if defined __USE_POSIX199309
libc_hidden_proto(getpid)
libc_hidden_proto(getuid)
-libc_hidden_proto(memset)
+/* Experimentally off - libc_hidden_proto(memset) */
#ifdef __NR_rt_sigqueueinfo
@@ -51,3 +52,4 @@ int sigqueue (pid_t pid, int sig, const union sigval val)
}
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c
index 0e0df6c61..b69431be9 100644
--- a/libc/sysdeps/linux/common/sigsuspend.c
+++ b/libc/sysdeps/linux/common/sigsuspend.c
@@ -2,13 +2,14 @@
/*
* sigsuspend() for uClibc
*
- * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_POSIX
#include <signal.h>
#undef sigsuspend
@@ -55,3 +56,4 @@ int sigsuspend(const sigset_t * set)
}
#endif
libc_hidden_def(sigsuspend)
+#endif
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 16b9f9c10..d8088ef60 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -31,8 +31,8 @@
#include <signal.h>
#include <sys/syslog.h>
-libc_hidden_proto(memset)
-libc_hidden_proto(strlen)
+/* Experimentally off - libc_hidden_proto(memset) */
+/* Experimentally off - libc_hidden_proto(strlen) */
libc_hidden_proto(sigaction)
libc_hidden_proto(sigfillset)
libc_hidden_proto(sigdelset)
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index 662ed665a..bbb070dbe 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -11,7 +11,7 @@
* will fail when __NR_stat64 doesnt exist */
#define stat64 __hidestat64
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/stat.h>
#include "xstatconv.h"
diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c
index 54e2b436e..1ef39de4a 100644
--- a/libc/sysdeps/linux/common/stat64.c
+++ b/libc/sysdeps/linux/common/stat64.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64
diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c
index 5da94d6f2..38c277fad 100644
--- a/libc/sysdeps/linux/common/statfs.c
+++ b/libc/sysdeps/linux/common/statfs.c
@@ -7,11 +7,19 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <string.h>
#include <sys/param.h>
#include <sys/vfs.h>
+extern __typeof(statfs) __libc_statfs;
+libc_hidden_proto(__libc_statfs)
+#define __NR___libc_statfs __NR_statfs
+_syscall2(int, __libc_statfs, const char *, path, struct statfs *, buf);
+libc_hidden_def(__libc_statfs)
+
+#if defined __UCLIBC_LINUX_SPECIFIC__
libc_hidden_proto(statfs)
-_syscall2(int, statfs, const char *, path, struct statfs *, buf);
-libc_hidden_def(statfs)
+weak_alias(__libc_statfs,statfs)
+libc_hidden_weak(statfs)
+#endif
diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c
index 387122ff3..af8595533 100644
--- a/libc/sysdeps/linux/common/stime.c
+++ b/libc/sysdeps/linux/common/stime.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#include <sys/time.h>
diff --git a/libc/sysdeps/linux/common/swapoff.c b/libc/sysdeps/linux/common/swapoff.c
index 60df6e473..a0de283ed 100644
--- a/libc/sysdeps/linux/common/swapoff.c
+++ b/libc/sysdeps/linux/common/swapoff.c
@@ -7,6 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_swapoff
+
#include <sys/swap.h>
_syscall1(int, swapoff, const char *, path);
+
+#endif
diff --git a/libc/sysdeps/linux/common/swapon.c b/libc/sysdeps/linux/common/swapon.c
index d5a5c235a..e9ffb6347 100644
--- a/libc/sysdeps/linux/common/swapon.c
+++ b/libc/sysdeps/linux/common/swapon.c
@@ -7,6 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_swapon
+
#include <sys/swap.h>
_syscall2(int, swapon, const char *, path, int, swapflags);
+
+#endif
diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index 3c8c39751..97f34eb8f 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -7,6 +7,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
#include <unistd.h>
_syscall2(int, symlink, const char *, oldpath, const char *, newpath);
+#endif
diff --git a/libc/sysdeps/linux/common/sync.c b/libc/sysdeps/linux/common/sync.c
index 48fac63ea..dd69e335b 100644
--- a/libc/sysdeps/linux/common/sync.c
+++ b/libc/sysdeps/linux/common/sync.c
@@ -7,10 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <features.h>
-#include <errno.h>
-#include <sys/types.h>
#include <sys/syscall.h>
+# if defined __USE_BSD || defined __USE_UNIX98
+#include <sys/types.h>
#include <unistd.h>
#ifndef INLINE_SYSCALL
@@ -23,4 +22,4 @@ void sync(void)
{
INLINE_SYSCALL(sync, 0);
}
-
+#endif
diff --git a/libc/sysdeps/linux/common/syscalls.h b/libc/sysdeps/linux/common/syscalls.h
index af015246a..c4f6a44fd 100644
--- a/libc/sysdeps/linux/common/syscalls.h
+++ b/libc/sysdeps/linux/common/syscalls.h
@@ -21,3 +21,4 @@
# undef __USE_FILE_OFFSET64
#endif
+#include <bits/kernel_types.h>
diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c
index 0d6f49185..adee22837 100644
--- a/libc/sysdeps/linux/common/sysctl.c
+++ b/libc/sysdeps/linux/common/sysctl.c
@@ -7,7 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+#if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD)
+
/* 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;
@@ -29,13 +31,14 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
void *newval, size_t newlen)
{
struct __sysctl_args args = {
- name:name,
- nlen:nlen,
- oldval:oldval,
- oldlenp:oldlenp,
- newval:newval,
- newlen:newlen
+ .name = name,
+ .nlen = nlen,
+ .oldval = oldval,
+ .oldlenp = oldlenp,
+ .newval = newval,
+ .newlen = newlen
};
return _sysctl(&args);
}
+#endif
diff --git a/libc/sysdeps/linux/common/sysfs.c b/libc/sysdeps/linux/common/sysfs.c
index e3cf0f15b..a4292f768 100644
--- a/libc/sysdeps/linux/common/sysfs.c
+++ b/libc/sysdeps/linux/common/sysfs.c
@@ -9,8 +9,9 @@
/* libc isn't really supposed to export this */
#if 0
+#include <sys/syscall.h>
-#include "syscalls.h"
+#if defined __USE_SVID
_syscall3(int, sysfs, int, option, unsigned int, index, char, addr);
-
+#endif
#endif
diff --git a/libc/sysdeps/linux/common/sysinfo.c b/libc/sysdeps/linux/common/sysinfo.c
index 67673a290..78bf75150 100644
--- a/libc/sysdeps/linux/common/sysinfo.c
+++ b/libc/sysdeps/linux/common/sysinfo.c
@@ -7,6 +7,6 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/sysinfo.h>
_syscall1(int, sysinfo, struct sysinfo *, info);
diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c
index 405954aa3..a7aa153d4 100644
--- a/libc/sysdeps/linux/common/time.c
+++ b/libc/sysdeps/linux/common/time.c
@@ -7,11 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <time.h>
#include <sys/time.h>
-libc_hidden_proto(time)
+/* Experimentally off - libc_hidden_proto(time) */
#ifdef __NR_time
_syscall1(time_t, time, time_t *, t);
diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c
index 178a73fa9..a68a2981f 100644
--- a/libc/sysdeps/linux/common/times.c
+++ b/libc/sysdeps/linux/common/times.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/times.h>
libc_hidden_proto(times)
diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c
index 08c71fc71..5ae8749ed 100644
--- a/libc/sysdeps/linux/common/truncate.c
+++ b/libc/sysdeps/linux/common/truncate.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(truncate)
diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c
index e227900c5..53c46fc56 100644
--- a/libc/sysdeps/linux/common/truncate64.c
+++ b/libc/sysdeps/linux/common/truncate64.c
@@ -57,7 +57,7 @@ int truncate64 (const char * path, __off64_t length)
}
#else /* __WORDSIZE */
-#error Your machine is not 64 bit or 32 bit, I am dazed and confused.
+#error Your machine is not 64 bit nor 32 bit, I am dazed and confused.
#endif /* __WORDSIZE */
#else /* __NR_truncate64 */
diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c
index 6f0278f60..2a1c88081 100644
--- a/libc/sysdeps/linux/common/ulimit.c
+++ b/libc/sysdeps/linux/common/ulimit.c
@@ -5,7 +5,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#ifdef __NR_ulimit
diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c
index 20fb12385..24297e07e 100644
--- a/libc/sysdeps/linux/common/umask.c
+++ b/libc/sysdeps/linux/common/umask.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
#define __NR___syscall_umask __NR_umask
diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c
index 550003d1b..c62f9fb7c 100644
--- a/libc/sysdeps/linux/common/umount.c
+++ b/libc/sysdeps/linux/common/umount.c
@@ -7,7 +7,9 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+
+#if defined __USE_GNU
#include <sys/mount.h>
/* arch provides umount() syscall */
@@ -36,3 +38,4 @@ int umount(const char *special_file)
}
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c
index b68c4da9c..25c24d450 100644
--- a/libc/sysdeps/linux/common/umount2.c
+++ b/libc/sysdeps/linux/common/umount2.c
@@ -7,9 +7,11 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
-#ifdef __NR_umount2 /* Old kernels don't have umount2 */
+#include <sys/syscall.h>
+
+#if defined __USE_GNU
#include <sys/mount.h>
+#ifdef __NR_umount2 /* Old kernels don't have umount2 */
_syscall2(int, umount2, const char *, special_file, int, flags);
#else
int umount2(const char *special_file, int flags)
@@ -18,3 +20,4 @@ int umount2(const char *special_file, int flags)
return -1;
}
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c
index 8c51f1f76..22b870370 100644
--- a/libc/sysdeps/linux/common/uname.c
+++ b/libc/sysdeps/linux/common/uname.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/utsname.h>
libc_hidden_proto(uname)
diff --git a/libc/sysdeps/linux/common/unlink.c b/libc/sysdeps/linux/common/unlink.c
index 1ecefd70d..313be9e0b 100644
--- a/libc/sysdeps/linux/common/unlink.c
+++ b/libc/sysdeps/linux/common/unlink.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
libc_hidden_proto(unlink)
diff --git a/libc/sysdeps/linux/common/uselib.c b/libc/sysdeps/linux/common/uselib.c
index 3ccde1de4..ffc5d77a1 100644
--- a/libc/sysdeps/linux/common/uselib.c
+++ b/libc/sysdeps/linux/common/uselib.c
@@ -6,10 +6,13 @@
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
+#if 0
+linux specific and we do not use it in uClibc.
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#ifdef __NR_uselib
int uselib (const char *library);
_syscall1(int, uselib, const char *, library);
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/ustat.c b/libc/sysdeps/linux/common/ustat.c
index 73e74e8e1..27cfa95ad 100644
--- a/libc/sysdeps/linux/common/ustat.c
+++ b/libc/sysdeps/linux/common/ustat.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/ustat.h>
#include <sys/sysmacros.h>
diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c
index 5d289aede..6e35be2c1 100644
--- a/libc/sysdeps/linux/common/utime.c
+++ b/libc/sysdeps/linux/common/utime.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <utime.h>
libc_hidden_proto(utime)
@@ -30,13 +30,8 @@ int utime(const char *file, const struct utimbuf *times)
timevals[1].tv_usec = 0L;
timevals[0].tv_sec = (long int) times->actime;
timevals[1].tv_sec = (long int) times->modtime;
- } else {
- if (gettimeofday(&timevals[0], NULL) < 0) {
- return -1;
- }
- timevals[1] = timevals[0];
}
- return utimes(file, timevals);
+ return utimes(file, times ? timevals : NULL);
}
#endif
libc_hidden_def(utime)
diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c
index 55f60d8c1..83ddb7381 100644
--- a/libc/sysdeps/linux/common/utimes.c
+++ b/libc/sysdeps/linux/common/utimes.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <utime.h>
#include <sys/time.h>
@@ -35,4 +35,5 @@ int utimes(const char *file, const struct timeval tvp[2])
return utime(file, times);
}
#endif
+link_warning(utimes, "the use of LEGACY `utimes' is discouraged, use `utime'")
libc_hidden_def(utimes)
diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c
index 2b043d293..f9634cd5c 100644
--- a/libc/sysdeps/linux/common/vfork.c
+++ b/libc/sysdeps/linux/common/vfork.c
@@ -9,6 +9,8 @@
#include <sys/types.h>
#include <sys/syscall.h>
+#ifdef __ARCH_USE_MMU__
+
#ifdef __NR_fork
libc_hidden_proto(fork)
@@ -21,3 +23,5 @@ libc_hidden_proto(vfork)
weak_alias(__vfork,vfork)
libc_hidden_weak(vfork)
#endif
+
+#endif
diff --git a/libc/sysdeps/linux/common/vhangup.c b/libc/sysdeps/linux/common/vhangup.c
index 984a09dec..8989a69d6 100644
--- a/libc/sysdeps/linux/common/vhangup.c
+++ b/libc/sysdeps/linux/common/vhangup.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
_syscall0(int, vhangup);
diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c
index 5de975c25..8a2d43f7a 100644
--- a/libc/sysdeps/linux/common/wait3.c
+++ b/libc/sysdeps/linux/common/wait3.c
@@ -4,11 +4,13 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <syscall.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
+#if defined __USE_BSD
+
libc_hidden_proto(wait4)
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
@@ -20,3 +22,4 @@ pid_t wait3 (__WAIT_STATUS stat_loc, int options, struct rusage * usage)
{
return wait4 (WAIT_ANY, stat_loc, options, usage);
}
+#endif
diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c
index 9d9de58d6..ff3b82645 100644
--- a/libc/sysdeps/linux/common/wait4.c
+++ b/libc/sysdeps/linux/common/wait4.c
@@ -7,7 +7,8 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#include <sys/wait.h>
#include <sys/resource.h>
@@ -22,3 +23,4 @@ pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage)
return (__syscall_wait4(pid, status, opts, rusage));
}
libc_hidden_def(wait4)
+#endif
diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c
index c150808f0..dbe5c12e6 100644
--- a/libc/sysdeps/linux/common/write.c
+++ b/libc/sysdeps/linux/common/write.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
extern __typeof(write) __libc_write;
diff --git a/libc/sysdeps/linux/common/writev.c b/libc/sysdeps/linux/common/writev.c
index cfb758974..464268b2f 100644
--- a/libc/sysdeps/linux/common/writev.c
+++ b/libc/sysdeps/linux/common/writev.c
@@ -2,13 +2,12 @@
/*
* writev() for uClibc
*
- * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * GNU Library General Public License (LGPL) version 2 or later.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/uio.h>
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c
index 6e4e7fa92..0ba17cde7 100644
--- a/libc/sysdeps/linux/common/xattr.c
+++ b/libc/sysdeps/linux/common/xattr.c
@@ -21,7 +21,7 @@
* filesystem, or are disabled, errno is set to ENOSYS.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <unistd.h>
#include <sys/xattr.h>
diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
index 58e05c437..abcb496b8 100644
--- a/libc/sysdeps/linux/common/xstatconv.c
+++ b/libc/sysdeps/linux/common/xstatconv.c
@@ -15,18 +15,22 @@
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.
-
+ 02111-1307 USA.
+
Modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <sys/stat.h>
+#include <string.h>
#include "xstatconv.h"
+/* Experimentally off - libc_hidden_proto(memset) */
+
void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
{
/* Convert to current kernel version of `struct stat'. */
+ memset(buf, 0x00, sizeof(*buf));
buf->st_dev = kbuf->st_dev;
buf->st_ino = kbuf->st_ino;
buf->st_mode = kbuf->st_mode;
@@ -52,6 +56,7 @@ void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
{
/* Convert to current kernel version of `struct stat64'. */
+ memset(buf, 0x00, sizeof(*buf));
buf->st_dev = kbuf->st_dev;
buf->st_ino = kbuf->st_ino;
# ifdef _HAVE_STAT64___ST_INO