summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/__socketcall.c7
-rw-r--r--libc/sysdeps/linux/common/__syscall_ipc.c7
-rw-r--r--libc/sysdeps/linux/common/__syscall_rt_sigaction.c7
-rw-r--r--libc/sysdeps/linux/common/__syscall_sigaction.c8
-rw-r--r--libc/sysdeps/linux/common/access.c4
-rw-r--r--libc/sysdeps/linux/common/acct.c4
-rw-r--r--libc/sysdeps/linux/common/alarm.c18
-rw-r--r--libc/sysdeps/linux/common/bdflush.c4
-rw-r--r--libc/sysdeps/linux/common/bits/endian.h5
-rw-r--r--libc/sysdeps/linux/common/bits/getopt.h2
-rw-r--r--libc/sysdeps/linux/common/bits/posix_opt.h6
-rw-r--r--libc/sysdeps/linux/common/bits/statfs.h3
-rw-r--r--libc/sysdeps/linux/common/bits/termios.h4
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_fpmax.h21
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_locale.h6
-rw-r--r--libc/sysdeps/linux/common/bits/wordsize.h5
-rw-r--r--libc/sysdeps/linux/common/capget.c11
-rw-r--r--libc/sysdeps/linux/common/capset.c11
-rw-r--r--libc/sysdeps/linux/common/chdir.c11
-rw-r--r--libc/sysdeps/linux/common/chmod.c10
-rw-r--r--libc/sysdeps/linux/common/chown.c4
-rw-r--r--libc/sysdeps/linux/common/chroot.c4
-rw-r--r--libc/sysdeps/linux/common/clock_getres.c21
-rw-r--r--libc/sysdeps/linux/common/clock_gettime.c21
-rw-r--r--libc/sysdeps/linux/common/clock_settime.c21
-rw-r--r--libc/sysdeps/linux/common/close.c14
-rw-r--r--libc/sysdeps/linux/common/cmsg_nxthdr.c8
-rw-r--r--libc/sysdeps/linux/common/creat64.c22
-rw-r--r--libc/sysdeps/linux/common/create_module.c28
-rw-r--r--libc/sysdeps/linux/common/delete_module.c6
-rw-r--r--libc/sysdeps/linux/common/dl-osinfo.h23
-rw-r--r--libc/sysdeps/linux/common/dup.c5
-rw-r--r--libc/sysdeps/linux/common/dup2.c12
-rw-r--r--libc/sysdeps/linux/common/execve.c15
-rw-r--r--libc/sysdeps/linux/common/fchdir.c12
-rw-r--r--libc/sysdeps/linux/common/fchmod.c4
-rw-r--r--libc/sysdeps/linux/common/fdatasync.c10
-rw-r--r--libc/sysdeps/linux/common/flock.c4
-rw-r--r--libc/sysdeps/linux/common/fork.c16
-rw-r--r--libc/sysdeps/linux/common/fstat.c28
-rw-r--r--libc/sysdeps/linux/common/fstat64.c17
-rw-r--r--libc/sysdeps/linux/common/fstatfs.c12
-rw-r--r--libc/sysdeps/linux/common/fsync.c5
-rw-r--r--libc/sysdeps/linux/common/ftruncate.c8
-rw-r--r--libc/sysdeps/linux/common/ftruncate64.c66
-rw-r--r--libc/sysdeps/linux/common/get_kernel_syms.c5
-rw-r--r--libc/sysdeps/linux/common/getcwd.c72
-rw-r--r--libc/sysdeps/linux/common/getdents.c86
-rw-r--r--libc/sysdeps/linux/common/getdents64.c58
-rw-r--r--libc/sysdeps/linux/common/getdirname.c30
-rw-r--r--libc/sysdeps/linux/common/getdnnm.c31
-rw-r--r--libc/sysdeps/linux/common/getdtablesize.c32
-rw-r--r--libc/sysdeps/linux/common/getegid.c25
-rw-r--r--libc/sysdeps/linux/common/getgid.c19
-rw-r--r--libc/sysdeps/linux/common/getgroups.c25
-rw-r--r--libc/sysdeps/linux/common/gethstnm.c22
-rw-r--r--libc/sysdeps/linux/common/getitimer.c4
-rw-r--r--libc/sysdeps/linux/common/getpagesize.c11
-rw-r--r--libc/sysdeps/linux/common/getpgid.c8
-rw-r--r--libc/sysdeps/linux/common/getpid.c19
-rw-r--r--libc/sysdeps/linux/common/getppid.c13
-rw-r--r--libc/sysdeps/linux/common/getpriority.c10
-rw-r--r--libc/sysdeps/linux/common/getresgid.c20
-rw-r--r--libc/sysdeps/linux/common/getresuid.c16
-rw-r--r--libc/sysdeps/linux/common/getrlimit.c44
-rw-r--r--libc/sysdeps/linux/common/getrlimit64.c24
-rw-r--r--libc/sysdeps/linux/common/getrusage.c4
-rw-r--r--libc/sysdeps/linux/common/getsid.c12
-rw-r--r--libc/sysdeps/linux/common/gettimeofday.c12
-rw-r--r--libc/sysdeps/linux/common/init_module.c5
-rw-r--r--libc/sysdeps/linux/common/ioctl.c10
-rw-r--r--libc/sysdeps/linux/common/ioperm.c8
-rw-r--r--libc/sysdeps/linux/common/iopl.c9
-rw-r--r--libc/sysdeps/linux/common/kill.c11
-rw-r--r--libc/sysdeps/linux/common/klogctl.c5
-rw-r--r--libc/sysdeps/linux/common/lchown.c4
-rw-r--r--libc/sysdeps/linux/common/link.c4
-rw-r--r--libc/sysdeps/linux/common/llseek.c60
-rw-r--r--libc/sysdeps/linux/common/longjmp.c16
-rw-r--r--libc/sysdeps/linux/common/lseek.c20
-rw-r--r--libc/sysdeps/linux/common/lstat.c27
-rw-r--r--libc/sysdeps/linux/common/lstat64.c22
-rw-r--r--libc/sysdeps/linux/common/madvise.c5
-rw-r--r--libc/sysdeps/linux/common/mincore.c10
-rw-r--r--libc/sysdeps/linux/common/mkdir.c10
-rw-r--r--libc/sysdeps/linux/common/mkfifo.c4
-rw-r--r--libc/sysdeps/linux/common/mknod.c10
-rw-r--r--libc/sysdeps/linux/common/mlock.c6
-rw-r--r--libc/sysdeps/linux/common/mlockall.c6
-rw-r--r--libc/sysdeps/linux/common/mmap.c25
-rw-r--r--libc/sysdeps/linux/common/mmap64.c87
-rw-r--r--libc/sysdeps/linux/common/modify_ldt.c6
-rw-r--r--libc/sysdeps/linux/common/mount.c4
-rw-r--r--libc/sysdeps/linux/common/mprotect.c4
-rw-r--r--libc/sysdeps/linux/common/mremap.c12
-rw-r--r--libc/sysdeps/linux/common/msync.c7
-rw-r--r--libc/sysdeps/linux/common/munlock.c6
-rw-r--r--libc/sysdeps/linux/common/munlockall.c6
-rw-r--r--libc/sysdeps/linux/common/munmap.c12
-rw-r--r--libc/sysdeps/linux/common/nanosleep.c8
-rw-r--r--libc/sysdeps/linux/common/nice.c21
-rw-r--r--libc/sysdeps/linux/common/noophooks.c2
-rw-r--r--libc/sysdeps/linux/common/open.c20
-rw-r--r--libc/sysdeps/linux/common/pause.c14
-rw-r--r--libc/sysdeps/linux/common/personality.c4
-rw-r--r--libc/sysdeps/linux/common/pipe.c12
-rw-r--r--libc/sysdeps/linux/common/pivot_root.c5
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise.c13
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c6
-rw-r--r--libc/sysdeps/linux/common/pread_write.c115
-rw-r--r--libc/sysdeps/linux/common/ptrace.c25
-rw-r--r--libc/sysdeps/linux/common/query_module.c6
-rw-r--r--libc/sysdeps/linux/common/quotactl.c4
-rw-r--r--libc/sysdeps/linux/common/read.c14
-rw-r--r--libc/sysdeps/linux/common/readlink.c12
-rw-r--r--libc/sysdeps/linux/common/reboot.c5
-rw-r--r--libc/sysdeps/linux/common/rename.c4
-rw-r--r--libc/sysdeps/linux/common/rmdir.c12
-rw-r--r--libc/sysdeps/linux/common/sbrk.c37
-rw-r--r--libc/sysdeps/linux/common/sched_get_priority_max.c4
-rw-r--r--libc/sysdeps/linux/common/sched_get_priority_min.c4
-rw-r--r--libc/sysdeps/linux/common/sched_getparam.c4
-rw-r--r--libc/sysdeps/linux/common/sched_getscheduler.c4
-rw-r--r--libc/sysdeps/linux/common/sched_rr_get_interval.c4
-rw-r--r--libc/sysdeps/linux/common/sched_setparam.c4
-rw-r--r--libc/sysdeps/linux/common/sched_setscheduler.c4
-rw-r--r--libc/sysdeps/linux/common/sched_yield.c4
-rw-r--r--libc/sysdeps/linux/common/select.c15
-rw-r--r--libc/sysdeps/linux/common/sendfile.c15
-rw-r--r--libc/sysdeps/linux/common/sendfile64.c38
-rw-r--r--libc/sysdeps/linux/common/setdomainname.c4
-rw-r--r--libc/sysdeps/linux/common/setegid.c15
-rw-r--r--libc/sysdeps/linux/common/seteuid.c21
-rw-r--r--libc/sysdeps/linux/common/setfsgid.c4
-rw-r--r--libc/sysdeps/linux/common/setfsuid.c4
-rw-r--r--libc/sysdeps/linux/common/setgid.c4
-rw-r--r--libc/sysdeps/linux/common/setgroups.c26
-rw-r--r--libc/sysdeps/linux/common/sethostname.c4
-rw-r--r--libc/sysdeps/linux/common/setitimer.c12
-rw-r--r--libc/sysdeps/linux/common/setpgid.c10
-rw-r--r--libc/sysdeps/linux/common/setpgrp.c8
-rw-r--r--libc/sysdeps/linux/common/setpriority.c12
-rw-r--r--libc/sysdeps/linux/common/setregid.c10
-rw-r--r--libc/sysdeps/linux/common/setresgid.c23
-rw-r--r--libc/sysdeps/linux/common/setresuid.c23
-rw-r--r--libc/sysdeps/linux/common/setreuid.c10
-rw-r--r--libc/sysdeps/linux/common/setrlimit.c63
-rw-r--r--libc/sysdeps/linux/common/setrlimit64.c24
-rw-r--r--libc/sysdeps/linux/common/setsid.c12
-rw-r--r--libc/sysdeps/linux/common/settimeofday.c12
-rw-r--r--libc/sysdeps/linux/common/setuid.c4
-rw-r--r--libc/sysdeps/linux/common/sigaltstack.c4
-rw-r--r--libc/sysdeps/linux/common/sigpending.c7
-rw-r--r--libc/sysdeps/linux/common/ssp-local.c8
-rw-r--r--libc/sysdeps/linux/common/ssp.c49
-rw-r--r--libc/sysdeps/linux/common/stat.c26
-rw-r--r--libc/sysdeps/linux/common/stat64.c24
-rw-r--r--libc/sysdeps/linux/common/statfs.c16
-rw-r--r--libc/sysdeps/linux/common/stime.c8
-rw-r--r--libc/sysdeps/linux/common/swapoff.c4
-rw-r--r--libc/sysdeps/linux/common/swapon.c4
-rw-r--r--libc/sysdeps/linux/common/symlink.c4
-rw-r--r--libc/sysdeps/linux/common/sync.c18
-rw-r--r--libc/sysdeps/linux/common/syscalls.h21
-rw-r--r--libc/sysdeps/linux/common/sysctl.c8
-rw-r--r--libc/sysdeps/linux/common/sysfs.c6
-rw-r--r--libc/sysdeps/linux/common/sysinfo.c4
-rw-r--r--libc/sysdeps/linux/common/time.c18
-rw-r--r--libc/sysdeps/linux/common/times.c12
-rw-r--r--libc/sysdeps/linux/common/truncate.c8
-rw-r--r--libc/sysdeps/linux/common/truncate64.c19
-rw-r--r--libc/sysdeps/linux/common/ulimit.c44
-rw-r--r--libc/sysdeps/linux/common/umask.c4
-rw-r--r--libc/sysdeps/linux/common/umount.c11
-rw-r--r--libc/sysdeps/linux/common/umount2.c4
-rw-r--r--libc/sysdeps/linux/common/uname.c12
-rw-r--r--libc/sysdeps/linux/common/unlink.c12
-rw-r--r--libc/sysdeps/linux/common/uselib.c5
-rw-r--r--libc/sysdeps/linux/common/ustat.c4
-rw-r--r--libc/sysdeps/linux/common/utime.c21
-rw-r--r--libc/sysdeps/linux/common/utimes.c20
-rw-r--r--libc/sysdeps/linux/common/vfork.c20
-rw-r--r--libc/sysdeps/linux/common/vhangup.c4
-rw-r--r--libc/sysdeps/linux/common/wait3.c7
-rw-r--r--libc/sysdeps/linux/common/wait4.c11
-rw-r--r--libc/sysdeps/linux/common/write.c19
-rw-r--r--libc/sysdeps/linux/common/xattr.c11
-rw-r--r--libc/sysdeps/linux/common/xstatconv.c20
188 files changed, 1473 insertions, 1331 deletions
diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c
index 48a083c3a..e3807cf06 100644
--- a/libc/sysdeps/linux/common/__socketcall.c
+++ b/libc/sysdeps/linux/common/__socketcall.c
@@ -2,13 +2,14 @@
/*
* __socketcall() for uClibc
*
- * 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"
#ifdef __NR_socketcall
#define __NR___socketcall __NR_socketcall
-attribute_hidden _syscall2(int, __socketcall, int, call, unsigned long *, args);
+int __socketcall(int __call, unsigned long *__args) attribute_hidden;
+_syscall2(int, __socketcall, int, call, unsigned long *, args);
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_ipc.c b/libc/sysdeps/linux/common/__syscall_ipc.c
index b19637e40..decc65ae5 100644
--- a/libc/sysdeps/linux/common/__syscall_ipc.c
+++ b/libc/sysdeps/linux/common/__syscall_ipc.c
@@ -2,15 +2,16 @@
/*
* __syscall_ipc() for uClibc
*
- * 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"
#ifdef __NR_ipc
#define __NR___syscall_ipc __NR_ipc
-attribute_hidden _syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
+#include "../../../misc/sysvipc/ipc.h"
+_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
third, void *, ptr);
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
index 9d4916618..cbf963633 100644
--- a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c
@@ -2,9 +2,9 @@
/*
* __syscall_rt_sigaction() for uClibc
*
- * 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"
@@ -12,10 +12,9 @@
#ifdef __NR_rt_sigaction
#include <signal.h>
+int __syscall_rt_sigaction (int __signum, const struct sigaction *__act, struct sigaction *__oldact, size_t __size) attribute_hidden;
#define __NR___syscall_rt_sigaction __NR_rt_sigaction
-#undef sigaction
_syscall4(int, __syscall_rt_sigaction, int, signum,
const struct sigaction *, act, struct sigaction *, oldact,
size_t, size);
-
#endif
diff --git a/libc/sysdeps/linux/common/__syscall_sigaction.c b/libc/sysdeps/linux/common/__syscall_sigaction.c
index 4333a6a1a..73d3b645f 100644
--- a/libc/sysdeps/linux/common/__syscall_sigaction.c
+++ b/libc/sysdeps/linux/common/__syscall_sigaction.c
@@ -2,9 +2,9 @@
/*
* __syscall_sigaction() for uClibc
*
- * 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"
@@ -12,8 +12,8 @@
#ifndef __NR_rt_sigaction
#define __NR___syscall_sigaction __NR_sigaction
#include <signal.h>
-#undef sigaction
-attribute_hidden _syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
+int __syscall_sigaction (int __signum, const struct sigaction *__act, struct sigaction *__oldact) attribute_hidden;
+_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
act, struct sigaction *, oldact);
#endif
diff --git a/libc/sysdeps/linux/common/access.c b/libc/sysdeps/linux/common/access.c
index 6ac237e83..0b8c3fe3a 100644
--- a/libc/sysdeps/linux/common/access.c
+++ b/libc/sysdeps/linux/common/access.c
@@ -2,9 +2,9 @@
/*
* access() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/acct.c b/libc/sysdeps/linux/common/acct.c
index 878c4ec75..5c64623fb 100644
--- a/libc/sysdeps/linux/common/acct.c
+++ b/libc/sysdeps/linux/common/acct.c
@@ -2,9 +2,9 @@
/*
* acct() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c
index 8239cec5b..4179d3416 100644
--- a/libc/sysdeps/linux/common/alarm.c
+++ b/libc/sysdeps/linux/common/alarm.c
@@ -2,21 +2,25 @@
/*
* alarm() for uClibc
*
- * 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.
*/
-#define setitimer __setitimer
-
#include "syscalls.h"
#include <unistd.h>
+
+libc_hidden_proto(alarm)
+
#ifdef __NR_alarm
#define __NR___alarm __NR_alarm
-attribute_hidden _syscall1(unsigned int, __alarm, unsigned int, seconds);
+_syscall1(unsigned int, alarm, unsigned int, seconds);
#else
#include <sys/time.h>
-unsigned int attribute_hidden __alarm(unsigned int seconds)
+
+libc_hidden_proto(setitimer)
+
+unsigned int alarm(unsigned int seconds)
{
struct itimerval old, new;
unsigned int retval;
@@ -35,4 +39,4 @@ unsigned int attribute_hidden __alarm(unsigned int seconds)
return retval;
}
#endif
-strong_alias(__alarm,alarm)
+libc_hidden_def(alarm)
diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c
index f272c961c..9d3118875 100644
--- a/libc/sysdeps/linux/common/bdflush.c
+++ b/libc/sysdeps/linux/common/bdflush.c
@@ -2,9 +2,9 @@
/*
* bdflush() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/bits/endian.h b/libc/sysdeps/linux/common/bits/endian.h
index 45afd4ae4..0086a1cd4 100644
--- a/libc/sysdeps/linux/common/bits/endian.h
+++ b/libc/sysdeps/linux/common/bits/endian.h
@@ -11,3 +11,8 @@
#endif
#error Machine byte order unknown.
+
+#if 0
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h
index a192c039b..a28d0a40b 100644
--- a/libc/sysdeps/linux/common/bits/getopt.h
+++ b/libc/sysdeps/linux/common/bits/getopt.h
@@ -157,6 +157,7 @@ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
extern int getopt ();
#endif /* __GNU_LIBRARY__ */
+#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
#ifndef __need_getopt
extern int getopt_long (int ___argc, char *const *___argv,
const char *__shortopts,
@@ -168,6 +169,7 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
__THROW;
#endif
+#endif
#ifdef __cplusplus
}
diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h
index 330989128..b2cae9d41 100644
--- a/libc/sysdeps/linux/common/bits/posix_opt.h
+++ b/libc/sysdeps/linux/common/bits/posix_opt.h
@@ -43,21 +43,21 @@
#define _POSIX_MAPPED_FILES 200112L
/* Locking of all memory is supported. */
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
# define _POSIX_MEMLOCK 200112L
#else
# undef _POSIX_MEMLOCK
#endif
/* Locking of ranges of memory is supported. */
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
# define _POSIX_MEMLOCK_RANGE 200112L
#else
# define _POSIX_MEMLOCK_RANGE
#endif
/* Setting of memory protections is supported. */
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
# define _POSIX_MEMORY_PROTECTION 1
#else
# undef _POSIX_MEMORY_PROTECTION
diff --git a/libc/sysdeps/linux/common/bits/statfs.h b/libc/sysdeps/linux/common/bits/statfs.h
index e115c4d75..0e27865e8 100644
--- a/libc/sysdeps/linux/common/bits/statfs.h
+++ b/libc/sysdeps/linux/common/bits/statfs.h
@@ -41,6 +41,7 @@ struct statfs
#endif
__fsid_t f_fsid;
__SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
__SWORD_TYPE f_spare[5];
};
@@ -56,9 +57,11 @@ struct statfs64
__fsfilcnt64_t f_ffree;
__fsid_t f_fsid;
__SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
__SWORD_TYPE f_spare[5];
};
#endif
/* Tell code we have these members. */
#define _STATFS_F_NAMELEN
+#define _STATFS_F_FRSIZE
diff --git a/libc/sysdeps/linux/common/bits/termios.h b/libc/sysdeps/linux/common/bits/termios.h
index c71e4ad1f..03a8e4182 100644
--- a/libc/sysdeps/linux/common/bits/termios.h
+++ b/libc/sysdeps/linux/common/bits/termios.h
@@ -156,6 +156,7 @@ struct termios
#endif
#define B57600 0010001
#define B115200 0010002
+#if 0 /* limited on uClibc, keep in sync w/ cfsetspeed.c */
#define B230400 0010003
#define B460800 0010004
#define B500000 0010005
@@ -170,6 +171,9 @@ struct termios
#define B3500000 0010016
#define B4000000 0010017
#define __MAX_BAUD B4000000
+#else
+#define __MAX_BAUD B115200
+#endif
#ifdef __USE_MISC
# define CIBAUD 002003600000 /* input baud rate (not used) */
# define CMSPAR 010000000000 /* mark or space (stick) parity */
diff --git a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
index 27432a03e..e1721bf40 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
@@ -1,21 +1,8 @@
-/* Copyright (C) 2003 Manuel Novoa III
+/*
+ * Copyright (C) 2003-2006 Manuel Novoa III
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * The GNU C Library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the GNU C Library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-
/* Define a maximal floating point type, and the associated constants
* that are defined for the floating point types in float.h.
*
@@ -114,8 +101,8 @@ extern __fpmax_t __wcstofpmax(const wchar_t *wcs, wchar_t **endptr,
extern __fpmax_t __wcstofpmax_l(const wchar_t *wcs, wchar_t **endptr,
int exp_adjust, __locale_t locale_arg) attribute_hidden;
#endif
-#endif /* _LIBC */
#endif /* __UCLIBC_HAS_WCHAR__ */
+#endif /* _LIBC */
/* The following checks in an __fpmax_t is either 0 or +/- infinity.
*
diff --git a/libc/sysdeps/linux/common/bits/uClibc_locale.h b/libc/sysdeps/linux/common/bits/uClibc_locale.h
index fe574170f..1de735a25 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_locale.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_locale.h
@@ -41,9 +41,7 @@
#define __LOCALE_C_ONLY
-#define __XL(N) N
#define __XL_NPP(N) N
-#define __XL_ALIAS(N)
#define __LOCALE_PARAM
#define __LOCALE_ARG
@@ -361,18 +359,14 @@ extern __locale_t __curlocale_set(__locale_t newloc);
/**********************************************************************/
#if defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE)
-#define __XL(N) __ ## N ## _l
#define __XL_NPP(N) N ## _l
-#define __XL_ALIAS(N) weak_alias( __ ## N ## _l , N ## _l )
#define __LOCALE_PARAM , __locale_t locale_arg
#define __LOCALE_ARG , locale_arg
#define __LOCALE_PTR locale_arg
#else /* defined(__UCLIBC_HAS_XLOCALE__) && defined(__UCLIBC_DO_XLOCALE) */
-#define __XL(N) N
#define __XL_NPP(N) N
-#define __XL_ALIAS(N)
#define __LOCALE_PARAM
#define __LOCALE_ARG
#define __LOCALE_PTR __UCLIBC_CURLOCALE
diff --git a/libc/sysdeps/linux/common/bits/wordsize.h b/libc/sysdeps/linux/common/bits/wordsize.h
index 9ef0e8526..2d8e2b943 100644
--- a/libc/sysdeps/linux/common/bits/wordsize.h
+++ b/libc/sysdeps/linux/common/bits/wordsize.h
@@ -1 +1,6 @@
#error "This file must be written based on the data type sizes of the target"
+
+#if 0
+#define __WORDSIZE 32
+#define __WORDSIZE 64
+#endif
diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c
index e63cfa821..8c28e51a5 100644
--- a/libc/sysdeps/linux/common/capget.c
+++ b/libc/sysdeps/linux/common/capget.c
@@ -2,18 +2,19 @@
/*
* capget() for uClibc
*
- * 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"
-# ifdef __NR_capget
+int capget(void *header, void *data);
+#ifdef __NR_capget
_syscall2(int, capget, void *, header, void *, data);
-# else
+#else
int capget(void *header, void *data)
{
__set_errno(ENOSYS);
return -1;
}
-# endif
+#endif
diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c
index 166de85e4..bee720f92 100644
--- a/libc/sysdeps/linux/common/capset.c
+++ b/libc/sysdeps/linux/common/capset.c
@@ -2,18 +2,19 @@
/*
* capset() for uClibc
*
- * 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"
-# ifdef __NR_capset
+int capset(void *header, const void *data);
+#ifdef __NR_capset
_syscall2(int, capset, void *, header, const void *, data);
-# else
+#else
int capset(void *header, const void *data)
{
__set_errno(ENOSYS);
return -1;
}
-# endif
+#endif
diff --git a/libc/sysdeps/linux/common/chdir.c b/libc/sysdeps/linux/common/chdir.c
index ff4ba527b..7afccf20c 100644
--- a/libc/sysdeps/linux/common/chdir.c
+++ b/libc/sysdeps/linux/common/chdir.c
@@ -2,19 +2,22 @@
/*
* chdir() for uClibc
*
- * 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 <string.h>
+#include <unistd.h>
#include <sys/param.h>
+libc_hidden_proto(chdir)
+
#define __NR___syscall_chdir __NR_chdir
static inline _syscall1(int, __syscall_chdir, const char *, path);
-int attribute_hidden __chdir(const char *path)
+int chdir(const char *path)
{
return __syscall_chdir(path);
}
-strong_alias(__chdir,chdir)
+libc_hidden_def(chdir)
diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c
index bf368cf5e..03438c054 100644
--- a/libc/sysdeps/linux/common/chmod.c
+++ b/libc/sysdeps/linux/common/chmod.c
@@ -2,19 +2,21 @@
/*
* chmod() for uClibc
*
- * 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/stat.h>
+libc_hidden_proto(chmod)
+
#define __NR___syscall_chmod __NR_chmod
static inline _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode);
-int attribute_hidden __chmod(const char *path, mode_t mode)
+int chmod(const char *path, mode_t mode)
{
return __syscall_chmod(path, mode);
}
-strong_alias(__chmod,chmod)
+libc_hidden_def(chmod)
diff --git a/libc/sysdeps/linux/common/chown.c b/libc/sysdeps/linux/common/chown.c
index c017e6f73..8ca955de5 100644
--- a/libc/sysdeps/linux/common/chown.c
+++ b/libc/sysdeps/linux/common/chown.c
@@ -2,9 +2,9 @@
/*
* chown() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/chroot.c b/libc/sysdeps/linux/common/chroot.c
index 462ec77fb..fcf2adac2 100644
--- a/libc/sysdeps/linux/common/chroot.c
+++ b/libc/sysdeps/linux/common/chroot.c
@@ -2,9 +2,9 @@
/*
* chroot() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c
index 7aff495d0..8ee782845 100644
--- a/libc/sysdeps/linux/common/clock_getres.c
+++ b/libc/sysdeps/linux/common/clock_getres.c
@@ -2,26 +2,11 @@
* clock_getres() for uClibc
*
* Copyright (C) 2005 by Peter Kjellerstedt <pkj@axis.com>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define sysconf __sysconf
-
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <unistd.h>
@@ -29,6 +14,8 @@
#ifdef __NR_clock_getres
_syscall2(int, clock_getres, clockid_t, clock_id, struct timespec*, res);
#else
+libc_hidden_proto(sysconf)
+
int clock_getres(clockid_t clock_id, struct timespec* res)
{
long clk_tck;
diff --git a/libc/sysdeps/linux/common/clock_gettime.c b/libc/sysdeps/linux/common/clock_gettime.c
index 33863a828..c6b4111fe 100644
--- a/libc/sysdeps/linux/common/clock_gettime.c
+++ b/libc/sysdeps/linux/common/clock_gettime.c
@@ -3,26 +3,11 @@
*
* Copyright (C) 2003 by Justus Pendleton <uc@ryoohki.net>
* Copyright (C) 2005 by Peter Kjellerstedt <pkj@axis.com>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define gettimeofday __gettimeofday
-
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
@@ -30,6 +15,8 @@
#ifdef __NR_clock_gettime
_syscall2(int, clock_gettime, clockid_t, clock_id, struct timespec*, tp);
#else
+libc_hidden_proto(gettimeofday)
+
int clock_gettime(clockid_t clock_id, struct timespec* tp)
{
struct timeval tv;
diff --git a/libc/sysdeps/linux/common/clock_settime.c b/libc/sysdeps/linux/common/clock_settime.c
index e2ec03f78..6ad7872ae 100644
--- a/libc/sysdeps/linux/common/clock_settime.c
+++ b/libc/sysdeps/linux/common/clock_settime.c
@@ -2,26 +2,11 @@
* clock_settime() for uClibc
*
* Copyright (C) 2005 by Peter Kjellerstedt <pkj@axis.com>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define settimeofday __settimeofday
-
-#define _GNU_SOURCE
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
@@ -29,6 +14,8 @@
#ifdef __NR_clock_settime
_syscall2(int, clock_settime, clockid_t, clock_id, const struct timespec*, tp);
#else
+libc_hidden_proto(settimeofday)
+
int clock_settime(clockid_t clock_id, const struct timespec* tp)
{
struct timeval tv;
diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c
index 2e9c2073d..9bd11c028 100644
--- a/libc/sysdeps/linux/common/close.c
+++ b/libc/sysdeps/linux/common/close.c
@@ -2,15 +2,17 @@
/*
* close() for uClibc
*
- * 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 <unistd.h>
-#define __NR___close __NR_close
-attribute_hidden _syscall1(int, __close, int, fd);
-strong_alias(__close,close)
-weak_alias(__close,__libc_close)
+extern __typeof(close) __libc_close;
+#define __NR___libc_close __NR_close
+_syscall1(int, __libc_close, int, fd);
+libc_hidden_proto(close)
+weak_alias(__libc_close,close)
+libc_hidden_weak(close)
diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c
index 771f5172b..ce6a298c0 100644
--- a/libc/sysdeps/linux/common/cmsg_nxthdr.c
+++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c
@@ -21,8 +21,10 @@
#include <features.h>
#include <sys/socket.h>
-struct cmsghdr attribute_hidden *
-__cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg)
+libc_hidden_proto(__cmsg_nxthdr)
+
+struct cmsghdr *
+__cmsg_nxthdr (struct msghdr *mhdr, struct cmsghdr *cmsg)
{
if ((size_t) cmsg->cmsg_len < sizeof (struct cmsghdr))
/* The kernel header does this so there may be a reason. */
@@ -38,4 +40,4 @@ __cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg)
return NULL;
return cmsg;
}
-strong_alias(__cmsg_nxthdr_internal,__cmsg_nxthdr)
+libc_hidden_def(__cmsg_nxthdr)
diff --git a/libc/sysdeps/linux/common/creat64.c b/libc/sysdeps/linux/common/creat64.c
index 759f5bed8..c1f250832 100644
--- a/libc/sysdeps/linux/common/creat64.c
+++ b/libc/sysdeps/linux/common/creat64.c
@@ -16,28 +16,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define open64 __open64
+#include <_lfs_64.h>
-#include <features.h>
+#ifdef __UCLIBC_HAS_LFS__
#include <fcntl.h>
#include <sys/types.h>
-#if defined __UCLIBC_HAS_LFS__
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-#undef creat
+libc_hidden_proto(open64)
/* Create FILE with protections MODE. */
int creat64 (const char *file, mode_t mode)
@@ -45,4 +30,3 @@ int creat64 (const char *file, mode_t mode)
return open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
}
#endif /* __UCLIBC_HAS_LFS__ */
-
diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
index 5a604d0dc..9a5c2d267 100644
--- a/libc/sysdeps/linux/common/create_module.c
+++ b/libc/sysdeps/linux/common/create_module.c
@@ -2,22 +2,7 @@
/* Syscalls for uClibc
*
* Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*/
#include <errno.h>
@@ -26,14 +11,12 @@
#include <sys/types.h>
#include <sys/syscall.h>
-
#ifdef __NR_create_module
-#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || defined(__thumb__) || defined(__cris__) || defined(__i960__)
+unsigned long create_module(const char *name, size_t size);
+
+#if defined(__UCLIBC_BROKEN_CREATE_MODULE__)
# define __NR___create_module __NR_create_module
-# ifdef __STR_NR_create_module
-# define __STR_NR___create_module __STR_NR_create_module
-# endif
static inline _syscall2(long, __create_module, const char *, name, size_t, size);
/* By checking the value of errno, we know if we have been fooled
* by the syscall2 macro making a very high address look like a
@@ -49,7 +32,7 @@ unsigned long create_module(const char *name, size_t size)
}
return ret;
}
-#elif defined(__alpha__)
+#elif defined(__UCLIBC_SLIGHTLY_BROKEN_CREATE_MODULE__)
# define __NR___create_module __NR_create_module
/* Alpha doesn't have the same problem, exactly, but a bug in older
kernels fails to clear the error flag. Clear it here explicitly. */
@@ -65,6 +48,7 @@ _syscall2(unsigned long, create_module, const char *, name, size_t, size);
#endif
#else /* !__NR_create_module */
+caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused);
caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused)
{
__set_errno(ENOSYS);
diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c
index d31f885bc..66a1610d3 100644
--- a/libc/sysdeps/linux/common/delete_module.c
+++ b/libc/sysdeps/linux/common/delete_module.c
@@ -1,13 +1,13 @@
/* vi: set sw=4 ts=4: */
/*
* delete_module() for uClibc
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * 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"
+int delete_module(const char *name);
#ifdef __NR_delete_module
_syscall1(int, delete_module, const char *, name);
#else
diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h
index ffb754321..cd791306e 100644
--- a/libc/sysdeps/linux/common/dl-osinfo.h
+++ b/libc/sysdeps/linux/common/dl-osinfo.h
@@ -7,8 +7,6 @@
#ifndef _DL_OSINFO_H
#define _DL_OSINFO_H 1
-#define gettimeofday __gettimeofday
-
#include <features.h>
#ifdef __UCLIBC_HAS_SSP__
@@ -22,18 +20,19 @@
# include <sys/time.h>
# ifdef IS_IN_libc
-# ifndef __SSP_QUICK_CANARY__
-# define OPEN __open
-# define READ __read
-# define CLOSE __close
-# endif
+#include <fcntl.h>
+libc_hidden_proto(open)
+libc_hidden_proto(read)
+libc_hidden_proto(close)
+libc_hidden_proto(gettimeofday)
+# define OPEN open
+# define READ read
+# define CLOSE close
# define GETTIMEOFDAY gettimeofday
# else
-# ifndef __SSP_QUICK_CANARY__
-# define OPEN _dl_open
-# define READ _dl_read
-# define CLOSE _dl_close
-# endif
+# define OPEN _dl_open
+# define READ _dl_read
+# define CLOSE _dl_close
# define GETTIMEOFDAY _dl_gettimeofday
# endif
diff --git a/libc/sysdeps/linux/common/dup.c b/libc/sysdeps/linux/common/dup.c
index 86c91ac8e..01b467639 100644
--- a/libc/sysdeps/linux/common/dup.c
+++ b/libc/sysdeps/linux/common/dup.c
@@ -1,10 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* dup() for uClibc
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * 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"
diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c
index 71164aa0b..27d837608 100644
--- a/libc/sysdeps/linux/common/dup2.c
+++ b/libc/sysdeps/linux/common/dup2.c
@@ -2,13 +2,15 @@
/*
* dup2() for uClibc
*
- * 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 <unistd.h>
-#define __NR___dup2 __NR_dup2
-attribute_hidden _syscall2(int, __dup2, int, oldfd, int, newfd);
-strong_alias(__dup2,dup2)
+
+libc_hidden_proto(dup2)
+
+_syscall2(int, dup2, int, oldfd, int, newfd);
+libc_hidden_def(dup2)
diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c
index 8a95746ee..7183f481f 100644
--- a/libc/sysdeps/linux/common/execve.c
+++ b/libc/sysdeps/linux/common/execve.c
@@ -2,9 +2,9 @@
/*
* execve() for uClibc
*
- * 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"
@@ -12,12 +12,7 @@
#include <string.h>
#include <sys/param.h>
-#define __NR___syscall_execve __NR_execve
-static inline _syscall3(int, __syscall_execve, const char *, filename,
+libc_hidden_proto(execve)
+_syscall3(int, execve, const char *, filename,
char *const *, argv, char *const *, envp);
-
-int attribute_hidden __execve(const char * filename, char *const * argv, char *const * envp)
-{
- return __syscall_execve(filename, argv, envp);
-}
-strong_alias(__execve,execve)
+libc_hidden_def(execve)
diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c
index f4692cc2c..1c59bac00 100644
--- a/libc/sysdeps/linux/common/fchdir.c
+++ b/libc/sysdeps/linux/common/fchdir.c
@@ -2,13 +2,15 @@
/*
* fchdir() for uClibc
*
- * 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 <unistd.h>
-#define __NR___fchdir __NR_fchdir
-attribute_hidden _syscall1(int, __fchdir, int, fd);
-strong_alias(__fchdir,fchdir)
+
+libc_hidden_proto(fchdir)
+
+_syscall1(int, fchdir, int, fd);
+libc_hidden_def(fchdir)
diff --git a/libc/sysdeps/linux/common/fchmod.c b/libc/sysdeps/linux/common/fchmod.c
index 70c8eb571..f1eb170ce 100644
--- a/libc/sysdeps/linux/common/fchmod.c
+++ b/libc/sysdeps/linux/common/fchmod.c
@@ -2,9 +2,9 @@
/*
* fchmod() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c
index d98d9da5e..c15e47b42 100644
--- a/libc/sysdeps/linux/common/fdatasync.c
+++ b/libc/sysdeps/linux/common/fdatasync.c
@@ -2,18 +2,16 @@
/*
* fdatasync() for uClibc
*
- * 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 <unistd.h>
-#if defined (__alpha__)
-#undef __NR_fdatasync
-#define __NR_fdatasync __NR_osf_fdatasync
+#if defined __NR_osf_fdatasync
+# define __NR_fdatasync __NR_osf_fdatasync
#endif
_syscall1(int, fdatasync, int, fd);
-
diff --git a/libc/sysdeps/linux/common/flock.c b/libc/sysdeps/linux/common/flock.c
index 53370654e..c08783ca9 100644
--- a/libc/sysdeps/linux/common/flock.c
+++ b/libc/sysdeps/linux/common/flock.c
@@ -2,9 +2,9 @@
/*
* flock() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c
index 899cbaf63..884e986ab 100644
--- a/libc/sysdeps/linux/common/fork.c
+++ b/libc/sysdeps/linux/common/fork.c
@@ -2,19 +2,21 @@
/*
* fork() for uClibc
*
- * 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 <unistd.h>
-#ifdef __ARCH_HAS_MMU__
+#ifdef __ARCH_USE_MMU__
#ifdef __NR_fork
-#define __NR___fork __NR_fork
-attribute_hidden _syscall0(pid_t, __fork);
-strong_alias(__fork,fork)
-weak_alias(__fork,__libc_fork)
+extern __typeof(fork) __libc_fork;
+#define __NR___libc_fork __NR_fork
+_syscall0(pid_t, __libc_fork);
+libc_hidden_proto(fork)
+weak_alias(__libc_fork,fork)
+libc_hidden_weak(fork)
#endif
#endif
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c
index 979a0db1d..c89d7e57c 100644
--- a/libc/sysdeps/linux/common/fstat.c
+++ b/libc/sysdeps/linux/common/fstat.c
@@ -2,24 +2,28 @@
/*
* fstat() for uClibc
*
- * 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.
*/
+/* need to hide the 64bit prototype or the strong_alias()
+ * will fail when __NR_fstat64 doesnt exist */
+#define fstat64 __hidefstat64
+
#include "syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
-#include <bits/kernel_stat.h>
+#include <sys/stat.h>
#include "xstatconv.h"
+#undef fstat64
+
+libc_hidden_proto(fstat)
+
#define __NR___syscall_fstat __NR_fstat
-#undef __fstat
-#undef fstat
static inline _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf);
-int attribute_hidden __fstat(int fd, struct stat *buf)
+int fstat(int fd, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
@@ -30,9 +34,11 @@ int attribute_hidden __fstat(int fd, struct stat *buf)
}
return result;
}
-strong_alias(__fstat,fstat)
+libc_hidden_def(fstat)
#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__
-hidden_strong_alias(__fstat,__fstat64)
-weak_alias(__fstat,fstat64)
+extern __typeof(fstat) fstat64;
+libc_hidden_proto(fstat64)
+strong_alias(fstat,fstat64)
+libc_hidden_def(fstat64)
#endif
diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c
index e1e9dff5c..f992de20a 100644
--- a/libc/sysdeps/linux/common/fstat64.c
+++ b/libc/sysdeps/linux/common/fstat64.c
@@ -2,25 +2,25 @@
/*
* fstat64() for uClibc
*
- * 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"
#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64
-#define __NR___syscall_fstat64 __NR_fstat64
#include <unistd.h>
#include <sys/stat.h>
-#include <bits/kernel_stat.h>
#include "xstatconv.h"
+libc_hidden_proto(fstat64)
+
+#define __NR___syscall_fstat64 __NR_fstat64
static inline _syscall2(int, __syscall_fstat64,
int, filedes, struct kernel_stat64 *, buf);
-#undef fstat64
-int attribute_hidden __fstat64(int fd, struct stat64 *buf)
+int fstat64(int fd, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
@@ -31,6 +31,5 @@ int attribute_hidden __fstat64(int fd, struct stat64 *buf)
}
return result;
}
-strong_alias(__fstat64,fstat64)
-
-#endif /* __UCLIBC_HAS_LFS__ */
+libc_hidden_def(fstat64)
+#endif
diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c
index 9a7cf303b..2a90a38ed 100644
--- a/libc/sysdeps/linux/common/fstatfs.c
+++ b/libc/sysdeps/linux/common/fstatfs.c
@@ -2,13 +2,15 @@
/*
* fstatfs() for uClibc
*
- * 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/vfs.h>
-#define __NR___fstatfs __NR_fstatfs
-attribute_hidden _syscall2(int, __fstatfs, int, fd, struct statfs *, buf);
-strong_alias(__fstatfs,fstatfs)
+
+libc_hidden_proto(fstatfs)
+
+_syscall2(int, fstatfs, int, fd, struct statfs *, buf);
+libc_hidden_def(fstatfs)
diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c
index e6f610751..677f3e3d6 100644
--- a/libc/sysdeps/linux/common/fsync.c
+++ b/libc/sysdeps/linux/common/fsync.c
@@ -2,14 +2,15 @@
/*
* fsync() for uClibc
*
- * 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 <unistd.h>
+extern __typeof(fsync) __libc_fsync;
#define __NR___libc_fsync __NR_fsync
_syscall1(int, __libc_fsync, int, fd);
weak_alias(__libc_fsync, fsync)
diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c
index f24ca8d9e..8c342e7fc 100644
--- a/libc/sysdeps/linux/common/ftruncate.c
+++ b/libc/sysdeps/linux/common/ftruncate.c
@@ -2,11 +2,15 @@
/*
* ftruncate() for uClibc
*
- * 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 <unistd.h>
+
+libc_hidden_proto(ftruncate)
+
_syscall2(int, ftruncate, int, fd, __off_t, length);
+libc_hidden_def(ftruncate)
diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c
index 3cbc9a799..cea9bc1bc 100644
--- a/libc/sysdeps/linux/common/ftruncate64.c
+++ b/libc/sysdeps/linux/common/ftruncate64.c
@@ -1,67 +1,70 @@
/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
* ftruncate64 syscall. Copes with 64 bit and 32 bit machines
* and on 32 bit machines this sends things into the kernel as
* two 32-bit arguments (high and low 32 bits of length) that
* are ordered based on endianess. It turns out endian.h has
* just the macro we need to order things, __LONG_LONG_PAIR.
- *
- * Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
- *
- * This file is subject to the terms and conditions of the GNU
- * Lesser General Public License. See the file COPYING.LIB in
- * the main directory of this archive for more details.
*/
#include <features.h>
-#include <unistd.h>
-#include <errno.h>
-#include <endian.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#if defined __UCLIBC_HAS_LFS__
+#ifdef __UCLIBC_HAS_LFS__
-#if defined __NR_ftruncate64
+# include <unistd.h>
+# include <errno.h>
+# include <endian.h>
+# include <stdint.h>
+# include <sys/types.h>
+# include <sys/syscall.h>
-#if __WORDSIZE == 64
+libc_hidden_proto(ftruncate64)
+
+# ifdef __NR_ftruncate64
+
+# if __WORDSIZE == 64
/* For a 64 bit machine, life is simple... */
_syscall2(int, ftruncate64, int, fd, __off64_t, length);
-#elif __WORDSIZE == 32
+# elif __WORDSIZE == 32
-#ifndef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) __syscall_ftruncate64 (args)
-#define __NR___syscall_ftruncate64 __NR_ftruncate64
-#if defined(__powerpc__) || defined(__mips__)
+# ifndef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) __syscall_ftruncate64 (args)
+# define __NR___syscall_ftruncate64 __NR_ftruncate64
+# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
static inline _syscall4(int, __syscall_ftruncate64, int, fd, uint32_t, pad,
unsigned long, high_length, unsigned long, low_length);
-#else
+# else
static inline _syscall3(int, __syscall_ftruncate64, int, fd,
unsigned long, high_length, unsigned long, low_length);
-#endif
-#endif
+# endif
+# endif
/* The exported ftruncate64 function. */
int ftruncate64 (int fd, __off64_t length)
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
-#if defined(__powerpc__) || defined(__mips__)
+# if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
return INLINE_SYSCALL(ftruncate64,
4, fd, 0, __LONG_LONG_PAIR (high, low));
-#else
+# else
return INLINE_SYSCALL(ftruncate64, 3, fd,
__LONG_LONG_PAIR (high, low));
-#endif
+# endif
}
-#else /* __WORDSIZE */
-#error Your machine is not 64 bit or 32 bit, I am dazed and confused.
-#endif /* __WORDSIZE */
+# else /* __WORDSIZE */
+# error Your machine is not 64 bit or 32 bit, I am dazed and confused.
+# endif /* __WORDSIZE */
+
+# else /* __NR_ftruncate64 */
-#else /* __NR_ftruncate64 */
+libc_hidden_proto(ftruncate)
int ftruncate64 (int fd, __off64_t length)
{
@@ -76,6 +79,7 @@ int ftruncate64 (int fd, __off64_t length)
return -1;
}
-#endif /* __NR_ftruncate64 */
+# endif /* __NR_ftruncate64 */
+libc_hidden_def(ftruncate64)
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c
index a1ab3a552..2c2d9c028 100644
--- a/libc/sysdeps/linux/common/get_kernel_syms.c
+++ b/libc/sysdeps/linux/common/get_kernel_syms.c
@@ -2,14 +2,15 @@
/*
* get_kernel_syms() for uClibc
*
- * 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"
struct kernel_sym;
+int get_kernel_syms(struct kernel_sym *table attribute_unused);
#ifdef __NR_get_kernel_syms
_syscall1(int, get_kernel_syms, struct kernel_sym *, table);
#else
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index a44647d67..a9042c76b 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -1,19 +1,33 @@
-/* These functions find the absolute path to the current working directory. */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
-#define opendir __opendir
-#define closedir __closedir
-#define readdir __readdir
+/* These functions find the absolute path to the current working directory. */
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
+#include <unistd.h>
#include <sys/syscall.h>
+libc_hidden_proto(getcwd)
+
+libc_hidden_proto(strcat)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(strncpy)
+libc_hidden_proto(strlen)
+libc_hidden_proto(opendir)
+libc_hidden_proto(readdir)
+libc_hidden_proto(closedir)
+libc_hidden_proto(stat)
+
#ifdef __NR_getcwd
-#define __NR___syscall_getcwd __NR_getcwd
+# define __NR___syscall_getcwd __NR_getcwd
static inline
_syscall2(int, __syscall_getcwd, char *, buf, unsigned long, size);
@@ -38,26 +52,26 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
int slen;
struct stat st;
-#ifdef FAST_DIR_SEARCH_POSSIBLE
+# ifdef FAST_DIR_SEARCH_POSSIBLE
/* The test is for ELKS lib 0.0.9, this should be fixed in the real kernel */
int slow_search = (sizeof(ino_t) != sizeof(d->d_ino));
-#endif
+# endif
- if (__stat(path_buf, &st) < 0) {
+ if (stat(path_buf, &st) < 0) {
goto oops;
}
-#ifdef FAST_DIR_SEARCH_POSSIBLE
+# ifdef FAST_DIR_SEARCH_POSSIBLE
if (this_dev != st.st_dev)
slow_search = 1;
-#endif
+# endif
- slen = __strlen(path_buf);
+ slen = strlen(path_buf);
ptr = path_buf + slen - 1;
if (*ptr != '/') {
if (slen + 2 > path_size) {
goto oops;
}
- __strcpy(++ptr, "/");
+ strcpy(++ptr, "/");
slen++;
}
slen++;
@@ -68,22 +82,22 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
}
while ((d = readdir(dp)) != 0) {
-#ifdef FAST_DIR_SEARCH_POSSIBLE
+# ifdef FAST_DIR_SEARCH_POSSIBLE
if (slow_search || this_ino == d->d_ino) {
-#endif
- if (slen + __strlen(d->d_name) > path_size) {
+# endif
+ if (slen + strlen(d->d_name) > path_size) {
goto oops;
}
- __strcpy(ptr + 1, d->d_name);
- if (__stat(path_buf, &st) < 0)
+ strcpy(ptr + 1, d->d_name);
+ if (stat(path_buf, &st) < 0)
continue;
if (st.st_ino == this_ino && st.st_dev == this_dev) {
closedir(dp);
return path_buf;
}
-#ifdef FAST_DIR_SEARCH_POSSIBLE
+# ifdef FAST_DIR_SEARCH_POSSIBLE
}
-#endif
+# endif
}
closedir(dp);
@@ -101,7 +115,7 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_
dev_t this_dev;
ino_t this_ino;
- if (__stat(path_buf, &st) < 0) {
+ if (stat(path_buf, &st) < 0) {
if (errno != EFAULT)
goto oops;
return 0;
@@ -112,13 +126,13 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_
if (path_size < 2) {
goto oops;
}
- __strcpy(path_buf, "/");
+ strcpy(path_buf, "/");
return path_buf;
}
- if (__strlen(path_buf) + 4 > path_size) {
+ if (strlen(path_buf) + 4 > path_size) {
goto oops;
}
- __strcat(path_buf, "/..");
+ strcat(path_buf, "/..");
if (recurser(path_buf, path_size, root_dev, root_ino) == 0)
return 0;
@@ -140,24 +154,24 @@ int __syscall_getcwd(char * buf, unsigned long size)
len = -1;
/* get stat for root to have a valid parameters for the terminating condition */
- if (__stat("/", &st) < 0) {
+ if (stat("/", &st) < 0) {
/* root dir not found! */
return -1;
}
/* start with actual dir */
- if (buf) __strncpy(buf, ".", size);
+ if (buf) strncpy(buf, ".", size);
cwd = recurser(buf, size, st.st_dev, st.st_ino);
if (cwd) {
- len = __strlen(buf);
+ len = strlen(buf);
__set_errno(olderrno);
}
return len;
}
-#endif
+#endif /* __NR_getcwd */
-char attribute_hidden *__getcwd(char *buf, size_t size)
+char *getcwd(char *buf, size_t size)
{
int ret;
char *path;
@@ -189,4 +203,4 @@ char attribute_hidden *__getcwd(char *buf, size_t size)
free (path);
return NULL;
}
-strong_alias(__getcwd,getcwd)
+libc_hidden_def(getcwd)
diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c
index f7f3a2f12..7fe191d77 100644
--- a/libc/sysdeps/linux/common/getdents.c
+++ b/libc/sysdeps/linux/common/getdents.c
@@ -1,20 +1,8 @@
-/* Copyright (C) 1993, 1995-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.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <alloca.h>
#include <assert.h>
@@ -28,23 +16,37 @@
#include <sys/types.h>
#include <sys/syscall.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 ...
+ *
+ * See __ASSUME_GETDENTS32_D_TYPE in glibc's kernel-features.h for specific
+ * version / arch details.
+ */
+
#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
struct kernel_dirent
{
- long d_ino;
- __kernel_off_t d_off;
- unsigned short d_reclen;
- char d_name[256];
+ long int d_ino;
+ __kernel_off_t d_off;
+ unsigned short int d_reclen;
+ char d_name[256];
};
+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);
-
-ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes)
+ssize_t __getdents (int fd, char *buf, size_t nbytes)
{
struct dirent *dp;
off_t last_offset = -1;
@@ -75,7 +77,7 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes)
/* Our heuristic failed. We read too many entries. Reset
the stream. */
assert (last_offset != -1);
- __lseek(fd, last_offset, SEEK_SET);
+ lseek(fd, last_offset, SEEK_SET);
if ((char *) dp == buf) {
/* The buffer the user passed in is too small to hold even
@@ -91,10 +93,42 @@ ssize_t attribute_hidden __getdents (int fd, char *buf, size_t nbytes)
dp->d_off = kdp->d_off;
dp->d_reclen = new_reclen;
dp->d_type = DT_UNKNOWN;
- __memcpy (dp->d_name, kdp->d_name,
+ memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
dp = (struct dirent *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent *) (((char *) kdp) + kdp->d_reclen);
}
return (char *) dp - buf;
}
+
+#elif __WORDSIZE == 32
+
+libc_hidden_proto(memmove)
+
+extern __typeof(__getdents) __getdents64 attribute_hidden;
+ssize_t __getdents (int fd, char *buf, size_t nbytes)
+{
+ struct dirent *dp;
+ struct dirent64 *dp64;
+ ssize_t ret = __getdents64 (fd, buf, nbytes);
+
+ if (ret <= 0)
+ return ret;
+
+ dp64 = (struct dirent64 *) buf;
+ buf += ret;
+ while ((void *) dp64 < (void *) buf) {
+ dp = (struct dirent *) dp64;
+ dp->d_ino = dp64->d_ino;
+ dp->d_off = dp64->d_off;
+ dp->d_reclen = dp64->d_reclen;
+ dp->d_type = dp64->d_type;
+ memmove (dp->d_name, dp64->d_name, dp->d_reclen - offsetof (struct dirent64, d_name));
+ memmove (dp64, dp, dp->d_reclen);
+ dp64 = ((void *) dp64) + dp->d_reclen;
+ }
+
+ return ret;
+}
+
+#endif
diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c
index 6eb5418a0..57936d348 100644
--- a/libc/sysdeps/linux/common/getdents64.c
+++ b/libc/sysdeps/linux/common/getdents64.c
@@ -1,20 +1,8 @@
-/* Copyright (C) 1993, 1995-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.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <features.h>
#include <alloca.h>
@@ -29,11 +17,14 @@
#include <sys/types.h>
#include <sys/syscall.h>
-#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
+#if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
+libc_hidden_proto(memcpy)
+libc_hidden_proto(lseek64)
+
+# ifndef offsetof
+# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+# endif
struct kernel_dirent64
{
@@ -45,11 +36,11 @@ struct kernel_dirent64
};
-#define __NR___syscall_getdents64 __NR_getdents64
+# define __NR___syscall_getdents64 __NR_getdents64
static inline _syscall3(int, __syscall_getdents64, int, fd, unsigned char *, dirp, size_t, count);
-
-ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)
+ssize_t __getdents64 (int fd, char *buf, size_t nbytes) attribute_hidden;
+ssize_t __getdents64 (int fd, char *buf, size_t nbytes)
{
struct dirent64 *dp;
off64_t last_offset = -1;
@@ -80,7 +71,7 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)
/* Our heuristic failed. We read too many entries. Reset
the stream. */
assert (last_offset != -1);
- __lseek64(fd, last_offset, SEEK_SET);
+ lseek64(fd, last_offset, SEEK_SET);
if ((char *) dp == buf) {
/* The buffer the user passed in is too small to hold even
@@ -95,18 +86,19 @@ ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)
dp->d_ino = kdp->d_ino;
dp->d_off = kdp->d_off;
dp->d_reclen = new_reclen;
- dp->d_type = DT_UNKNOWN;
- __memcpy (dp->d_name, kdp->d_name,
+ dp->d_type = kdp->d_type;
+ memcpy (dp->d_name, kdp->d_name,
kdp->d_reclen - offsetof (struct kernel_dirent64, d_name));
dp = (struct dirent64 *) ((char *) dp + new_reclen);
kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen);
}
return (char *) dp - buf;
}
-#else
-extern ssize_t __getdents (int fd, char *buf, size_t nbytes) attribute_hidden;
-ssize_t attribute_hidden __getdents64 (int fd, char *buf, size_t nbytes)
-{
- return(__getdents(fd, buf, nbytes));
-}
+
+#if __WORDSIZE == 64
+/* since getdents doesnt give us d_type but getdents64 does, try and
+ * use getdents64 as much as possible */
+attribute_hidden strong_alias(__getdents64,__getdents)
+#endif
+
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c
index a4285322b..e196d1bd9 100644
--- a/libc/sysdeps/linux/common/getdirname.c
+++ b/libc/sysdeps/linux/common/getdirname.c
@@ -17,14 +17,23 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define getcwd __getcwd
-
#include <features.h>
+
+#ifdef __USE_GNU
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
+libc_hidden_proto(strdup)
+libc_hidden_proto(getcwd)
+libc_hidden_proto(getenv)
+#ifdef __UCLIBC_HAS_LFS__
+libc_hidden_proto(stat64)
+#else
+libc_hidden_proto(stat)
+#endif
+
/* Return a malloc'd string containing the current directory name.
If the environment variable `PWD' is set, and its value is correct,
that value is used. */
@@ -33,25 +42,26 @@ char *
get_current_dir_name (void)
{
char *pwd;
-#if defined __UCLIBC_HAS_LFS__
+#ifdef __UCLIBC_HAS_LFS__
struct stat64 dotstat, pwdstat;
#else
struct stat dotstat, pwdstat;
#endif
- pwd = __getenv ("PWD");
+ pwd = getenv ("PWD");
if (pwd != NULL
-#if defined __UCLIBC_HAS_LFS__
- && __stat64 (".", &dotstat) == 0
- && __stat64 (pwd, &pwdstat) == 0
+#ifdef __UCLIBC_HAS_LFS__
+ && stat64 (".", &dotstat) == 0
+ && stat64 (pwd, &pwdstat) == 0
#else
- && __stat (".", &dotstat) == 0
- && __stat (pwd, &pwdstat) == 0
+ && stat (".", &dotstat) == 0
+ && stat (pwd, &pwdstat) == 0
#endif
&& pwdstat.st_dev == dotstat.st_dev
&& pwdstat.st_ino == dotstat.st_ino)
/* The PWD value is correct. Use it. */
- return __strdup (pwd);
+ return strdup (pwd);
return getcwd ((char *) NULL, 0);
}
+#endif
diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c
index aa4215f84..d4caec6ad 100644
--- a/libc/sysdeps/linux/common/getdnnm.c
+++ b/libc/sysdeps/linux/common/getdnnm.c
@@ -1,15 +1,24 @@
-#define uname __uname
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+#include <features.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#define __USE_GNU
#include <sys/utsname.h>
+libc_hidden_proto(getdomainname)
-int attribute_hidden
-__getdomainname(char *name, size_t len)
+libc_hidden_proto(strlen)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(uname)
+
+int
+getdomainname(char *name, size_t len)
{
struct utsname uts;
@@ -20,11 +29,19 @@ __getdomainname(char *name, size_t len)
if (uname(&uts) == -1) return -1;
- if (__strlen(uts.domainname)+1 > len) {
+#ifdef __USE_GNU
+ if (strlen(uts.domainname)+1 > len) {
+#else
+ if (strlen(uts.__domainname)+1 > len) {
+#endif
__set_errno(EINVAL);
return -1;
}
- __strcpy(name, uts.domainname);
+#ifdef __USE_GNU
+ strcpy(name, uts.domainname);
+#else
+ strcpy(name, uts.__domainname);
+#endif
return 0;
}
-strong_alias(__getdomainname,getdomainname)
+libc_hidden_def(getdomainname)
diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c
index de3af63d7..4efd8280d 100644
--- a/libc/sysdeps/linux/common/getdtablesize.c
+++ b/libc/sysdeps/linux/common/getdtablesize.c
@@ -1,33 +1,23 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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 Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- 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. */
-
-#define getrlimit __getrlimit
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#include <limits.h>
+libc_hidden_proto(getdtablesize)
+
+libc_hidden_proto(getrlimit)
+
#define __LOCAL_OPEN_MAX 256
/* Return the maximum number of file descriptors
the current process could possibly have. */
-int attribute_hidden __getdtablesize (void)
+int getdtablesize (void)
{
struct rlimit ru;
@@ -36,4 +26,4 @@ int attribute_hidden __getdtablesize (void)
returns -1. */
return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur;
}
-strong_alias(__getdtablesize,getdtablesize)
+libc_hidden_def(getdtablesize)
diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c
index bed60f052..466d63d89 100644
--- a/libc/sysdeps/linux/common/getegid.c
+++ b/libc/sysdeps/linux/common/getegid.c
@@ -2,27 +2,34 @@
/*
* getegid() for uClibc
*
- * 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.
*/
-#define getgid __getgid
-
#include "syscalls.h"
#include <unistd.h>
-#ifdef __NR_getegid
-#define __NR___syscall_getegid __NR_getegid
+libc_hidden_proto(getegid)
+
+#if defined(__NR_getegid32)
+# undef __NR_getegid
+# define __NR_getegid __NR_getegid32
+_syscall0(gid_t, getegid);
+
+#elif defined(__NR_getegid)
+# define __NR___syscall_getegid __NR_getegid
static inline _syscall0(int, __syscall_getegid);
-gid_t attribute_hidden __getegid(void)
+gid_t getegid(void)
{
return (__syscall_getegid());
}
#else
-gid_t attribute_hidden __getegid(void)
+libc_hidden_proto(getgid)
+
+gid_t getegid(void)
{
return (getgid());
}
#endif
-strong_alias(__getegid,getegid)
+libc_hidden_def(getegid)
diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c
index eba29afa2..3f48c33c8 100644
--- a/libc/sysdeps/linux/common/getgid.c
+++ b/libc/sysdeps/linux/common/getgid.c
@@ -2,22 +2,17 @@
/*
* getgid() for uClibc
*
- * 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 <unistd.h>
-#define __NR___syscall_getgid __NR_getgid
-#if defined (__alpha__)
-#define __NR_getgid __NR_getxgid
+#if defined __NR_getxgid
+# define __NR_getgid __NR_getxgid
#endif
-
-static inline _syscall0(int, __syscall_getgid);
-gid_t attribute_hidden __getgid(void)
-{
- return (__syscall_getgid());
-}
-strong_alias(__getgid,getgid)
+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 83d92627e..6903ed14f 100644
--- a/libc/sysdeps/linux/common/getgroups.c
+++ b/libc/sysdeps/linux/common/getgroups.c
@@ -2,25 +2,36 @@
/*
* getgroups() for uClibc
*
- * 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.
*/
-#define sysconf __sysconf
-
#include "syscalls.h"
#include <stdlib.h>
#include <unistd.h>
#include <grp.h>
+libc_hidden_proto(getgroups)
+
+#if defined(__NR_getgroups32)
+# undef __NR_getgroups
+# define __NR_getgroups __NR_getgroups32
+_syscall2(int, getgroups, int, size, gid_t *, list);
+
+#elif __WORDSIZE == 64
+_syscall2(int, getgroups, int, size, gid_t *, list);
+
+#else
+
+libc_hidden_proto(sysconf)
#define MIN(a,b) (((a)<(b))?(a):(b))
#define __NR___syscall_getgroups __NR_getgroups
static inline _syscall2(int, __syscall_getgroups,
int, size, __kernel_gid_t *, list);
-int attribute_hidden __getgroups(int size, gid_t groups[])
+int getgroups(int size, gid_t groups[])
{
if (unlikely(size < 0)) {
ret_error:
@@ -47,4 +58,6 @@ ret_error:
return ngids;
}
}
-strong_alias(__getgroups,getgroups)
+#endif
+
+libc_hidden_def(getgroups)
diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c
index cb6e5efce..fc5a72c8d 100644
--- a/libc/sysdeps/linux/common/gethstnm.c
+++ b/libc/sysdeps/linux/common/gethstnm.c
@@ -1,12 +1,22 @@
-#define uname __uname
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <string.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <errno.h>
-int attribute_hidden
-__gethostname(char *name, size_t len)
+libc_hidden_proto(gethostname)
+
+libc_hidden_proto(strlen)
+libc_hidden_proto(strcpy)
+libc_hidden_proto(uname)
+
+int
+gethostname(char *name, size_t len)
{
struct utsname uts;
@@ -17,11 +27,11 @@ __gethostname(char *name, size_t len)
if (uname(&uts) == -1) return -1;
- if (__strlen(uts.nodename)+1 > len) {
+ if (strlen(uts.nodename)+1 > len) {
__set_errno(EINVAL);
return -1;
}
- __strcpy(name, uts.nodename);
+ strcpy(name, uts.nodename);
return 0;
}
-strong_alias(__gethostname,gethostname)
+libc_hidden_def(gethostname)
diff --git a/libc/sysdeps/linux/common/getitimer.c b/libc/sysdeps/linux/common/getitimer.c
index a7bc89209..0d2024dfc 100644
--- a/libc/sysdeps/linux/common/getitimer.c
+++ b/libc/sysdeps/linux/common/getitimer.c
@@ -2,9 +2,9 @@
/*
* getitimer() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c
index 669cdb075..4a35d0775 100644
--- a/libc/sysdeps/linux/common/getpagesize.c
+++ b/libc/sysdeps/linux/common/getpagesize.c
@@ -19,11 +19,14 @@
#include <unistd.h>
#include <features.h>
#include <sys/param.h>
+
extern size_t __pagesize;
+libc_hidden_proto(__pagesize)
/* Return the system page size. */
/* couldn't make __getpagesize hidden, because shm.h uses it in a macro */
-int attribute_hidden __getpagesize_internal(void)
+extern __typeof(getpagesize) __getpagesize;
+int __getpagesize(void)
{
if (__pagesize != 0)
return __pagesize;
@@ -41,6 +44,6 @@ int attribute_hidden __getpagesize_internal(void)
#endif /* NBPG. */
#endif /* EXEC_PAGESIZE. */
}
-strong_alias(__getpagesize_internal, __getpagesize)
-weak_alias(__getpagesize_internal, getpagesize)
-
+libc_hidden_proto(getpagesize)
+strong_alias(__getpagesize,getpagesize)
+libc_hidden_def(getpagesize)
diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c
index 8de8516dc..6cdaef172 100644
--- a/libc/sysdeps/linux/common/getpgid.c
+++ b/libc/sysdeps/linux/common/getpgid.c
@@ -2,18 +2,18 @@
/*
* getpgid() for uClibc
*
- * 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 <unistd.h>
#define __NR___syscall_getpgid __NR_getpgid
static inline _syscall1(__kernel_pid_t, __syscall_getpgid, __kernel_pid_t, pid);
-pid_t __getpgid(pid_t pid)
+pid_t getpgid(pid_t pid)
{
return (__syscall_getpgid(pid));
}
-weak_alias(__getpgid, getpgid)
diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c
index 6a6a9e129..fd331bd62 100644
--- a/libc/sysdeps/linux/common/getpid.c
+++ b/libc/sysdeps/linux/common/getpid.c
@@ -2,19 +2,20 @@
/*
* getpid() for uClibc
*
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 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 <unistd.h>
-#if defined (__alpha__)
-#define __NR___getpid __NR_getxpid
+extern __typeof(getpid) __libc_getpid;
+#if defined __NR_getxpid
+# define __NR_getpid __NR_getxpid
#endif
-#define __NR___getpid __NR_getpid
-attribute_hidden _syscall0(pid_t, __getpid);
-strong_alias(__getpid, getpid)
-/* not used in libpthread */
-/* weak_alias(__getpid, __libc_getpid) */
+#define __NR___libc_getpid __NR_getpid
+_syscall0(pid_t, __libc_getpid);
+libc_hidden_proto(getpid)
+weak_alias(__libc_getpid, getpid)
+libc_hidden_weak(getpid)
diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c
index b2944e5e0..81d613bb9 100644
--- a/libc/sysdeps/linux/common/getppid.c
+++ b/libc/sysdeps/linux/common/getppid.c
@@ -2,18 +2,19 @@
/*
* getppid() for uClibc
*
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*/
#include "syscalls.h"
-# include <unistd.h>
-# ifdef __NR_getppid
+#include <unistd.h>
+#ifdef __NR_getppid
_syscall0(pid_t, getppid);
-# else
+#else
+libc_hidden_proto(getpid)
pid_t getppid(void)
{
- return (__getpid());
+ return getpid();
}
-# endif
+#endif
diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c
index 3f695402d..41cc3eb49 100644
--- a/libc/sysdeps/linux/common/getpriority.c
+++ b/libc/sysdeps/linux/common/getpriority.c
@@ -2,14 +2,16 @@
/*
* getpriority() for uClibc
*
- * 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/resource.h>
+libc_hidden_proto(getpriority)
+
#define __NR___syscall_getpriority __NR_getpriority
static inline _syscall2(int, __syscall_getpriority,
__priority_which_t, which, id_t, who);
@@ -17,7 +19,7 @@ static inline _syscall2(int, __syscall_getpriority,
/* The return value of __syscall_getpriority is biased by this value
* to avoid returning negative values. */
#define PZERO 20
-int attribute_hidden __getpriority(enum __priority_which which, id_t who)
+int getpriority(__priority_which_t which, id_t who)
{
int res;
@@ -26,4 +28,4 @@ int attribute_hidden __getpriority(enum __priority_which which, id_t who)
res = PZERO - res;
return res;
}
-strong_alias(__getpriority,getpriority)
+libc_hidden_def(getpriority)
diff --git a/libc/sysdeps/linux/common/getresgid.c b/libc/sysdeps/linux/common/getresgid.c
index a4b4e13c3..bc19b97ea 100644
--- a/libc/sysdeps/linux/common/getresgid.c
+++ b/libc/sysdeps/linux/common/getresgid.c
@@ -2,17 +2,24 @@
/*
* getresgid() for uClibc
*
- * 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"
+#ifdef __USE_GNU
+#include <unistd.h>
-#ifdef __NR_getresgid
-#define __NR___syscall_getresgid __NR_getresgid
-static inline _syscall3(int, __syscall_getresgid, __kernel_gid_t *, egid,
- __kernel_gid_t *, rgid, __kernel_gid_t *, sgid);
+#if defined(__NR_getresgid32)
+# undef __NR_getresgid
+# define __NR_getresgid __NR_getresgid32
+_syscall3(int, getresgid, gid_t *, rgid, gid_t *, egid, gid_t *, sgid)
+
+#elif defined(__NR_getresgid)
+# define __NR___syscall_getresgid __NR_getresgid
+static inline _syscall3(int, __syscall_getresgid, __kernel_gid_t *, rgid,
+ __kernel_gid_t *, egid, __kernel_gid_t *, sgid);
int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
{
@@ -28,3 +35,4 @@ int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid)
return result;
}
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/getresuid.c b/libc/sysdeps/linux/common/getresuid.c
index 98fdcc4cb..b8d1788f6 100644
--- a/libc/sysdeps/linux/common/getresuid.c
+++ b/libc/sysdeps/linux/common/getresuid.c
@@ -2,15 +2,22 @@
/*
* getresuid() for uClibc
*
- * 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"
+#ifdef __USE_GNU
+#include <unistd.h>
-#ifdef __NR_getresuid
-#define __NR___syscall_getresuid __NR_getresuid
+#if defined(__NR_getresuid32)
+# undef __NR_getresuid
+# define __NR_getresuid __NR_getresuid32
+_syscall3(int, getresuid, uid_t *, ruid, uid_t *, euid, uid_t *, suid)
+
+#elif defined(__NR_getresuid)
+# define __NR___syscall_getresuid __NR_getresuid
static inline _syscall3(int, __syscall_getresuid, __kernel_uid_t *, ruid,
__kernel_uid_t *, euid, __kernel_uid_t *, suid);
@@ -28,3 +35,4 @@ int getresuid(uid_t * ruid, uid_t * euid, uid_t * suid)
return result;
}
#endif
+#endif
diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c
index fef907a03..2a4d05318 100644
--- a/libc/sysdeps/linux/common/getrlimit.c
+++ b/libc/sysdeps/linux/common/getrlimit.c
@@ -2,33 +2,47 @@
/*
* getrlimit() for uClibc
*
- * 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.
*/
+#define getrlimit64 __hide_getrlimit64
#include "syscalls.h"
#include <unistd.h>
#include <sys/resource.h>
+#undef getrlimit64
-#ifdef __NR_ugetrlimit
-#define __NR___ugetrlimit __NR_ugetrlimit
+libc_hidden_proto(getrlimit)
+
+/* Only wrap getrlimit if the new ugetrlimit is not present and getrlimit sucks */
+
+#if defined(__NR_ugetrlimit)
+
+/* just call ugetrlimit() */
+# define __NR___syscall_ugetrlimit __NR_ugetrlimit
static inline
-_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource,
- struct rlimit *, rlim);
-int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+_syscall2(int, __syscall_ugetrlimit, enum __rlimit_resource, resource,
+ struct rlimit *, rlim);
+int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
- return (__ugetrlimit(resource, rlimits));
+ return (__syscall_ugetrlimit(resource, rlimits));
}
-#else /* __NR_ugetrlimit */
+#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
+
+/* We don't need to wrap getrlimit() */
+_syscall2(int, getrlimit, __rlimit_resource_t, resource,
+ struct rlimit *, rlim);
-/* Only include the old getrlimit if the new one (ugetrlimit) is not around */
-#define __NR___syscall_getrlimit __NR_getrlimit
+#else
+
+/* we have to handle old style getrlimit() */
+# define __NR___syscall_getrlimit __NR_getrlimit
static inline
_syscall2(int, __syscall_getrlimit, int, resource, struct rlimit *, rlim);
-int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
{
int result;
@@ -47,4 +61,8 @@ int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rl
}
#endif
-strong_alias(__getrlimit,getrlimit)
+libc_hidden_def(getrlimit)
+
+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+strong_alias(getrlimit, getrlimit64)
+#endif
diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c
index 76c3196ad..ca7aa7310 100644
--- a/libc/sysdeps/linux/common/getrlimit64.c
+++ b/libc/sysdeps/linux/common/getrlimit64.c
@@ -16,27 +16,17 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define getrlimit __getrlimit
-
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include <_lfs_64.h>
#include <sys/types.h>
#include <sys/resource.h>
+#include <bits/wordsize.h>
+
+/* the regular getrlimit will work just fine for 64bit users */
+
+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
-#if defined __UCLIBC_HAS_LFS__
+libc_hidden_proto(getrlimit)
/* Put the soft and hard limits for RESOURCE in *RLIMITS.
Returns 0 if successful, -1 if not (and sets errno). */
diff --git a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c
index c6aa5a95e..9b87cb1b4 100644
--- a/libc/sysdeps/linux/common/getrusage.c
+++ b/libc/sysdeps/linux/common/getrusage.c
@@ -2,9 +2,9 @@
/*
* getrusage() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c
index 3e9c2d8ba..aaac0ceb9 100644
--- a/libc/sysdeps/linux/common/getsid.c
+++ b/libc/sysdeps/linux/common/getsid.c
@@ -2,19 +2,23 @@
/*
* getsid() for uClibc
*
- * 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 <unistd.h>
+#ifdef __USE_XOPEN_EXTENDED
+libc_hidden_proto(getsid)
+
#define __NR___syscall_getsid __NR_getsid
static inline _syscall1(__kernel_pid_t, __syscall_getsid, __kernel_pid_t, pid);
-pid_t attribute_hidden __getsid(pid_t pid)
+pid_t getsid(pid_t pid)
{
return (__syscall_getsid(pid));
}
-strong_alias(__getsid,getsid)
+libc_hidden_def(getsid)
+#endif
diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c
index 6c2613f01..2d8a6cb25 100644
--- a/libc/sysdeps/linux/common/gettimeofday.c
+++ b/libc/sysdeps/linux/common/gettimeofday.c
@@ -2,13 +2,15 @@
/*
* gettimeofday() for uClibc
*
- * 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/time.h>
-#define __NR___gettimeofday __NR_gettimeofday
-attribute_hidden _syscall2(int, __gettimeofday, struct timeval *, tv, struct timezone *, tz);
-strong_alias(__gettimeofday,gettimeofday)
+
+libc_hidden_proto(gettimeofday)
+
+_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz);
+libc_hidden_def(gettimeofday)
diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c
index 0065a74b8..3fb566961 100644
--- a/libc/sysdeps/linux/common/init_module.c
+++ b/libc/sysdeps/linux/common/init_module.c
@@ -2,12 +2,13 @@
/*
* init_module() for uClibc
*
- * 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"
+int init_module(void *first, void *second, void *third, void *fourth, void *fifth);
#ifdef __NR_init_module
/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
* (for 2.2 and 2.4 kernels). Use the greatest common denominator,
diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c
index 29293f359..e8e3a1031 100644
--- a/libc/sysdeps/linux/common/ioctl.c
+++ b/libc/sysdeps/linux/common/ioctl.c
@@ -2,20 +2,22 @@
/*
* ioctl() for uClibc
*
- * 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 <stdarg.h>
#include <sys/ioctl.h>
+libc_hidden_proto(ioctl)
+
#define __NR___syscall_ioctl __NR_ioctl
static inline
_syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg);
-int attribute_hidden __ioctl(int fd, unsigned long int request, ...)
+int ioctl(int fd, unsigned long int request, ...)
{
void *arg;
va_list list;
@@ -26,4 +28,4 @@ int attribute_hidden __ioctl(int fd, unsigned long int request, ...)
va_end(list);
return __syscall_ioctl(fd, request, arg);
}
-strong_alias(__ioctl,ioctl)
+libc_hidden_def(ioctl)
diff --git a/libc/sysdeps/linux/common/ioperm.c b/libc/sysdeps/linux/common/ioperm.c
index 16c9eecfa..e9ca964cc 100644
--- a/libc/sysdeps/linux/common/ioperm.c
+++ b/libc/sysdeps/linux/common/ioperm.c
@@ -2,12 +2,14 @@
/*
* ioperm() for uClibc
*
- * 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"
-#if defined __ARCH_HAS_MMU__ && defined __NR_ioperm
+#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;
_syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on);
#endif
diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c
index ab9513d9b..2a6b619d5 100644
--- a/libc/sysdeps/linux/common/iopl.c
+++ b/libc/sysdeps/linux/common/iopl.c
@@ -2,13 +2,14 @@
/*
* iopl() for uClibc
*
- * Copyright (C) 2000-2005 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"
-/* Tuns out the m68k unistd.h kernel header is broken */
-#if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
+#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;
_syscall1(int, iopl, int, level);
#endif
diff --git a/libc/sysdeps/linux/common/kill.c b/libc/sysdeps/linux/common/kill.c
index 2d1d9ae8a..7e1b330a5 100644
--- a/libc/sysdeps/linux/common/kill.c
+++ b/libc/sysdeps/linux/common/kill.c
@@ -2,20 +2,21 @@
/*
* kill() for uClibc
*
- * 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 <signal.h>
-#undef kill
+libc_hidden_proto(kill)
+
#define __NR___syscall_kill __NR_kill
static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig);
-int attribute_hidden __kill(pid_t pid, int sig)
+int kill(pid_t pid, int sig)
{
return (__syscall_kill(pid, sig));
}
-strong_alias(__kill,kill)
+libc_hidden_def(kill)
diff --git a/libc/sysdeps/linux/common/klogctl.c b/libc/sysdeps/linux/common/klogctl.c
index acfeac59d..5e36104f1 100644
--- a/libc/sysdeps/linux/common/klogctl.c
+++ b/libc/sysdeps/linux/common/klogctl.c
@@ -2,13 +2,14 @@
/*
* klogctl() for uClibc
*
- * 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 <unistd.h>
+#include <sys/klog.h>
#define __NR__syslog __NR_syslog
static inline _syscall3(int, _syslog, int, type, char *, buf, int, len);
int klogctl(int type, char *buf, int len)
diff --git a/libc/sysdeps/linux/common/lchown.c b/libc/sysdeps/linux/common/lchown.c
index 96fef52d0..ffee39126 100644
--- a/libc/sysdeps/linux/common/lchown.c
+++ b/libc/sysdeps/linux/common/lchown.c
@@ -2,9 +2,9 @@
/*
* lchown() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/link.c b/libc/sysdeps/linux/common/link.c
index 4035fcac6..21d1f1413 100644
--- a/libc/sysdeps/linux/common/link.c
+++ b/libc/sysdeps/linux/common/link.c
@@ -2,9 +2,9 @@
/*
* link() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c
index 55200d369..76354fa15 100644
--- a/libc/sysdeps/linux/common/llseek.c
+++ b/libc/sysdeps/linux/common/llseek.c
@@ -2,61 +2,41 @@
/*
* llseek/lseek64 syscall for uClibc
*
- * Copyright (C) 2002 by Erik Andersen <andersen@codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "syscalls.h"
+#include <unistd.h>
+
+extern __typeof(lseek64) __libc_lseek64;
-#undef lseek64
#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
-#ifndef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) __syscall_llseek (args)
-#define __NR___syscall_llseek __NR__llseek
+# ifndef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) __syscall_llseek (args)
+# define __NR___syscall_llseek __NR__llseek
static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi,
off_t, offset_lo, loff_t *, result, int, whence);
-#endif
+# endif
-loff_t attribute_hidden __lseek64(int fd, loff_t offset, int whence)
+loff_t __libc_lseek64(int fd, loff_t offset, int whence)
{
loff_t result;
return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
(off_t) (offset & 0xffffffff), &result, whence) ?: result);
}
#else
-extern __off_t __lseek(int fildes, off_t offset, int whence) attribute_hidden;
-loff_t __lseek64(int fd, loff_t offset, int whence)
+extern __typeof(lseek) __libc_lseek;
+libc_hidden_proto(__libc_lseek)
+
+loff_t __libc_lseek64(int fd, loff_t offset, int whence)
{
- return(loff_t)(__lseek(fd, (off_t) (offset & 0xffffffff), whence));
+ return(loff_t)(__libc_lseek(fd, (off_t) (offset), whence));
}
#endif
-strong_alias(__lseek64,lseek64)
-//strong_alias(__lseek64,_llseek)
-//strong_alias(__lseek64,llseek)
-weak_alias(__lseek64,__libc_lseek64)
+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/longjmp.c b/libc/sysdeps/linux/common/longjmp.c
index 5b4eff5f5..a54f01f48 100644
--- a/libc/sysdeps/linux/common/longjmp.c
+++ b/libc/sysdeps/linux/common/longjmp.c
@@ -20,10 +20,12 @@
#include <setjmp.h>
#include <signal.h>
+libc_hidden_proto(sigprocmask)
-extern void __longjmp (__jmp_buf __env, int val);
-
+extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
+libc_hidden_proto(__longjmp)
+extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
/* Set the signal mask to the one specified in ENV, and jump
to the position specified in ENV, causing the setjmp
call there to return VAL, or 1 if VAL is 0. */
@@ -36,14 +38,14 @@ void __libc_longjmp (sigjmp_buf env, int val)
if (env[0].__mask_was_saved)
/* Restore the saved signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
+ (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
(sigset_t *) NULL);
/* Call the machine-dependent function to restore machine state. */
__longjmp (env[0].__jmpbuf, val ?: 1);
}
-weak_alias (__libc_longjmp, longjmp)
-weak_alias (__libc_longjmp, _longjmp)
-weak_alias (__libc_longjmp, siglongjmp)
-weak_alias (__libc_longjmp, __libc_siglongjmp)
+weak_alias(__libc_longjmp,longjmp)
+weak_alias(__libc_longjmp,siglongjmp)
+strong_alias(__libc_longjmp,__libc_siglongjmp)
+strong_alias(__libc_longjmp,_longjmp)
diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c
index 4eb51d322..72833b81b 100644
--- a/libc/sysdeps/linux/common/lseek.c
+++ b/libc/sysdeps/linux/common/lseek.c
@@ -2,17 +2,21 @@
/*
* lseek() for uClibc
*
- * 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 <unistd.h>
-#define __NR___lseek __NR_lseek
-#undef __lseek
-#undef lseek
-attribute_hidden _syscall3(__off_t, __lseek, int, fildes, __off_t, offset, int, whence);
-strong_alias(__lseek,lseek)
-weak_alias(__lseek,__libc_lseek)
+extern __typeof(lseek) __libc_lseek;
+libc_hidden_proto(__libc_lseek)
+
+#define __NR___libc_lseek __NR_lseek
+_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence);
+libc_hidden_def(__libc_lseek)
+
+libc_hidden_proto(lseek)
+weak_alias(__libc_lseek,lseek)
+libc_hidden_weak(lseek)
diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c
index 69d663d51..06c7c5d90 100644
--- a/libc/sysdeps/linux/common/lstat.c
+++ b/libc/sysdeps/linux/common/lstat.c
@@ -2,25 +2,29 @@
/*
* lstat() for uClibc
*
- * 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.
*/
+/* need to hide the 64bit prototype or the strong_alias()
+ * will fail when __NR_lstat64 doesnt exist */
+#define lstat64 __hidelstat64
+
#include "syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
-#include <bits/kernel_stat.h>
+#include <sys/stat.h>
#include "xstatconv.h"
+#undef lstat64
+
+libc_hidden_proto(lstat)
+
#define __NR___syscall_lstat __NR_lstat
-#undef __lstat
-#undef lstat
static inline _syscall2(int, __syscall_lstat,
const char *, file_name, struct kernel_stat *, buf);
-int attribute_hidden __lstat(const char *file_name, struct stat *buf)
+int lstat(const char *file_name, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
@@ -31,8 +35,11 @@ int attribute_hidden __lstat(const char *file_name, struct stat *buf)
}
return result;
}
-strong_alias(__lstat,lstat)
+libc_hidden_def(lstat)
#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
-weak_alias(lstat,lstat64)
+extern __typeof(lstat) lstat64;
+libc_hidden_proto(lstat64)
+strong_alias(lstat,lstat64)
+libc_hidden_def(lstat64)
#endif
diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c
index 80268d2a1..2dc06c692 100644
--- a/libc/sysdeps/linux/common/lstat64.c
+++ b/libc/sysdeps/linux/common/lstat64.c
@@ -2,25 +2,25 @@
/*
* lstat64() for uClibc
*
- * 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"
#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
-#include <unistd.h>
-#include <sys/stat.h>
-#include <bits/kernel_stat.h>
-#include "xstatconv.h"
+# include <unistd.h>
+# include <sys/stat.h>
+# include "xstatconv.h"
-#define __NR___syscall_lstat64 __NR_lstat64
-#undef lstat64
+libc_hidden_proto(lstat64)
+
+# define __NR___syscall_lstat64 __NR_lstat64
static inline _syscall2(int, __syscall_lstat64, const char *, file_name,
struct kernel_stat64 *, buf);
-int attribute_hidden __lstat64(const char *file_name, struct stat64 *buf)
+int lstat64(const char *file_name, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
@@ -31,6 +31,6 @@ int attribute_hidden __lstat64(const char *file_name, struct stat64 *buf)
}
return result;
}
-strong_alias(__lstat64,lstat64)
+libc_hidden_def(lstat64)
-#endif /* __UCLIBC_HAS_LFS__ */
+#endif
diff --git a/libc/sysdeps/linux/common/madvise.c b/libc/sysdeps/linux/common/madvise.c
index bdea24c66..70ed9c4cb 100644
--- a/libc/sysdeps/linux/common/madvise.c
+++ b/libc/sysdeps/linux/common/madvise.c
@@ -2,12 +2,13 @@
/*
* madvise() for uClibc
*
- * 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/mman.h>
#ifdef __NR_madvise
_syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);
#endif
diff --git a/libc/sysdeps/linux/common/mincore.c b/libc/sysdeps/linux/common/mincore.c
index ecae441a5..0e3ade1ce 100644
--- a/libc/sysdeps/linux/common/mincore.c
+++ b/libc/sysdeps/linux/common/mincore.c
@@ -1,14 +1,14 @@
-/*
- * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvs/uClibc/libc/sysdeps/linux/common/mincore.c,v 1.1 2004/12/20 00:10:51 solar Exp $
- *
+/*
* This file provides the mincore() system call to uClibc.
- * 20041215 - <solar@gentoo.org>
+ * Copyright (C) 20041215 - <solar@gentoo.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 <unistd.h>
+#include <sys/mman.h>
#ifdef __NR_mincore
_syscall3(int, mincore, void *, start, size_t, length, unsigned char *, vec);
diff --git a/libc/sysdeps/linux/common/mkdir.c b/libc/sysdeps/linux/common/mkdir.c
index 5e96cf599..93b66ae40 100644
--- a/libc/sysdeps/linux/common/mkdir.c
+++ b/libc/sysdeps/linux/common/mkdir.c
@@ -2,20 +2,22 @@
/*
* mkdir() for uClibc
*
- * 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/stat.h>
+libc_hidden_proto(mkdir)
+
#define __NR___syscall_mkdir __NR_mkdir
static inline _syscall2(int, __syscall_mkdir, const char *, pathname,
__kernel_mode_t, mode);
-int attribute_hidden __mkdir(const char *pathname, mode_t mode)
+int mkdir(const char *pathname, mode_t mode)
{
return (__syscall_mkdir(pathname, mode));
}
-strong_alias(__mkdir,mkdir)
+libc_hidden_def(mkdir)
diff --git a/libc/sysdeps/linux/common/mkfifo.c b/libc/sysdeps/linux/common/mkfifo.c
index db7f8fc42..dddfe8c7b 100644
--- a/libc/sysdeps/linux/common/mkfifo.c
+++ b/libc/sysdeps/linux/common/mkfifo.c
@@ -20,13 +20,13 @@
by Erik Andersen <andersee@debian.org>
*/
-#define mknod __mknod
-
#include <errno.h>
#include <stddef.h>
#include <sys/stat.h>
#include <sys/types.h>
+libc_hidden_proto(mknod)
+
/* Create a named pipe (FIFO) named PATH with protections MODE. */
int
mkfifo (const char *path, mode_t mode)
diff --git a/libc/sysdeps/linux/common/mknod.c b/libc/sysdeps/linux/common/mknod.c
index d66747178..b71541d95 100644
--- a/libc/sysdeps/linux/common/mknod.c
+++ b/libc/sysdeps/linux/common/mknod.c
@@ -2,20 +2,22 @@
/*
* mknod() for uClibc
*
- * 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/stat.h>
#include <sys/sysmacros.h>
+libc_hidden_proto(mknod)
+
#define __NR___syscall_mknod __NR_mknod
static inline _syscall3(int, __syscall_mknod, const char *, path,
__kernel_mode_t, mode, __kernel_dev_t, dev);
-int attribute_hidden __mknod(const char *path, mode_t mode, dev_t dev)
+int mknod(const char *path, mode_t mode, dev_t dev)
{
/* We must convert the dev_t value to a __kernel_dev_t */
__kernel_dev_t k_dev;
@@ -23,4 +25,4 @@ int attribute_hidden __mknod(const char *path, mode_t mode, dev_t dev)
k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
return __syscall_mknod(path, mode, k_dev);
}
-strong_alias(__mknod,mknod)
+libc_hidden_def(mknod)
diff --git a/libc/sysdeps/linux/common/mlock.c b/libc/sysdeps/linux/common/mlock.c
index aa6bbb63b..3eb72bb07 100644
--- a/libc/sysdeps/linux/common/mlock.c
+++ b/libc/sysdeps/linux/common/mlock.c
@@ -2,13 +2,13 @@
/*
* mlock() for uClibc
*
- * 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/mman.h>
-#if defined __ARCH_HAS_MMU__ && defined __NR_mlock
+#if defined __ARCH_USE_MMU__ && defined __NR_mlock
_syscall2(int, mlock, const void *, addr, size_t, len);
#endif
diff --git a/libc/sysdeps/linux/common/mlockall.c b/libc/sysdeps/linux/common/mlockall.c
index 4f51bd0df..6e6d3bc36 100644
--- a/libc/sysdeps/linux/common/mlockall.c
+++ b/libc/sysdeps/linux/common/mlockall.c
@@ -2,13 +2,13 @@
/*
* mlockall() for uClibc
*
- * 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/mman.h>
-#if defined __ARCH_HAS_MMU__ && defined __NR_mlockall
+#if defined __ARCH_USE_MMU__ && defined __NR_mlockall
_syscall1(int, mlockall, int, flags);
#endif
diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c
index 3cd3eee4d..6acb73980 100644
--- a/libc/sysdeps/linux/common/mmap.c
+++ b/libc/sysdeps/linux/common/mmap.c
@@ -1,10 +1,10 @@
/* vi: set sw=4 ts=4: */
/*
- * _mmap() for uClibc
+ * mmap() for uClibc
*
- * 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"
@@ -12,9 +12,19 @@
#include <sys/mman.h>
#ifdef __NR_mmap
-#define __NR__mmap __NR_mmap
+
+libc_hidden_proto(mmap)
+
+#ifdef __UCLIBC_MMAP_HAS_6_ARGS__
+
+_syscall6(void *, mmap, void *, start, size_t, length,
+ int, prot, int, flags, int, fd, off_t, offset);
+
+#else
+
+# define __NR__mmap __NR_mmap
static inline _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
-attribute_hidden __ptr_t __mmap(__ptr_t addr, size_t len, int prot,
+__ptr_t mmap(__ptr_t addr, size_t len, int prot,
int flags, int fd, __off_t offset)
{
unsigned long buffer[6];
@@ -27,5 +37,8 @@ attribute_hidden __ptr_t __mmap(__ptr_t addr, size_t len, int prot,
buffer[5] = (unsigned long) offset;
return (__ptr_t) _mmap(buffer);
}
-strong_alias(__mmap,mmap)
+
+#endif
+
+libc_hidden_def(mmap)
#endif
diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c
index f0380b1ad..2cf200dc9 100644
--- a/libc/sysdeps/linux/common/mmap64.c
+++ b/libc/sysdeps/linux/common/mmap64.c
@@ -1,87 +1,66 @@
-/* Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Daniel Jacobowitz <dan@debian.org>, 1999.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
/* Massivly hacked up for uClibc by Erik Andersen */
-#define mmap __mmap
+#include <_lfs_64.h>
+
+#ifdef __UCLIBC_HAS_LFS__
-#include <features.h>
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <sys/syscall.h>
+#include <bits/uClibc_page.h>
+libc_hidden_proto(mmap)
-#if defined __UCLIBC_HAS_LFS__
+# if !defined __NR_mmap2 || !defined _syscall6
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#if ! defined __NR_mmap2 || ! defined _syscall6
-
-/*
+/*
* This version is a stub that just chops off everything at the mmap 32 bit
* mmap() address space... You will probably need to add in an arch specific
* implementation to override this as there is not a generic way for me to
* implement this particular syscall if your arch lacks _syscall6...
*
-*/
+ */
__ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
{
- if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) {
- __set_errno (EINVAL);
+ if (offset != (off_t) offset ||
+ (offset + len) != (off_t) (offset + len)) {
+ __set_errno(EINVAL);
return MAP_FAILED;
}
- return mmap (addr, len, prot, flags, fd, (off_t) offset);
+ return mmap(addr, len, prot, flags, fd, (off_t) offset);
}
-#else
+# else
-#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);
+# 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);
-/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
-# ifndef MMAP2_PAGE_SHIFT
-# define MMAP2_PAGE_SHIFT 12
-# endif
+/* 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 mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
{
if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
- __set_errno (EINVAL);
+ __set_errno(EINVAL);
return MAP_FAILED;
}
- return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
+
+ return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT));
}
-#endif
+# endif
#endif /* __UCLIBC_HAS_LFS__ */
diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c
index 618681ad3..9ebb68b3c 100644
--- a/libc/sysdeps/linux/common/modify_ldt.c
+++ b/libc/sysdeps/linux/common/modify_ldt.c
@@ -2,14 +2,14 @@
/*
* modify_ldt() for uClibc
*
- * 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"
+int modify_ldt (int func, void *ptr, unsigned long bytecount);
#ifdef __NR_modify_ldt
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount);
-weak_alias(modify_ldt, __modify_ldt)
#endif
diff --git a/libc/sysdeps/linux/common/mount.c b/libc/sysdeps/linux/common/mount.c
index f62c62676..9cbefe4a8 100644
--- a/libc/sysdeps/linux/common/mount.c
+++ b/libc/sysdeps/linux/common/mount.c
@@ -2,9 +2,9 @@
/*
* mount() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/mprotect.c b/libc/sysdeps/linux/common/mprotect.c
index cb6beb489..7eab338d0 100644
--- a/libc/sysdeps/linux/common/mprotect.c
+++ b/libc/sysdeps/linux/common/mprotect.c
@@ -2,9 +2,9 @@
/*
* mprotect() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/mremap.c b/libc/sysdeps/linux/common/mremap.c
index f4a4670d2..080d2c1c2 100644
--- a/libc/sysdeps/linux/common/mremap.c
+++ b/libc/sysdeps/linux/common/mremap.c
@@ -2,15 +2,17 @@
/*
* mremap() for uClibc
*
- * 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 <unistd.h>
#include <sys/mman.h>
-#define __NR___mremap __NR_mremap
-attribute_hidden _syscall4(__ptr_t, __mremap, __ptr_t, old_address, size_t, old_size, size_t,
+
+libc_hidden_proto(mremap)
+
+_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t,
new_size, int, may_move);
-strong_alias(__mremap,mremap)
+libc_hidden_def(mremap)
diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c
index 8de9f346e..494d4afd3 100644
--- a/libc/sysdeps/linux/common/msync.c
+++ b/libc/sysdeps/linux/common/msync.c
@@ -2,15 +2,16 @@
/*
* msync() for uClibc
*
- * 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 <unistd.h>
#include <sys/mman.h>
+extern __typeof(msync) __libc_msync;
#define __NR___libc_msync __NR_msync
_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags);
-weak_alias(__libc_msync, msync)
+weak_alias(__libc_msync,msync)
diff --git a/libc/sysdeps/linux/common/munlock.c b/libc/sysdeps/linux/common/munlock.c
index 674ae41e0..1d6870ecc 100644
--- a/libc/sysdeps/linux/common/munlock.c
+++ b/libc/sysdeps/linux/common/munlock.c
@@ -2,13 +2,13 @@
/*
* munlock() for uClibc
*
- * 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/mman.h>
-#if defined __ARCH_HAS_MMU__ && defined __NR_munlock
+#if defined __ARCH_USE_MMU__ && defined __NR_munlock
_syscall2(int, munlock, const void *, addr, size_t, len);
#endif
diff --git a/libc/sysdeps/linux/common/munlockall.c b/libc/sysdeps/linux/common/munlockall.c
index c1087658f..4ee729292 100644
--- a/libc/sysdeps/linux/common/munlockall.c
+++ b/libc/sysdeps/linux/common/munlockall.c
@@ -2,13 +2,13 @@
/*
* munlockall() for uClibc
*
- * 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/mman.h>
-#if defined __ARCH_HAS_MMU__
+#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 be631060a..7a82df632 100644
--- a/libc/sysdeps/linux/common/munmap.c
+++ b/libc/sysdeps/linux/common/munmap.c
@@ -2,14 +2,16 @@
/*
* munmap() for uClibc
*
- * 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 <unistd.h>
#include <sys/mman.h>
-#define __NR___munmap __NR_munmap
-attribute_hidden _syscall2(int, __munmap, void *, start, size_t, length);
-strong_alias(__munmap,munmap)
+
+libc_hidden_proto(munmap)
+
+_syscall2(int, munmap, void *, start, size_t, length);
+libc_hidden_def(munmap)
diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c
index 3f5ffbaa3..76cab97f2 100644
--- a/libc/sysdeps/linux/common/nanosleep.c
+++ b/libc/sysdeps/linux/common/nanosleep.c
@@ -2,16 +2,18 @@
/*
* nanosleep() for uClibc
*
- * 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 <time.h>
+extern __typeof(nanosleep) __libc_nanosleep;
#define __NR___libc_nanosleep __NR_nanosleep
_syscall2(int, __libc_nanosleep, const struct timespec *, req,
struct timespec *, rem);
-hidden_weak_alias(__libc_nanosleep,__nanosleep)
+libc_hidden_proto(nanosleep)
weak_alias(__libc_nanosleep,nanosleep)
+libc_hidden_weak(nanosleep)
diff --git a/libc/sysdeps/linux/common/nice.c b/libc/sysdeps/linux/common/nice.c
index 20f7996a7..e6e80e7be 100644
--- a/libc/sysdeps/linux/common/nice.c
+++ b/libc/sysdeps/linux/common/nice.c
@@ -2,27 +2,28 @@
/*
* nice() for uClibc
*
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 2005 by Manuel Novoa III <mjn3@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.
*/
-#define getpriority __getpriority
-#define setpriority __setpriority
-
#include "syscalls.h"
#include <unistd.h>
#include <sys/resource.h>
+libc_hidden_proto(getpriority)
+
#ifdef __NR_nice
-#define __NR___syscall_nice __NR_nice
+# define __NR___syscall_nice __NR_nice
static inline _syscall1(int, __syscall_nice, int, incr);
#else
-#include <limits.h>
+# include <limits.h>
+
+libc_hidden_proto(setpriority)
static inline int int_add_no_wrap(int a, int b)
{
@@ -40,10 +41,10 @@ static inline int int_add_no_wrap(int a, int b)
static inline int __syscall_nice(int incr)
{
int old_priority;
-#if 1
+# if 1
/* This should never fail. */
old_priority = getpriority(PRIO_PROCESS, 0);
-#else
+# else
/* But if you want to be paranoid... */
int old_errno;
@@ -54,7 +55,7 @@ static inline int __syscall_nice(int incr)
return -1;
}
__set_errno(old_errno);
-#endif
+# endif
if (setpriority(PRIO_PROCESS, 0, int_add_no_wrap(old_priority, incr))) {
__set_errno(EPERM); /* SUSv3 mandates EPERM for nice failure. */
diff --git a/libc/sysdeps/linux/common/noophooks.c b/libc/sysdeps/linux/common/noophooks.c
index b8c33eeac..a6c9d7673 100644
--- a/libc/sysdeps/linux/common/noophooks.c
+++ b/libc/sysdeps/linux/common/noophooks.c
@@ -21,6 +21,8 @@
#include <libc-internal.h>
void
+__cyg_profile_func_enter (attribute_unused void *this_fn, attribute_unused void *call_site);
+void
__cyg_profile_func_enter (attribute_unused void *this_fn, attribute_unused void *call_site)
{
}
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 648f7d053..822ac4f63 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -2,9 +2,9 @@
/*
* open() for uClibc
*
- * 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"
@@ -14,13 +14,14 @@
#include <string.h>
#include <sys/param.h>
-#undef __open
-#undef open
+extern __typeof(open) __libc_open;
+libc_hidden_proto(__libc_open)
+
#define __NR___syscall_open __NR_open
static inline _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode);
-int attribute_hidden __open(const char *file, int flags, ...)
+int __libc_open(const char *file, int flags, ...)
{
/* gcc may warn about mode being uninitialized.
* Just ignore that, since gcc is wrong. */
@@ -35,10 +36,13 @@ int attribute_hidden __open(const char *file, int flags, ...)
}
return __syscall_open(file, flags, mode);
}
-strong_alias(__open,open)
-weak_alias(__open,__libc_open)
+libc_hidden_def(__libc_open)
+
+libc_hidden_proto(open)
+weak_alias(__libc_open,open)
+libc_hidden_weak(open)
int creat(const char *file, mode_t mode)
{
- return __open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
}
diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c
index a017ef611..751b6b6a9 100644
--- a/libc/sysdeps/linux/common/pause.c
+++ b/libc/sysdeps/linux/common/pause.c
@@ -2,25 +2,27 @@
/*
* pause() for uClibc
*
- * 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.
*/
-#define __sigpause __sigpause_internal
-#define sigblock __sigblock
-
+#define __UCLIBC_HIDE_DEPRECATED__
#include "syscalls.h"
#include <unistd.h>
+extern __typeof(pause) __libc_pause;
#ifdef __NR_pause
#define __NR___libc_pause __NR_pause
_syscall0(int, __libc_pause);
#else
#include <signal.h>
+libc_hidden_proto(__sigpause)
+libc_hidden_proto(sigblock)
+
int __libc_pause(void)
{
return (__sigpause(sigblock(0), 0));
}
#endif
-weak_alias(__libc_pause, pause)
+weak_alias(__libc_pause,pause)
diff --git a/libc/sysdeps/linux/common/personality.c b/libc/sysdeps/linux/common/personality.c
index 138909fcc..39b15007f 100644
--- a/libc/sysdeps/linux/common/personality.c
+++ b/libc/sysdeps/linux/common/personality.c
@@ -2,9 +2,9 @@
/*
* personality() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/pipe.c b/libc/sysdeps/linux/common/pipe.c
index 2045b8d64..02a6975e9 100644
--- a/libc/sysdeps/linux/common/pipe.c
+++ b/libc/sysdeps/linux/common/pipe.c
@@ -2,13 +2,15 @@
/*
* pipe() for uClibc
*
- * 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 <unistd.h>
-#define __NR___pipe __NR_pipe
-attribute_hidden _syscall1(int, __pipe, int *, filedes);
-strong_alias(__pipe,pipe)
+
+libc_hidden_proto(pipe)
+
+_syscall1(int, pipe, int *, filedes);
+libc_hidden_def(pipe)
diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c
index c424afd13..f5d1f1d7f 100644
--- a/libc/sysdeps/linux/common/pivot_root.c
+++ b/libc/sysdeps/linux/common/pivot_root.c
@@ -2,13 +2,14 @@
/*
* pivot_root() for uClibc
*
- * Copyright (C) 2000-2005 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"
+int pivot_root(const char *new_root, const char *put_old);
#ifdef __NR_pivot_root
_syscall2(int, pivot_root, const char *, new_root, const char *, put_old);
#else
diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index 5662a440c..5fba19ffc 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -3,16 +3,18 @@
* posix_fadvise() for uClibc
* http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
*
- * Copyright (C) 2000-2005 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.
*/
-/* need to hide the posix_fadvise64 prototype or the weak_alias()
+/* need to hide the 64bit prototype or the strong_alias()
* will fail when __NR_fadvise64_64 doesnt exist */
-#define posix_fadvise64 __hide_posix_fadvise64
+#define posix_fadvise64 __hideposix_fadvise64
+
#include "syscalls.h"
#include <fcntl.h>
+
#undef posix_fadvise64
#ifdef __NR_fadvise64
@@ -21,7 +23,8 @@ _syscall4(int, posix_fadvise, int, fd, off_t, offset,
off_t, len, int, advice);
#if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || !defined _syscall6)
-weak_alias(posix_fadvise, posix_fadvise64)
+extern __typeof(posix_fadvise) posix_fadvise64;
+strong_alias(posix_fadvise,posix_fadvise64)
#endif
#else
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index 5c5cf9906..d931aff60 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -3,9 +3,9 @@
* posix_fadvise64() for uClibc
* http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
*
- * Copyright (C) 2000-2005 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 <features.h>
@@ -52,7 +52,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
#endif
#elif !defined __NR_fadvise64
-/* This is declared as a weak alias in posix_fadvise.c if __NR_fadvise64
+/* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64
* is defined.
*/
int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice)
diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c
index 7183ac9a7..2509b7ab6 100644
--- a/libc/sysdeps/linux/common/pread_write.c
+++ b/libc/sysdeps/linux/common/pread_write.c
@@ -1,48 +1,32 @@
-/* vi: set sw=4 ts=4:
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org>
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+/*
* Based in part on the files
* ./sysdeps/unix/sysv/linux/pwrite.c,
* ./sysdeps/unix/sysv/linux/pread.c,
* sysdeps/posix/pread.c
* sysdeps/posix/pwrite.c
* from GNU libc 2.2.5, but reworked considerably...
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
+#include "syscalls.h"
#include <unistd.h>
#include <stdint.h>
+extern __typeof(pread) __libc_pread;
+extern __typeof(pwrite) __libc_pwrite;
+#ifdef __UCLIBC_HAS_LFS__
+extern __typeof(pread64) __libc_pread64;
+extern __typeof(pwrite64) __libc_pwrite64;
+#endif
+
#ifdef __NR_pread
-#define __NR___syscall_pread __NR_pread
+# 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);
@@ -50,24 +34,23 @@ 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)));
}
-weak_alias (__libc_pread, pread)
+weak_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
uint32_t high = offset >> 32;
return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
-weak_alias (__libc_pread64, pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+weak_alias(__libc_pread64,pread64)
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pread */
-
#ifdef __NR_pwrite
-#define __NR___syscall_pwrite __NR_pwrite
+# define __NR___syscall_pwrite __NR_pwrite
static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf,
size_t, count, off_t, offset_hi, off_t, offset_lo);
@@ -75,22 +58,24 @@ 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)));
}
-weak_alias (__libc_pwrite, pwrite)
+weak_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
uint32_t low = offset & 0xffffffff;
uint32_t high = offset >> 32;
return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low)));
}
-weak_alias (__libc_pwrite64, pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+weak_alias(__libc_pwrite64,pwrite64)
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* __NR_pwrite */
-
-
#if ! defined __NR_pread || ! defined __NR_pwrite
+libc_hidden_proto(read)
+libc_hidden_proto(write)
+libc_hidden_proto(lseek)
+
static ssize_t __fake_pread_write(int fd, void *buf,
size_t count, off_t offset, int do_pwrite)
{
@@ -100,25 +85,25 @@ static ssize_t __fake_pread_write(int fd, void *buf,
/* 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)
+ 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) {
/* Write the data. */
- result = __write(fd, buf, count);
+ result = write(fd, buf, count);
} else {
/* Read the data. */
- result = __read(fd, buf, count);
+ result = read(fd, buf, count);
}
/* 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)
+ if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
{
if (result == -1)
__set_errno(save_errno);
@@ -128,7 +113,9 @@ static ssize_t __fake_pread_write(int fd, void *buf,
return(result);
}
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
+libc_hidden_proto(lseek64)
+
static ssize_t __fake_pread_write64(int fd, void *buf,
size_t count, off64_t offset, int do_pwrite)
{
@@ -138,24 +125,24 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
/* 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)
+ 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)
+ if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
return -1;
if (do_pwrite==1) {
/* Write the data. */
- result = __write(fd, buf, count);
+ result = write(fd, buf, count);
} else {
/* Read the data. */
- result = __read(fd, buf, count);
+ result = read(fd, buf, count);
}
/* 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;
@@ -163,7 +150,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf,
__set_errno (save_errno);
return result;
}
-#endif /* __UCLIBC_HAS_LFS__ */
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! defined __NR_pread || ! defined __NR_pwrite */
#ifndef __NR_pread
@@ -171,18 +158,17 @@ ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
{
return(__fake_pread_write(fd, buf, count, offset, 0));
}
-weak_alias (__libc_pread, pread)
+weak_alias(__libc_pread,pread)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, buf, count, offset, 0));
}
-weak_alias (__libc_pread64, pread64)
-#endif /* __UCLIBC_HAS_LFS__ */
+weak_alias(__libc_pread64,pread64)
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pread */
-
#ifndef __NR_pwrite
ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
{
@@ -190,14 +176,13 @@ ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset)
*just cast it to get rid of warnings */
return(__fake_pread_write(fd, (void*)buf, count, offset, 1));
}
-weak_alias (__libc_pwrite, pwrite)
+weak_alias(__libc_pwrite,pwrite)
-#if defined __UCLIBC_HAS_LFS__
+# ifdef __UCLIBC_HAS_LFS__
ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{
return(__fake_pread_write64(fd, (void*)buf, count, offset, 1));
}
-weak_alias (__libc_pwrite64, pwrite64)
-#endif /* __UCLIBC_HAS_LFS__ */
+weak_alias(__libc_pwrite64,pwrite64)
+# endif /* __UCLIBC_HAS_LFS__ */
#endif /* ! __NR_pwrite */
-
diff --git a/libc/sysdeps/linux/common/ptrace.c b/libc/sysdeps/linux/common/ptrace.c
index 1f2b35b33..fda2e9d84 100644
--- a/libc/sysdeps/linux/common/ptrace.c
+++ b/libc/sysdeps/linux/common/ptrace.c
@@ -1,20 +1,8 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- 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. */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <errno.h>
#include <sys/types.h>
@@ -22,10 +10,9 @@
#include <sys/syscall.h>
#include <stdarg.h>
-
#define __NR___syscall_ptrace __NR_ptrace
-static _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
diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c
index 853b9ed94..ac77f7e18 100644
--- a/libc/sysdeps/linux/common/query_module.c
+++ b/libc/sysdeps/linux/common/query_module.c
@@ -2,12 +2,14 @@
/*
* query_module() for uClibc
*
- * 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"
+int query_module(const char *name attribute_unused, int which attribute_unused,
+ void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused);
#ifdef __NR_query_module
_syscall5(int, query_module, const char *, name, int, which,
void *, buf, size_t, bufsize, size_t *, ret);
diff --git a/libc/sysdeps/linux/common/quotactl.c b/libc/sysdeps/linux/common/quotactl.c
index 3ac367748..2982f4956 100644
--- a/libc/sysdeps/linux/common/quotactl.c
+++ b/libc/sysdeps/linux/common/quotactl.c
@@ -2,9 +2,9 @@
/*
* quotactl() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c
index 6490bccbc..236029ac6 100644
--- a/libc/sysdeps/linux/common/read.c
+++ b/libc/sysdeps/linux/common/read.c
@@ -2,15 +2,17 @@
/*
* read() for uClibc
*
- * 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 <unistd.h>
-#define __NR___read __NR_read
-attribute_hidden _syscall3(ssize_t, __read, int, fd, __ptr_t, buf, size_t, count);
-strong_alias(__read,read)
-weak_alias(__read,__libc_read)
+extern __typeof(read) __libc_read;
+#define __NR___libc_read __NR_read
+_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count);
+libc_hidden_proto(read)
+weak_alias(__libc_read,read)
+libc_hidden_weak(read)
diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c
index 45db1a64f..73d5441c0 100644
--- a/libc/sysdeps/linux/common/readlink.c
+++ b/libc/sysdeps/linux/common/readlink.c
@@ -2,13 +2,15 @@
/*
* readlink() for uClibc
*
- * 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 <unistd.h>
-#define __NR___readlink __NR_readlink
-attribute_hidden _syscall3(int, __readlink, const char *, path, char *, buf, size_t, bufsiz);
-strong_alias(__readlink,readlink)
+
+libc_hidden_proto(readlink)
+
+_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz);
+libc_hidden_def(readlink)
diff --git a/libc/sysdeps/linux/common/reboot.c b/libc/sysdeps/linux/common/reboot.c
index 57ac2398b..a015d40ad 100644
--- a/libc/sysdeps/linux/common/reboot.c
+++ b/libc/sysdeps/linux/common/reboot.c
@@ -2,12 +2,13 @@
/*
* _reboot() for uClibc
*
- * 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/reboot.h>
#define __NR__reboot __NR_reboot
static inline _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
int reboot(int flag)
diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c
index 7906cc939..55de6b1d0 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -2,9 +2,9 @@
/*
* rename() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c
index 2f2c8a335..0aadd73f2 100644
--- a/libc/sysdeps/linux/common/rmdir.c
+++ b/libc/sysdeps/linux/common/rmdir.c
@@ -2,13 +2,15 @@
/*
* rmdir() for uClibc
*
- * 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 <unistd.h>
-#define __NR___rmdir __NR_rmdir
-attribute_hidden _syscall1(int, __rmdir, const char *, pathname);
-strong_alias(__rmdir,rmdir)
+
+libc_hidden_proto(rmdir)
+
+_syscall1(int, rmdir, const char *, pathname);
+libc_hidden_def(rmdir)
diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c
index d8507335b..d9a4d6899 100644
--- a/libc/sysdeps/linux/common/sbrk.c
+++ b/libc/sysdeps/linux/common/sbrk.c
@@ -1,47 +1,38 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <unistd.h>
#include <errno.h>
+libc_hidden_proto(sbrk)
+
+libc_hidden_proto(brk)
+
/* Defined in brk.c. */
extern void *__curbrk;
-extern int __brk (void *addr) attribute_hidden;
-
+libc_hidden_proto(__curbrk)
/* 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. */
-void attribute_hidden * __sbrk (intptr_t increment)
+void * sbrk (intptr_t increment)
{
void *oldbrk;
if (__curbrk == NULL)
- if (__brk (0) < 0) /* Initialize the break. */
+ if (brk (0) < 0) /* Initialize the break. */
return (void *) -1;
if (increment == 0)
return __curbrk;
oldbrk = __curbrk;
- if (__brk (oldbrk + increment) < 0)
+ if (brk (oldbrk + increment) < 0)
return (void *) -1;
return oldbrk;
}
-strong_alias(__sbrk,sbrk)
+libc_hidden_def(sbrk)
diff --git a/libc/sysdeps/linux/common/sched_get_priority_max.c b/libc/sysdeps/linux/common/sched_get_priority_max.c
index 77da3573e..c9292ffbd 100644
--- a/libc/sysdeps/linux/common/sched_get_priority_max.c
+++ b/libc/sysdeps/linux/common/sched_get_priority_max.c
@@ -2,9 +2,9 @@
/*
* sched_get_priority_max() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_get_priority_min.c b/libc/sysdeps/linux/common/sched_get_priority_min.c
index adcb6d622..317911fc1 100644
--- a/libc/sysdeps/linux/common/sched_get_priority_min.c
+++ b/libc/sysdeps/linux/common/sched_get_priority_min.c
@@ -2,9 +2,9 @@
/*
* sched_get_priority_min() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_getparam.c b/libc/sysdeps/linux/common/sched_getparam.c
index 992010ddb..d9b3dcde5 100644
--- a/libc/sysdeps/linux/common/sched_getparam.c
+++ b/libc/sysdeps/linux/common/sched_getparam.c
@@ -2,9 +2,9 @@
/*
* sched_getparam() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_getscheduler.c b/libc/sysdeps/linux/common/sched_getscheduler.c
index dedd5e17f..13df2aefd 100644
--- a/libc/sysdeps/linux/common/sched_getscheduler.c
+++ b/libc/sysdeps/linux/common/sched_getscheduler.c
@@ -2,9 +2,9 @@
/*
* sched_getscheduler() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_rr_get_interval.c b/libc/sysdeps/linux/common/sched_rr_get_interval.c
index 8bf31dcbf..0eb25016e 100644
--- a/libc/sysdeps/linux/common/sched_rr_get_interval.c
+++ b/libc/sysdeps/linux/common/sched_rr_get_interval.c
@@ -2,9 +2,9 @@
/*
* sched_rr_get_interval() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_setparam.c b/libc/sysdeps/linux/common/sched_setparam.c
index f10b5269d..a0ff56840 100644
--- a/libc/sysdeps/linux/common/sched_setparam.c
+++ b/libc/sysdeps/linux/common/sched_setparam.c
@@ -2,9 +2,9 @@
/*
* sched_setparam() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_setscheduler.c b/libc/sysdeps/linux/common/sched_setscheduler.c
index ebf4b777a..14236e927 100644
--- a/libc/sysdeps/linux/common/sched_setscheduler.c
+++ b/libc/sysdeps/linux/common/sched_setscheduler.c
@@ -2,9 +2,9 @@
/*
* sched_setscheduler() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sched_yield.c b/libc/sysdeps/linux/common/sched_yield.c
index 77674143a..3953d8d16 100644
--- a/libc/sysdeps/linux/common/sched_yield.c
+++ b/libc/sysdeps/linux/common/sched_yield.c
@@ -2,9 +2,9 @@
/*
* sched_yield() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c
index 36f88229a..d5a0663fa 100644
--- a/libc/sysdeps/linux/common/select.c
+++ b/libc/sysdeps/linux/common/select.c
@@ -2,19 +2,20 @@
/*
* select() for uClibc
*
- * 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 <unistd.h>
+libc_hidden_proto(select)
+
#ifdef __NR__newselect
-#define __NR___select __NR__newselect
-#else
-#define __NR___select __NR_select
+# undef __NR_select
+# define __NR_select __NR__newselect
#endif
-attribute_hidden _syscall5(int, __select, int, n, fd_set *, readfds, fd_set *, writefds,
+_syscall5(int, select, int, n, fd_set *, readfds, fd_set *, writefds,
fd_set *, exceptfds, struct timeval *, timeout);
-strong_alias(__select,select)
+libc_hidden_def(select)
diff --git a/libc/sysdeps/linux/common/sendfile.c b/libc/sysdeps/linux/common/sendfile.c
index cff95f579..af19617bb 100644
--- a/libc/sysdeps/linux/common/sendfile.c
+++ b/libc/sysdeps/linux/common/sendfile.c
@@ -2,13 +2,24 @@
/*
* sendfile() for uClibc
*
- * 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.
*/
+/* need to hide the 64bit prototype or the strong_alias()
+ * will fail when __NR_sendfile64 doesnt exist */
+#define sendfile64 __hidesendfile64
+
#include "syscalls.h"
#include <unistd.h>
#include <sys/sendfile.h>
+
+#undef sendfile64
+
_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
diff --git a/libc/sysdeps/linux/common/sendfile64.c b/libc/sysdeps/linux/common/sendfile64.c
index 9c7c0ad3c..ccaa8d202 100644
--- a/libc/sysdeps/linux/common/sendfile64.c
+++ b/libc/sysdeps/linux/common/sendfile64.c
@@ -1,15 +1,13 @@
/*
- * sendfile64 syscall. Copes with 64 bit and 32 bit machines
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+/* sendfile64 syscall. Copes with 64 bit and 32 bit machines
* and on 32 bit machines this sends things into the kernel as
* two 32-bit arguments (high and low 32 bits of length) that
* are ordered based on endianess. It turns out endian.h has
* just the macro we need to order things, __LONG_LONG_PAIR.
- *
- * Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
- *
- * This file is subject to the terms and conditions of the GNU
- * Lesser General Public License. See the file COPYING.LIB in
- * the main directory of this archive for more details.
*/
#include <features.h>
@@ -19,30 +17,8 @@
#include <stdint.h>
#include <sys/sendfile.h>
#include <sys/syscall.h>
+#include <bits/wordsize.h>
-#if defined __NR_sendfile64
-
-#if __WORDSIZE == 64 || (defined(__powerpc__) && defined (__UCLIBC_HAS_LFS__))
-/* For a 64 bit machine, life is simple... */
+#if defined __UCLIBC_HAS_LFS__ && defined __NR_sendfile64
_syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count);
-
-#elif __WORDSIZE == 32
-
-#if defined __UCLIBC_HAS_LFS__
-_syscall4(ssize_t,sendfile64, int, out_fd, int, in_fd, __off64_t *, offset, size_t, count);
-#endif /* __UCLIBC_HAS_LFS__ */
-
-#else /* __WORDSIZE */
-#error Your machine is not 64 bit or 32 bit, I am dazed and confused.
-#endif /* __WORDSIZE */
-
-
-#else /* ! defined __NR_sendfile64 */
-
-ssize_t sendfile64 (int out_fd, int in_fd, __off64_t *offset, size_t count)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-
#endif
diff --git a/libc/sysdeps/linux/common/setdomainname.c b/libc/sysdeps/linux/common/setdomainname.c
index a88e5a47d..138250d09 100644
--- a/libc/sysdeps/linux/common/setdomainname.c
+++ b/libc/sysdeps/linux/common/setdomainname.c
@@ -2,9 +2,9 @@
/*
* setdomainname() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c
index d3175dad5..e0bbfd4bc 100644
--- a/libc/sysdeps/linux/common/setegid.c
+++ b/libc/sysdeps/linux/common/setegid.c
@@ -1,7 +1,9 @@
-#define setresgid __setresgid
-#define setregid __setregid
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
-#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -9,6 +11,11 @@
#include <sys/types.h>
#include <sys/syscall.h>
+#if defined __NR_setresgid || defined __NR_setresgid32
+libc_hidden_proto(setresgid)
+#endif
+libc_hidden_proto(setregid)
+
int setegid(gid_t gid)
{
int result;
@@ -19,7 +26,7 @@ int setegid(gid_t gid)
return -1;
}
-#ifdef __NR_setresgid
+#if defined __NR_setresgid || defined __NR_setresgid32
result = setresgid(-1, gid, -1);
if (result == -1 && errno == ENOSYS)
/* Will also set the saved group ID if egid != gid,
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
index f5ed35743..e5ed576ff 100644
--- a/libc/sysdeps/linux/common/seteuid.c
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -1,7 +1,9 @@
-#define setresuid __setresuid
-#define setreuid __setreuid
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
-#define _GNU_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -9,7 +11,14 @@
#include <sys/types.h>
#include <sys/syscall.h>
-int attribute_hidden __seteuid(uid_t uid)
+libc_hidden_proto(seteuid)
+
+#if defined __NR_setresuid || defined __NR_setresuid32
+libc_hidden_proto(setresuid)
+#endif
+libc_hidden_proto(setreuid)
+
+int seteuid(uid_t uid)
{
int result;
@@ -19,7 +28,7 @@ int attribute_hidden __seteuid(uid_t uid)
return -1;
}
-#ifdef __NR_setresuid
+#if defined __NR_setresuid || defined __NR_setresuid32
result = setresuid(-1, uid, -1);
if (result == -1 && errno == ENOSYS)
/* Will also set the saved user ID if euid != uid,
@@ -29,4 +38,4 @@ int attribute_hidden __seteuid(uid_t uid)
return result;
}
-strong_alias(__seteuid,seteuid)
+libc_hidden_def(seteuid)
diff --git a/libc/sysdeps/linux/common/setfsgid.c b/libc/sysdeps/linux/common/setfsgid.c
index 87e72683e..027dd11f6 100644
--- a/libc/sysdeps/linux/common/setfsgid.c
+++ b/libc/sysdeps/linux/common/setfsgid.c
@@ -2,9 +2,9 @@
/*
* setfsgid() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/setfsuid.c b/libc/sysdeps/linux/common/setfsuid.c
index a515652fe..4bbc931cf 100644
--- a/libc/sysdeps/linux/common/setfsuid.c
+++ b/libc/sysdeps/linux/common/setfsuid.c
@@ -2,9 +2,9 @@
/*
* setfsuid() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/setgid.c b/libc/sysdeps/linux/common/setgid.c
index b055b9333..d0698f517 100644
--- a/libc/sysdeps/linux/common/setgid.c
+++ b/libc/sysdeps/linux/common/setgid.c
@@ -2,9 +2,9 @@
/*
* setgid() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c
index 49d85156f..dd1a03f38 100644
--- a/libc/sysdeps/linux/common/setgroups.c
+++ b/libc/sysdeps/linux/common/setgroups.c
@@ -2,23 +2,35 @@
/*
* setgroups() for uClibc
*
- * 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.
*/
-#define sysconf __sysconf
-
#include "syscalls.h"
#include <stdlib.h>
#include <unistd.h>
#include <grp.h>
+libc_hidden_proto(setgroups)
+
+#if defined(__NR_setgroups32)
+# undef __NR_setgroups
+# define __NR_setgroups __NR_setgroups32
+_syscall2(int, setgroups, size_t, size, const gid_t *, list);
+
+#elif __WORDSIZE == 64
+_syscall2(int, setgroups, size_t, size, const gid_t *, list);
+
+#else
+
+libc_hidden_proto(sysconf)
+
#define __NR___syscall_setgroups __NR_setgroups
static inline _syscall2(int, __syscall_setgroups,
size_t, size, const __kernel_gid_t *, list);
-int attribute_hidden __setgroups(size_t size, const gid_t *groups)
+int setgroups(size_t size, const gid_t *groups)
{
if (size > (size_t) sysconf(_SC_NGROUPS_MAX)) {
ret_error:
@@ -47,4 +59,6 @@ ret_error:
return i;
}
}
-strong_alias(__setgroups,setgroups)
+#endif
+
+libc_hidden_def(setgroups)
diff --git a/libc/sysdeps/linux/common/sethostname.c b/libc/sysdeps/linux/common/sethostname.c
index 16d636b6f..d8e0789bb 100644
--- a/libc/sysdeps/linux/common/sethostname.c
+++ b/libc/sysdeps/linux/common/sethostname.c
@@ -2,9 +2,9 @@
/*
* sethostname() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c
index be51cb5c5..fb6c6b1e6 100644
--- a/libc/sysdeps/linux/common/setitimer.c
+++ b/libc/sysdeps/linux/common/setitimer.c
@@ -2,14 +2,16 @@
/*
* setitimer() for uClibc
*
- * 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/time.h>
-#define __NR___setitimer __NR_setitimer
-attribute_hidden _syscall3(int, __setitimer, __itimer_which_t, which,
+
+libc_hidden_proto(setitimer)
+
+_syscall3(int, setitimer, __itimer_which_t, which,
const struct itimerval *, new, struct itimerval *, old);
-strong_alias(__setitimer,setitimer)
+libc_hidden_def(setitimer)
diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c
index 6d73f08ec..98289ff72 100644
--- a/libc/sysdeps/linux/common/setpgid.c
+++ b/libc/sysdeps/linux/common/setpgid.c
@@ -2,20 +2,22 @@
/*
* setpgid() for uClibc
*
- * 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 <unistd.h>
+libc_hidden_proto(setpgid)
+
#define __NR___syscall_setpgid __NR_setpgid
static inline _syscall2(int, __syscall_setpgid,
__kernel_pid_t, pid, __kernel_pid_t, pgid);
-int attribute_hidden __setpgid(pid_t pid, pid_t pgid)
+int setpgid(pid_t pid, pid_t pgid)
{
return (__syscall_setpgid(pid, pgid));
}
-strong_alias(__setpgid,setpgid)
+libc_hidden_def(setpgid)
diff --git a/libc/sysdeps/linux/common/setpgrp.c b/libc/sysdeps/linux/common/setpgrp.c
index 966bb4da6..38300dc2e 100644
--- a/libc/sysdeps/linux/common/setpgrp.c
+++ b/libc/sysdeps/linux/common/setpgrp.c
@@ -1,8 +1,14 @@
-#define setpgid __setpgid
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <syscall.h>
#include <unistd.h>
+libc_hidden_proto(setpgid)
+
int setpgrp(void)
{
return setpgid(0,0);
diff --git a/libc/sysdeps/linux/common/setpriority.c b/libc/sysdeps/linux/common/setpriority.c
index 06476d88f..d836153d5 100644
--- a/libc/sysdeps/linux/common/setpriority.c
+++ b/libc/sysdeps/linux/common/setpriority.c
@@ -2,13 +2,15 @@
/*
* setpriority() for uClibc
*
- * 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/resource.h>
-#define __NR___setpriority __NR_setpriority
-attribute_hidden _syscall3(int, __setpriority, __priority_which_t, which, id_t, who, int, prio);
-strong_alias(__setpriority,setpriority)
+
+libc_hidden_proto(setpriority)
+
+_syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio);
+libc_hidden_def(setpriority)
diff --git a/libc/sysdeps/linux/common/setregid.c b/libc/sysdeps/linux/common/setregid.c
index cfd375744..a085ed2ab 100644
--- a/libc/sysdeps/linux/common/setregid.c
+++ b/libc/sysdeps/linux/common/setregid.c
@@ -2,19 +2,21 @@
/*
* setregid() for uClibc
*
- * 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 <unistd.h>
+libc_hidden_proto(setregid)
+
#define __NR___syscall_setregid __NR_setregid
static inline _syscall2(int, __syscall_setregid,
__kernel_gid_t, rgid, __kernel_gid_t, egid);
-int attribute_hidden __setregid(gid_t rgid, gid_t egid)
+int setregid(gid_t rgid, gid_t egid)
{
if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
@@ -23,4 +25,4 @@ int attribute_hidden __setregid(gid_t rgid, gid_t egid)
}
return (__syscall_setregid(rgid, egid));
}
-strong_alias(__setregid,setregid)
+libc_hidden_def(setregid)
diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c
index fbfa98be3..07959e4af 100644
--- a/libc/sysdeps/linux/common/setresgid.c
+++ b/libc/sysdeps/linux/common/setresgid.c
@@ -2,19 +2,28 @@
/*
* setresgid() for uClibc
*
- * 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"
+#ifdef __USE_GNU
+#include <unistd.h>
-#ifdef __NR_setresgid
-#define __NR___syscall_setresgid __NR_setresgid
+libc_hidden_proto(setresgid)
+
+#if defined(__NR_setresgid32)
+# undef __NR_setresgid
+# define __NR_setresgid __NR_setresgid32
+_syscall3(int, setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid)
+
+#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);
-int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid)
+int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
{
if (((rgid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
|| ((egid + 1) > (gid_t) ((__kernel_gid_t) - 1U))
@@ -24,5 +33,7 @@ int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid)
}
return (__syscall_setresgid(rgid, egid, sgid));
}
-strong_alias(__setresgid,setresgid)
+#endif
+
+libc_hidden_def(setresgid)
#endif
diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c
index 6ed1423f5..1249611a9 100644
--- a/libc/sysdeps/linux/common/setresuid.c
+++ b/libc/sysdeps/linux/common/setresuid.c
@@ -2,19 +2,28 @@
/*
* setresuid() for uClibc
*
- * 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"
+#ifdef __USE_GNU
+#include <unistd.h>
-#ifdef __NR_setresuid
-#define __NR___syscall_setresuid __NR_setresuid
+libc_hidden_proto(setresuid)
+
+#if defined(__NR_setresuid32)
+# undef __NR_setresuid
+# define __NR_setresuid __NR_setresuid32
+_syscall3(int, setresuid, uid_t, ruid, uid_t, euid, uid_t, suid)
+
+#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);
-int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid)
+int setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
@@ -24,5 +33,7 @@ int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid)
}
return (__syscall_setresuid(ruid, euid, suid));
}
-strong_alias(__setresuid,setresuid)
+#endif
+
+libc_hidden_def(setresuid)
#endif
diff --git a/libc/sysdeps/linux/common/setreuid.c b/libc/sysdeps/linux/common/setreuid.c
index 15ab5c01a..dcbe4adfe 100644
--- a/libc/sysdeps/linux/common/setreuid.c
+++ b/libc/sysdeps/linux/common/setreuid.c
@@ -2,19 +2,21 @@
/*
* setreuid() for uClibc
*
- * 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 <unistd.h>
+libc_hidden_proto(setreuid)
+
#define __NR___syscall_setreuid __NR_setreuid
static inline _syscall2(int, __syscall_setreuid,
__kernel_uid_t, ruid, __kernel_uid_t, euid);
-int attribute_hidden __setreuid(uid_t ruid, uid_t euid)
+int setreuid(uid_t ruid, uid_t euid)
{
if (((ruid + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((euid + 1) > (uid_t) ((__kernel_uid_t) - 1U))) {
@@ -23,4 +25,4 @@ int attribute_hidden __setreuid(uid_t ruid, uid_t euid)
}
return (__syscall_setreuid(ruid, euid));
}
-strong_alias(__setreuid,setreuid)
+libc_hidden_def(setreuid)
diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c
index 9c5466a09..ba2ea0728 100644
--- a/libc/sysdeps/linux/common/setrlimit.c
+++ b/libc/sysdeps/linux/common/setrlimit.c
@@ -2,44 +2,69 @@
/*
* setrlimit() for uClibc
*
- * 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.
*/
+#define setrlimit64 __hide_setrlimit64
#include "syscalls.h"
-
-#ifndef __NR_ugetrlimit
-/* Only wrap setrlimit if the new ugetrlimit is not present */
-
-#define __NR___syscall_setrlimit __NR_setrlimit
#include <unistd.h>
#include <sys/resource.h>
-#define RMIN(x, y) ((x) < (y) ? (x) : (y))
+#undef setrlimit64
+
+libc_hidden_proto(setrlimit)
+
+/* Only wrap setrlimit if the new usetrlimit is not present and setrlimit sucks */
+
+#if defined(__NR_usetrlimit)
+
+/* just call usetrlimit() */
+# define __NR___syscall_usetrlimit __NR_usetrlimit
+static inline
+_syscall2(int, __syscall_usetrlimit, enum __rlimit_resource, resource,
+ const struct rlimit *, rlim);
+int setrlimit(__rlimit_resource_t resource, struct rlimit *rlimits)
+{
+ return (__syscall_usetrlimit(resource, rlimits));
+}
+
+#elif !defined(__UCLIBC_HANDLE_OLDER_RLIMIT__)
+
+/* We don't need to wrap setrlimit() */
+_syscall2(int, setrlimit, __rlimit_resource_t, resource,
+ const struct rlimit *, rlim);
+
+#else
+
+/* we have to handle old style setrlimit() */
+# define __NR___syscall_setrlimit __NR_setrlimit
static inline
_syscall2(int, __syscall_setrlimit, int, resource, const struct rlimit *, rlim);
-int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
+
+int setrlimit(__rlimit_resource_t resource, const struct rlimit *rlimits)
{
struct rlimit rlimits_small;
+ if (rlimits == NULL) {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
/* We might have to correct the limits values. Since the old values
* were signed the new values might be too large. */
+# define RMIN(x, y) ((x) < (y) ? (x) : (y))
rlimits_small.rlim_cur = RMIN((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 1);
rlimits_small.rlim_max = RMIN((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 1);
+#undef RMIN
return (__syscall_setrlimit(resource, &rlimits_small));
}
+#endif
-#undef RMIN
-
-#else /* We don't need to wrap setrlimit */
+libc_hidden_def(setrlimit)
-#include <unistd.h>
-struct rlimit;
-#define __NR___setrlimit __NR_setrlimit
-attribute_hidden _syscall2(int, __setrlimit, unsigned int, resource,
- const struct rlimit *, rlim);
+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
+strong_alias(setrlimit, setrlimit64)
#endif
-
-strong_alias(__setrlimit,setrlimit)
diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c
index d59057c90..90b8eebd7 100644
--- a/libc/sysdeps/linux/common/setrlimit64.c
+++ b/libc/sysdeps/linux/common/setrlimit64.c
@@ -16,27 +16,17 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define setrlimit __setrlimit
-
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64 1
-#endif
-/* We absolutely do _NOT_ want interfaces silently
- * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include <_lfs_64.h>
#include <sys/types.h>
#include <sys/resource.h>
+#include <bits/wordsize.h>
+
+/* the regular setrlimit will work just fine for 64bit users */
+
+#if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
-#if defined __UCLIBC_HAS_LFS__
+libc_hidden_proto(setrlimit)
/* Set the soft and hard limits for RESOURCE to *RLIMITS.
Only the super-user can increase hard limits.
diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c
index b3e1e8706..042ee43a4 100644
--- a/libc/sysdeps/linux/common/setsid.c
+++ b/libc/sysdeps/linux/common/setsid.c
@@ -2,13 +2,15 @@
/*
* setsid() for uClibc
*
- * 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 <unistd.h>
-#define __NR___setsid __NR_setsid
-attribute_hidden _syscall0(pid_t, __setsid);
-strong_alias(__setsid,setsid)
+
+libc_hidden_proto(setsid)
+
+_syscall0(pid_t, setsid);
+libc_hidden_def(setsid)
diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c
index 4e88b3edb..2dc2a6a44 100644
--- a/libc/sysdeps/linux/common/settimeofday.c
+++ b/libc/sysdeps/linux/common/settimeofday.c
@@ -2,14 +2,16 @@
/*
* settimeofday() for uClibc
*
- * 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/time.h>
-#define __NR___settimeofday __NR_settimeofday
-attribute_hidden _syscall2(int, __settimeofday, const struct timeval *, tv,
+
+libc_hidden_proto(settimeofday)
+
+_syscall2(int, settimeofday, const struct timeval *, tv,
const struct timezone *, tz);
-strong_alias(__settimeofday,settimeofday)
+libc_hidden_def(settimeofday)
diff --git a/libc/sysdeps/linux/common/setuid.c b/libc/sysdeps/linux/common/setuid.c
index 237b986ce..b4b2e1bd1 100644
--- a/libc/sysdeps/linux/common/setuid.c
+++ b/libc/sysdeps/linux/common/setuid.c
@@ -2,9 +2,9 @@
/*
* setuid() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sigaltstack.c b/libc/sysdeps/linux/common/sigaltstack.c
index 23ad14689..af087ae57 100644
--- a/libc/sysdeps/linux/common/sigaltstack.c
+++ b/libc/sysdeps/linux/common/sigaltstack.c
@@ -2,9 +2,9 @@
/*
* sigaltstack() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sigpending.c b/libc/sysdeps/linux/common/sigpending.c
index 66513feb6..ea8fc40e6 100644
--- a/libc/sysdeps/linux/common/sigpending.c
+++ b/libc/sysdeps/linux/common/sigpending.c
@@ -2,9 +2,9 @@
/*
* sigpending() for uClibc
*
- * 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"
@@ -12,14 +12,13 @@
#undef sigpending
#ifdef __NR_rt_sigpending
-#define __NR___rt_sigpending __NR_rt_sigpending
+# define __NR___rt_sigpending __NR_rt_sigpending
static inline _syscall2(int, __rt_sigpending, sigset_t *, set, size_t, size);
int sigpending(sigset_t * set)
{
return __rt_sigpending(set, _NSIG / 8);
}
-
#else
_syscall1(int, sigpending, sigset_t *, set);
#endif
diff --git a/libc/sysdeps/linux/common/ssp-local.c b/libc/sysdeps/linux/common/ssp-local.c
index 11ae654c8..202d956a5 100644
--- a/libc/sysdeps/linux/common/ssp-local.c
+++ b/libc/sysdeps/linux/common/ssp-local.c
@@ -23,13 +23,13 @@
#include <features.h>
-extern void __stack_chk_fail_internal (void) attribute_noreturn;
+extern void __stack_chk_fail (void) attribute_noreturn;
/* On some architectures, this helps needless PIC pointer setup
that would be needed just for the __stack_chk_fail call. */
-void attribute_noreturn attribute_hidden
-__stack_chk_fail_local (void)
+void __stack_chk_fail_local (void) attribute_noreturn attribute_hidden;
+void __stack_chk_fail_local (void)
{
- __stack_chk_fail_internal ();
+ __stack_chk_fail ();
}
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 9efcd1a89..16b9f9c10 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -26,19 +26,25 @@
# define SSP_SIGTYPE SIGABRT
#endif
-#define openlog __openlog
-#define syslog __syslog
-#define closelog __closelog
-#define sigfillset __sigfillset_internal
-#define sigdelset __sigdelset_internal
-#define sigaction __sigaction
-#define kill __kill
-
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/syslog.h>
+libc_hidden_proto(memset)
+libc_hidden_proto(strlen)
+libc_hidden_proto(sigaction)
+libc_hidden_proto(sigfillset)
+libc_hidden_proto(sigdelset)
+libc_hidden_proto(sigprocmask)
+libc_hidden_proto(write)
+libc_hidden_proto(openlog)
+libc_hidden_proto(syslog)
+libc_hidden_proto(closelog)
+libc_hidden_proto(kill)
+libc_hidden_proto(getpid)
+libc_hidden_proto(_exit)
+
static void block_signals(void)
{
struct sigaction sa;
@@ -47,10 +53,10 @@ static void block_signals(void)
sigfillset(&mask);
sigdelset(&mask, SSP_SIGTYPE); /* Block all signal handlers */
- __sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SSP_SIGTYPE */
/* Make the default handler associated with the signal handler */
- __memset(&sa, 0, sizeof(struct sigaction));
+ memset(&sa, 0, sizeof(struct sigaction));
sigfillset(&sa.sa_mask); /* Block all signals */
sa.sa_flags = 0;
sa.sa_handler = SIG_DFL;
@@ -59,10 +65,10 @@ static void block_signals(void)
static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3)
{
- __write(fd, msg1, __strlen(msg1));
- __write(fd, msg2, __strlen(msg2));
- __write(fd, msg3, __strlen(msg3));
- __write(fd, "()\n", 3);
+ write(fd, msg1, strlen(msg1));
+ write(fd, msg2, strlen(msg2));
+ write(fd, msg3, strlen(msg3));
+ write(fd, "()\n", 3);
openlog("ssp", LOG_CONS | LOG_PID, LOG_USER);
syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3);
closelog();
@@ -70,12 +76,12 @@ static void ssp_write(int fd, const char *msg1, const char *msg2, const char *ms
static attribute_noreturn void terminate(void)
{
- (void) kill(__getpid(), SSP_SIGTYPE);
- _exit_internal(127);
+ (void) kill(getpid(), SSP_SIGTYPE);
+ _exit(127);
}
-void attribute_noreturn __stack_smash_handler(char func[], int damaged __attribute__ ((unused)));
-void attribute_noreturn __stack_smash_handler(char func[], int damaged)
+void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn;
+void __stack_smash_handler(char func[], int damaged)
{
static const char message[] = ": stack smashing attack in function ";
@@ -88,7 +94,8 @@ void attribute_noreturn __stack_smash_handler(char func[], int damaged)
terminate();
}
-void attribute_noreturn attribute_hidden __stack_chk_fail_internal(void)
+void __stack_chk_fail(void) attribute_noreturn;
+void __stack_chk_fail(void)
{
static const char msg1[] = "stack smashing detected: ";
static const char msg3[] = " terminated";
@@ -101,10 +108,10 @@ void attribute_noreturn attribute_hidden __stack_chk_fail_internal(void)
while(1)
terminate();
}
-strong_alias(__stack_chk_fail_internal,__stack_chk_fail)
#if 0
-void attribute_noreturn __chk_fail(void)
+void __chk_fail(void) attribute_noreturn;
+void __chk_fail(void)
{
static const char msg1[] = "buffer overflow detected: ";
static const char msg3[] = " terminated";
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c
index 7e7fe6bec..662ed665a 100644
--- a/libc/sysdeps/linux/common/stat.c
+++ b/libc/sysdeps/linux/common/stat.c
@@ -2,24 +2,30 @@
/*
* stat() for uClibc
*
- * 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.
*/
+/* need to hide the 64bit prototype or the strong_alias()
+ * will fail when __NR_stat64 doesnt exist */
+#define stat64 __hidestat64
+
#include "syscalls.h"
#include <unistd.h>
-#define _SYS_STAT_H
-#include <bits/stat.h>
+#include <sys/stat.h>
#include "xstatconv.h"
+#undef stat64
+
+libc_hidden_proto(stat)
+
#define __NR___syscall_stat __NR_stat
-#undef __stat
#undef stat
static inline _syscall2(int, __syscall_stat,
const char *, file_name, struct kernel_stat *, buf);
-int attribute_hidden __stat(const char *file_name, struct stat *buf)
+int stat(const char *file_name, struct stat *buf)
{
int result;
struct kernel_stat kbuf;
@@ -30,9 +36,11 @@ int attribute_hidden __stat(const char *file_name, struct stat *buf)
}
return result;
}
-strong_alias(__stat,stat)
+libc_hidden_def(stat)
#if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__
-hidden_strong_alias(__stat,__stat64)
-weak_alias(__stat,stat64)
+extern __typeof(stat) stat64;
+libc_hidden_proto(stat64)
+strong_alias(stat,stat64)
+libc_hidden_def(stat64)
#endif
diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c
index f46e52e98..54e2b436e 100644
--- a/libc/sysdeps/linux/common/stat64.c
+++ b/libc/sysdeps/linux/common/stat64.c
@@ -2,25 +2,26 @@
/*
* stat64() for uClibc
*
- * 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/stat.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_stat64
-#define __NR___syscall_stat64 __NR_stat64
-#include <unistd.h>
-#include <sys/stat.h>
-#include <bits/kernel_stat.h>
-#include "xstatconv.h"
+libc_hidden_proto(stat64)
+
+# define __NR___syscall_stat64 __NR_stat64
+# include <unistd.h>
+# include <sys/stat.h>
+# include "xstatconv.h"
static inline _syscall2(int, __syscall_stat64,
const char *, file_name, struct kernel_stat64 *, buf);
-#undef stat64
-int attribute_hidden __stat64(const char *file_name, struct stat64 *buf)
+int stat64(const char *file_name, struct stat64 *buf)
{
int result;
struct kernel_stat64 kbuf;
@@ -31,6 +32,5 @@ int attribute_hidden __stat64(const char *file_name, struct stat64 *buf)
}
return result;
}
-strong_alias(__stat64,stat64)
-
-#endif /* __UCLIBC_HAS_LFS__ */
+libc_hidden_def(stat64)
+#endif
diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c
index f8aa9d3ba..5da94d6f2 100644
--- a/libc/sysdeps/linux/common/statfs.c
+++ b/libc/sysdeps/linux/common/statfs.c
@@ -2,9 +2,9 @@
/*
* statfs() for uClibc
*
- * 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"
@@ -12,12 +12,6 @@
#include <sys/param.h>
#include <sys/vfs.h>
-#define __NR___syscall_statfs __NR_statfs
-static inline _syscall2(int, __syscall_statfs,
- const char *, path, struct statfs *, buf);
-
-int attribute_hidden __statfs(const char *path, struct statfs * buf)
-{
- return __syscall_statfs(path, buf);
-}
-strong_alias(__statfs,statfs)
+libc_hidden_proto(statfs)
+_syscall2(int, statfs, const char *, path, struct statfs *, buf);
+libc_hidden_def(statfs)
diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c
index bfb7682d0..9f9615d3e 100644
--- a/libc/sysdeps/linux/common/stime.c
+++ b/libc/sysdeps/linux/common/stime.c
@@ -2,19 +2,19 @@
/*
* stime() for uClibc
*
- * 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.
*/
-#define settimeofday __settimeofday
-
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
#ifdef __NR_stime
_syscall1(int, stime, const time_t *, t);
#else
+libc_hidden_proto(settimeofday)
+
int stime(const time_t * when)
{
struct timeval tv;
diff --git a/libc/sysdeps/linux/common/swapoff.c b/libc/sysdeps/linux/common/swapoff.c
index 8ecb45f85..60df6e473 100644
--- a/libc/sysdeps/linux/common/swapoff.c
+++ b/libc/sysdeps/linux/common/swapoff.c
@@ -2,9 +2,9 @@
/*
* swapoff() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/swapon.c b/libc/sysdeps/linux/common/swapon.c
index c3c507e6b..d5a5c235a 100644
--- a/libc/sysdeps/linux/common/swapon.c
+++ b/libc/sysdeps/linux/common/swapon.c
@@ -2,9 +2,9 @@
/*
* swapon() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index efd59405b..3c8c39751 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -2,9 +2,9 @@
/*
* symlink() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/sync.c b/libc/sysdeps/linux/common/sync.c
index 8e9850419..48fac63ea 100644
--- a/libc/sysdeps/linux/common/sync.c
+++ b/libc/sysdeps/linux/common/sync.c
@@ -2,25 +2,11 @@
/*
* sync syscall for uClibc
*
- * Copyright (C) 2002 by Erik Andersen <andersen@codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
#include <features.h>
#include <errno.h>
#include <sys/types.h>
diff --git a/libc/sysdeps/linux/common/syscalls.h b/libc/sysdeps/linux/common/syscalls.h
index 88d9b4dcf..af015246a 100644
--- a/libc/sysdeps/linux/common/syscalls.h
+++ b/libc/sysdeps/linux/common/syscalls.h
@@ -2,25 +2,12 @@
/*
* Common header file for uClibc syscalls
*
- * Copyright (C) 2001-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define _GNU_SOURCE
+#define _LARGEFILE64_SOURCE
#include <features.h>
#include <errno.h>
#include <sys/types.h>
@@ -29,7 +16,7 @@
#undef __OPTIMIZE__
/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
+ * being renamed under us or very bad things will happen... */
#ifdef __USE_FILE_OFFSET64
# undef __USE_FILE_OFFSET64
#endif
diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c
index a1ab9bcc5..0d6f49185 100644
--- a/libc/sysdeps/linux/common/sysctl.c
+++ b/libc/sysdeps/linux/common/sysctl.c
@@ -2,12 +2,16 @@
/*
* _sysctl() for uClibc
*
- * 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"
+/* psm: including sys/sysctl.h would depend on kernel headers */
+extern int sysctl (int *__name, int __nlen, void *__oldval,
+ size_t *__oldlenp, void *__newval, size_t __newlen) __THROW;
+
struct __sysctl_args {
int *name;
int nlen;
diff --git a/libc/sysdeps/linux/common/sysfs.c b/libc/sysdeps/linux/common/sysfs.c
index 371c08b9e..28350fdd2 100644
--- a/libc/sysdeps/linux/common/sysfs.c
+++ b/libc/sysdeps/linux/common/sysfs.c
@@ -2,10 +2,10 @@
/*
* sysfs() for uClibc
*
- * 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"
-//_syscall3(int, sysfs, int, option, unsigned int, index, char addr);
+_syscall3(int, sysfs, int, option, unsigned int, index, char, addr);
diff --git a/libc/sysdeps/linux/common/sysinfo.c b/libc/sysdeps/linux/common/sysinfo.c
index a2668d75d..67673a290 100644
--- a/libc/sysdeps/linux/common/sysinfo.c
+++ b/libc/sysdeps/linux/common/sysinfo.c
@@ -2,9 +2,9 @@
/*
* sysinfo() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c
index 02ebd5570..405954aa3 100644
--- a/libc/sysdeps/linux/common/time.c
+++ b/libc/sysdeps/linux/common/time.c
@@ -2,21 +2,23 @@
/*
* time() for uClibc
*
- * 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.
*/
-#define gettimeofday __gettimeofday
-
#include "syscalls.h"
#include <time.h>
#include <sys/time.h>
+
+libc_hidden_proto(time)
+
#ifdef __NR_time
-#define __NR___time __NR_time
-attribute_hidden _syscall1(time_t, __time, time_t *, t);
+_syscall1(time_t, time, time_t *, t);
#else
-time_t attribute_hidden __time(time_t * t)
+libc_hidden_proto(gettimeofday)
+
+time_t time(time_t * t)
{
time_t result;
struct timeval tv;
@@ -32,4 +34,4 @@ time_t attribute_hidden __time(time_t * t)
return result;
}
#endif
-strong_alias(__time,time)
+libc_hidden_def(time)
diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c
index 0fefdca10..178a73fa9 100644
--- a/libc/sysdeps/linux/common/times.c
+++ b/libc/sysdeps/linux/common/times.c
@@ -2,13 +2,15 @@
/*
* times() for uClibc
*
- * 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/times.h>
-#define __NR___times __NR_times
-attribute_hidden _syscall1(clock_t, __times, struct tms *, buf);
-strong_alias(__times,times)
+
+libc_hidden_proto(times)
+
+_syscall1(clock_t, times, struct tms *, buf);
+libc_hidden_def(times)
diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c
index 02527d949..08c71fc71 100644
--- a/libc/sysdeps/linux/common/truncate.c
+++ b/libc/sysdeps/linux/common/truncate.c
@@ -2,11 +2,15 @@
/*
* truncate() for uClibc
*
- * 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 <unistd.h>
+
+libc_hidden_proto(truncate)
+
_syscall2(int, truncate, const char *, path, __off_t, length);
+libc_hidden_def(truncate)
diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c
index cf74812d6..e227900c5 100644
--- a/libc/sysdeps/linux/common/truncate64.c
+++ b/libc/sysdeps/linux/common/truncate64.c
@@ -1,15 +1,13 @@
/*
- * truncate64 syscall. Copes with 64 bit and 32 bit machines
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+/* truncate64 syscall. Copes with 64 bit and 32 bit machines
* and on 32 bit machines this sends things into the kernel as
* two 32-bit arguments (high and low 32 bits of length) that
* are ordered based on endianess. It turns out endian.h has
* just the macro we need to order things, __LONG_LONG_PAIR.
- *
- * Copyright (C) 2002 Erik Andersen <andersen@codepoet.org>
- *
- * This file is subject to the terms and conditions of the GNU
- * Lesser General Public License. See the file COPYING.LIB in
- * the main directory of this archive for more details.
*/
#include <features.h>
@@ -34,7 +32,7 @@ _syscall2(int, truncate64, const char *, path, __off64_t, length);
#ifndef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) __syscall_truncate64 (args)
#define __NR___syscall_truncate64 __NR_truncate64
-#if defined(__powerpc__) || defined(__mips__)
+#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
static inline _syscall4(int, __syscall_truncate64, const char *, path,
uint32_t, pad, unsigned long, high_length, unsigned long, low_length);
#else
@@ -49,7 +47,7 @@ int truncate64 (const char * path, __off64_t length)
{
uint32_t low = length & 0xffffffff;
uint32_t high = length >> 32;
-#if defined(__powerpc__) || defined(__mips__)
+#if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__)
return INLINE_SYSCALL(truncate64, 4, path, 0,
__LONG_LONG_PAIR (high, low));
#else
@@ -64,6 +62,8 @@ int truncate64 (const char * path, __off64_t length)
#else /* __NR_truncate64 */
+libc_hidden_proto(truncate)
+
int truncate64 (const char * path, __off64_t length)
{
__off_t x = (__off_t) length;
@@ -80,4 +80,3 @@ int truncate64 (const char * path, __off64_t length)
#endif /* __NR_truncate64 */
#endif /* __UCLIBC_HAS_LFS__ */
-
diff --git a/libc/sysdeps/linux/common/ulimit.c b/libc/sysdeps/linux/common/ulimit.c
index b8e09fc8f..6f0278f60 100644
--- a/libc/sysdeps/linux/common/ulimit.c
+++ b/libc/sysdeps/linux/common/ulimit.c
@@ -1,53 +1,28 @@
/* vi: set sw=4 ts=4: */
/*
- * Copyright (C) 2003 by Erik Andersen <andersen@codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define sysconf __sysconf
-#define getrlimit __getrlimit
-#define setrlimit __setrlimit
-
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
-
+#include "syscalls.h"
#ifdef __NR_ulimit
-#include <sys/types.h>
-#include <sys/syscall.h>
-
-_syscall2(long, ulimit, int, cmd, int, arg);
+extern long int ulimit(int cmd, long arg);
+_syscall2(long, ulimit, int, cmd, long, arg);
#else
#include <stdarg.h>
#include <unistd.h>
#include <ulimit.h>
-#include <errno.h>
#include <sys/resource.h>
+libc_hidden_proto(sysconf)
+libc_hidden_proto(getrlimit)
+libc_hidden_proto(setrlimit)
+
long int ulimit(int cmd, ...)
{
va_list va;
@@ -82,4 +57,3 @@ long int ulimit(int cmd, ...)
return result;
}
#endif
-
diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c
index 4a5b33abf..20fb12385 100644
--- a/libc/sysdeps/linux/common/umask.c
+++ b/libc/sysdeps/linux/common/umask.c
@@ -2,9 +2,9 @@
/*
* umask() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c
index 158aefc5f..1480b63cd 100644
--- a/libc/sysdeps/linux/common/umount.c
+++ b/libc/sysdeps/linux/common/umount.c
@@ -2,25 +2,23 @@
/*
* umount() for uClibc
*
- * 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"
-
/* arch provides umount() syscall */
#ifdef __NR_umount
-#include <sys/mount.h>
+# include <sys/mount.h>
_syscall1(int, umount, const char *, specialfile);
-
/* arch provides umount2() syscall */
#elif defined __NR_umount2
-#define __NR___syscall_umount2 __NR_umount2
+# define __NR___syscall_umount2 __NR_umount2
static inline _syscall2(int, __syscall_umount2, const char *, special_file, int, flags);
int umount(const char *special_file)
@@ -28,7 +26,6 @@ int umount(const char *special_file)
return (__syscall_umount2(special_file, 0));
}
-
/* arch doesn't provide any umount syscall !? */
#else
diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c
index 467ec1dbc..b68c4da9c 100644
--- a/libc/sysdeps/linux/common/umount2.c
+++ b/libc/sysdeps/linux/common/umount2.c
@@ -2,9 +2,9 @@
/*
* umount2() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c
index 3d252edc7..8c51f1f76 100644
--- a/libc/sysdeps/linux/common/uname.c
+++ b/libc/sysdeps/linux/common/uname.c
@@ -2,13 +2,15 @@
/*
* uname() for uClibc
*
- * 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/utsname.h>
-#define __NR___uname __NR_uname
-attribute_hidden _syscall1(int, __uname, struct utsname *, buf);
-strong_alias(__uname,uname)
+
+libc_hidden_proto(uname)
+
+_syscall1(int, uname, struct utsname *, buf);
+libc_hidden_def(uname)
diff --git a/libc/sysdeps/linux/common/unlink.c b/libc/sysdeps/linux/common/unlink.c
index 4d9c3cda9..1ecefd70d 100644
--- a/libc/sysdeps/linux/common/unlink.c
+++ b/libc/sysdeps/linux/common/unlink.c
@@ -2,13 +2,15 @@
/*
* unlink() for uClibc
*
- * 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 <unistd.h>
-#define __NR___unlink __NR_unlink
-attribute_hidden _syscall1(int, __unlink, const char *, pathname);
-strong_alias(__unlink,unlink)
+
+libc_hidden_proto(unlink)
+
+_syscall1(int, unlink, const char *, pathname);
+libc_hidden_def(unlink)
diff --git a/libc/sysdeps/linux/common/uselib.c b/libc/sysdeps/linux/common/uselib.c
index b0b84a775..3ccde1de4 100644
--- a/libc/sysdeps/linux/common/uselib.c
+++ b/libc/sysdeps/linux/common/uselib.c
@@ -2,13 +2,14 @@
/*
* uselib() for uClibc
*
- * 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 <unistd.h>
#ifdef __NR_uselib
+int uselib (const char *library);
_syscall1(int, uselib, const char *, library);
#endif
diff --git a/libc/sysdeps/linux/common/ustat.c b/libc/sysdeps/linux/common/ustat.c
index 4ee1c41d1..73e74e8e1 100644
--- a/libc/sysdeps/linux/common/ustat.c
+++ b/libc/sysdeps/linux/common/ustat.c
@@ -2,9 +2,9 @@
/*
* ustat() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c
index 8087863f7..5641cc6f0 100644
--- a/libc/sysdeps/linux/common/utime.c
+++ b/libc/sysdeps/linux/common/utime.c
@@ -2,23 +2,26 @@
/*
* utime() for uClibc
*
- * 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.
*/
-#define utimes __utimes
-#define gettimeofday __gettimeofday
-
#include "syscalls.h"
#include <utime.h>
+
+libc_hidden_proto(utime)
+
#ifdef __NR_utime
-#define __NR___utime __NR_utime
-attribute_hidden _syscall2(int, __utime, const char *, file, const struct utimbuf *, times);
+attribute_hidden _syscall2(int, utime, const char *, file, const struct utimbuf *, times);
#else
#include <stdlib.h>
#include <sys/time.h>
-int attribute_hidden __utime(const char *file, const struct utimbuf *times)
+
+libc_hidden_proto(utimes)
+libc_hidden_proto(gettimeofday)
+
+int utime(const char *file, const struct utimbuf *times)
{
struct timeval timevals[2];
@@ -36,4 +39,4 @@ int attribute_hidden __utime(const char *file, const struct utimbuf *times)
return utimes(file, timevals);
}
#endif
-strong_alias(__utime,utime)
+libc_hidden_def(utime)
diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c
index ca45204c7..55f60d8c1 100644
--- a/libc/sysdeps/linux/common/utimes.c
+++ b/libc/sysdeps/linux/common/utimes.c
@@ -2,22 +2,26 @@
/*
* utimes() for uClibc
*
- * 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.
*/
-#define utime __utime
-
#include "syscalls.h"
#include <utime.h>
+#include <sys/time.h>
+
+libc_hidden_proto(utimes)
+
#ifdef __NR_utimes
-#define __NR___utimes __NR_utimes
-attribute_hidden _syscall2(int, __utimes, const char *, file, const struct timeval *, tvp);
+_syscall2(int, utimes, const char *, file, const struct timeval *, tvp);
#else
#include <stdlib.h>
#include <sys/time.h>
-int attribute_hidden __utimes(const char *file, const struct timeval tvp[2])
+
+libc_hidden_proto(utime)
+
+int utimes(const char *file, const struct timeval tvp[2])
{
struct utimbuf buf, *times;
@@ -31,4 +35,4 @@ int attribute_hidden __utimes(const char *file, const struct timeval tvp[2])
return utime(file, times);
}
#endif
-strong_alias(__utimes,utimes)
+libc_hidden_def(utimes)
diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c
index d0a4d9a0e..2b043d293 100644
--- a/libc/sysdeps/linux/common/vfork.c
+++ b/libc/sysdeps/linux/common/vfork.c
@@ -1,11 +1,23 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
/* Trivial implementation for arches that lack vfork */
#include <unistd.h>
#include <sys/types.h>
+#include <sys/syscall.h>
-extern __pid_t __fork (void) __THROW attribute_hidden;
+#ifdef __NR_fork
+libc_hidden_proto(fork)
-pid_t attribute_hidden __vfork(void)
+extern __typeof(vfork) __vfork attribute_hidden;
+pid_t __vfork(void)
{
- return __fork();
+ return fork();
}
-strong_alias(__vfork,vfork)
+libc_hidden_proto(vfork)
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)
+#endif
diff --git a/libc/sysdeps/linux/common/vhangup.c b/libc/sysdeps/linux/common/vhangup.c
index 5ff243916..f6dc0865f 100644
--- a/libc/sysdeps/linux/common/vhangup.c
+++ b/libc/sysdeps/linux/common/vhangup.c
@@ -2,9 +2,9 @@
/*
* vhangup() for uClibc
*
- * 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"
diff --git a/libc/sysdeps/linux/common/wait3.c b/libc/sysdeps/linux/common/wait3.c
index 4b4d6aef1..5de975c25 100644
--- a/libc/sysdeps/linux/common/wait3.c
+++ b/libc/sysdeps/linux/common/wait3.c
@@ -1,10 +1,15 @@
-#define wait4 __wait4
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
#include <syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/resource.h>
+libc_hidden_proto(wait4)
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
* return its process ID. For errors return (pid_t) -1. If USAGE is not nil,
diff --git a/libc/sysdeps/linux/common/wait4.c b/libc/sysdeps/linux/common/wait4.c
index b5a2c5933..9d9de58d6 100644
--- a/libc/sysdeps/linux/common/wait4.c
+++ b/libc/sysdeps/linux/common/wait4.c
@@ -2,20 +2,23 @@
/*
* wait4() for uClibc
*
- * 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/wait.h>
#include <sys/resource.h>
+libc_hidden_proto(wait4)
+
#define __NR___syscall_wait4 __NR_wait4
static inline _syscall4(int, __syscall_wait4, __kernel_pid_t, pid,
int *, status, int, opts, struct rusage *, rusage);
-pid_t attribute_hidden __wait4(pid_t pid, int *status, int opts, struct rusage *rusage)
+pid_t wait4(pid_t pid, int *status, int opts, struct rusage *rusage)
{
return (__syscall_wait4(pid, status, opts, rusage));
}
-strong_alias(__wait4,wait4)
+libc_hidden_def(wait4)
diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c
index 651365fed..c150808f0 100644
--- a/libc/sysdeps/linux/common/write.c
+++ b/libc/sysdeps/linux/common/write.c
@@ -2,15 +2,22 @@
/*
* write() for uClibc
*
- * 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 <unistd.h>
-#define __NR___write __NR_write
-attribute_hidden _syscall3(ssize_t, __write, int, fd, const __ptr_t, buf, size_t, count);
-strong_alias(__write,write)
-weak_alias(__write,__libc_write)
+extern __typeof(write) __libc_write;
+#define __NR___libc_write __NR_write
+_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count);
+libc_hidden_proto(write)
+weak_alias(__libc_write,write)
+libc_hidden_weak(write)
+#if 0
+/* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o
+ * which is a blatent GNU libc-ism... */
+strong_alias(__libc_write,__write)
+#endif
diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c
index 556cd1a57..6e4e7fa92 100644
--- a/libc/sysdeps/linux/common/xattr.c
+++ b/libc/sysdeps/linux/common/xattr.c
@@ -1,8 +1,10 @@
/*
- * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvs/uClibc/libc/sysdeps/linux/common/xattr.c,v 1.2 2004/12/22 19:53:11 andersen Exp $
+ * Copyright (C) 2004 <solar@gentoo.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- * This file provides the following Extended Attribute system calls to uClibc.
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+/* This file provides the following Extended Attribute system calls to uClibc.
*
* setxattr(), lsetxattr(), fsetxattr(),
* getxattr(), lgetxattr(), fgetxattr(),
@@ -21,6 +23,7 @@
#include "syscalls.h"
#include <unistd.h>
+#include <sys/xattr.h>
/* sets */
#ifdef __NR_setxattr
@@ -120,7 +123,7 @@ ssize_t llistxattr(__const char *__path, char *__list, size_t __size)
#endif
#ifdef __NR_flistxattr
-_syscall3(size_t, flistxattr, int, filedes, char *, list, size_t, size);
+_syscall3(ssize_t, flistxattr, int, filedes, char *, list, size_t, size);
#else
ssize_t flistxattr(int __fd, char *__list, size_t __size)
{
diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
index 407f32496..58e05c437 100644
--- a/libc/sysdeps/linux/common/xstatconv.c
+++ b/libc/sysdeps/linux/common/xstatconv.c
@@ -20,15 +20,7 @@
Modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-#define _GNU_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <features.h>
-#undef __OPTIMIZE__
-/* We absolutely do _NOT_ want interfaces silently
- * * * renamed under us or very bad things will happen... */
-#ifdef __USE_FILE_OFFSET64
-# undef __USE_FILE_OFFSET64
-#endif
+#include "syscalls.h"
#include <sys/stat.h>
#include "xstatconv.h"
@@ -55,16 +47,16 @@ void attribute_hidden __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
#endif
}
-#if defined(__UCLIBC_HAS_LFS__)
+#ifdef __UCLIBC_HAS_LFS__
void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
{
/* Convert to current kernel version of `struct stat64'. */
buf->st_dev = kbuf->st_dev;
buf->st_ino = kbuf->st_ino;
-#ifdef _HAVE_STAT64___ST_INO
+# ifdef _HAVE_STAT64___ST_INO
buf->__st_ino = kbuf->__st_ino;
-#endif
+# endif
buf->st_mode = kbuf->st_mode;
buf->st_nlink = kbuf->st_nlink;
buf->st_uid = kbuf->st_uid;
@@ -76,11 +68,11 @@ void attribute_hidden __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *
buf->st_atime = kbuf->st_atime;
buf->st_mtime = kbuf->st_mtime;
buf->st_ctime = kbuf->st_ctime;
-#ifdef STAT_HAVE_NSEC
+# ifdef STAT_HAVE_NSEC
buf->st_atimensec = kbuf->st_atime_nsec;
buf->st_mtimensec = kbuf->st_mtime_nsec;
buf->st_ctimensec = kbuf->st_ctime_nsec;
-#endif
+# endif
}
#endif /* __UCLIBC_HAS_LFS__ */