From 3ab0557e5a3a81b5202334142326dd2e5edc5d28 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 13 Feb 2002 09:47:04 +0000 Subject: A number of naming updates in preparation for adding in proper threading. Most of this is from Stefan Soucek, with additions and changes as needed from me. --- libc/sysdeps/linux/common/longjmp.c | 7 ++-- libc/sysdeps/linux/common/syscalls.c | 72 ++++++++++++++++++++++++------------ libc/sysdeps/linux/common/wait.c | 5 +-- libc/sysdeps/linux/common/waitpid.c | 3 +- 4 files changed, 56 insertions(+), 31 deletions(-) (limited to 'libc/sysdeps/linux/common') diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 3502a0323..e416865f2 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -27,7 +27,7 @@ extern void __longjmp (__jmp_buf __env, int val); /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp call there to return VAL, or 1 if VAL is 0. */ -void longjmp (sigjmp_buf env, int val) +void __libc_longjmp (sigjmp_buf env, int val) { #if 0 /* Perform any cleanups needed by the frames being unwound. */ @@ -43,5 +43,6 @@ void longjmp (sigjmp_buf env, int val) __longjmp (env[0].__jmpbuf, val ?: 1); } -weak_alias (longjmp, _longjmp) -weak_alias (longjmp, siglongjmp) +weak_alias (__libc_longjmp, _longjmp) +weak_alias (__libc_longjmp, siglongjmp) +weak_alias (__libc_longjmp, __libc_siglongjmp) diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index bb4bb109e..30426a419 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -22,8 +22,8 @@ * */ -#include #include +#include #include #include @@ -39,10 +39,12 @@ _syscall1(void, _exit, int, status); #endif //#define __NR_fork 2 -#ifdef L_fork +#ifdef L___libc_fork #include # ifdef __UCLIBC_HAS_MMU__ - _syscall0(pid_t, fork); +#define __NR___libc_fork __NR_fork + _syscall0(pid_t, __libc_fork); + weak_alias (__libc_fork, fork) # else pid_t fork(void) { @@ -53,16 +55,19 @@ _syscall1(void, _exit, int, status); #endif //#define __NR_read 3 -#ifdef L_read +#ifdef L___libc_read #include -_syscall3(ssize_t, read, int, fd, __ptr_t, buf, size_t, count); +#define __NR___libc_read __NR_read +_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count); +weak_alias(__libc_read, read) #endif //#define __NR_write 4 -#ifdef L_write +#ifdef L___libc_write #include -_syscall3(ssize_t, write, int, fd, const __ptr_t, buf, size_t, count); -weak_alias(write, __write); +#define __NR___libc_write __NR_write +_syscall3(ssize_t, __libc_write, int, fd, const __ptr_t, buf, size_t, count); +weak_alias(__libc_write, write) #endif //#define __NR_open 5 @@ -75,7 +80,7 @@ weak_alias(write, __write); #endif _syscall3(int, __open, const char *, fn, int, flags, mode_t, mode); -int open(const char *file, int oflag, ...) +int __libc_open(const char *file, int oflag, ...) { int mode = 0; @@ -90,12 +95,15 @@ int open(const char *file, int oflag, ...) return __open(file, oflag, mode); } +weak_alias(__libc_open, open) #endif //#define __NR_close 6 -#ifdef L_close +#ifdef L___libc_close #include -_syscall1(int, close, int, fd); +#define __NR___libc_close __NR_close +_syscall1(int, __libc_close, int, fd); +weak_alias(__libc_close, close) #endif //#define __NR_waitpid 7 @@ -182,15 +190,20 @@ _syscall3(int, lchown, const char *, path, uid_t, owner, gid_t, group); //#define __NR_oldstat 18 //#define __NR_lseek 19 -#ifdef L_lseek +#ifdef L___libc_lseek #include -_syscall3(off_t, lseek, int, fildes, off_t, offset, int, whence); +#define __NR___libc_lseek __NR_lseek +_syscall3(off_t, __libc_lseek, int, fildes, off_t, offset, int, whence); +weak_alias(__libc_lseek, lseek) #endif //#define __NR_getpid 20 -#ifdef L_getpid +#ifdef L___libc_getpid #include -_syscall0(pid_t, getpid); +#define __NR___libc_getpid __NR_getpid +_syscall0(pid_t, __libc_getpid); +weak_alias(__libc_getpid, getpid) +weak_alias(__libc_getpid, __getpid) #endif //#define __NR_mount 21 @@ -256,9 +269,11 @@ _syscall1(unsigned int, alarm, unsigned int, seconds); //#define __NR_oldfstat 28 //#define __NR_pause 29 -#ifdef L_pause +#ifdef L___libc_pause #include -_syscall0(int, pause); +#define __NR___libc_pause __NR_pause +_syscall0(int, __libc_pause); +weak_alias(__libc_pause, pause) #endif //#define __NR_utime 30 @@ -458,7 +473,7 @@ extern int _fcntl(int fd, int cmd, long arg); _syscall3(int, _fcntl, int, fd, int, cmd, long, arg); -int fcntl(int fd, int command, ...) +int __libc_fcntl(int fd, int command, ...) { long arg; va_list list; @@ -469,6 +484,7 @@ int fcntl(int fd, int command, ...) va_end(list); return _fcntl(fd, command, arg); } +weak_alias(__libc_fcntl, fcntl) #endif //#define __NR_mpx 56 @@ -951,9 +967,11 @@ _syscall5(int, __ipc, unsigned int, call, int, first, int, second, int, third, v #endif //#define __NR_fsync 118 -#ifdef L_fsync +#ifdef L___libc_fsync #include -_syscall1(int, fsync, int, fd); +#define __NR___libc_fsync __NR_fsync +_syscall1(int, __libc_fsync, int, fd); +weak_alias(__libc_fsync, fsync) #endif //#define __NR_sigreturn 119 @@ -1123,6 +1141,11 @@ _syscall2(int,flock,int,fd, int,operation); #endif //#define __NR_msync 144 +/* If this ever gets implemented, be sure to use the __libc_ convention + * so that it can be over-ridden with a cancelable version by linuxthreads. + * Also update uClibc/libpthread/linuxthreads/wrapsyscall.c to do the override. + */ + //#define __NR_readv 145 #ifdef L_readv @@ -1251,17 +1274,18 @@ _syscall2(int, sched_rr_get_interval, pid_t, pid, struct timespec *, tp); #endif //#define __NR_nanosleep 162 -#ifdef L_nanosleep +#ifdef L___libc_nanosleep #include -_syscall2(int, nanosleep, const struct timespec *, req, struct timespec *, rem); +#define __NR___libc_nanosleep __NR_nanosleep +_syscall2(int, __libc_nanosleep, const struct timespec *, req, struct timespec *, rem); +weak_alias(__libc_nanosleep, nanosleep) #endif //#define __NR_mremap 163 #ifdef L_mremap #include #include -_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t, - new_size, int, may_move); +_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t, new_size, int, may_move); #endif //#define __NR_setresuid 164 diff --git a/libc/sysdeps/linux/common/wait.c b/libc/sysdeps/linux/common/wait.c index 13f9e148e..6c46d0caa 100644 --- a/libc/sysdeps/linux/common/wait.c +++ b/libc/sysdeps/linux/common/wait.c @@ -6,9 +6,8 @@ /* 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); } - - +weak_alias(__libc_wait, wait) diff --git a/libc/sysdeps/linux/common/waitpid.c b/libc/sysdeps/linux/common/waitpid.c index a912e5179..fef93173b 100644 --- a/libc/sysdeps/linux/common/waitpid.c +++ b/libc/sysdeps/linux/common/waitpid.c @@ -4,7 +4,8 @@ #include #include -__pid_t waitpid(__pid_t pid, int *wait_stat, int options) +__pid_t __libc_waitpid(__pid_t pid, int *wait_stat, int options) { return wait4(pid, wait_stat, options, NULL); } +weak_alias(__libc_waitpid, waitpid) -- cgit v1.2.3