diff options
Diffstat (limited to 'libc/sysdeps/linux/common')
113 files changed, 593 insertions, 455 deletions
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index 09409fe81..43c6b6517 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -16,18 +16,18 @@ static _syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info, const struct timespec *, timeout, size_t, setsize); -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) +int sigwaitinfo(const sigset_t * set, siginfo_t * info) { return __rt_sigtimedwait(set, info, NULL, _NSIG / 8); } -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, +int sigtimedwait(const sigset_t * set, siginfo_t * info, const struct timespec *timeout) { return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); } #else -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) +int sigwaitinfo(const sigset_t * set, siginfo_t * info) { if (set == NULL) __set_errno(EINVAL); @@ -36,7 +36,7 @@ int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) return -1; } -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, +int sigtimedwait(const sigset_t * set, siginfo_t * info, const struct timespec *timeout) { if (set == NULL) @@ -46,6 +46,7 @@ int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, return -1; } #endif -/* keep these weak so that libpthread can overwrite them */ -weak_alias(__sigtimedwait,sigtimedwait) -weak_alias(__sigwaitinfo,sigwaitinfo) +libc_hidden_proto(sigwaitinfo) +libc_hidden_def(sigwaitinfo) +libc_hidden_proto(sigtimedwait) +libc_hidden_def(sigtimedwait) diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index ca9aff5e7..f8652def6 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -11,18 +11,16 @@ #include <stdarg.h> #include <fcntl.h> -#undef __fcntl - #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -extern int __fcntl64(int fd, int cmd, ...) attribute_hidden; +extern int __libc_fcntl64(int fd, int cmd, ...); +libc_hidden_proto(__libc_fcntl64) #endif -#undef fcntl #define __NR___syscall_fcntl __NR_fcntl static inline _syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg); -int attribute_hidden __fcntl(int fd, int cmd, ...) +int __libc_fcntl(int fd, int cmd, ...) { long arg; va_list list; @@ -33,7 +31,7 @@ int attribute_hidden __fcntl(int fd, int cmd, ...) if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 - return __fcntl64(fd, cmd, arg); + return __libc_fcntl64(fd, cmd, arg); #else __set_errno(ENOSYS); return -1; @@ -41,10 +39,15 @@ int attribute_hidden __fcntl(int fd, int cmd, ...) } return (__syscall_fcntl(fd, cmd, arg)); } -strong_alias(__fcntl,fcntl) -weak_alias(__fcntl,__libc_fcntl) +libc_hidden_proto(__libc_fcntl) +libc_hidden_def(__libc_fcntl) + +strong_alias(__libc_fcntl,fcntl) +libc_hidden_proto(fcntl) +libc_hidden_def(fcntl) #if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__fcntl,__fcntl64) -weak_alias(__fcntl,fcntl64) -weak_alias(__fcntl,__libc_fcntl64) +strong_alias(__libc_fcntl,__libc_fcntl64) +strong_alias(__libc_fcntl,fcntl64) +libc_hidden_proto(fcntl64) +libc_hidden_def(fcntl64) #endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 9231808e3..759ba949f 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -12,10 +12,9 @@ #include <fcntl.h> #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 -#undef fcntl64 #define __NR___syscall_fcntl64 __NR_fcntl64 static inline _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg); -int attribute_hidden __fcntl64(int fd, int cmd, ...) +int __libc_fcntl64(int fd, int cmd, ...) { long arg; va_list list; @@ -26,6 +25,10 @@ int attribute_hidden __fcntl64(int fd, int cmd, ...) va_end(list); return (__syscall_fcntl64(fd, cmd, arg)); } -strong_alias(__fcntl64,fcntl64) -weak_alias(__fcntl64,__libc_fcntl64) +libc_hidden_proto(__libc_fcntl64) +libc_hidden_def(__libc_fcntl64) + +strong_alias(__libc_fcntl64,fcntl64) +libc_hidden_proto(fcntl64) +libc_hidden_def(fcntl64) #endif diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 4e450bbc5..a708fad90 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -32,12 +32,11 @@ static inline _syscall1(void, __syscall_exit, int, status); #endif -#undef _exit -#undef _exit_internal -void attribute_noreturn attribute_hidden _exit_internal(int status) +void attribute_noreturn _exit(int status) { /* The loop is added only to keep gcc happy. */ while(1) INLINE_SYSCALL(exit, 1, status); } -strong_alias(_exit_internal,_exit) +libc_hidden_proto(_exit) +libc_hidden_def(_exit) diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c index ef33051e8..a6c9be2b8 100644 --- a/libc/sysdeps/linux/common/adjtimex.c +++ b/libc/sysdeps/linux/common/adjtimex.c @@ -10,8 +10,7 @@ #include "syscalls.h" #include <sys/timex.h> -#define __NR___adjtimex __NR_adjtimex -attribute_hidden _syscall1(int, __adjtimex, struct timex *, buf); - -strong_alias(__adjtimex, adjtimex) -weak_alias(__adjtimex, ntp_adjtime) +_syscall1(int, adjtimex, struct timex *, buf); +libc_hidden_proto(adjtimex) +libc_hidden_def(adjtimex) +strong_alias(adjtimex,ntp_adjtime) diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c index 8239cec5b..6089a50cf 100644 --- a/libc/sysdeps/linux/common/alarm.c +++ b/libc/sysdeps/linux/common/alarm.c @@ -7,16 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define setitimer __setitimer - #include "syscalls.h" #include <unistd.h> #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 +36,5 @@ unsigned int attribute_hidden __alarm(unsigned int seconds) return retval; } #endif -strong_alias(__alarm,alarm) +libc_hidden_proto(alarm) +libc_hidden_def(alarm) diff --git a/libc/sysdeps/linux/common/chdir.c b/libc/sysdeps/linux/common/chdir.c index ff4ba527b..230f86eb9 100644 --- a/libc/sysdeps/linux/common/chdir.c +++ b/libc/sysdeps/linux/common/chdir.c @@ -13,8 +13,9 @@ #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_proto(chdir) +libc_hidden_def(chdir) diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c index bf368cf5e..d6be1e130 100644 --- a/libc/sysdeps/linux/common/chmod.c +++ b/libc/sysdeps/linux/common/chmod.c @@ -13,8 +13,9 @@ #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_proto(chmod) +libc_hidden_def(chmod) diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c index 7aff495d0..985426444 100644 --- a/libc/sysdeps/linux/common/clock_getres.c +++ b/libc/sysdeps/linux/common/clock_getres.c @@ -19,8 +19,6 @@ * */ -#define sysconf __sysconf - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -29,6 +27,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..e72432b3c 100644 --- a/libc/sysdeps/linux/common/clock_gettime.c +++ b/libc/sysdeps/linux/common/clock_gettime.c @@ -20,8 +20,6 @@ * */ -#define gettimeofday __gettimeofday - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -30,6 +28,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..88d5df93e 100644 --- a/libc/sysdeps/linux/common/clock_settime.c +++ b/libc/sysdeps/linux/common/clock_settime.c @@ -19,8 +19,6 @@ * */ -#define settimeofday __settimeofday - #define _GNU_SOURCE #include "syscalls.h" #include <time.h> @@ -29,6 +27,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..38381a223 100644 --- a/libc/sysdeps/linux/common/close.c +++ b/libc/sysdeps/linux/common/close.c @@ -10,7 +10,8 @@ #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) +#define __NR___libc_close __NR_close +_syscall1(int, __libc_close, int, fd); +strong_alias(__libc_close,close) +libc_hidden_proto(close) +libc_hidden_def(close) diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c index 771f5172b..a2352efe4 100644 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c @@ -21,8 +21,8 @@ #include <features.h> #include <sys/socket.h> -struct cmsghdr attribute_hidden * -__cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg) +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 +38,5 @@ __cmsg_nxthdr_internal (struct msghdr *mhdr, struct cmsghdr *cmsg) return NULL; return cmsg; } -strong_alias(__cmsg_nxthdr_internal,__cmsg_nxthdr) +libc_hidden_proto(__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..0bf20f175 100644 --- a/libc/sysdeps/linux/common/creat64.c +++ b/libc/sysdeps/linux/common/creat64.c @@ -16,8 +16,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define open64 __open64 - #include <features.h> #include <fcntl.h> #include <sys/types.h> @@ -37,7 +35,7 @@ # undef __USE_FILE_OFFSET64 #endif -#undef creat +libc_hidden_proto(open64) /* Create FILE with protections MODE. */ int creat64 (const char *file, mode_t mode) diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h index b4108cc53..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,9 +20,14 @@ # include <sys/time.h> # ifdef IS_IN_libc -# define OPEN __open -# define READ __read -# define CLOSE __close +#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 # define OPEN _dl_open diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c index 71164aa0b..c7bd115aa 100644 --- a/libc/sysdeps/linux/common/dup2.c +++ b/libc/sysdeps/linux/common/dup2.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___dup2 __NR_dup2 -attribute_hidden _syscall2(int, __dup2, int, oldfd, int, newfd); -strong_alias(__dup2,dup2) +_syscall2(int, dup2, int, oldfd, int, newfd); +libc_hidden_proto(dup2) +libc_hidden_def(dup2) diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c index 8a95746ee..bbc7b1dec 100644 --- a/libc/sysdeps/linux/common/execve.c +++ b/libc/sysdeps/linux/common/execve.c @@ -16,8 +16,9 @@ static inline _syscall3(int, __syscall_execve, const char *, filename, char *const *, argv, char *const *, envp); -int attribute_hidden __execve(const char * filename, char *const * argv, char *const * envp) +int execve(const char * filename, char *const * argv, char *const * envp) { return __syscall_execve(filename, argv, envp); } -strong_alias(__execve,execve) +libc_hidden_proto(execve) +libc_hidden_def(execve) diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c index f4692cc2c..3da6e1d58 100644 --- a/libc/sysdeps/linux/common/fchdir.c +++ b/libc/sysdeps/linux/common/fchdir.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___fchdir __NR_fchdir -attribute_hidden _syscall1(int, __fchdir, int, fd); -strong_alias(__fchdir,fchdir) +_syscall1(int, fchdir, int, fd); +libc_hidden_proto(fchdir) +libc_hidden_def(fchdir) diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 899cbaf63..23c6fedff 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -12,9 +12,10 @@ #ifdef __ARCH_HAS_MMU__ #ifdef __NR_fork -#define __NR___fork __NR_fork -attribute_hidden _syscall0(pid_t, __fork); -strong_alias(__fork,fork) -weak_alias(__fork,__libc_fork) +#define __NR___libc_fork __NR_fork +_syscall0(pid_t, __libc_fork); +strong_alias(__libc_fork,fork) +libc_hidden_proto(fork) +libc_hidden_def(fork) #endif #endif diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c index af3f9a13b..0a8c81df6 100644 --- a/libc/sysdeps/linux/common/fstat.c +++ b/libc/sysdeps/linux/common/fstat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_fstat64 doesnt exist */ #define fstat64 __hidefstat64 -#define __fstat64 __hide__fstat64 #include "syscalls.h" #include <unistd.h> @@ -18,14 +17,12 @@ #include "xstatconv.h" #undef fstat64 -#undef __fstat64 #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; @@ -36,9 +33,11 @@ int attribute_hidden __fstat(int fd, struct stat *buf) } return result; } -strong_alias(__fstat,fstat) +libc_hidden_proto(fstat) +libc_hidden_def(fstat) #if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__fstat,__fstat64) -weak_alias(__fstat,fstat64) +strong_alias(fstat,fstat64) +libc_hidden_proto(fstat64) +libc_hidden_def(fstat64) #endif diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c index 0d8bbdb43..fc91cbaf9 100644 --- a/libc/sysdeps/linux/common/fstat64.c +++ b/libc/sysdeps/linux/common/fstat64.c @@ -18,8 +18,7 @@ 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; @@ -30,6 +29,7 @@ int attribute_hidden __fstat64(int fd, struct stat64 *buf) } return result; } -strong_alias(__fstat64,fstat64) +libc_hidden_proto(fstat64) +libc_hidden_def(fstat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c index 9a7cf303b..c88162e6d 100644 --- a/libc/sysdeps/linux/common/fstatfs.c +++ b/libc/sysdeps/linux/common/fstatfs.c @@ -9,6 +9,6 @@ #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) +_syscall2(int, fstatfs, int, fd, struct statfs *, buf); +libc_hidden_proto(fstatfs) +libc_hidden_def(fstatfs) diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c index e6f610751..ab382bd87 100644 --- a/libc/sysdeps/linux/common/fsync.c +++ b/libc/sysdeps/linux/common/fsync.c @@ -12,4 +12,4 @@ #define __NR___libc_fsync __NR_fsync _syscall1(int, __libc_fsync, int, fd); -weak_alias(__libc_fsync, fsync) +strong_alias(__libc_fsync, fsync) diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c index a25fd0285..1d4e62d26 100644 --- a/libc/sysdeps/linux/common/ftruncate.c +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -10,4 +10,5 @@ #include "syscalls.h" #include <unistd.h> _syscall2(int, ftruncate, int, fd, __off_t, length); -hidden_strong_alias(ftruncate, __ftruncate) +libc_hidden_proto(ftruncate) +libc_hidden_def(ftruncate) diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index 51392a1aa..5516f3b6f 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -12,8 +12,6 @@ * the main directory of this archive for more details. */ -#define ftruncate __ftruncate - #include <features.h> #include <unistd.h> #include <errno.h> @@ -65,6 +63,8 @@ int ftruncate64 (int fd, __off64_t length) #else /* __NR_ftruncate64 */ +libc_hidden_proto(ftruncate) + int ftruncate64 (int fd, __off64_t length) { __off_t x = (__off_t) length; diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index a44647d67..63b195ec2 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -1,8 +1,10 @@ -/* 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> @@ -11,6 +13,15 @@ #include <string.h> #include <sys/syscall.h> +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 @@ -43,7 +54,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path int slow_search = (sizeof(ino_t) != sizeof(d->d_ino)); #endif - if (__stat(path_buf, &st) < 0) { + if (stat(path_buf, &st) < 0) { goto oops; } #ifdef FAST_DIR_SEARCH_POSSIBLE @@ -51,13 +62,13 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path slow_search = 1; #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++; @@ -71,11 +82,11 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path #ifdef FAST_DIR_SEARCH_POSSIBLE if (slow_search || this_ino == d->d_ino) { #endif - if (slen + __strlen(d->d_name) > path_size) { + 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); @@ -101,7 +112,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 +123,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,16 +151,16 @@ 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; @@ -157,7 +168,7 @@ int __syscall_getcwd(char * buf, unsigned long size) #endif -char attribute_hidden *__getcwd(char *buf, size_t size) +char *getcwd(char *buf, size_t size) { int ret; char *path; @@ -189,4 +200,5 @@ char attribute_hidden *__getcwd(char *buf, size_t size) free (path); return NULL; } -strong_alias(__getcwd,getcwd) +libc_hidden_proto(getcwd) +libc_hidden_def(getcwd) diff --git a/libc/sysdeps/linux/common/getdents.c b/libc/sysdeps/linux/common/getdents.c index 4db513a62..4b85d2c62 100644 --- a/libc/sysdeps/linux/common/getdents.c +++ b/libc/sysdeps/linux/common/getdents.c @@ -28,6 +28,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(lseek) + #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif @@ -75,7 +78,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,7 +94,7 @@ 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); diff --git a/libc/sysdeps/linux/common/getdents64.c b/libc/sysdeps/linux/common/getdents64.c index f65e9e70b..c734fbbb6 100644 --- a/libc/sysdeps/linux/common/getdents64.c +++ b/libc/sysdeps/linux/common/getdents64.c @@ -29,6 +29,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(lseek64) + #if defined __UCLIBC_HAS_LFS__ && defined __NR_getdents64 #ifndef offsetof @@ -80,7 +83,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 @@ -96,7 +99,7 @@ ssize_t attribute_hidden __getdents64 (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_dirent64, d_name)); dp = (struct dirent64 *) ((char *) dp + new_reclen); kdp = (struct kernel_dirent64 *) (((char *) kdp) + kdp->d_reclen); diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index a4285322b..3b470db05 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -17,14 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getcwd __getcwd - #include <features.h> #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) +libc_hidden_proto(stat) +libc_hidden_proto(stat64) + /* 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. */ @@ -39,19 +43,19 @@ get_current_dir_name (void) 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 + && 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); } diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c index aa4215f84..04077b197 100644 --- a/libc/sysdeps/linux/common/getdnnm.c +++ b/libc/sysdeps/linux/common/getdnnm.c @@ -1,4 +1,8 @@ -#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 <stdlib.h> #include <string.h> @@ -7,9 +11,12 @@ #define __USE_GNU #include <sys/utsname.h> +libc_hidden_proto(strlen) +libc_hidden_proto(strcpy) +libc_hidden_proto(uname) -int attribute_hidden -__getdomainname(char *name, size_t len) +int +getdomainname(char *name, size_t len) { struct utsname uts; @@ -20,11 +27,12 @@ __getdomainname(char *name, size_t len) if (uname(&uts) == -1) return -1; - if (__strlen(uts.domainname)+1 > len) { + if (strlen(uts.domainname)+1 > len) { __set_errno(EINVAL); return -1; } - __strcpy(name, uts.domainname); + strcpy(name, uts.domainname); return 0; } -strong_alias(__getdomainname,getdomainname) +libc_hidden_proto(getdomainname) +libc_hidden_def(getdomainname) diff --git a/libc/sysdeps/linux/common/getdtablesize.c b/libc/sysdeps/linux/common/getdtablesize.c index de3af63d7..4408273b7 100644 --- a/libc/sysdeps/linux/common/getdtablesize.c +++ b/libc/sysdeps/linux/common/getdtablesize.c @@ -16,18 +16,18 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define getrlimit __getrlimit - #include <stdlib.h> #include <unistd.h> #include <sys/resource.h> #include <limits.h> +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 +36,5 @@ 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_proto(getdtablesize) +libc_hidden_def(getdtablesize) diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c index bed60f052..4379ddd0b 100644 --- a/libc/sysdeps/linux/common/getegid.c +++ b/libc/sysdeps/linux/common/getegid.c @@ -7,22 +7,23 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define getgid __getgid - #include "syscalls.h" #include <unistd.h> #ifdef __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_proto(getegid) +libc_hidden_def(getegid) diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c index 3936739b3..c267d1483 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -7,22 +7,23 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define getuid __getuid - #include "syscalls.h" #include <unistd.h> #ifdef __NR_geteuid #define __NR___syscall_geteuid __NR_geteuid static inline _syscall0(int, __syscall_geteuid); -uid_t attribute_hidden __geteuid(void) +uid_t geteuid(void) { return (__syscall_geteuid()); } #else -uid_t attribute_hidden __geteuid(void) +libc_hidden_proto(getuid) + +uid_t geteuid(void) { return (getuid()); } #endif -strong_alias(__geteuid,geteuid) +libc_hidden_proto(geteuid) +libc_hidden_def(geteuid) diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c index eba29afa2..48c9af17c 100644 --- a/libc/sysdeps/linux/common/getgid.c +++ b/libc/sysdeps/linux/common/getgid.c @@ -16,8 +16,9 @@ #endif static inline _syscall0(int, __syscall_getgid); -gid_t attribute_hidden __getgid(void) +gid_t getgid(void) { return (__syscall_getgid()); } -strong_alias(__getgid,getgid) +libc_hidden_proto(getgid) +libc_hidden_def(getgid) diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c index 83d92627e..081f001f1 100644 --- a/libc/sysdeps/linux/common/getgroups.c +++ b/libc/sysdeps/linux/common/getgroups.c @@ -7,20 +7,20 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define sysconf __sysconf - #include "syscalls.h" #include <stdlib.h> #include <unistd.h> #include <grp.h> +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 +47,5 @@ ret_error: return ngids; } } -strong_alias(__getgroups,getgroups) +libc_hidden_proto(getgroups) +libc_hidden_def(getgroups) diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c index cb6e5efce..c932d239c 100644 --- a/libc/sysdeps/linux/common/gethstnm.c +++ b/libc/sysdeps/linux/common/gethstnm.c @@ -1,12 +1,20 @@ -#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(strlen) +libc_hidden_proto(strcpy) +libc_hidden_proto(uname) + +int +gethostname(char *name, size_t len) { struct utsname uts; @@ -17,11 +25,12 @@ __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_proto(gethostname) +libc_hidden_def(gethostname) diff --git a/libc/sysdeps/linux/common/getpagesize.c b/libc/sysdeps/linux/common/getpagesize.c index 517040d46..44456c0e7 100644 --- a/libc/sysdeps/linux/common/getpagesize.c +++ b/libc/sysdeps/linux/common/getpagesize.c @@ -19,14 +19,16 @@ #include <unistd.h> #include <features.h> #include <sys/param.h> -extern size_t __pagesize_internal attribute_hidden; + +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) +int __getpagesize(void) { - if (__pagesize_internal != 0) - return __pagesize_internal; + if (__pagesize != 0) + return __pagesize; #ifdef EXEC_PAGESIZE return EXEC_PAGESIZE; @@ -41,6 +43,6 @@ int attribute_hidden __getpagesize_internal(void) #endif /* NBPG. */ #endif /* EXEC_PAGESIZE. */ } -strong_alias(__getpagesize_internal, __getpagesize) -weak_alias(__getpagesize_internal, getpagesize) - +strong_alias(__getpagesize,getpagesize) +libc_hidden_proto(getpagesize) +libc_hidden_def(getpagesize) diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c index 8de8516dc..adb8beb06 100644 --- a/libc/sysdeps/linux/common/getpgid.c +++ b/libc/sysdeps/linux/common/getpgid.c @@ -12,8 +12,7 @@ #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..ecb29851e 100644 --- a/libc/sysdeps/linux/common/getpid.c +++ b/libc/sysdeps/linux/common/getpid.c @@ -11,10 +11,10 @@ #include <unistd.h> #if defined (__alpha__) -#define __NR___getpid __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); +strong_alias(__libc_getpid, getpid) +libc_hidden_proto(getpid) +libc_hidden_def(getpid) diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c index 3f695402d..bde7a3d85 100644 --- a/libc/sysdeps/linux/common/getpriority.c +++ b/libc/sysdeps/linux/common/getpriority.c @@ -17,7 +17,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(enum __priority_which which, id_t who) { int res; @@ -26,4 +26,5 @@ int attribute_hidden __getpriority(enum __priority_which which, id_t who) res = PZERO - res; return res; } -strong_alias(__getpriority,getpriority) +libc_hidden_proto(getpriority) +libc_hidden_def(getpriority) diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c index fef907a03..804410b34 100644 --- a/libc/sysdeps/linux/common/getrlimit.c +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -16,7 +16,7 @@ static inline _syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, struct rlimit *, rlim); -int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) { return (__ugetrlimit(resource, rlimits)); } @@ -28,7 +28,7 @@ int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rl 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 +47,5 @@ int attribute_hidden __getrlimit(__rlimit_resource_t resource, struct rlimit *rl } #endif -strong_alias(__getrlimit,getrlimit) +libc_hidden_proto(getrlimit) +libc_hidden_def(getrlimit) diff --git a/libc/sysdeps/linux/common/getrlimit64.c b/libc/sysdeps/linux/common/getrlimit64.c index 76c3196ad..6f670c001 100644 --- a/libc/sysdeps/linux/common/getrlimit64.c +++ b/libc/sysdeps/linux/common/getrlimit64.c @@ -16,8 +16,6 @@ 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 @@ -36,6 +34,8 @@ #include <sys/types.h> #include <sys/resource.h> +libc_hidden_proto(getrlimit) + #if defined __UCLIBC_HAS_LFS__ /* Put the soft and hard limits for RESOURCE in *RLIMITS. diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c index 3e9c2d8ba..91d327098 100644 --- a/libc/sysdeps/linux/common/getsid.c +++ b/libc/sysdeps/linux/common/getsid.c @@ -13,8 +13,9 @@ #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_proto(getsid) +libc_hidden_def(getsid) diff --git a/libc/sysdeps/linux/common/gettimeofday.c b/libc/sysdeps/linux/common/gettimeofday.c index 6c2613f01..175691f89 100644 --- a/libc/sysdeps/linux/common/gettimeofday.c +++ b/libc/sysdeps/linux/common/gettimeofday.c @@ -9,6 +9,6 @@ #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) +_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +libc_hidden_proto(gettimeofday) +libc_hidden_def(gettimeofday) diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index 7c81ccf48..610c34edc 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -17,8 +17,9 @@ static inline _syscall0(int, __syscall_getuid); -uid_t attribute_hidden __getuid(void) +uid_t getuid(void) { return (__syscall_getuid()); } -strong_alias(__getuid,getuid) +libc_hidden_proto(getuid) +libc_hidden_def(getuid) diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c index 29293f359..e9ea707ab 100644 --- a/libc/sysdeps/linux/common/ioctl.c +++ b/libc/sysdeps/linux/common/ioctl.c @@ -11,11 +11,13 @@ #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/kill.c b/libc/sysdeps/linux/common/kill.c index 2d1d9ae8a..2a6bfce8e 100644 --- a/libc/sysdeps/linux/common/kill.c +++ b/libc/sysdeps/linux/common/kill.c @@ -14,8 +14,9 @@ #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_proto(kill) +libc_hidden_def(kill) diff --git a/libc/sysdeps/linux/common/llseek.c b/libc/sysdeps/linux/common/llseek.c index a2ffd6196..b48641a1a 100644 --- a/libc/sysdeps/linux/common/llseek.c +++ b/libc/sysdeps/linux/common/llseek.c @@ -33,7 +33,6 @@ #include <sys/types.h> #include <sys/syscall.h> -#undef lseek64 #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__ #ifndef INLINE_SYSCALL @@ -43,20 +42,21 @@ static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi, off_t, offset_lo, loff_t *, result, int, whence); #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 __off_t __libc_lseek(int fildes, off_t offset, int whence); +libc_hidden_proto(__libc_lseek) +loff_t __libc_lseek64(int fd, loff_t offset, int whence) { - return(loff_t)(__lseek(fd, (off_t) (offset), 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) +strong_alias(__libc_lseek64,lseek64) +libc_hidden_proto(lseek64) +libc_hidden_def(lseek64) +//strong_alias(__libc_lseek64,_llseek) diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 5b4eff5f5..b2fdde9c9 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -20,9 +20,10 @@ #include <setjmp.h> #include <signal.h> +libc_hidden_proto(sigprocmask) extern void __longjmp (__jmp_buf __env, int val); - +libc_hidden_proto(__longjmp) /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp @@ -36,14 +37,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) +strong_alias(__libc_longjmp,longjmp) +strong_alias(__libc_longjmp,siglongjmp) +strong_alias(__libc_longjmp,__libc_siglongjmp) +/* weak_alias (__libc_longjmp, _longjmp) */ diff --git a/libc/sysdeps/linux/common/lseek.c b/libc/sysdeps/linux/common/lseek.c index 4eb51d322..2ed5e4a14 100644 --- a/libc/sysdeps/linux/common/lseek.c +++ b/libc/sysdeps/linux/common/lseek.c @@ -10,9 +10,11 @@ #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) +#define __NR___libc_lseek __NR_lseek +_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence); +libc_hidden_proto(__libc_lseek) +libc_hidden_def(__libc_lseek) + +strong_alias(__libc_lseek,lseek) +libc_hidden_proto(lseek) +libc_hidden_def(lseek) diff --git a/libc/sysdeps/linux/common/lstat.c b/libc/sysdeps/linux/common/lstat.c index d7feac273..9509c489d 100644 --- a/libc/sysdeps/linux/common/lstat.c +++ b/libc/sysdeps/linux/common/lstat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_lstat64 doesnt exist */ #define lstat64 __hidelstat64 -#define __lstat64 __hide__lstat64 #include "syscalls.h" #include <unistd.h> @@ -18,15 +17,13 @@ #include "xstatconv.h" #undef lstat64 -#undef __lstat64 #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; @@ -37,9 +34,11 @@ int attribute_hidden __lstat(const char *file_name, struct stat *buf) } return result; } -strong_alias(__lstat,lstat) +libc_hidden_proto(lstat) +libc_hidden_def(lstat) #if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__lstat,__lstat64) -weak_alias(lstat,lstat64) +strong_alias(lstat,lstat64) +libc_hidden_proto(lstat64) +libc_hidden_def(lstat64) #endif diff --git a/libc/sysdeps/linux/common/lstat64.c b/libc/sysdeps/linux/common/lstat64.c index 99b655a0c..b56184f82 100644 --- a/libc/sysdeps/linux/common/lstat64.c +++ b/libc/sysdeps/linux/common/lstat64.c @@ -15,11 +15,10 @@ #include "xstatconv.h" #define __NR___syscall_lstat64 __NR_lstat64 -#undef 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; @@ -30,6 +29,7 @@ int attribute_hidden __lstat64(const char *file_name, struct stat64 *buf) } return result; } -strong_alias(__lstat64,lstat64) +libc_hidden_proto(lstat64) +libc_hidden_def(lstat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/mkdir.c b/libc/sysdeps/linux/common/mkdir.c index 5e96cf599..819793f87 100644 --- a/libc/sysdeps/linux/common/mkdir.c +++ b/libc/sysdeps/linux/common/mkdir.c @@ -14,8 +14,9 @@ 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_proto(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..f914af5d7 100644 --- a/libc/sysdeps/linux/common/mknod.c +++ b/libc/sysdeps/linux/common/mknod.c @@ -15,7 +15,7 @@ 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 +23,5 @@ 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_proto(mknod) +libc_hidden_def(mknod) diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c index 3cd3eee4d..eadecfeee 100644 --- a/libc/sysdeps/linux/common/mmap.c +++ b/libc/sysdeps/linux/common/mmap.c @@ -14,7 +14,7 @@ #ifdef __NR_mmap #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 +27,6 @@ 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) +libc_hidden_proto(mmap) +libc_hidden_def(mmap) #endif diff --git a/libc/sysdeps/linux/common/mmap64.c b/libc/sysdeps/linux/common/mmap64.c index f0380b1ad..c0bc2b53a 100644 --- a/libc/sysdeps/linux/common/mmap64.c +++ b/libc/sysdeps/linux/common/mmap64.c @@ -19,14 +19,11 @@ /* Massivly hacked up for uClibc by Erik Andersen */ -#define mmap __mmap - #include <features.h> #include <errno.h> #include <unistd.h> #include <sys/mman.h> - #if defined __UCLIBC_HAS_LFS__ #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 @@ -45,6 +42,8 @@ #if ! defined __NR_mmap2 || ! defined _syscall6 +libc_hidden_proto(mmap) + /* * 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 diff --git a/libc/sysdeps/linux/common/modify_ldt.c b/libc/sysdeps/linux/common/modify_ldt.c index 618681ad3..47ed7e350 100644 --- a/libc/sysdeps/linux/common/modify_ldt.c +++ b/libc/sysdeps/linux/common/modify_ldt.c @@ -11,5 +11,5 @@ #ifdef __NR_modify_ldt _syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount); -weak_alias(modify_ldt, __modify_ldt) +/*weak_alias(modify_ldt, __modify_ldt)*/ #endif diff --git a/libc/sysdeps/linux/common/mremap.c b/libc/sysdeps/linux/common/mremap.c index f4a4670d2..16359193b 100644 --- a/libc/sysdeps/linux/common/mremap.c +++ b/libc/sysdeps/linux/common/mremap.c @@ -10,7 +10,7 @@ #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, +_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_proto(mremap) +libc_hidden_def(mremap) diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 8de9f346e..044652720 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -13,4 +13,4 @@ #define __NR___libc_msync __NR_msync _syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); -weak_alias(__libc_msync, msync) +strong_alias(__libc_msync,msync) diff --git a/libc/sysdeps/linux/common/munmap.c b/libc/sysdeps/linux/common/munmap.c index be631060a..cd76eb297 100644 --- a/libc/sysdeps/linux/common/munmap.c +++ b/libc/sysdeps/linux/common/munmap.c @@ -10,6 +10,6 @@ #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) +_syscall2(int, munmap, void *, start, size_t, length); +libc_hidden_proto(munmap) +libc_hidden_def(munmap) diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 3f5ffbaa3..0032f6623 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -13,5 +13,6 @@ #define __NR___libc_nanosleep __NR_nanosleep _syscall2(int, __libc_nanosleep, const struct timespec *, req, struct timespec *, rem); -hidden_weak_alias(__libc_nanosleep,__nanosleep) -weak_alias(__libc_nanosleep,nanosleep) +strong_alias(__libc_nanosleep,nanosleep) +libc_hidden_proto(nanosleep) +libc_hidden_def(nanosleep) diff --git a/libc/sysdeps/linux/common/nice.c b/libc/sysdeps/linux/common/nice.c index 20f7996a7..75e065e65 100644 --- a/libc/sysdeps/linux/common/nice.c +++ b/libc/sysdeps/linux/common/nice.c @@ -8,13 +8,12 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#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 @@ -24,6 +23,8 @@ static inline _syscall1(int, __syscall_nice, int, incr); #include <limits.h> +libc_hidden_proto(setpriority) + static inline int int_add_no_wrap(int a, int b) { int s = a + b; diff --git a/libc/sysdeps/linux/common/ntp_gettime.c b/libc/sysdeps/linux/common/ntp_gettime.c index 0c4d1549f..f32e05444 100644 --- a/libc/sysdeps/linux/common/ntp_gettime.c +++ b/libc/sysdeps/linux/common/ntp_gettime.c @@ -16,17 +16,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define adjtimex __adjtimex - #include <sys/timex.h> +libc_hidden_proto(adjtimex) + int ntp_gettime(struct ntptimeval *ntv) { struct timex tntx; int result; tntx.modes = 0; - result = __adjtimex(&tntx); + result = adjtimex(&tntx); ntv->time = tntx.time; ntv->maxerror = tntx.maxerror; ntv->esterror = tntx.esterror; diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 648f7d053..14cf65750 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -14,13 +14,11 @@ #include <string.h> #include <sys/param.h> -#undef __open -#undef 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 +33,14 @@ 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_proto(__libc_open) +libc_hidden_def(__libc_open) + +strong_alias(__libc_open,open) +libc_hidden_proto(open) +libc_hidden_def(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/open64.c b/libc/sysdeps/linux/common/open64.c index f577d9507..fbe99b0d9 100644 --- a/libc/sysdeps/linux/common/open64.c +++ b/libc/sysdeps/linux/common/open64.c @@ -26,10 +26,12 @@ #endif #ifdef __UCLIBC_HAS_LFS__ +extern int __libc_open (__const char *__file, int __oflag, ...) __nonnull ((1)); +libc_hidden_proto(__libc_open) + /* Open FILE with access OFLAG. If OFLAG includes O_CREAT, a third argument is the file protection. */ -#undef open64 -int attribute_hidden __open64 (const char *file, int oflag, ...) +int __libc_open64 (const char *file, int oflag, ...) { int mode = 0; @@ -41,8 +43,10 @@ int attribute_hidden __open64 (const char *file, int oflag, ...) va_end (arg); } - return __open(file, oflag | O_LARGEFILE, mode); + return __libc_open(file, oflag | O_LARGEFILE, mode); } -strong_alias(__open64,open64) -weak_alias(__open64,__libc_open64) + +strong_alias(__libc_open64,open64) +libc_hidden_proto(open64) +libc_hidden_def(open64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/pause.c b/libc/sysdeps/linux/common/pause.c index a017ef611..1028a7a63 100644 --- a/libc/sysdeps/linux/common/pause.c +++ b/libc/sysdeps/linux/common/pause.c @@ -7,9 +7,6 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define __sigpause __sigpause_internal -#define sigblock __sigblock - #include "syscalls.h" #include <unistd.h> @@ -18,9 +15,12 @@ _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) +strong_alias(__libc_pause,pause) diff --git a/libc/sysdeps/linux/common/pipe.c b/libc/sysdeps/linux/common/pipe.c index 2045b8d64..93d52b88f 100644 --- a/libc/sysdeps/linux/common/pipe.c +++ b/libc/sysdeps/linux/common/pipe.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___pipe __NR_pipe -attribute_hidden _syscall1(int, __pipe, int *, filedes); -strong_alias(__pipe,pipe) +_syscall1(int, pipe, int *, filedes); +libc_hidden_proto(pipe) +libc_hidden_def(pipe) diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index c957f1edf..c76df966f 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -17,15 +17,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getdtablesize __getdtablesize -#define select __select - #include "syscalls.h" #include <sys/poll.h> #ifdef __NR_poll -#define __NR___poll __NR_poll -attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, +_syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout); #else @@ -37,6 +33,11 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, #include <sys/param.h> #include <unistd.h> +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(getdtablesize) +libc_hidden_proto(select) + /* uClinux 2.0 doesn't have poll, emulate it using select */ /* Poll the file descriptors described by the NFDS structures starting at @@ -45,7 +46,7 @@ attribute_hidden _syscall3(int, __poll, struct pollfd *, fds, Returns the number of file descriptors with events, zero if timed out, or -1 for errors. */ -int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) +int poll(struct pollfd *fds, nfds_t nfds, int timeout) { static int max_fd_size; struct timeval tv; @@ -65,9 +66,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) /* We can't call FD_ZERO, since FD_ZERO only works with sets of exactly __FD_SETSIZE size. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); for (f = fds; f < &fds[nfds]; ++f) { @@ -89,13 +90,13 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) nwset = alloca (nbytes); nxset = alloca (nbytes); - __memset ((char *) nrset + bytes, 0, nbytes - bytes); - __memset ((char *) nwset + bytes, 0, nbytes - bytes); - __memset ((char *) nxset + bytes, 0, nbytes - bytes); + memset ((char *) nrset + bytes, 0, nbytes - bytes); + memset ((char *) nwset + bytes, 0, nbytes - bytes); + memset ((char *) nxset + bytes, 0, nbytes - bytes); - rset = __memcpy (nrset, rset, bytes); - wset = __memcpy (nwset, wset, bytes); - xset = __memcpy (nxset, xset, bytes); + rset = memcpy (nrset, rset, bytes); + wset = memcpy (nwset, wset, bytes); + xset = memcpy (nxset, xset, bytes); bytes = nbytes; } @@ -129,9 +130,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval sngl_tv; /* Clear the original set. */ - __memset (rset, 0, bytes); - __memset (wset, 0, bytes); - __memset (xset, 0, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); /* This means we don't wait for input. */ sngl_tv.tv_sec = 0; @@ -148,9 +149,9 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) { int n; - __memset (sngl_rset, 0, bytes); - __memset (sngl_wset, 0, bytes); - __memset (sngl_xset, 0, bytes); + memset (sngl_rset, 0, bytes); + memset (sngl_wset, 0, bytes); + memset (sngl_xset, 0, bytes); if (f->events & POLLIN) FD_SET (f->fd, sngl_rset); @@ -204,4 +205,5 @@ int attribute_hidden __poll(struct pollfd *fds, nfds_t nfds, int timeout) } #endif -strong_alias(__poll,poll) +libc_hidden_proto(poll) +libc_hidden_def(poll) diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 5662a440c..72419be7b 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -8,12 +8,8 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -/* need to hide the posix_fadvise64 prototype or the weak_alias() - * will fail when __NR_fadvise64_64 doesnt exist */ -#define posix_fadvise64 __hide_posix_fadvise64 #include "syscalls.h" #include <fcntl.h> -#undef posix_fadvise64 #ifdef __NR_fadvise64 #define __NR_posix_fadvise __NR_fadvise64 @@ -21,7 +17,7 @@ _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) +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..e5f23d509 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -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..c622b22d2 100644 --- a/libc/sysdeps/linux/common/pread_write.c +++ b/libc/sysdeps/linux/common/pread_write.c @@ -40,6 +40,12 @@ #include <unistd.h> #include <stdint.h> +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(lseek64) +#else +libc_hidden_proto(lseek) +#endif + #ifdef __NR_pread #define __NR___syscall_pread __NR_pread @@ -50,7 +56,7 @@ 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) +strong_alias(__libc_pread,pread) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) @@ -59,7 +65,7 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pread(fd, buf, count, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pread64, pread64) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pread */ @@ -75,7 +81,7 @@ 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) +strong_alias(__libc_pwrite,pwrite) #if defined __UCLIBC_HAS_LFS__ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) @@ -84,7 +90,7 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) uint32_t high = offset >> 32; return(__syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR (high, low))); } -weak_alias (__libc_pwrite64, pwrite64) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* __NR_pwrite */ @@ -100,11 +106,11 @@ 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) { @@ -118,7 +124,7 @@ static ssize_t __fake_pread_write(int fd, void *buf, /* 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); @@ -138,11 +144,11 @@ 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) { @@ -155,7 +161,7 @@ static ssize_t __fake_pread_write64(int fd, void *buf, /* Now we have to restore the position. */ save_errno = errno; - if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { + if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1) { if (result == -1) __set_errno (save_errno); return -1; @@ -171,14 +177,14 @@ 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) +strong_alias(__libc_pread,pread) #if defined __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) +strong_alias(__libc_pread64,pread64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pread */ @@ -190,14 +196,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) +strong_alias(__libc_pwrite,pwrite) #if defined __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) +strong_alias(__libc_pwrite64,pwrite64) #endif /* __UCLIBC_HAS_LFS__ */ #endif /* ! __NR_pwrite */ - diff --git a/libc/sysdeps/linux/common/read.c b/libc/sysdeps/linux/common/read.c index 6490bccbc..912533e55 100644 --- a/libc/sysdeps/linux/common/read.c +++ b/libc/sysdeps/linux/common/read.c @@ -10,7 +10,8 @@ #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) +#define __NR___libc_read __NR_read +_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count); +strong_alias(__libc_read,read) +libc_hidden_proto(read) +libc_hidden_def(read) diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c index 45db1a64f..d1587154d 100644 --- a/libc/sysdeps/linux/common/readlink.c +++ b/libc/sysdeps/linux/common/readlink.c @@ -9,6 +9,6 @@ #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) +_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz); +libc_hidden_proto(readlink) +libc_hidden_def(readlink) diff --git a/libc/sysdeps/linux/common/rmdir.c b/libc/sysdeps/linux/common/rmdir.c index 2f2c8a335..706fa0fd3 100644 --- a/libc/sysdeps/linux/common/rmdir.c +++ b/libc/sysdeps/linux/common/rmdir.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___rmdir __NR_rmdir -attribute_hidden _syscall1(int, __rmdir, const char *, pathname); -strong_alias(__rmdir,rmdir) +_syscall1(int, rmdir, const char *, pathname); +libc_hidden_proto(rmdir) +libc_hidden_def(rmdir) diff --git a/libc/sysdeps/linux/common/sbrk.c b/libc/sysdeps/linux/common/sbrk.c index d8507335b..bdc8c68a7 100644 --- a/libc/sysdeps/linux/common/sbrk.c +++ b/libc/sysdeps/linux/common/sbrk.c @@ -19,29 +19,31 @@ #include <unistd.h> #include <errno.h> +libc_hidden_proto(brk) + /* Defined in brk.c. */ extern void *__curbrk; -extern int __brk (void *addr) attribute_hidden; /* Extend the process's data space by INCREMENT. If INCREMENT is negative, shrink data space by - INCREMENT. Return start of new space allocated, or -1 for errors. */ -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_proto(sbrk) +libc_hidden_def(sbrk) diff --git a/libc/sysdeps/linux/common/select.c b/libc/sysdeps/linux/common/select.c index 36f88229a..19e14b99a 100644 --- a/libc/sysdeps/linux/common/select.c +++ b/libc/sysdeps/linux/common/select.c @@ -11,10 +11,10 @@ #include <unistd.h> #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_proto(select) +libc_hidden_def(select) diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c index d3175dad5..dcd207132 100644 --- a/libc/sysdeps/linux/common/setegid.c +++ b/libc/sysdeps/linux/common/setegid.c @@ -1,5 +1,8 @@ -#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> @@ -9,6 +12,9 @@ #include <sys/types.h> #include <sys/syscall.h> +libc_hidden_proto(setresgid) +libc_hidden_proto(setregid) + int setegid(gid_t gid) { int result; diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c index f5ed35743..aeb6356e5 100644 --- a/libc/sysdeps/linux/common/seteuid.c +++ b/libc/sysdeps/linux/common/seteuid.c @@ -1,5 +1,8 @@ -#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> @@ -9,7 +12,10 @@ #include <sys/types.h> #include <sys/syscall.h> -int attribute_hidden __seteuid(uid_t uid) +libc_hidden_proto(setresuid) +libc_hidden_proto(setreuid) + +int seteuid(uid_t uid) { int result; @@ -29,4 +35,4 @@ int attribute_hidden __seteuid(uid_t uid) return result; } -strong_alias(__seteuid,seteuid) +libc_hidden_proto(seteuid) diff --git a/libc/sysdeps/linux/common/setgroups.c b/libc/sysdeps/linux/common/setgroups.c index 49d85156f..a41578d62 100644 --- a/libc/sysdeps/linux/common/setgroups.c +++ b/libc/sysdeps/linux/common/setgroups.c @@ -7,18 +7,18 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define sysconf __sysconf - #include "syscalls.h" #include <stdlib.h> #include <unistd.h> #include <grp.h> +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 +47,5 @@ ret_error: return i; } } -strong_alias(__setgroups,setgroups) +libc_hidden_proto(setgroups) +libc_hidden_def(setgroups) diff --git a/libc/sysdeps/linux/common/setitimer.c b/libc/sysdeps/linux/common/setitimer.c index be51cb5c5..f34a9f39c 100644 --- a/libc/sysdeps/linux/common/setitimer.c +++ b/libc/sysdeps/linux/common/setitimer.c @@ -9,7 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -#define __NR___setitimer __NR_setitimer -attribute_hidden _syscall3(int, __setitimer, __itimer_which_t, which, +_syscall3(int, setitimer, __itimer_which_t, which, const struct itimerval *, new, struct itimerval *, old); -strong_alias(__setitimer,setitimer) +libc_hidden_proto(setitimer) +libc_hidden_def(setitimer) diff --git a/libc/sysdeps/linux/common/setpgid.c b/libc/sysdeps/linux/common/setpgid.c index 6d73f08ec..0453fbdfb 100644 --- a/libc/sysdeps/linux/common/setpgid.c +++ b/libc/sysdeps/linux/common/setpgid.c @@ -14,8 +14,9 @@ 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_proto(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..7347786af 100644 --- a/libc/sysdeps/linux/common/setpriority.c +++ b/libc/sysdeps/linux/common/setpriority.c @@ -9,6 +9,6 @@ #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) +_syscall3(int, setpriority, __priority_which_t, which, id_t, who, int, prio); +libc_hidden_proto(setpriority) +libc_hidden_def(setpriority) diff --git a/libc/sysdeps/linux/common/setregid.c b/libc/sysdeps/linux/common/setregid.c index cfd375744..043afffc9 100644 --- a/libc/sysdeps/linux/common/setregid.c +++ b/libc/sysdeps/linux/common/setregid.c @@ -14,7 +14,7 @@ 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 +23,4 @@ int attribute_hidden __setregid(gid_t rgid, gid_t egid) } return (__syscall_setregid(rgid, egid)); } -strong_alias(__setregid,setregid) +libc_hidden_proto(setregid) diff --git a/libc/sysdeps/linux/common/setresgid.c b/libc/sysdeps/linux/common/setresgid.c index fbfa98be3..82087d1c1 100644 --- a/libc/sysdeps/linux/common/setresgid.c +++ b/libc/sysdeps/linux/common/setresgid.c @@ -14,7 +14,7 @@ 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 +24,6 @@ int attribute_hidden __setresgid(gid_t rgid, gid_t egid, gid_t sgid) } return (__syscall_setresgid(rgid, egid, sgid)); } -strong_alias(__setresgid,setresgid) +libc_hidden_proto(setresgid) +libc_hidden_def(setresgid) #endif diff --git a/libc/sysdeps/linux/common/setresuid.c b/libc/sysdeps/linux/common/setresuid.c index 6ed1423f5..7d34c4027 100644 --- a/libc/sysdeps/linux/common/setresuid.c +++ b/libc/sysdeps/linux/common/setresuid.c @@ -14,7 +14,7 @@ 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 +24,6 @@ int attribute_hidden __setresuid(uid_t ruid, uid_t euid, uid_t suid) } return (__syscall_setresuid(ruid, euid, suid)); } -strong_alias(__setresuid,setresuid) +libc_hidden_proto(setresuid) +libc_hidden_def(setresuid) #endif diff --git a/libc/sysdeps/linux/common/setreuid.c b/libc/sysdeps/linux/common/setreuid.c index 15ab5c01a..93684d047 100644 --- a/libc/sysdeps/linux/common/setreuid.c +++ b/libc/sysdeps/linux/common/setreuid.c @@ -14,7 +14,7 @@ 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 +23,5 @@ int attribute_hidden __setreuid(uid_t ruid, uid_t euid) } return (__syscall_setreuid(ruid, euid)); } -strong_alias(__setreuid,setreuid) +libc_hidden_proto(setreuid) +libc_hidden_def(setreuid) diff --git a/libc/sysdeps/linux/common/setrlimit.c b/libc/sysdeps/linux/common/setrlimit.c index 9c5466a09..08e955e05 100644 --- a/libc/sysdeps/linux/common/setrlimit.c +++ b/libc/sysdeps/linux/common/setrlimit.c @@ -18,7 +18,7 @@ #define RMIN(x, y) ((x) < (y) ? (x) : (y)) 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; @@ -37,9 +37,9 @@ int attribute_hidden __setrlimit(__rlimit_resource_t resource, const struct rlim #include <unistd.h> struct rlimit; -#define __NR___setrlimit __NR_setrlimit -attribute_hidden _syscall2(int, __setrlimit, unsigned int, resource, +_syscall2(int, setrlimit, unsigned int, resource, const struct rlimit *, rlim); #endif -strong_alias(__setrlimit,setrlimit) +libc_hidden_proto(setrlimit) +libc_hidden_def(setrlimit) diff --git a/libc/sysdeps/linux/common/setrlimit64.c b/libc/sysdeps/linux/common/setrlimit64.c index d59057c90..b0d84de53 100644 --- a/libc/sysdeps/linux/common/setrlimit64.c +++ b/libc/sysdeps/linux/common/setrlimit64.c @@ -16,8 +16,6 @@ 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 @@ -38,6 +36,8 @@ #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. Return 0 if successful, -1 if not (and sets errno). */ diff --git a/libc/sysdeps/linux/common/setsid.c b/libc/sysdeps/linux/common/setsid.c index b3e1e8706..6b63e3a31 100644 --- a/libc/sysdeps/linux/common/setsid.c +++ b/libc/sysdeps/linux/common/setsid.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___setsid __NR_setsid -attribute_hidden _syscall0(pid_t, __setsid); -strong_alias(__setsid,setsid) +_syscall0(pid_t, setsid); +libc_hidden_proto(setsid) +libc_hidden_def(setsid) diff --git a/libc/sysdeps/linux/common/settimeofday.c b/libc/sysdeps/linux/common/settimeofday.c index 4e88b3edb..7f4c336a2 100644 --- a/libc/sysdeps/linux/common/settimeofday.c +++ b/libc/sysdeps/linux/common/settimeofday.c @@ -9,7 +9,7 @@ #include "syscalls.h" #include <sys/time.h> -#define __NR___settimeofday __NR_settimeofday -attribute_hidden _syscall2(int, __settimeofday, const struct timeval *, tv, +attribute_hidden _syscall2(int, settimeofday, const struct timeval *, tv, const struct timezone *, tz); -strong_alias(__settimeofday,settimeofday) +libc_hidden_proto(settimeofday) +libc_hidden_def(settimeofday) diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c index 7a18648e8..6ca040c59 100644 --- a/libc/sysdeps/linux/common/sigprocmask.c +++ b/libc/sysdeps/linux/common/sigprocmask.c @@ -19,7 +19,7 @@ static inline _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset, size_t, size); -int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -44,7 +44,7 @@ static inline _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set, sigset_t *, oldset); -int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset) +int sigprocmask(int how, const sigset_t * set, sigset_t * oldset) { if (set && #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2) @@ -62,4 +62,5 @@ int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * old } #endif -strong_alias(__sigprocmask,sigprocmask) +libc_hidden_proto(sigprocmask) +libc_hidden_def(sigprocmask) diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index be69c62c2..be90d7e87 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -15,7 +15,7 @@ #define __NR___rt_sigsuspend __NR_rt_sigsuspend static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size); -int attribute_hidden __sigsuspend(const sigset_t * mask) +int sigsuspend(const sigset_t * mask) { return __rt_sigsuspend(mask, _NSIG / 8); } @@ -24,9 +24,10 @@ int attribute_hidden __sigsuspend(const sigset_t * mask) static inline _syscall3(int, __syscall_sigsuspend, int, a, unsigned long int, b, unsigned long int, c); -int attribute_hidden __sigsuspend(const sigset_t * set) +int sigsuspend(const sigset_t * set) { return __syscall_sigsuspend(0, 0, set->__val[0]); } #endif -strong_alias(__sigsuspend,sigsuspend) +libc_hidden_proto(sigsuspend) +libc_hidden_def(sigsuspend) diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index ecd9dd8d7..33d84e5eb 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,8 +76,8 @@ 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))); diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c index 7cc6131b3..51e353f96 100644 --- a/libc/sysdeps/linux/common/stat.c +++ b/libc/sysdeps/linux/common/stat.c @@ -10,7 +10,6 @@ /* need to hide the 64bit prototype or the weak_alias() * will fail when __NR_stat64 doesnt exist */ #define stat64 __hidestat64 -#define __stat64 __hide__stat64 #include "syscalls.h" #include <unistd.h> @@ -18,15 +17,13 @@ #include "xstatconv.h" #undef stat64 -#undef __stat64 #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; @@ -37,9 +34,11 @@ int attribute_hidden __stat(const char *file_name, struct stat *buf) } return result; } -strong_alias(__stat,stat) +libc_hidden_proto(stat) +libc_hidden_def(stat) #if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__ -hidden_strong_alias(__stat,__stat64) -weak_alias(__stat,stat64) +strong_alias(stat,stat64) +libc_hidden_proto(stat64) +libc_hidden_def(stat64) #endif diff --git a/libc/sysdeps/linux/common/stat64.c b/libc/sysdeps/linux/common/stat64.c index dcd9163fb..e46cf8a25 100644 --- a/libc/sysdeps/linux/common/stat64.c +++ b/libc/sysdeps/linux/common/stat64.c @@ -18,8 +18,7 @@ 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; @@ -30,6 +29,7 @@ int attribute_hidden __stat64(const char *file_name, struct stat64 *buf) } return result; } -strong_alias(__stat64,stat64) +libc_hidden_proto(stat64) +libc_hidden_def(stat64) #endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c index f8aa9d3ba..d931707f4 100644 --- a/libc/sysdeps/linux/common/statfs.c +++ b/libc/sysdeps/linux/common/statfs.c @@ -16,8 +16,9 @@ static inline _syscall2(int, __syscall_statfs, const char *, path, struct statfs *, buf); -int attribute_hidden __statfs(const char *path, struct statfs * buf) +int statfs(const char *path, struct statfs * buf) { return __syscall_statfs(path, buf); } -strong_alias(__statfs,statfs) +libc_hidden_proto(statfs) +libc_hidden_def(statfs) diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index 02ebd5570..a4dc1c742 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -7,16 +7,15 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define gettimeofday __gettimeofday - #include "syscalls.h" #include <time.h> #include <sys/time.h> #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 +31,5 @@ time_t attribute_hidden __time(time_t * t) return result; } #endif -strong_alias(__time,time) +libc_hidden_proto(time) +libc_hidden_def(time) diff --git a/libc/sysdeps/linux/common/times.c b/libc/sysdeps/linux/common/times.c index 0fefdca10..fa751a03b 100644 --- a/libc/sysdeps/linux/common/times.c +++ b/libc/sysdeps/linux/common/times.c @@ -9,6 +9,6 @@ #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) +_syscall1(clock_t, times, struct tms *, buf); +libc_hidden_proto(times) +libc_hidden_def(times) diff --git a/libc/sysdeps/linux/common/truncate.c b/libc/sysdeps/linux/common/truncate.c index dd69bcb3e..d0b04ebee 100644 --- a/libc/sysdeps/linux/common/truncate.c +++ b/libc/sysdeps/linux/common/truncate.c @@ -10,4 +10,5 @@ #include "syscalls.h" #include <unistd.h> _syscall2(int, truncate, const char *, path, __off_t, length); -hidden_strong_alias(truncate, __truncate) +libc_hidden_proto(truncate) +libc_hidden_def(truncate) diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index 06b076c4f..df6c9e4d5 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -12,8 +12,6 @@ * the main directory of this archive for more details. */ -#define truncate __truncate - #include <features.h> #include <unistd.h> #include <errno.h> @@ -66,6 +64,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; @@ -82,4 +82,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..64bb45515 100644 --- a/libc/sysdeps/linux/common/ulimit.c +++ b/libc/sysdeps/linux/common/ulimit.c @@ -18,10 +18,6 @@ * */ -#define sysconf __sysconf -#define getrlimit __getrlimit -#define setrlimit __setrlimit - #define _GNU_SOURCE #define _LARGEFILE64_SOURCE #include <features.h> @@ -48,6 +44,10 @@ _syscall2(long, ulimit, int, cmd, int, arg); #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; diff --git a/libc/sysdeps/linux/common/uname.c b/libc/sysdeps/linux/common/uname.c index 3d252edc7..936b862c0 100644 --- a/libc/sysdeps/linux/common/uname.c +++ b/libc/sysdeps/linux/common/uname.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <sys/utsname.h> -#define __NR___uname __NR_uname -attribute_hidden _syscall1(int, __uname, struct utsname *, buf); -strong_alias(__uname,uname) +_syscall1(int, uname, struct utsname *, buf); +libc_hidden_proto(uname) +libc_hidden_def(uname) diff --git a/libc/sysdeps/linux/common/unlink.c b/libc/sysdeps/linux/common/unlink.c index 4d9c3cda9..37c145226 100644 --- a/libc/sysdeps/linux/common/unlink.c +++ b/libc/sysdeps/linux/common/unlink.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include <unistd.h> -#define __NR___unlink __NR_unlink -attribute_hidden _syscall1(int, __unlink, const char *, pathname); -strong_alias(__unlink,unlink) +_syscall1(int, unlink, const char *, pathname); +libc_hidden_proto(unlink) +libc_hidden_def(unlink) diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c index 8087863f7..a01da3697 100644 --- a/libc/sysdeps/linux/common/utime.c +++ b/libc/sysdeps/linux/common/utime.c @@ -7,18 +7,18 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define utimes __utimes -#define gettimeofday __gettimeofday - #include "syscalls.h" #include <utime.h> #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 +36,5 @@ int attribute_hidden __utime(const char *file, const struct utimbuf *times) return utimes(file, timevals); } #endif -strong_alias(__utime,utime) +libc_hidden_proto(utime) +libc_hidden_def(utime) diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c index ca45204c7..4dfcfb30a 100644 --- a/libc/sysdeps/linux/common/utimes.c +++ b/libc/sysdeps/linux/common/utimes.c @@ -7,17 +7,17 @@ * GNU Library General Public License (LGPL) version 2 or later. */ -#define utime __utime - #include "syscalls.h" #include <utime.h> #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 +31,5 @@ int attribute_hidden __utimes(const char *file, const struct timeval tvp[2]) return utime(file, times); } #endif -strong_alias(__utimes,utimes) +libc_hidden_proto(utimes) +libc_hidden_def(utimes) diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index d0a4d9a0e..df00b27c3 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -2,10 +2,11 @@ #include <unistd.h> #include <sys/types.h> -extern __pid_t __fork (void) __THROW attribute_hidden; +libc_hidden_proto(fork) -pid_t attribute_hidden __vfork(void) +pid_t vfork(void) { - return __fork(); + return fork(); } -strong_alias(__vfork,vfork) +libc_hidden_proto(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index b2a6d2295..471650e04 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -1,4 +1,8 @@ -#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 <stdlib.h> #include <syscall.h> @@ -6,10 +10,12 @@ #include <sys/wait.h> #include <sys/resource.h> +libc_hidden_proto(wait4) + /* Wait for a child to die. When one does, put its status in *STAT_LOC * and return its process ID. For errors, return (pid_t) -1. */ -__pid_t wait (__WAIT_STATUS_DEFN stat_loc) +__pid_t __libc_wait (__WAIT_STATUS_DEFN stat_loc) { - return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); + return wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); } -weak_alias(wait,__libc_wait) +strong_alias(__libc_wait,wait) 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..9acca8ff8 100644 --- a/libc/sysdeps/linux/common/wait4.c +++ b/libc/sysdeps/linux/common/wait4.c @@ -14,8 +14,9 @@ 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_proto(wait4) +libc_hidden_def(wait4) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index 612917fcf..aeeafc7c5 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -1,4 +1,8 @@ -#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 <stdlib.h> #include <sys/types.h> @@ -6,9 +10,12 @@ #include <sys/wait.h> #include <sys/resource.h> -__pid_t attribute_hidden __waitpid(__pid_t pid, int *wait_stat, int options) +libc_hidden_proto(wait4) + +__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) { - return __wait4(pid, wait_stat, options, NULL); + return wait4(pid, wait_stat, options, NULL); } -strong_alias(__waitpid,waitpid) -weak_alias(__waitpid,__libc_waitpid) +strong_alias(__libc_waitpid,waitpid) +libc_hidden_proto(waitpid) +libc_hidden_def(waitpid) diff --git a/libc/sysdeps/linux/common/write.c b/libc/sysdeps/linux/common/write.c index 8a1d57a82..814e68cc6 100644 --- a/libc/sysdeps/linux/common/write.c +++ b/libc/sysdeps/linux/common/write.c @@ -10,12 +10,13 @@ #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) +#define __NR___libc_write __NR_write +_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count); +strong_alias(__libc_write,write) +libc_hidden_proto(write) +libc_hidden_def(write) #if 0 /* Stupid libgcc.a from gcc 2.95.x uses __write in pure.o * which is a blatent GNU libc-ism... */ -weak_alias(__libc_write, __write) +strong_alias(__libc_write,__write) #endif |