Browse Source

Split up syscalls.c, since it had grown to be quite large and ugly.
-Erik

Eric Andersen 21 years ago
parent
commit
6334e558ab
100 changed files with 1880 additions and 37 deletions
  1. 1 4
      libc/misc/sysvipc/ftok.c
  2. 1 1
      libc/misc/sysvipc/ipc.h
  3. 5 5
      libc/misc/sysvipc/msgq.c
  4. 7 7
      libc/misc/sysvipc/sem.c
  5. 4 4
      libc/misc/sysvipc/shm.c
  6. 40 9
      libc/sysdeps/linux/common/Makefile
  7. 48 0
      libc/sysdeps/linux/common/__rt_sigtimedwait.c
  8. 14 0
      libc/sysdeps/linux/common/__socketcall.c
  9. 38 0
      libc/sysdeps/linux/common/__syscall_fcntl.c
  10. 30 0
      libc/sysdeps/linux/common/__syscall_fcntl64.c
  11. 16 0
      libc/sysdeps/linux/common/__syscall_ipc.c
  12. 21 0
      libc/sysdeps/linux/common/__syscall_rt_sigaction.c
  13. 19 0
      libc/sysdeps/linux/common/__syscall_sigaction.c
  14. 1 1
      libc/sysdeps/linux/common/_exit.c
  15. 12 0
      libc/sysdeps/linux/common/access.c
  16. 12 0
      libc/sysdeps/linux/common/acct.c
  17. 15 0
      libc/sysdeps/linux/common/adjtimex.c
  18. 34 0
      libc/sysdeps/linux/common/alarm.c
  19. 12 0
      libc/sysdeps/linux/common/bdflush.c
  20. 19 0
      libc/sysdeps/linux/common/capget.c
  21. 19 0
      libc/sysdeps/linux/common/capset.c
  22. 20 0
      libc/sysdeps/linux/common/chdir.c
  23. 19 0
      libc/sysdeps/linux/common/chmod.c
  24. 25 0
      libc/sysdeps/linux/common/chown.c
  25. 21 0
      libc/sysdeps/linux/common/chroot.c
  26. 15 0
      libc/sysdeps/linux/common/close.c
  27. 19 0
      libc/sysdeps/linux/common/delete_module.c
  28. 12 0
      libc/sysdeps/linux/common/dup.c
  29. 12 0
      libc/sysdeps/linux/common/dup2.c
  30. 22 0
      libc/sysdeps/linux/common/execve.c
  31. 12 0
      libc/sysdeps/linux/common/fchdir.c
  32. 20 0
      libc/sysdeps/linux/common/fchmod.c
  33. 25 0
      libc/sysdeps/linux/common/fchown.c
  34. 12 0
      libc/sysdeps/linux/common/fdatasync.c
  35. 19 0
      libc/sysdeps/linux/common/flock.c
  36. 23 0
      libc/sysdeps/linux/common/fork.c
  37. 34 0
      libc/sysdeps/linux/common/fstat.c
  38. 33 0
      libc/sysdeps/linux/common/fstat64.c
  39. 12 0
      libc/sysdeps/linux/common/fstatfs.c
  40. 15 0
      libc/sysdeps/linux/common/fsync.c
  41. 12 0
      libc/sysdeps/linux/common/ftruncate.c
  42. 12 0
      libc/sysdeps/linux/common/get_kernel_syms.c
  43. 25 0
      libc/sysdeps/linux/common/getegid.c
  44. 25 0
      libc/sysdeps/linux/common/geteuid.c
  45. 22 0
      libc/sysdeps/linux/common/getgid.c
  46. 36 0
      libc/sysdeps/linux/common/getgroups.c
  47. 12 0
      libc/sysdeps/linux/common/getitimer.c
  48. 19 0
      libc/sysdeps/linux/common/getpgid.c
  49. 12 0
      libc/sysdeps/linux/common/getpgrp.c
  50. 19 0
      libc/sysdeps/linux/common/getpid.c
  51. 19 0
      libc/sysdeps/linux/common/getppid.c
  52. 28 0
      libc/sysdeps/linux/common/getpriority.c
  53. 28 0
      libc/sysdeps/linux/common/getresgid.c
  54. 28 0
      libc/sysdeps/linux/common/getresuid.c
  55. 47 0
      libc/sysdeps/linux/common/getrlimit.c
  56. 13 0
      libc/sysdeps/linux/common/getrusage.c
  57. 19 0
      libc/sysdeps/linux/common/getsid.c
  58. 12 0
      libc/sysdeps/linux/common/gettimeofday.c
  59. 23 0
      libc/sysdeps/linux/common/getuid.c
  60. 15 0
      libc/sysdeps/linux/common/init_module.c
  61. 12 2
      libc/sysdeps/linux/common/ioctl.c
  62. 19 0
      libc/sysdeps/linux/common/ioperm.c
  63. 23 0
      libc/sysdeps/linux/common/iopl.c
  64. 20 0
      libc/sysdeps/linux/common/kill.c
  65. 17 0
      libc/sysdeps/linux/common/klogctl.c
  66. 25 0
      libc/sysdeps/linux/common/lchown.c
  67. 12 0
      libc/sysdeps/linux/common/link.c
  68. 0 4
      libc/sysdeps/linux/common/list_syscalls.sh
  69. 15 0
      libc/sysdeps/linux/common/lseek.c
  70. 35 0
      libc/sysdeps/linux/common/lstat.c
  71. 33 0
      libc/sysdeps/linux/common/lstat64.c
  72. 11 0
      libc/sysdeps/linux/common/madvise.c
  73. 20 0
      libc/sysdeps/linux/common/mkdir.c
  74. 24 0
      libc/sysdeps/linux/common/mknod.c
  75. 14 0
      libc/sysdeps/linux/common/mlock.c
  76. 14 0
      libc/sysdeps/linux/common/mlockall.c
  77. 28 0
      libc/sysdeps/linux/common/mmap.c
  78. 13 0
      libc/sysdeps/linux/common/modify_ldt.c
  79. 14 0
      libc/sysdeps/linux/common/mount.c
  80. 12 0
      libc/sysdeps/linux/common/mprotect.c
  81. 14 0
      libc/sysdeps/linux/common/mremap.c
  82. 16 0
      libc/sysdeps/linux/common/msync.c
  83. 14 0
      libc/sysdeps/linux/common/munlock.c
  84. 14 0
      libc/sysdeps/linux/common/munlockall.c
  85. 13 0
      libc/sysdeps/linux/common/munmap.c
  86. 16 0
      libc/sysdeps/linux/common/nanosleep.c
  87. 37 0
      libc/sysdeps/linux/common/nice.c
  88. 41 0
      libc/sysdeps/linux/common/open.c
  89. 28 0
      libc/sysdeps/linux/common/pause.c
  90. 12 0
      libc/sysdeps/linux/common/personality.c
  91. 12 0
      libc/sysdeps/linux/common/pipe.c
  92. 11 0
      libc/sysdeps/linux/common/pivot_root.c
  93. 13 0
      libc/sysdeps/linux/common/prctl.c
  94. 21 0
      libc/sysdeps/linux/common/query_module.c
  95. 13 0
      libc/sysdeps/linux/common/quotactl.c
  96. 15 0
      libc/sysdeps/linux/common/read.c
  97. 12 0
      libc/sysdeps/linux/common/readlink.c
  98. 13 0
      libc/sysdeps/linux/common/readv.c
  99. 16 0
      libc/sysdeps/linux/common/reboot.c
  100. 24 0
      libc/sysdeps/linux/common/rename.c

+ 1 - 4
libc/misc/sysvipc/ftok.c

@@ -20,10 +20,7 @@
 #include <sys/ipc.h>
 #include <sys/stat.h>
 
-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;

+ 1 - 1
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));
 
 

+ 5 - 5
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

+ 7 - 7
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 <stdlib.h>		
+#include <stdlib.h>
 
 #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

+ 4 - 4
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

+ 40 - 9
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

+ 48 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+#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

+ 14 - 0
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 <andersen@codpoet.org>
+ *
+ * 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

+ 38 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <stdarg.h>
+#include <fcntl.h>
+
+#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

+ 30 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <stdarg.h>
+#include <fcntl.h>
+
+#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

+ 16 - 0
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 <andersen@codpoet.org>
+ *
+ * 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

+ 21 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+
+#ifdef __NR_rt_sigaction
+#include <signal.h>
+
+#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

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+
+#ifndef __NR_rt_sigaction
+#define __NR___syscall_sigaction __NR_sigaction
+#include <signal.h>
+#undef sigaction
+_syscall3(int, __syscall_sigaction, int, signum, const struct sigaction *,
+		  act, struct sigaction *, oldact);
+#endif
+

+ 1 - 1
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
 

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall2(int, access, const char *, pathname, int, mode);

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall1(int, acct, const char *, filename);

+ 15 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/timex.h>
+_syscall1(int, adjtimex, struct timex *, buf);
+
+weak_alias(adjtimex, __adjtimex);
+weak_alias(adjtimex, ntp_adjtime);

+ 34 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#ifdef __NR_alarm
+_syscall1(unsigned int, alarm, unsigned int, seconds);
+#else
+#include <sys/time.h>
+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

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/kdaemon.h>
+_syscall2(int, bdflush, int, __func, long int, __data);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * 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

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * 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

+ 20 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <string.h>
+#include <sys/param.h>
+
+#define __NR___syscall_chdir __NR_chdir
+static inline _syscall1(int, __syscall_chdir, const char *, path);
+int chdir(const char *path)
+{
+	return __syscall_chdir(path);
+}
+

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/stat.h>
+
+#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);
+}

+ 25 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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));
+}

+ 21 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <string.h>
+#include <sys/param.h>
+
+#define __NR___syscall_chroot __NR_chroot
+static inline _syscall1(int, __syscall_chroot, const char *, path);
+
+int chroot(const char *path)
+{
+	return __syscall_chroot(path);
+}

+ 15 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#define __NR___libc_close __NR_close
+_syscall1(int, __libc_close, int, fd);
+weak_alias(__libc_close, close);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * 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

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall1(int, dup, int, oldfd);

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall2(int, dup2, int, oldfd, int, newfd);

+ 22 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <string.h>
+#include <sys/param.h>
+
+#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);
+}

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall1(int, fchdir, int, fd);

+ 20 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/stat.h>
+
+#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));
+}

+ 25 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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));
+}

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall1(int, fdatasync, int, fd);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/file.h>
+
+#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));
+}

+ 23 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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);

+ 34 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#define _SYS_STAT_H
+#include <bits/stat.h>
+#include <bits/kernel_stat.h>
+#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

+ 33 - 0
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 <andersen@codpoet.org>
+ *
+ * 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 <unistd.h>
+#include <sys/stat.h>
+#include <bits/kernel_stat.h>
+#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__ */

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/vfs.h>
+_syscall2(int, fstatfs, int, fd, struct statfs *, buf);

+ 15 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#define __NR___libc_fsync __NR_fsync
+_syscall1(int, __libc_fsync, int, fd);
+weak_alias(__libc_fsync, fsync);

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall2(int, ftruncate, int, fd, __off_t, length);

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * 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);

+ 25 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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

+ 25 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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

+ 22 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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());
+}

+ 36 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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;
+	}
+}

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/time.h>
+_syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * 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);

+ 12 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall0(pid_t, getpgrp);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#	include <unistd.h>
+#	ifdef	__NR_getppid
+_syscall0(pid_t, getppid);
+#	else
+pid_t getppid(void)
+{
+	return (getpid());
+}
+#	endif

+ 28 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/resource.h>
+
+#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;
+}

+ 28 - 0
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 <andersen@codpoet.org>
+ *
+ * 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;
+}

+ 28 - 0
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 <andersen@codpoet.org>
+ *
+ * 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;
+}

+ 47 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <sys/resource.h>
+
+#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

+ 13 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <wait.h>
+_syscall2(int, getrusage, int, who, struct rusage *, usage);

+ 19 - 0
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 <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#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(pid));
+}

+ 12 - 0
libc/sysdeps/linux/common/gettimeofday.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * gettimeofday() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/time.h>
+_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz);

+ 23 - 0
libc/sysdeps/linux/common/getuid.c

@@ -0,0 +1,23 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * getuid() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#if defined (__alpha__)
+#define __NR_getuid     __NR_getxuid
+#endif
+#define __NR___syscall_getuid __NR_getuid
+
+static inline _syscall0(int, __syscall_getuid);
+
+uid_t getuid(void)
+{
+	return (__syscall_getuid());
+}

+ 15 - 0
libc/sysdeps/linux/common/init_module.c

@@ -0,0 +1,15 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * init_module() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
+ * (for 2.2 and 2.4 kernels).  Use the greatest common denominator,
+ * and let the kernel cope with whatever it gets.  It's good at that. */
+_syscall5(int, init_module, void *, first, void *, second, void *, third,
+		  void *, fourth, void *, fifth);

+ 12 - 2
libc/sysdeps/linux/common/ioctl.c

@@ -1,9 +1,19 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * ioctl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
 #include <stdarg.h>
 #include <sys/ioctl.h>
 
-extern int __syscall_ioctl(int fd, int request, void *arg);
+#define __NR___syscall_ioctl __NR_ioctl
+_syscall3(int, __syscall_ioctl, int, fd, unsigned long int, request, void *, arg);
 
-/* powerpc has its own special version... */
 int ioctl(int fd, unsigned long int request, ...)
 {
     void *arg;

+ 19 - 0
libc/sysdeps/linux/common/ioperm.c

@@ -0,0 +1,19 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * ioperm() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#	if defined __ARCH_HAS_MMU__ && defined __NR_ioperm
+_syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on);
+#	else
+int ioperm(unsigned long from, unsigned long num, int turn_on)
+{
+	__set_errno(ENOSYS);
+	return -1;
+}
+#	endif

+ 23 - 0
libc/sysdeps/linux/common/iopl.c

@@ -0,0 +1,23 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * iopl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+/* For arm there is a totally different implementation */
+#if !defined(__arm__)
+/* Tuns out the m68k unistd.h kernel header is broken */
+#	if defined __ARCH_HAS_MMU__ && defined __NR_iopl && ( !defined(__mc68000__))
+_syscall1(int, iopl, int, level);
+#	else
+int iopl(int level)
+{
+	__set_errno(ENOSYS);
+	return -1;
+}
+#	endif
+# endif

+ 20 - 0
libc/sysdeps/linux/common/kill.c

@@ -0,0 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * kill() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <signal.h>
+
+#undef kill
+#define __NR___syscall_kill __NR_kill
+static inline _syscall2(int, __syscall_kill, __kernel_pid_t, pid, int, sig);
+
+int kill(pid_t pid, int sig)
+{
+	return (__syscall_kill(pid, sig));
+}

+ 17 - 0
libc/sysdeps/linux/common/klogctl.c

@@ -0,0 +1,17 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * klogctl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#define __NR__syslog		__NR_syslog
+static inline _syscall3(int, _syslog, int, type, char *, buf, int, len);
+int klogctl(int type, char *buf, int len)
+{
+	return (_syslog(type, buf, len));
+}

+ 25 - 0
libc/sysdeps/linux/common/lchown.c

@@ -0,0 +1,25 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * lchown() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#define __NR___syscall_lchown __NR_lchown
+static inline _syscall3(int, __syscall_lchown, const char *, path,
+		__kernel_uid_t, owner, __kernel_gid_t, group);
+
+int lchown(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_lchown(path, owner, group);
+}

+ 12 - 0
libc/sysdeps/linux/common/link.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * link() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall2(int, link, const char *, oldpath, const char *, newpath);

+ 0 - 4
libc/sysdeps/linux/common/list_syscalls.sh

@@ -1,4 +0,0 @@
-#!/bin/sh
-sed -ne 's/^.*_syscall[0-9].*([^,]*,\([^,)]*\).*/\1.o/gp' syscalls.c
-
-

+ 15 - 0
libc/sysdeps/linux/common/lseek.c

@@ -0,0 +1,15 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * lseek() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#define __NR___libc_lseek __NR_lseek
+_syscall3(__off_t, __libc_lseek, int, fildes, __off_t, offset, int, whence);
+weak_alias(__libc_lseek, lseek);

+ 35 - 0
libc/sysdeps/linux/common/lstat.c

@@ -0,0 +1,35 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * lstat() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#define _SYS_STAT_H
+#include <bits/stat.h>
+#include <bits/kernel_stat.h>
+#include "xstatconv.h"
+
+#define __NR___syscall_lstat __NR_lstat
+static inline _syscall2(int, __syscall_lstat,
+		const char *, file_name, struct kernel_stat *, buf);
+
+int lstat(const char *file_name, struct stat *buf)
+{
+	int result;
+	struct kernel_stat kbuf;
+
+	result = __syscall_lstat(file_name, &kbuf);
+	if (result == 0) {
+		__xstat_conv(&kbuf, buf);
+	}
+	return result;
+}
+
+#if ! defined __NR_lstat64 && defined __UCLIBC_HAS_LFS__
+weak_alias(lstat, lstat64);
+#endif

+ 33 - 0
libc/sysdeps/linux/common/lstat64.c

@@ -0,0 +1,33 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * lstat64() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+
+#if defined __UCLIBC_HAS_LFS__ && defined __NR_lstat64
+#include <unistd.h>
+#include <sys/stat.h>
+#include <bits/kernel_stat.h>
+#include "xstatconv.h"
+
+#define __NR___syscall_lstat64 __NR_lstat64
+static inline _syscall2(int, __syscall_lstat64, const char *, file_name,
+		  struct kernel_stat64 *, buf);
+
+int lstat64(const char *file_name, struct stat64 *buf)
+{
+	int result;
+	struct kernel_stat64 kbuf;
+
+	result = __syscall_lstat64(file_name, &kbuf);
+	if (result == 0) {
+		__xstat64_conv(&kbuf, buf);
+	}
+	return result;
+}
+#endif							/* __UCLIBC_HAS_LFS__ */

+ 11 - 0
libc/sysdeps/linux/common/madvise.c

@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * madvise() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+_syscall3(int, madvise, void *, __addr, size_t, __len, int, __advice);

+ 20 - 0
libc/sysdeps/linux/common/mkdir.c

@@ -0,0 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mkdir() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/stat.h>
+
+#define __NR___syscall_mkdir __NR_mkdir
+static inline _syscall2(int, __syscall_mkdir, const char *, pathname,
+		__kernel_mode_t, mode);
+
+int mkdir(const char *pathname, mode_t mode)
+{
+	return (__syscall_mkdir(pathname, mode));
+}

+ 24 - 0
libc/sysdeps/linux/common/mknod.c

@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mknod() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/stat.h>
+
+#define __NR___syscall_mknod __NR_mknod
+static inline _syscall3(int, __syscall_mknod, const char *, path,
+		__kernel_mode_t, mode, __kernel_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;
+
+	k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
+	return __syscall_mknod(path, mode, k_dev);
+}

+ 14 - 0
libc/sysdeps/linux/common/mlock.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mlock() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mman.h>
+#	if defined __ARCH_HAS_MMU__ && defined __NR_mlock
+_syscall2(int, mlock, const void *, addr, size_t, len);
+#	endif

+ 14 - 0
libc/sysdeps/linux/common/mlockall.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mlockall() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mman.h>
+#	if defined __ARCH_HAS_MMU__ && defined __NR_mlockall
+_syscall1(int, mlockall, int, flags);
+#	endif

+ 28 - 0
libc/sysdeps/linux/common/mmap.c

@@ -0,0 +1,28 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * _mmap() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <sys/mman.h>
+
+#define __NR__mmap __NR_mmap
+_syscall1(__ptr_t, _mmap, unsigned long *, buffer);
+__ptr_t mmap(__ptr_t addr, size_t len, int prot,
+			 int flags, int fd, __off_t offset)
+{
+	unsigned long buffer[6];
+
+	buffer[0] = (unsigned long) addr;
+	buffer[1] = (unsigned long) len;
+	buffer[2] = (unsigned long) prot;
+	buffer[3] = (unsigned long) flags;
+	buffer[4] = (unsigned long) fd;
+	buffer[5] = (unsigned long) offset;
+	return (__ptr_t) _mmap(buffer);
+}

+ 13 - 0
libc/sysdeps/linux/common/modify_ldt.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * modify_ldt() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount);
+
+weak_alias(modify_ldt, __modify_ldt);

+ 14 - 0
libc/sysdeps/linux/common/mount.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mount() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mount.h>
+_syscall5(int, mount, const char *, specialfile, const char *, dir,
+		  const char *, filesystemtype, unsigned long, rwflag,
+		  const void *, data);

+ 12 - 0
libc/sysdeps/linux/common/mprotect.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mprotect() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mman.h>
+_syscall3(int, mprotect, void *, addr, size_t, len, int, prot);

+ 14 - 0
libc/sysdeps/linux/common/mremap.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mremap() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#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);

+ 16 - 0
libc/sysdeps/linux/common/msync.c

@@ -0,0 +1,16 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * msync() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <sys/mman.h>
+
+#define __NR___libc_msync __NR_msync
+_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags);
+weak_alias(__libc_msync, msync);

+ 14 - 0
libc/sysdeps/linux/common/munlock.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * munlock() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mman.h>
+#	if defined __ARCH_HAS_MMU__ && defined __NR_munlock
+_syscall2(int, munlock, const void *, addr, size_t, len);
+#	endif

+ 14 - 0
libc/sysdeps/linux/common/munlockall.c

@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * munlockall() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/mman.h>
+#if defined __ARCH_HAS_MMU__
+_syscall0(int, munlockall);
+#endif

+ 13 - 0
libc/sysdeps/linux/common/munmap.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * munmap() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <sys/mman.h>
+_syscall2(int, munmap, void *, start, size_t, length);

+ 16 - 0
libc/sysdeps/linux/common/nanosleep.c

@@ -0,0 +1,16 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * nanosleep() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <time.h>
+
+#define __NR___libc_nanosleep __NR_nanosleep
+_syscall2(int, __libc_nanosleep, const struct timespec *, req,
+		  struct timespec *, rem);
+weak_alias(__libc_nanosleep, nanosleep);

+ 37 - 0
libc/sysdeps/linux/common/nice.c

@@ -0,0 +1,37 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * nice() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#ifdef __NR_nice
+_syscall1(int, nice, int, inc);
+#else
+#include <sys/resource.h>
+int nice(int incr)
+{
+	int save, prio, result;
+
+	save = errno;
+	__set_errno(0);
+	prio = getpriority(PRIO_PROCESS, 0);
+	if (prio == -1) {
+		if (errno != 0) {
+			return -1;
+		} else {
+			__set_errno(save);
+		}
+	}
+	result = setpriority(PRIO_PROCESS, 0, prio + incr);
+	if (result != -1) {
+		return prio + incr;
+	} else {
+		return -1;
+	}
+}
+#endif

+ 41 - 0
libc/sysdeps/linux/common/open.c

@@ -0,0 +1,41 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * open() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/param.h>
+
+#define __NR___syscall_open __NR_open
+static inline _syscall3(int, __syscall_open, const char *, file,
+		int, flags, __kernel_mode_t, mode);
+
+int __libc_open(const char *file, int flags, ...)
+{
+	/* gcc may warn about mode being uninitialized.
+	 * Just ignore that, since gcc is wrong. */
+	mode_t mode;
+
+	if (flags & O_CREAT) {
+		va_list ap;
+
+		va_start(ap, flags);
+		mode = va_arg(ap, mode_t);
+		va_end(ap);
+	}
+	return __syscall_open(file, flags, mode);
+}
+weak_alias(__libc_open, open);
+
+int creat(const char *file, mode_t mode)
+{
+	return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+}

+ 28 - 0
libc/sysdeps/linux/common/pause.c

@@ -0,0 +1,28 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * pause() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#ifdef __NR_pause
+
+#define __NR___libc_pause __NR_pause
+_syscall0(int, __libc_pause);
+weak_alias(__libc_pause, pause);
+
+#else
+
+#include <signal.h>
+int __libc_pause(void)
+{
+	return (__sigpause(sigblock(0), 0));
+}
+weak_alias(__libc_pause, pause);
+
+#endif

+ 12 - 0
libc/sysdeps/linux/common/personality.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * personality() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/personality.h>
+_syscall1(int, personality, unsigned long int, __persona);

+ 12 - 0
libc/sysdeps/linux/common/pipe.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * pipe() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall1(int, pipe, int *, filedes);

+ 11 - 0
libc/sysdeps/linux/common/pivot_root.c

@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * pivot_root() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+_syscall2(int, pivot_root, const char *, new_root, const char *, put_old);

+ 13 - 0
libc/sysdeps/linux/common/prctl.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * prctl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <stdarg.h>
+//#include <sys/prctl.h>
+_syscall5(int, prctl, int, a, int, b, int, c, int, d, int, e);

+ 21 - 0
libc/sysdeps/linux/common/query_module.c

@@ -0,0 +1,21 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * query_module() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#	ifdef __NR_query_module
+_syscall5(int, query_module, const char *, name, int, which,
+		  void *, buf, size_t, bufsize, size_t *, ret);
+#	else
+int query_module(const char *name, int which,
+				 void *buf, size_t bufsize, size_t * ret)
+{
+	__set_errno(ENOSYS);
+	return -1;
+}
+#	endif

+ 13 - 0
libc/sysdeps/linux/common/quotactl.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * quotactl() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/quota.h>
+_syscall4(int, quotactl, int, cmd, const char *, special,
+		  int, id, caddr_t, addr);

+ 15 - 0
libc/sysdeps/linux/common/read.c

@@ -0,0 +1,15 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * read() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+
+#define __NR___libc_read __NR_read
+_syscall3(ssize_t, __libc_read, int, fd, __ptr_t, buf, size_t, count);
+weak_alias(__libc_read, read);

+ 12 - 0
libc/sysdeps/linux/common/readlink.c

@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * readlink() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+_syscall3(int, readlink, const char *, path, char *, buf, size_t, bufsiz);

+ 13 - 0
libc/sysdeps/linux/common/readv.c

@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * readv() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <sys/uio.h>
+_syscall3(ssize_t, readv, int, filedes, const struct iovec *, vector,
+		  int, count);

+ 16 - 0
libc/sysdeps/linux/common/reboot.c

@@ -0,0 +1,16 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * _reboot() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#define __NR__reboot __NR_reboot
+static inline _syscall3(int, _reboot, int, magic, int, magic2, int, flag);
+int reboot(int flag)
+{
+	return (_reboot((int) 0xfee1dead, 672274793, flag));
+}

+ 24 - 0
libc/sysdeps/linux/common/rename.c

@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * rename() for uClibc
+ *
+ * Copyright (C) 2000-2004 by Erik Andersen <andersen@codpoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ */
+
+#include "syscalls.h"
+#include <unistd.h>
+#include <string.h>
+#include <sys/param.h>
+#include <stdio.h>
+
+#define __NR___syscall_rename __NR_rename
+static inline _syscall2(int, __syscall_rename, const char *, oldpath,
+		const char *, newpath);
+
+int rename(const char * oldpath, const char * newpath)
+{
+	return __syscall_rename(oldpath, newpath);
+}
+

Some files were not shown because too many files changed in this diff