summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-13 09:47:04 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-13 09:47:04 +0000
commit3ab0557e5a3a81b5202334142326dd2e5edc5d28 (patch)
treefbc4cb8ae1dd73c49fdf4f898d0fb329e8551164 /libc/sysdeps/linux
parent80e6061ac5deca193759b979d34906bfc9b857ef (diff)
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.
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/longjmp.c7
-rw-r--r--libc/sysdeps/linux/common/syscalls.c72
-rw-r--r--libc/sysdeps/linux/common/wait.c5
-rw-r--r--libc/sysdeps/linux/common/waitpid.c3
-rw-r--r--libc/sysdeps/linux/sh/longjmp.c9
5 files changed, 60 insertions, 36 deletions
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 <errno.h>
#include <features.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/syscall.h>
@@ -39,10 +39,12 @@ _syscall1(void, _exit, int, status);
#endif
//#define __NR_fork 2
-#ifdef L_fork
+#ifdef L___libc_fork
#include <unistd.h>
# 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 <unistd.h>
-_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 <unistd.h>
-_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 <unistd.h>
-_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 <unistd.h>
-_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 <unistd.h>
-_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 <unistd.h>
-_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 <unistd.h>
-_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 <time.h>
-_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 <unistd.h>
#include <sys/mman.h>
-_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 <sys/wait.h>
#include <sys/resource.h>
-__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)
diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c
index 5395d5568..9c81e0432 100644
--- a/libc/sysdeps/linux/sh/longjmp.c
+++ b/libc/sysdeps/linux/sh/longjmp.c
@@ -28,8 +28,7 @@
/* 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
-__uClibc_siglongjmp (sigjmp_buf env, int val)
+void __libc_siglongjmp (sigjmp_buf env, int val)
{
if (env[0].__mask_was_saved)
/* Restore the saved signal mask. */
@@ -40,7 +39,7 @@ __uClibc_siglongjmp (sigjmp_buf env, int val)
__longjmp (env[0].__jmpbuf, val ?: 1);
}
-__asm__(".weak longjmp; longjmp = __uClibc_siglongjmp");
-__asm__(".weak _longjmp; _longjmp = __uClibc_siglongjmp");
-__asm__(".weak siglongjmp; siglongjmp = __uClibc_siglongjmp");
+__asm__(".weak longjmp; longjmp = __libc_siglongjmp");
+__asm__(".weak _longjmp; _longjmp = __libc_siglongjmp");
+__asm__(".weak siglongjmp; siglongjmp = __libc_siglongjmp");
__asm__(".weak __sigprocmask; __sigprocmask = sigprocmask");