From 6334e558ab33ee1e54ed33740881a2798c5915c2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 21 Jan 2004 23:27:48 +0000 Subject: Split up syscalls.c, since it had grown to be quite large and ugly. -Erik --- libc/misc/sysvipc/ftok.c | 5 +- libc/misc/sysvipc/ipc.h | 2 +- libc/misc/sysvipc/msgq.c | 10 +- libc/misc/sysvipc/sem.c | 14 +- libc/misc/sysvipc/shm.c | 8 +- libc/sysdeps/linux/common/Makefile | 49 +- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 48 + libc/sysdeps/linux/common/__socketcall.c | 14 + libc/sysdeps/linux/common/__syscall_fcntl.c | 38 + libc/sysdeps/linux/common/__syscall_fcntl64.c | 30 + libc/sysdeps/linux/common/__syscall_ipc.c | 16 + libc/sysdeps/linux/common/__syscall_rt_sigaction.c | 21 + libc/sysdeps/linux/common/__syscall_sigaction.c | 19 + libc/sysdeps/linux/common/_exit.c | 2 +- libc/sysdeps/linux/common/access.c | 12 + libc/sysdeps/linux/common/acct.c | 12 + libc/sysdeps/linux/common/adjtimex.c | 15 + libc/sysdeps/linux/common/alarm.c | 34 + libc/sysdeps/linux/common/bdflush.c | 12 + libc/sysdeps/linux/common/capget.c | 19 + libc/sysdeps/linux/common/capset.c | 19 + libc/sysdeps/linux/common/chdir.c | 20 + libc/sysdeps/linux/common/chmod.c | 19 + libc/sysdeps/linux/common/chown.c | 25 + libc/sysdeps/linux/common/chroot.c | 21 + libc/sysdeps/linux/common/close.c | 15 + libc/sysdeps/linux/common/delete_module.c | 19 + libc/sysdeps/linux/common/dup.c | 12 + libc/sysdeps/linux/common/dup2.c | 12 + libc/sysdeps/linux/common/execve.c | 22 + libc/sysdeps/linux/common/fchdir.c | 12 + libc/sysdeps/linux/common/fchmod.c | 20 + libc/sysdeps/linux/common/fchown.c | 25 + libc/sysdeps/linux/common/fdatasync.c | 12 + libc/sysdeps/linux/common/flock.c | 19 + libc/sysdeps/linux/common/fork.c | 23 + libc/sysdeps/linux/common/fstat.c | 34 + libc/sysdeps/linux/common/fstat64.c | 33 + libc/sysdeps/linux/common/fstatfs.c | 12 + libc/sysdeps/linux/common/fsync.c | 15 + libc/sysdeps/linux/common/ftruncate.c | 12 + libc/sysdeps/linux/common/get_kernel_syms.c | 12 + libc/sysdeps/linux/common/getegid.c | 25 + libc/sysdeps/linux/common/geteuid.c | 25 + libc/sysdeps/linux/common/getgid.c | 22 + libc/sysdeps/linux/common/getgroups.c | 36 + libc/sysdeps/linux/common/getitimer.c | 12 + libc/sysdeps/linux/common/getpgid.c | 19 + libc/sysdeps/linux/common/getpgrp.c | 12 + libc/sysdeps/linux/common/getpid.c | 19 + libc/sysdeps/linux/common/getppid.c | 19 + libc/sysdeps/linux/common/getpriority.c | 28 + libc/sysdeps/linux/common/getresgid.c | 28 + libc/sysdeps/linux/common/getresuid.c | 28 + libc/sysdeps/linux/common/getrlimit.c | 47 + libc/sysdeps/linux/common/getrusage.c | 13 + libc/sysdeps/linux/common/getsid.c | 19 + libc/sysdeps/linux/common/gettimeofday.c | 12 + libc/sysdeps/linux/common/getuid.c | 23 + libc/sysdeps/linux/common/init_module.c | 15 + libc/sysdeps/linux/common/ioctl.c | 14 +- libc/sysdeps/linux/common/ioperm.c | 19 + libc/sysdeps/linux/common/iopl.c | 23 + libc/sysdeps/linux/common/kill.c | 20 + libc/sysdeps/linux/common/klogctl.c | 17 + libc/sysdeps/linux/common/lchown.c | 25 + libc/sysdeps/linux/common/link.c | 12 + libc/sysdeps/linux/common/list_syscalls.sh | 4 - libc/sysdeps/linux/common/lseek.c | 15 + libc/sysdeps/linux/common/lstat.c | 35 + libc/sysdeps/linux/common/lstat64.c | 33 + libc/sysdeps/linux/common/madvise.c | 11 + libc/sysdeps/linux/common/mkdir.c | 20 + libc/sysdeps/linux/common/mknod.c | 24 + libc/sysdeps/linux/common/mlock.c | 14 + libc/sysdeps/linux/common/mlockall.c | 14 + libc/sysdeps/linux/common/mmap.c | 28 + libc/sysdeps/linux/common/modify_ldt.c | 13 + libc/sysdeps/linux/common/mount.c | 14 + libc/sysdeps/linux/common/mprotect.c | 12 + libc/sysdeps/linux/common/mremap.c | 14 + libc/sysdeps/linux/common/msync.c | 16 + libc/sysdeps/linux/common/munlock.c | 14 + libc/sysdeps/linux/common/munlockall.c | 14 + libc/sysdeps/linux/common/munmap.c | 13 + libc/sysdeps/linux/common/nanosleep.c | 16 + libc/sysdeps/linux/common/nice.c | 37 + libc/sysdeps/linux/common/open.c | 41 + libc/sysdeps/linux/common/pause.c | 28 + libc/sysdeps/linux/common/personality.c | 12 + libc/sysdeps/linux/common/pipe.c | 12 + libc/sysdeps/linux/common/pivot_root.c | 11 + libc/sysdeps/linux/common/prctl.c | 13 + libc/sysdeps/linux/common/query_module.c | 21 + libc/sysdeps/linux/common/quotactl.c | 13 + libc/sysdeps/linux/common/read.c | 15 + libc/sysdeps/linux/common/readlink.c | 12 + libc/sysdeps/linux/common/readv.c | 13 + libc/sysdeps/linux/common/reboot.c | 16 + libc/sysdeps/linux/common/rename.c | 24 + libc/sysdeps/linux/common/rmdir.c | 12 + libc/sysdeps/linux/common/sched_get_priority_max.c | 12 + libc/sysdeps/linux/common/sched_get_priority_min.c | 12 + libc/sysdeps/linux/common/sched_getparam.c | 20 + libc/sysdeps/linux/common/sched_getscheduler.c | 19 + libc/sysdeps/linux/common/sched_rr_get_interval.c | 20 + libc/sysdeps/linux/common/sched_setparam.c | 20 + libc/sysdeps/linux/common/sched_setscheduler.c | 20 + libc/sysdeps/linux/common/sched_yield.c | 12 + libc/sysdeps/linux/common/select.c | 29 + libc/sysdeps/linux/common/sendfile.c | 14 + libc/sysdeps/linux/common/setdomainname.c | 12 + libc/sysdeps/linux/common/setfsgid.c | 23 + libc/sysdeps/linux/common/setfsuid.c | 23 + libc/sysdeps/linux/common/setgid.c | 23 + libc/sysdeps/linux/common/setgroups.c | 36 + libc/sysdeps/linux/common/sethostname.c | 12 + libc/sysdeps/linux/common/setitimer.c | 13 + libc/sysdeps/linux/common/setpgid.c | 20 + libc/sysdeps/linux/common/setpriority.c | 12 + libc/sysdeps/linux/common/setregid.c | 25 + libc/sysdeps/linux/common/setresgid.c | 25 + libc/sysdeps/linux/common/setresuid.c | 25 + libc/sysdeps/linux/common/setreuid.c | 25 + libc/sysdeps/linux/common/setrlimit.c | 41 + libc/sysdeps/linux/common/setsid.c | 12 + libc/sysdeps/linux/common/settimeofday.c | 13 + libc/sysdeps/linux/common/setuid.c | 23 + libc/sysdeps/linux/common/sigaltstack.c | 13 + libc/sysdeps/linux/common/sigpending.c | 25 + libc/sysdeps/linux/common/sigprocmask.c | 63 + libc/sysdeps/linux/common/sigsuspend.c | 34 + libc/sysdeps/linux/common/ssp.c | 4 +- libc/sysdeps/linux/common/stat.c | 34 + libc/sysdeps/linux/common/stat64.c | 33 + libc/sysdeps/linux/common/statfs.c | 23 + libc/sysdeps/linux/common/stime.c | 28 + libc/sysdeps/linux/common/str_syscalls.sh | 34 - libc/sysdeps/linux/common/swapoff.c | 12 + libc/sysdeps/linux/common/swapon.c | 12 + libc/sysdeps/linux/common/symlink.c | 12 + libc/sysdeps/linux/common/syscalls.c | 2280 -------------------- libc/sysdeps/linux/common/syscalls.h | 37 + libc/sysdeps/linux/common/sysctl.c | 37 + libc/sysdeps/linux/common/sysfs.c | 11 + libc/sysdeps/linux/common/sysinfo.c | 12 + libc/sysdeps/linux/common/time.c | 31 + libc/sysdeps/linux/common/times.c | 12 + libc/sysdeps/linux/common/truncate.c | 12 + libc/sysdeps/linux/common/umask.c | 19 + libc/sysdeps/linux/common/umount.c | 12 + libc/sysdeps/linux/common/umount2.c | 20 + libc/sysdeps/linux/common/uname.c | 12 + libc/sysdeps/linux/common/unified_syscall_i386.h | 35 - libc/sysdeps/linux/common/unlink.c | 12 + libc/sysdeps/linux/common/uselib.c | 12 + libc/sysdeps/linux/common/ustat.c | 24 + libc/sysdeps/linux/common/utime.c | 34 + libc/sysdeps/linux/common/utimes.c | 30 + libc/sysdeps/linux/common/vhangup.c | 12 + libc/sysdeps/linux/common/wait4.c | 19 + libc/sysdeps/linux/common/write.c | 18 + libc/sysdeps/linux/common/writev.c | 13 + libc/sysdeps/linux/common/xstatconv.h | 4 +- libc/sysdeps/linux/i960/_mmap.S | 52 - libc/sysdeps/linux/i960/mmap.S | 52 + libc/sysdeps/linux/microblaze/_mmap.c | 9 - libc/sysdeps/linux/microblaze/mmap.c | 9 + libc/sysdeps/linux/mips/_mmap.c | 18 - libc/sysdeps/linux/mips/mmap.c | 18 + libc/sysdeps/linux/powerpc/_mmap.c | 48 - libc/sysdeps/linux/powerpc/ioctl.c | 4 +- libc/sysdeps/linux/powerpc/mmap.c | 48 + libc/sysdeps/linux/sh/_mmap.c | 71 - libc/sysdeps/linux/sh/mmap.c | 71 + libc/sysdeps/linux/v850/_mmap.c | 9 - libc/sysdeps/linux/v850/mmap.c | 9 + 177 files changed, 3325 insertions(+), 2598 deletions(-) create mode 100644 libc/sysdeps/linux/common/__rt_sigtimedwait.c create mode 100644 libc/sysdeps/linux/common/__socketcall.c create mode 100644 libc/sysdeps/linux/common/__syscall_fcntl.c create mode 100644 libc/sysdeps/linux/common/__syscall_fcntl64.c create mode 100644 libc/sysdeps/linux/common/__syscall_ipc.c create mode 100644 libc/sysdeps/linux/common/__syscall_rt_sigaction.c create mode 100644 libc/sysdeps/linux/common/__syscall_sigaction.c create mode 100644 libc/sysdeps/linux/common/access.c create mode 100644 libc/sysdeps/linux/common/acct.c create mode 100644 libc/sysdeps/linux/common/adjtimex.c create mode 100644 libc/sysdeps/linux/common/alarm.c create mode 100644 libc/sysdeps/linux/common/bdflush.c create mode 100644 libc/sysdeps/linux/common/capget.c create mode 100644 libc/sysdeps/linux/common/capset.c create mode 100644 libc/sysdeps/linux/common/chdir.c create mode 100644 libc/sysdeps/linux/common/chmod.c create mode 100644 libc/sysdeps/linux/common/chown.c create mode 100644 libc/sysdeps/linux/common/chroot.c create mode 100644 libc/sysdeps/linux/common/close.c create mode 100644 libc/sysdeps/linux/common/delete_module.c create mode 100644 libc/sysdeps/linux/common/dup.c create mode 100644 libc/sysdeps/linux/common/dup2.c create mode 100644 libc/sysdeps/linux/common/execve.c create mode 100644 libc/sysdeps/linux/common/fchdir.c create mode 100644 libc/sysdeps/linux/common/fchmod.c create mode 100644 libc/sysdeps/linux/common/fchown.c create mode 100644 libc/sysdeps/linux/common/fdatasync.c create mode 100644 libc/sysdeps/linux/common/flock.c create mode 100644 libc/sysdeps/linux/common/fork.c create mode 100644 libc/sysdeps/linux/common/fstat.c create mode 100644 libc/sysdeps/linux/common/fstat64.c create mode 100644 libc/sysdeps/linux/common/fstatfs.c create mode 100644 libc/sysdeps/linux/common/fsync.c create mode 100644 libc/sysdeps/linux/common/ftruncate.c create mode 100644 libc/sysdeps/linux/common/get_kernel_syms.c create mode 100644 libc/sysdeps/linux/common/getegid.c create mode 100644 libc/sysdeps/linux/common/geteuid.c create mode 100644 libc/sysdeps/linux/common/getgid.c create mode 100644 libc/sysdeps/linux/common/getgroups.c create mode 100644 libc/sysdeps/linux/common/getitimer.c create mode 100644 libc/sysdeps/linux/common/getpgid.c create mode 100644 libc/sysdeps/linux/common/getpgrp.c create mode 100644 libc/sysdeps/linux/common/getpid.c create mode 100644 libc/sysdeps/linux/common/getppid.c create mode 100644 libc/sysdeps/linux/common/getpriority.c create mode 100644 libc/sysdeps/linux/common/getresgid.c create mode 100644 libc/sysdeps/linux/common/getresuid.c create mode 100644 libc/sysdeps/linux/common/getrlimit.c create mode 100644 libc/sysdeps/linux/common/getrusage.c create mode 100644 libc/sysdeps/linux/common/getsid.c create mode 100644 libc/sysdeps/linux/common/gettimeofday.c create mode 100644 libc/sysdeps/linux/common/getuid.c create mode 100644 libc/sysdeps/linux/common/init_module.c create mode 100644 libc/sysdeps/linux/common/ioperm.c create mode 100644 libc/sysdeps/linux/common/iopl.c create mode 100644 libc/sysdeps/linux/common/kill.c create mode 100644 libc/sysdeps/linux/common/klogctl.c create mode 100644 libc/sysdeps/linux/common/lchown.c create mode 100644 libc/sysdeps/linux/common/link.c delete mode 100755 libc/sysdeps/linux/common/list_syscalls.sh create mode 100644 libc/sysdeps/linux/common/lseek.c create mode 100644 libc/sysdeps/linux/common/lstat.c create mode 100644 libc/sysdeps/linux/common/lstat64.c create mode 100644 libc/sysdeps/linux/common/madvise.c create mode 100644 libc/sysdeps/linux/common/mkdir.c create mode 100644 libc/sysdeps/linux/common/mknod.c create mode 100644 libc/sysdeps/linux/common/mlock.c create mode 100644 libc/sysdeps/linux/common/mlockall.c create mode 100644 libc/sysdeps/linux/common/mmap.c create mode 100644 libc/sysdeps/linux/common/modify_ldt.c create mode 100644 libc/sysdeps/linux/common/mount.c create mode 100644 libc/sysdeps/linux/common/mprotect.c create mode 100644 libc/sysdeps/linux/common/mremap.c create mode 100644 libc/sysdeps/linux/common/msync.c create mode 100644 libc/sysdeps/linux/common/munlock.c create mode 100644 libc/sysdeps/linux/common/munlockall.c create mode 100644 libc/sysdeps/linux/common/munmap.c create mode 100644 libc/sysdeps/linux/common/nanosleep.c create mode 100644 libc/sysdeps/linux/common/nice.c create mode 100644 libc/sysdeps/linux/common/open.c create mode 100644 libc/sysdeps/linux/common/pause.c create mode 100644 libc/sysdeps/linux/common/personality.c create mode 100644 libc/sysdeps/linux/common/pipe.c create mode 100644 libc/sysdeps/linux/common/pivot_root.c create mode 100644 libc/sysdeps/linux/common/prctl.c create mode 100644 libc/sysdeps/linux/common/query_module.c create mode 100644 libc/sysdeps/linux/common/quotactl.c create mode 100644 libc/sysdeps/linux/common/read.c create mode 100644 libc/sysdeps/linux/common/readlink.c create mode 100644 libc/sysdeps/linux/common/readv.c create mode 100644 libc/sysdeps/linux/common/reboot.c create mode 100644 libc/sysdeps/linux/common/rename.c create mode 100644 libc/sysdeps/linux/common/rmdir.c create mode 100644 libc/sysdeps/linux/common/sched_get_priority_max.c create mode 100644 libc/sysdeps/linux/common/sched_get_priority_min.c create mode 100644 libc/sysdeps/linux/common/sched_getparam.c create mode 100644 libc/sysdeps/linux/common/sched_getscheduler.c create mode 100644 libc/sysdeps/linux/common/sched_rr_get_interval.c create mode 100644 libc/sysdeps/linux/common/sched_setparam.c create mode 100644 libc/sysdeps/linux/common/sched_setscheduler.c create mode 100644 libc/sysdeps/linux/common/sched_yield.c create mode 100644 libc/sysdeps/linux/common/select.c create mode 100644 libc/sysdeps/linux/common/sendfile.c create mode 100644 libc/sysdeps/linux/common/setdomainname.c create mode 100644 libc/sysdeps/linux/common/setfsgid.c create mode 100644 libc/sysdeps/linux/common/setfsuid.c create mode 100644 libc/sysdeps/linux/common/setgid.c create mode 100644 libc/sysdeps/linux/common/setgroups.c create mode 100644 libc/sysdeps/linux/common/sethostname.c create mode 100644 libc/sysdeps/linux/common/setitimer.c create mode 100644 libc/sysdeps/linux/common/setpgid.c create mode 100644 libc/sysdeps/linux/common/setpriority.c create mode 100644 libc/sysdeps/linux/common/setregid.c create mode 100644 libc/sysdeps/linux/common/setresgid.c create mode 100644 libc/sysdeps/linux/common/setresuid.c create mode 100644 libc/sysdeps/linux/common/setreuid.c create mode 100644 libc/sysdeps/linux/common/setrlimit.c create mode 100644 libc/sysdeps/linux/common/setsid.c create mode 100644 libc/sysdeps/linux/common/settimeofday.c create mode 100644 libc/sysdeps/linux/common/setuid.c create mode 100644 libc/sysdeps/linux/common/sigaltstack.c create mode 100644 libc/sysdeps/linux/common/sigpending.c create mode 100644 libc/sysdeps/linux/common/sigprocmask.c create mode 100644 libc/sysdeps/linux/common/sigsuspend.c create mode 100644 libc/sysdeps/linux/common/stat.c create mode 100644 libc/sysdeps/linux/common/stat64.c create mode 100644 libc/sysdeps/linux/common/statfs.c create mode 100644 libc/sysdeps/linux/common/stime.c delete mode 100755 libc/sysdeps/linux/common/str_syscalls.sh create mode 100644 libc/sysdeps/linux/common/swapoff.c create mode 100644 libc/sysdeps/linux/common/swapon.c create mode 100644 libc/sysdeps/linux/common/symlink.c delete mode 100644 libc/sysdeps/linux/common/syscalls.c create mode 100644 libc/sysdeps/linux/common/syscalls.h create mode 100644 libc/sysdeps/linux/common/sysctl.c create mode 100644 libc/sysdeps/linux/common/sysfs.c create mode 100644 libc/sysdeps/linux/common/sysinfo.c create mode 100644 libc/sysdeps/linux/common/time.c create mode 100644 libc/sysdeps/linux/common/times.c create mode 100644 libc/sysdeps/linux/common/truncate.c create mode 100644 libc/sysdeps/linux/common/umask.c create mode 100644 libc/sysdeps/linux/common/umount.c create mode 100644 libc/sysdeps/linux/common/umount2.c create mode 100644 libc/sysdeps/linux/common/uname.c delete mode 100644 libc/sysdeps/linux/common/unified_syscall_i386.h create mode 100644 libc/sysdeps/linux/common/unlink.c create mode 100644 libc/sysdeps/linux/common/uselib.c create mode 100644 libc/sysdeps/linux/common/ustat.c create mode 100644 libc/sysdeps/linux/common/utime.c create mode 100644 libc/sysdeps/linux/common/utimes.c create mode 100644 libc/sysdeps/linux/common/vhangup.c create mode 100644 libc/sysdeps/linux/common/wait4.c create mode 100644 libc/sysdeps/linux/common/write.c create mode 100644 libc/sysdeps/linux/common/writev.c delete mode 100644 libc/sysdeps/linux/i960/_mmap.S create mode 100644 libc/sysdeps/linux/i960/mmap.S delete mode 100644 libc/sysdeps/linux/microblaze/_mmap.c create mode 100644 libc/sysdeps/linux/microblaze/mmap.c delete mode 100644 libc/sysdeps/linux/mips/_mmap.c create mode 100644 libc/sysdeps/linux/mips/mmap.c delete mode 100644 libc/sysdeps/linux/powerpc/_mmap.c create mode 100644 libc/sysdeps/linux/powerpc/mmap.c delete mode 100644 libc/sysdeps/linux/sh/_mmap.c create mode 100644 libc/sysdeps/linux/sh/mmap.c delete mode 100644 libc/sysdeps/linux/v850/_mmap.c create mode 100644 libc/sysdeps/linux/v850/mmap.c diff --git a/libc/misc/sysvipc/ftok.c b/libc/misc/sysvipc/ftok.c index ce0bd3f40..2bd8b2ec0 100644 --- a/libc/misc/sysvipc/ftok.c +++ b/libc/misc/sysvipc/ftok.c @@ -20,10 +20,7 @@ #include #include -key_t -ftok (pathname, proj_id) - const char *pathname; - int proj_id; +key_t ftok (const char *pathname, int proj_id) { struct stat st; key_t key; diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h index 18011410f..741b720bc 100644 --- a/libc/misc/sysvipc/ipc.h +++ b/libc/misc/sysvipc/ipc.h @@ -5,7 +5,7 @@ #ifdef __NR_ipc /* The actual system call: all functions are multiplexed by this. */ -extern int __ipc __P((int __call, int __first, int __second, +extern int __syscall_ipc __P((int __call, int __first, int __second, int __third, void *__ptr)); diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c index ffd58df05..d4f48e7ad 100644 --- a/libc/misc/sysvipc/msgq.c +++ b/libc/misc/sysvipc/msgq.c @@ -11,7 +11,7 @@ _syscall3(int, msgctl, int, msqid, int, cmd, struct msqid_ds *, buf); /* Message queue control operation. */ int msgctl (int msqid, int cmd, struct msqid_ds *buf) { - return __ipc(IPCOP_msgctl ,msqid ,cmd ,0 ,buf); + return __syscall_ipc(IPCOP_msgctl ,msqid ,cmd ,0 ,buf); } #endif #endif @@ -24,7 +24,7 @@ _syscall2(int, msgget, key_t, key, int, msgflg) /* Get messages queue. */ int msgget (key_t key, int msgflg) { - return __ipc(IPCOP_msgget ,key ,msgflg ,0 ,0); + return __syscall_ipc(IPCOP_msgget ,key ,msgflg ,0 ,0); } #endif #endif @@ -32,7 +32,7 @@ int msgget (key_t key, int msgflg) struct new_msg_buf{ struct msgbuf * oldmsg; - long int r_msgtyp; /* the fifth arg of __ipc */ + long int r_msgtyp; /* the fifth arg of __syscall_ipc */ }; /* Receive message from message queue. */ @@ -48,7 +48,7 @@ int msgrcv (int msqid, void *msgp, size_t msgsz, temp.r_msgtyp = msgtyp; temp.oldmsg = msgp; - return __ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp); + return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp); } #endif #endif @@ -62,7 +62,7 @@ _syscall4(int, msgsnd, int, msqid, const void *, msgp, size_t, msgsz, int, msgfl /* Send message to message queue. */ int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) { - return __ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp); + return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp); } #endif #endif diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c index a3eaca7be..1cc39e7bd 100644 --- a/libc/misc/sysvipc/sem.c +++ b/libc/misc/sysvipc/sem.c @@ -44,7 +44,7 @@ static inline _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, union int semctl(int semid, int semnum, int cmd, ...) { union semun arg; - va_list ap; + va_list ap; /* Get the argument. */ va_start (ap, cmd); @@ -53,24 +53,24 @@ int semctl(int semid, int semnum, int cmd, ...) #ifdef __NR_semctl return __semctl(semid, semnum, cmd, &arg); #else - return __ipc(IPCOP_semctl, semid, semnum, cmd, &arg); + return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd, &arg); #endif -} +} #endif #ifdef L_semget /* for definition of NULL */ -#include +#include #ifdef __NR_semget _syscall3(int, semget, key_t, key, int, nsems, int, semflg); #else -/* Return identifier for array of NSEMS semaphores associated +/* Return identifier for array of NSEMS semaphores associated * with KEY. */ int semget (key_t key, int nsems, int semflg) { - return __ipc(IPCOP_semget, key, nsems, semflg, NULL); + return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL); } #endif #endif @@ -84,7 +84,7 @@ _syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops); /* Perform user-defined atomical operation of array of semaphores. */ int semop (int semid, struct sembuf *sops, size_t nsops) { - return __ipc(IPCOP_semop, semid, (int) nsops, 0, sops); + return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops); } #endif #endif diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 553c1203e..8193ac2f0 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -38,7 +38,7 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) int retval; unsigned long raddr; - retval = __ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr); + retval = __syscall_ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr); return ((unsigned long int) retval > -(unsigned long int) SHMLBA ? (void *) retval : (void *) raddr); } @@ -52,7 +52,7 @@ _syscall3(int, shmctl, int, shmid, int, cmd, struct shmid_ds *, buf); #else int shmctl (int shmid, int cmd, struct shmid_ds *buf) { - return __ipc(IPCOP_shmctl, shmid, cmd, 0, buf); + return __syscall_ipc(IPCOP_shmctl, shmid, cmd, 0, buf); } #endif #endif @@ -66,7 +66,7 @@ _syscall1(int, shmdt, const void *, shmaddr); #else int shmdt (const void *shmaddr) { - return __ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr); + return __syscall_ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr); } #endif #endif @@ -79,7 +79,7 @@ _syscall3(int, shmget, key_t, key, size_t, size, int, shmflg); #else int shmget (key_t key, size_t size, int shmflg) { - return __ipc(IPCOP_shmget, key, size, shmflg, NULL); + return __syscall_ipc(IPCOP_shmget, key, size, shmflg, NULL); } #endif #endif diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index ec53d33bf..3428f7262 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -26,7 +26,45 @@ CSRC= waitpid.c getdnnm.c gethstnm.c getcwd.c ptrace.c \ truncate64.c getrlimit64.c setrlimit64.c creat64.c \ llseek.c pread_write.c _exit.c sync.c getdirname.c \ sendfile64.c xstatconv.c getdents.c getdents64.c vfork.c \ - ulimit.c ntp_gettime.c poll.c + ulimit.c ntp_gettime.c poll.c \ + fork.c read.c write.c open.c \ + close.c link.c unlink.c execve.c chdir.c \ + time.c mknod.c chmod.c lchown.c \ + lseek.c getpid.c mount.c umount.c setuid.c \ + getuid.c stime.c alarm.c pause.c utime.c utimes.c \ + access.c nice.c kill.c rename.c mkdir.c \ + rmdir.c dup.c pipe.c times.c setgid.c getgid.c \ + geteuid.c getegid.c acct.c umount2.c \ + ioctl.c setpgid.c \ + umask.c chroot.c ustat.c dup2.c \ + getppid.c getpgrp.c setsid.c __syscall_sigaction.c \ + setreuid.c setregid.c sigsuspend.c sigpending.c \ + sethostname.c setrlimit.c getrlimit.c getrusage.c \ + gettimeofday.c settimeofday.c getgroups.c \ + setgroups.c select.c symlink.c readlink.c uselib.c swapon.c \ + reboot.c mmap.c munmap.c truncate.c ftruncate.c fchmod.c \ + fchown.c getpriority.c setpriority.c \ + statfs.c fstatfs.c ioperm.c __socketcall.c klogctl.c \ + setitimer.c getitimer.c stat.c lstat.c \ + fstat.c iopl.c vhangup.c wait4.c swapoff.c \ + sysinfo.c __syscall_ipc.c fsync.c setdomainname.c uname.c modify_ldt.c \ + adjtimex.c mprotect.c sigprocmask.c init_module.c \ + delete_module.c get_kernel_syms.c quotactl.c getpgid.c \ + fchdir.c bdflush.c sysfs.c personality.c setfsuid.c \ + setfsgid.c flock.c msync.c \ + readv.c writev.c getsid.c fdatasync.c sysctl.c mlock.c \ + munlock.c mlockall.c munlockall.c sched_setparam.c \ + sched_getparam.c sched_setscheduler.c \ + sched_getscheduler.c sched_yield.c sched_get_priority_max.c \ + sched_get_priority_min.c sched_rr_get_interval.c \ + nanosleep.c mremap.c setresuid.c \ + getresuid.c query_module.c setresgid.c \ + getresgid.c prctl.c __syscall_rt_sigaction.c \ + __rt_sigtimedwait.c \ + chown.c capget.c capset.c sigaltstack.c \ + sendfile.c stat64.c lstat64.c \ + fstat64.c pivot_root.c madvise.c __syscall_fcntl.c __syscall_fcntl64.c + ifneq ($(strip $(EXCLUDE_BRK)),y) CSRC+=sbrk.c endif @@ -38,9 +76,6 @@ CSRC+=ssp.c endif COBJS=$(patsubst %.c,%.o, $(CSRC)) -MSRC=syscalls.c -MOBJ=$(shell ./list_syscalls.sh) - OBJ=$(COBJS) $(MOBJ) all: $(STR_SYSCALLS) $(OBJ) $(LIBC) @@ -50,10 +85,6 @@ $(LIBC): ar-target ar-target: $(OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJ) -$(MOBJ): $(MSRC) - $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(STRIPTOOL) -x -R .note -R .comment $*.o - $(COBJS): %.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -62,4 +93,4 @@ headers: $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h $(TOPDIR)/include/ clean: - $(RM) *.[oa] *~ core crt[in].* *.S + $(RM) *.[oa] *~ core diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c new file mode 100644 index 000000000..c5020039e --- /dev/null +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -0,0 +1,48 @@ +/* vi: set sw=4 ts=4: */ +/* + * __rt_sigtimedwait() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#define __need_NULL +#include +#ifdef __NR_rt_sigtimedwait +#define __NR___rt_sigtimedwait __NR_rt_sigtimedwait +_syscall4(int, __rt_sigtimedwait, const sigset_t *, set, siginfo_t *, info, + const struct timespec *, timeout, size_t, setsize); + +int sigwaitinfo(const sigset_t * set, siginfo_t * info) +{ + return __rt_sigtimedwait(set, info, NULL, _NSIG / 8); +} + +int sigtimedwait(const sigset_t * set, siginfo_t * info, + const struct timespec *timeout) +{ + return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); +} +#else +int sigwaitinfo(const sigset_t * set, siginfo_t * info) +{ + if (set == NULL) + __set_errno(EINVAL); + else + __set_errno(ENOSYS); + return -1; +} + +int sigtimedwait(const sigset_t * set, siginfo_t * info, + const struct timespec *timeout) +{ + if (set == NULL) + __set_errno(EINVAL); + else + __set_errno(ENOSYS); + return -1; +} +#endif diff --git a/libc/sysdeps/linux/common/__socketcall.c b/libc/sysdeps/linux/common/__socketcall.c new file mode 100644 index 000000000..e8e8ee0ee --- /dev/null +++ b/libc/sysdeps/linux/common/__socketcall.c @@ -0,0 +1,14 @@ +/* vi: set sw=4 ts=4: */ +/* + * __socketcall() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#ifdef __NR_socketcall +#define __NR___socketcall __NR_socketcall +_syscall2(int, __socketcall, int, call, unsigned long *, args); +#endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c new file mode 100644 index 000000000..279ad74ad --- /dev/null +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -0,0 +1,38 @@ +/* vi: set sw=4 ts=4: */ +/* + * __syscall_fcntl() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include + +#define __NR___syscall_fcntl __NR_fcntl +#ifdef __UCLIBC_HAS_LFS__ +static inline +#endif +_syscall3(int, __syscall_fcntl, int, fd, int, cmd, long, arg); + +int __libc_fcntl(int fd, int cmd, ...) +{ + long arg; + va_list list; + + if (cmd == F_GETLK64 || cmd == F_SETLK64 || cmd == F_SETLKW64) { + __set_errno(ENOSYS); + return -1; + } + va_start(list, cmd); + arg = va_arg(list, long); + va_end(list); + return (__syscall_fcntl(fd, cmd, arg)); +} + +weak_alias(__libc_fcntl, fcntl); +#if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__ +weak_alias(__libc_fcntl, fcntl64); +#endif diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c new file mode 100644 index 000000000..196798956 --- /dev/null +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -0,0 +1,30 @@ +/* vi: set sw=4 ts=4: */ +/* + * __syscall_fcntl64() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include + +#if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64 +#define __NR___syscall_fcntl64 __NR_fcntl64 +static inline _syscall3(int, __syscall_fcntl64, int, fd, int, cmd, long, arg); +int __libc_fcntl64(int fd, int cmd, ...) +{ + long arg; + va_list list; + + va_start(list, cmd); + arg = va_arg(list, long); + + va_end(list); + return (__syscall_fcntl64(fd, cmd, arg)); +} + +weak_alias(__libc_fcntl64, fcntl64); +#endif diff --git a/libc/sysdeps/linux/common/__syscall_ipc.c b/libc/sysdeps/linux/common/__syscall_ipc.c new file mode 100644 index 000000000..22957ac7b --- /dev/null +++ b/libc/sysdeps/linux/common/__syscall_ipc.c @@ -0,0 +1,16 @@ +/* vi: set sw=4 ts=4: */ +/* + * __syscall_ipc() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#ifdef __NR_ipc +#define __NR___syscall_ipc __NR_ipc +_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int, + third, void *, ptr); +#endif diff --git a/libc/sysdeps/linux/common/__syscall_rt_sigaction.c b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c new file mode 100644 index 000000000..e2924ff19 --- /dev/null +++ b/libc/sysdeps/linux/common/__syscall_rt_sigaction.c @@ -0,0 +1,21 @@ +/* vi: set sw=4 ts=4: */ +/* + * __syscall_rt_sigaction() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#ifdef __NR_rt_sigaction +#include + +#define __NR___syscall_rt_sigaction __NR_rt_sigaction +#undef sigaction +_syscall4(int, __syscall_rt_sigaction, int, signum, + const struct sigaction *, act, struct sigaction *, oldact, + size_t, size); + +#endif diff --git a/libc/sysdeps/linux/common/__syscall_sigaction.c b/libc/sysdeps/linux/common/__syscall_sigaction.c new file mode 100644 index 000000000..5f9ef1301 --- /dev/null +++ b/libc/sysdeps/linux/common/__syscall_sigaction.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * __syscall_sigaction() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#ifndef __NR_rt_sigaction +#define __NR___syscall_sigaction __NR_sigaction +#include +#undef sigaction +_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *, + act, struct sigaction *, oldact); +#endif + diff --git a/libc/sysdeps/linux/common/_exit.c b/libc/sysdeps/linux/common/_exit.c index 5e1f180bd..fcfbe517b 100644 --- a/libc/sysdeps/linux/common/_exit.c +++ b/libc/sysdeps/linux/common/_exit.c @@ -28,7 +28,7 @@ #ifndef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) __syscall_exit (args) -#define __NR___syscall_exit __NR_exit +#define __NR___syscall_exit __NR_exit static inline _syscall1(void, __syscall_exit, int, status); #endif diff --git a/libc/sysdeps/linux/common/access.c b/libc/sysdeps/linux/common/access.c new file mode 100644 index 000000000..9c77cbeed --- /dev/null +++ b/libc/sysdeps/linux/common/access.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * access() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, access, const char *, pathname, int, mode); diff --git a/libc/sysdeps/linux/common/acct.c b/libc/sysdeps/linux/common/acct.c new file mode 100644 index 000000000..acdccf9d9 --- /dev/null +++ b/libc/sysdeps/linux/common/acct.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * acct() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall1(int, acct, const char *, filename); diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c new file mode 100644 index 000000000..5bf4e6a3f --- /dev/null +++ b/libc/sysdeps/linux/common/adjtimex.c @@ -0,0 +1,15 @@ +/* vi: set sw=4 ts=4: */ +/* + * adjtimex() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall1(int, adjtimex, struct timex *, buf); + +weak_alias(adjtimex, __adjtimex); +weak_alias(adjtimex, ntp_adjtime); diff --git a/libc/sysdeps/linux/common/alarm.c b/libc/sysdeps/linux/common/alarm.c new file mode 100644 index 000000000..a0d6669f9 --- /dev/null +++ b/libc/sysdeps/linux/common/alarm.c @@ -0,0 +1,34 @@ +/* vi: set sw=4 ts=4: */ +/* + * alarm() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#ifdef __NR_alarm +_syscall1(unsigned int, alarm, unsigned int, seconds); +#else +#include +unsigned int alarm(unsigned int seconds) +{ + struct itimerval old, new; + unsigned int retval; + + new.it_value.tv_usec = 0; + new.it_interval.tv_sec = 0; + new.it_interval.tv_usec = 0; + new.it_value.tv_sec = (long int) seconds; + if (setitimer(ITIMER_REAL, &new, &old) < 0) { + return 0; + } + retval = old.it_value.tv_sec; + if (old.it_value.tv_usec) { + ++retval; + } + return retval; +} +#endif diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c new file mode 100644 index 000000000..b3c9bd9bd --- /dev/null +++ b/libc/sysdeps/linux/common/bdflush.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * bdflush() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, bdflush, int, __func, long int, __data); diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c new file mode 100644 index 000000000..bfde70318 --- /dev/null +++ b/libc/sysdeps/linux/common/capget.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * capget() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +# ifdef __NR_capget +_syscall2(int, capget, void *, header, void *, data); +# else +int capget(void *header, void *data) +{ + __set_errno(ENOSYS); + return -1; +} +# endif diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c new file mode 100644 index 000000000..9815e3981 --- /dev/null +++ b/libc/sysdeps/linux/common/capset.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * capset() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +# ifdef __NR_capset +_syscall2(int, capset, void *, header, const void *, data); +# else +int capset(void *header, const void *data) +{ + __set_errno(ENOSYS); + return -1; +} +# endif diff --git a/libc/sysdeps/linux/common/chdir.c b/libc/sysdeps/linux/common/chdir.c new file mode 100644 index 000000000..d04b9a281 --- /dev/null +++ b/libc/sysdeps/linux/common/chdir.c @@ -0,0 +1,20 @@ +/* vi: set sw=4 ts=4: */ +/* + * chdir() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include + +#define __NR___syscall_chdir __NR_chdir +static inline _syscall1(int, __syscall_chdir, const char *, path); +int chdir(const char *path) +{ + return __syscall_chdir(path); +} + diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c new file mode 100644 index 000000000..a6023f37d --- /dev/null +++ b/libc/sysdeps/linux/common/chmod.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * chmod() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_chmod __NR_chmod +static inline _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode); + +int chmod(const char *path, mode_t mode) +{ + return __syscall_chmod(path, mode); +} diff --git a/libc/sysdeps/linux/common/chown.c b/libc/sysdeps/linux/common/chown.c new file mode 100644 index 000000000..2d4fcc0da --- /dev/null +++ b/libc/sysdeps/linux/common/chown.c @@ -0,0 +1,25 @@ +/* vi: set sw=4 ts=4: */ +/* + * chown() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_chown __NR_chown +static inline _syscall3(int, __syscall_chown, const char *, path, + __kernel_uid_t, owner, __kernel_gid_t, group); + +int chown(const char *path, uid_t owner, gid_t group) +{ + if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U)) + || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) { + __set_errno(EINVAL); + return -1; + } + return (__syscall_chown(path, owner, group)); +} diff --git a/libc/sysdeps/linux/common/chroot.c b/libc/sysdeps/linux/common/chroot.c new file mode 100644 index 000000000..e38280012 --- /dev/null +++ b/libc/sysdeps/linux/common/chroot.c @@ -0,0 +1,21 @@ +/* vi: set sw=4 ts=4: */ +/* + * chroot() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include +#include + +#define __NR___syscall_chroot __NR_chroot +static inline _syscall1(int, __syscall_chroot, const char *, path); + +int chroot(const char *path) +{ + return __syscall_chroot(path); +} diff --git a/libc/sysdeps/linux/common/close.c b/libc/sysdeps/linux/common/close.c new file mode 100644 index 000000000..efd0d9d3e --- /dev/null +++ b/libc/sysdeps/linux/common/close.c @@ -0,0 +1,15 @@ +/* vi: set sw=4 ts=4: */ +/* + * close() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___libc_close __NR_close +_syscall1(int, __libc_close, int, fd); +weak_alias(__libc_close, close); diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c new file mode 100644 index 000000000..bcdb7a811 --- /dev/null +++ b/libc/sysdeps/linux/common/delete_module.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * delete_module() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +# ifdef __NR_delete_module +_syscall1(int, delete_module, const char *, name); +# else +int delete_module(const char *name) +{ + __set_errno(ENOSYS); + return -1; +} +# endif diff --git a/libc/sysdeps/linux/common/dup.c b/libc/sysdeps/linux/common/dup.c new file mode 100644 index 000000000..559d302c1 --- /dev/null +++ b/libc/sysdeps/linux/common/dup.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * dup() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall1(int, dup, int, oldfd); diff --git a/libc/sysdeps/linux/common/dup2.c b/libc/sysdeps/linux/common/dup2.c new file mode 100644 index 000000000..ab61f6327 --- /dev/null +++ b/libc/sysdeps/linux/common/dup2.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * dup2() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, dup2, int, oldfd, int, newfd); diff --git a/libc/sysdeps/linux/common/execve.c b/libc/sysdeps/linux/common/execve.c new file mode 100644 index 000000000..5f79fd02f --- /dev/null +++ b/libc/sysdeps/linux/common/execve.c @@ -0,0 +1,22 @@ +/* vi: set sw=4 ts=4: */ +/* + * execve() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include +#include + +#define __NR___syscall_execve __NR_execve +static inline _syscall3(int, __syscall_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); +} diff --git a/libc/sysdeps/linux/common/fchdir.c b/libc/sysdeps/linux/common/fchdir.c new file mode 100644 index 000000000..8b15dc8a4 --- /dev/null +++ b/libc/sysdeps/linux/common/fchdir.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * fchdir() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall1(int, fchdir, int, fd); diff --git a/libc/sysdeps/linux/common/fchmod.c b/libc/sysdeps/linux/common/fchmod.c new file mode 100644 index 000000000..540fd3f45 --- /dev/null +++ b/libc/sysdeps/linux/common/fchmod.c @@ -0,0 +1,20 @@ +/* vi: set sw=4 ts=4: */ +/* + * fchmod() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_fchmod __NR_fchmod +static inline _syscall2(int, __syscall_fchmod, + int, fildes, __kernel_mode_t, mode); + +int fchmod(int fildes, mode_t mode) +{ + return (__syscall_fchmod(fildes, mode)); +} diff --git a/libc/sysdeps/linux/common/fchown.c b/libc/sysdeps/linux/common/fchown.c new file mode 100644 index 000000000..a54b450c4 --- /dev/null +++ b/libc/sysdeps/linux/common/fchown.c @@ -0,0 +1,25 @@ +/* vi: set sw=4 ts=4: */ +/* + * fchown() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_fchown __NR_fchown +static inline _syscall3(int, __syscall_fchown, int, fd, + __kernel_uid_t, owner, __kernel_gid_t, group); + +int fchown(int fd, uid_t owner, gid_t group) +{ + if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U)) + || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) { + __set_errno(EINVAL); + return -1; + } + return (__syscall_fchown(fd, owner, group)); +} diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c new file mode 100644 index 000000000..5695c5090 --- /dev/null +++ b/libc/sysdeps/linux/common/fdatasync.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * fdatasync() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall1(int, fdatasync, int, fd); diff --git a/libc/sysdeps/linux/common/flock.c b/libc/sysdeps/linux/common/flock.c new file mode 100644 index 000000000..ab5dd38d0 --- /dev/null +++ b/libc/sysdeps/linux/common/flock.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * flock() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_flock __NR_flock +static inline _syscall2(int, __syscall_flock, int, fd, int, operation); + +int flock(int fd, int operation) +{ + return (__syscall_flock(fd, operation)); +} diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c new file mode 100644 index 000000000..6689b4e63 --- /dev/null +++ b/libc/sysdeps/linux/common/fork.c @@ -0,0 +1,23 @@ +/* vi: set sw=4 ts=4: */ +/* + * fork() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#ifdef __ARCH_HAS_MMU__ +#define __NR___libc_fork __NR_fork +_syscall0(pid_t, __libc_fork); +#else +pid_t __libc_fork(void) +{ + __set_errno(ENOSYS); + return -1; +} +#endif +weak_alias(__libc_fork, fork); diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c new file mode 100644 index 000000000..ab841f5bc --- /dev/null +++ b/libc/sysdeps/linux/common/fstat.c @@ -0,0 +1,34 @@ +/* vi: set sw=4 ts=4: */ +/* + * fstat() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#define _SYS_STAT_H +#include +#include +#include "xstatconv.h" + +#define __NR___syscall_fstat __NR_fstat +static inline _syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf); + +int fstat(int fd, struct stat *buf) +{ + int result; + struct kernel_stat kbuf; + + result = __syscall_fstat(fd, &kbuf); + if (result == 0) { + __xstat_conv(&kbuf, buf); + } + return result; +} + +#if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__ +weak_alias(fstat, fstat64); +#endif diff --git a/libc/sysdeps/linux/common/fstat64.c b/libc/sysdeps/linux/common/fstat64.c new file mode 100644 index 000000000..ea7d1329d --- /dev/null +++ b/libc/sysdeps/linux/common/fstat64.c @@ -0,0 +1,33 @@ +/* vi: set sw=4 ts=4: */ +/* + * fstat64() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#if defined __UCLIBC_HAS_LFS__ && defined __NR_fstat64 +#define __NR___syscall_fstat64 __NR_fstat64 +#include +#include +#include +#include "xstatconv.h" + +static inline _syscall2(int, __syscall_fstat64, + int, filedes, struct kernel_stat64 *, buf); + +int fstat64(int fd, struct stat64 *buf) +{ + int result; + struct kernel_stat64 kbuf; + + result = __syscall_fstat64(fd, &kbuf); + if (result == 0) { + __xstat64_conv(&kbuf, buf); + } + return result; +} +#endif /* __UCLIBC_HAS_LFS__ */ diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c new file mode 100644 index 000000000..a4996fa9f --- /dev/null +++ b/libc/sysdeps/linux/common/fstatfs.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * fstatfs() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, fstatfs, int, fd, struct statfs *, buf); diff --git a/libc/sysdeps/linux/common/fsync.c b/libc/sysdeps/linux/common/fsync.c new file mode 100644 index 000000000..1db130329 --- /dev/null +++ b/libc/sysdeps/linux/common/fsync.c @@ -0,0 +1,15 @@ +/* vi: set sw=4 ts=4: */ +/* + * fsync() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___libc_fsync __NR_fsync +_syscall1(int, __libc_fsync, int, fd); +weak_alias(__libc_fsync, fsync); diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c new file mode 100644 index 000000000..c2ef15d55 --- /dev/null +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * ftruncate() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, ftruncate, int, fd, __off_t, length); diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c new file mode 100644 index 000000000..190f87d22 --- /dev/null +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * get_kernel_syms() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +struct kernel_sym; +_syscall1(int, get_kernel_syms, struct kernel_sym *, table); diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c new file mode 100644 index 000000000..8d6402767 --- /dev/null +++ b/libc/sysdeps/linux/common/getegid.c @@ -0,0 +1,25 @@ +/* vi: set sw=4 ts=4: */ +/* + * getegid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#ifdef __NR_getegid +#define __NR___syscall_getegid __NR_getegid +static inline _syscall0(int, __syscall_getegid); +gid_t getegid(void) +{ + return (__syscall_getegid()); +} +#else +gid_t getegid(void) +{ + return (getgid()); +} +#endif diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c new file mode 100644 index 000000000..d975a7837 --- /dev/null +++ b/libc/sysdeps/linux/common/geteuid.c @@ -0,0 +1,25 @@ +/* vi: set sw=4 ts=4: */ +/* + * geteuid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#ifdef __NR_geteuid +#define __NR___syscall_geteuid __NR_geteuid +static inline _syscall0(int, __syscall_geteuid); +uid_t geteuid(void) +{ + return (__syscall_geteuid()); +} +#else +uid_t geteuid(void) +{ + return (getuid()); +} +#endif diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c new file mode 100644 index 000000000..809fe546f --- /dev/null +++ b/libc/sysdeps/linux/common/getgid.c @@ -0,0 +1,22 @@ +/* vi: set sw=4 ts=4: */ +/* + * getgid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_getgid __NR_getgid +#if defined (__alpha__) +#define __NR_getgid __NR_getxgid +#endif + +static inline _syscall0(int, __syscall_getgid); +gid_t getgid(void) +{ + return (__syscall_getgid()); +} diff --git a/libc/sysdeps/linux/common/getgroups.c b/libc/sysdeps/linux/common/getgroups.c new file mode 100644 index 000000000..21085ea78 --- /dev/null +++ b/libc/sysdeps/linux/common/getgroups.c @@ -0,0 +1,36 @@ +/* vi: set sw=4 ts=4: */ +/* + * getgroups() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#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 getgroups(int n, gid_t * groups) +{ + if (unlikely(n < 0)) { + __set_errno(EINVAL); + return -1; + } else { + int i, ngids; + __kernel_gid_t kernel_groups[n = MIN(n, sysconf(_SC_NGROUPS_MAX))]; + + ngids = __syscall_getgroups(n, kernel_groups); + if (n != 0 && ngids > 0) { + for (i = 0; i < ngids; i++) { + groups[i] = kernel_groups[i]; + } + } + return ngids; + } +} diff --git a/libc/sysdeps/linux/common/getitimer.c b/libc/sysdeps/linux/common/getitimer.c new file mode 100644 index 000000000..de2226a82 --- /dev/null +++ b/libc/sysdeps/linux/common/getitimer.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * getitimer() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value); diff --git a/libc/sysdeps/linux/common/getpgid.c b/libc/sysdeps/linux/common/getpgid.c new file mode 100644 index 000000000..9c694bb01 --- /dev/null +++ b/libc/sysdeps/linux/common/getpgid.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * getpgid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#define __NR___syscall_getpgid __NR_getpgid +static inline _syscall1(__kernel_pid_t, __syscall_getpgid, __kernel_pid_t, pid); + +pid_t __getpgid(pid_t pid) +{ + return (__syscall_getpgid(pid)); +} +weak_alias(__getpgid, getpgid); diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c new file mode 100644 index 000000000..546336589 --- /dev/null +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -0,0 +1,12 @@ +/* vi: set sw=4 ts=4: */ +/* + * getpgrp() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +_syscall0(pid_t, getpgrp); diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c new file mode 100644 index 000000000..86c3b4638 --- /dev/null +++ b/libc/sysdeps/linux/common/getpid.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * getpid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#if defined (__alpha__) +#define __NR_getpid __NR_getxpid +#endif +#define __NR___libc_getpid __NR_getpid +_syscall0(pid_t, __libc_getpid); +weak_alias(__libc_getpid, getpid); +weak_alias(__libc_getpid, __getpid); diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c new file mode 100644 index 000000000..9d97a0bfd --- /dev/null +++ b/libc/sysdeps/linux/common/getppid.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * getppid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +# include +# ifdef __NR_getppid +_syscall0(pid_t, getppid); +# else +pid_t getppid(void) +{ + return (getpid()); +} +# endif diff --git a/libc/sysdeps/linux/common/getpriority.c b/libc/sysdeps/linux/common/getpriority.c new file mode 100644 index 000000000..9f4338464 --- /dev/null +++ b/libc/sysdeps/linux/common/getpriority.c @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * getpriority() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_getpriority __NR_getpriority +static inline _syscall2(int, __syscall_getpriority, + __priority_which_t, which, id_t, who); + +/* The return value of __syscall_getpriority is biased by this value + * to avoid returning negative values. */ +#define PZERO 20 +int getpriority(enum __priority_which which, id_t who) +{ + int res; + + res = __syscall_getpriority(which, who); + if (res >= 0) + res = PZERO - res; + return res; +} diff --git a/libc/sysdeps/linux/common/getresgid.c b/libc/sysdeps/linux/common/getresgid.c new file mode 100644 index 000000000..c16d5384c --- /dev/null +++ b/libc/sysdeps/linux/common/getresgid.c @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * getresgid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#define __NR___syscall_getresgid __NR_getresgid +static inline _syscall3(int, __syscall_getresgid, __kernel_gid_t *, egid, + __kernel_gid_t *, rgid, __kernel_gid_t *, sgid); + +int getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid) +{ + int result; + __kernel_gid_t k_rgid, k_egid, k_sgid; + + result = __syscall_getresgid(&k_rgid, &k_egid, &k_sgid); + if (result == 0) { + *rgid = (gid_t) k_rgid; + *egid = (gid_t) k_egid; + *sgid = (gid_t) k_sgid; + } + return result; +} diff --git a/libc/sysdeps/linux/common/getresuid.c b/libc/sysdeps/linux/common/getresuid.c new file mode 100644 index 000000000..ec7d6ebb1 --- /dev/null +++ b/libc/sysdeps/linux/common/getresuid.c @@ -0,0 +1,28 @@ +/* vi: set sw=4 ts=4: */ +/* + * getresuid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" + +#define __NR___syscall_getresuid __NR_getresuid +static inline _syscall3(int, __syscall_getresuid, __kernel_uid_t *, ruid, + __kernel_uid_t *, euid, __kernel_uid_t *, suid); + +int getresuid(uid_t * ruid, uid_t * euid, uid_t * suid) +{ + int result; + __kernel_uid_t k_ruid, k_euid, k_suid; + + result = __syscall_getresuid(&k_ruid, &k_euid, &k_suid); + if (result == 0) { + *ruid = (uid_t) k_ruid; + *euid = (uid_t) k_euid; + *suid = (uid_t) k_suid; + } + return result; +} diff --git a/libc/sysdeps/linux/common/getrlimit.c b/libc/sysdeps/linux/common/getrlimit.c new file mode 100644 index 000000000..279f02fdc --- /dev/null +++ b/libc/sysdeps/linux/common/getrlimit.c @@ -0,0 +1,47 @@ +/* vi: set sw=4 ts=4: */ +/* + * getrlimit() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include + +#ifdef __NR_ugetrlimit +#define __NR___ugetrlimit __NR_ugetrlimit +_syscall2(int, __ugetrlimit, enum __rlimit_resource, resource, + struct rlimit *, rlim); +int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +{ + return (__ugetrlimit(resource, rlimits)); +} + +#else /* __NR_ugetrlimit */ + +/* Only include the old getrlimit if the new one (ugetrlimit) is not around */ +#define __NR___getrlimit __NR_getrlimit +static inline +_syscall2(int, __getrlimit, int, resource, struct rlimit *, rlim); + +int getrlimit(__rlimit_resource_t resource, struct rlimit *rlimits) +{ + int result; + + result = __getrlimit(resource, rlimits); + + if (result == -1) + return result; + + /* We might have to correct the limits values. Since the old values + * were signed the infinity value is too small. */ + if (rlimits->rlim_cur == RLIM_INFINITY >> 1) + rlimits->rlim_cur = RLIM_INFINITY; + if (rlimits->rlim_max == RLIM_INFINITY >> 1) + rlimits->rlim_max = RLIM_INFINITY; + return result; +} +#endif diff --git a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c new file mode 100644 index 000000000..34428beed --- /dev/null +++ b/libc/sysdeps/linux/common/getrusage.c @@ -0,0 +1,13 @@ +/* vi: set sw=4 ts=4: */ +/* + * getrusage() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include +#include +_syscall2(int, getrusage, int, who, struct rusage *, usage); diff --git a/libc/sysdeps/linux/common/getsid.c b/libc/sysdeps/linux/common/getsid.c new file mode 100644 index 000000000..a0790285e --- /dev/null +++ b/libc/sysdeps/linux/common/getsid.c @@ -0,0 +1,19 @@ +/* vi: set sw=4 ts=4: */ +/* + * getsid() for uClibc + * + * Copyright (C) 2000-2004 by Erik Andersen + * + * GNU Library General Public License (LGPL) version 2 or later. + */ + +#include "syscalls.h" +#include + +#define __NR___syscall_getsid __NR_getsid +static inline _syscall1(__kernel_pid_t, __syscall_getsid, __kernel_pid_t, pid); + +pid_t getsid(pid_t pid) +{ + return (__syscall_getsid