summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sys/personality.h73
-rw-r--r--include/sys/prctl.h32
-rw-r--r--include/sys/resource.h4
-rw-r--r--include/sys/ustat.h38
-rw-r--r--include/ulimit.h48
-rw-r--r--include/ustat.h1
-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
9 files changed, 232 insertions, 8 deletions
diff --git a/include/sys/personality.h b/include/sys/personality.h
new file mode 100644
index 000000000..5d14a9bc8
--- /dev/null
+++ b/include/sys/personality.h
@@ -0,0 +1,73 @@
+/* Copyright (C) 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Taken verbatim from Linux 2.4 (include/linux/personality.h). */
+
+#ifndef _SYS_PERSONALITY_H
+#define _SYS_PERSONALITY_H 1
+
+#include <features.h>
+
+/* Flags for bug emulation.
+ These occupy the top three bytes. */
+enum
+ {
+ MMAP_PAGE_ZERO = 0x0100000,
+ ADDR_LIMIT_32BIT = 0x0800000,
+ SHORT_INODE = 0x1000000,
+ WHOLE_SECONDS = 0x2000000,
+ STICKY_TIMEOUTS = 0x4000000,
+ };
+
+/* Personality types.
+
+ These go in the low byte. Avoid using the top bit, it will
+ conflict with error returns. */
+enum
+ {
+ PER_LINUX = 0x0000,
+ PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
+ PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
+ PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
+ PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE,
+ PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
+ PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
+ PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
+ PER_BSD = 0x0006,
+ PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
+ PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
+ PER_LINUX32 = 0x0008,
+ PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, /* IRIX5 32-bit */
+ PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, /* IRIX6 new 32-bit */
+ PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, /* IRIX6 64-bit */
+ PER_RISCOS = 0x000c,
+ PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
+ PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
+ PER_HPUX = 0x000f,
+ PER_OSF4 = 0x0010,
+ PER_MASK = 0x00ff,
+ };
+
+__BEGIN_DECLS
+
+/* Set different ABIs (personalities). */
+extern int personality (unsigned long int __persona) __THROW;
+
+__END_DECLS
+
+#endif /* sys/personality.h */
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
new file mode 100644
index 000000000..7e9b72d3a
--- /dev/null
+++ b/include/sys/prctl.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1997, 1999 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H 1
+
+#include <features.h>
+#include <linux/prctl.h> /* The magic values come from here */
+
+__BEGIN_DECLS
+
+/* Control process execution. */
+extern int prctl (int __option, ...) __THROW;
+
+__END_DECLS
+
+#endif /* sys/prctl.h */
diff --git a/include/sys/resource.h b/include/sys/resource.h
index e64a08672..3dd2da929 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 94, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992,94,96,97,98,99,2000,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
@@ -35,7 +35,7 @@ __BEGIN_DECLS
`int' as the type for the first argument. When we are compiling with
GNU extensions we change this slightly to provide better error
checking. */
-#ifdef __USE_GNU
+#if defined __USE_GNU && !defined __cplusplus
typedef enum __rlimit_resource __rlimit_resource_t;
typedef enum __rusage_who __rusage_who_t;
typedef enum __priority_which __priority_which_t;
diff --git a/include/sys/ustat.h b/include/sys/ustat.h
new file mode 100644
index 000000000..7a9cdac0d
--- /dev/null
+++ b/include/sys/ustat.h
@@ -0,0 +1,38 @@
+/* Header describing obsolete `ustat' interface.
+ Copyright (C) 1996, 1998, 1999 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * This interface is obsolete. Use <sys/statfs.h> instead.
+ */
+
+#ifndef _SYS_USTAT_H
+#define _SYS_USTAT_H 1
+
+#include <features.h>
+
+#include <sys/types.h>
+#include <bits/ustat.h>
+
+__BEGIN_DECLS
+
+extern int ustat (__dev_t __dev, struct ustat *__ubuf) __THROW;
+
+__END_DECLS
+
+#endif /* sys/ustat.h */
diff --git a/include/ulimit.h b/include/ulimit.h
new file mode 100644
index 000000000..93b5f3796
--- /dev/null
+++ b/include/ulimit.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 1997, 1998, 1999 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _ULIMIT_H
+#define _ULIMIT_H 1
+
+#include <features.h>
+
+/* Constants used as the first parameter for `ulimit'. They denote limits
+ which can be set or retrieved using this function. */
+enum
+{
+ UL_GETFSIZE = 1, /* Return limit on the size of a file,
+ in units of 512 bytes. */
+#define UL_GETFSIZE UL_GETFSIZE
+ UL_SETFSIZE, /* Set limit on the size of a file to
+ second argument. */
+#define UL_SETFSIZE UL_SETFSIZE
+ __UL_GETMAXBRK, /* Return the maximum possible address
+ of the data segment. */
+ __UL_GETOPENMAX /* Return the maximum number of files
+ that the calling process can open.*/
+};
+
+
+__BEGIN_DECLS
+
+/* Control process limits according to CMD. */
+extern long int ulimit (int __cmd, ...) __THROW;
+
+__END_DECLS
+
+#endif /* ulimit.h */
diff --git a/include/ustat.h b/include/ustat.h
new file mode 100644
index 000000000..cba150e44
--- /dev/null
+++ b/include/ustat.h
@@ -0,0 +1 @@
+#include <sys/ustat.h>
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