summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-08-08 10:07:32 +0000
committerEric Andersen <andersen@codepoet.org>2003-08-08 10:07:32 +0000
commitea9f6e1e2d60bac4e2c7f1fb9ee98f581a7c6229 (patch)
tree21b23d087fc8b0b522d5fa2bc54bd099e274d0b0 /libc/sysdeps/linux/common
parentcffcfd3f2f02aa906e5bffe2b81a04b92b04f7eb (diff)
Add support for personality(), prctl(), ustat(), and ulimit()
syscalls, which had managed to stay unimplemented thus far. -Erik
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/Makefile3
-rw-r--r--libc/sysdeps/linux/common/bits/ustat.h10
-rw-r--r--libc/sysdeps/linux/common/syscalls.c31
3 files changed, 38 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index f308856ec..3135172c0 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -25,7 +25,8 @@ CSRC= waitpid.c getdnnm.c gethstnm.c getcwd.c ptrace.c \
cmsg_nxthdr.c longjmp.c open64.c ftruncate64.c mmap64.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
+ sendfile64.c xstatconv.c getdents.c getdents64.c vfork.c \
+ ulimit.c
ifneq ($(strip $(EXCLUDE_BRK)),y)
CSRC+=sbrk.c
endif
diff --git a/libc/sysdeps/linux/common/bits/ustat.h b/libc/sysdeps/linux/common/bits/ustat.h
index aeafc22a5..69c6b7227 100644
--- a/libc/sysdeps/linux/common/bits/ustat.h
+++ b/libc/sysdeps/linux/common/bits/ustat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,12 +16,16 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#ifndef _SYS_USTAT_H
+# error "Never include <bits/ustat.h> directly; use <sys/ustat.h> instead."
+#endif
+
#include <sys/types.h>
struct ustat
{
- __daddr_t f_tfree;
- __ino_t f_tinode;
+ __daddr_t f_tfree; /* Number of free blocks. */
+ __ino_t f_tinode; /* Number of free inodes. */
char f_fname[6];
char f_fpack[6];
};
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 9c5fb9530..c37099dd5 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -2,8 +2,7 @@
/*
* Syscalls for uClibc
*
- * Copyright (C) 2000 by Lineo, inc
- * Copyright (C) 2001, 2002 by Erik Andersen
+ * Copyright (C) 2001-2003 by Erik Andersen
* Written by Erik Andersen <andersen@codpoet.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -630,6 +629,7 @@ int setpgid(pid_t pid, pid_t pgid)
#endif
//#define __NR_ulimit 58
+//See ulimit.c
//#define __NR_oldolduname 59
@@ -652,6 +652,20 @@ _syscall1(int, chroot, const char *, path);
#endif
//#define __NR_ustat 62
+#ifdef L___syscall_ustat
+#define __NR___syscall_ustat __NR_ustat
+#include <sys/stat.h>
+static inline
+_syscall2(int, __syscall_ustat, unsigned short int, kdev_t, struct ustat *, ubuf);
+int ustat(dev_t dev, struct ustat *ubuf)
+{
+ __kernel_dev_t k_dev;
+ /* We must convert the dev_t value to a __kernel_dev_t */
+ k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
+ return __syscall_ustat(k_dev, ubuf);
+}
+#endif
+
//#define __NR_dup2 63
#ifdef L_dup2
@@ -1345,6 +1359,12 @@ _syscall2(int, bdflush, int, __func, long int, __data);
//#define __NR_sysfs 135
//#define __NR_personality 136
+#ifdef __NR_personality
+#ifdef L_personality
+#include <sys/personality.h>
+_syscall1(int, personality, unsigned long int, __persona);
+#endif
+#endif
//#define __NR_afs_syscall 137
@@ -1703,6 +1723,13 @@ int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
#endif
//#define __NR_prctl 172
+#ifdef __NR_prctl
+#ifdef L_prctl
+#include <stdarg.h>
+//#include <sys/prctl.h>
+_syscall5(int, prctl, int, a, int, b, int, c, int, d, int, e);
+#endif
+#endif
//#define __NR_rt_sigreturn 173
//#define __NR_rt_sigaction 174