summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sys/quota.h158
-rw-r--r--include/sys/sendfile.h38
-rw-r--r--libc/sysdeps/linux/common/syscalls.c137
3 files changed, 324 insertions, 9 deletions
diff --git a/include/sys/quota.h b/include/sys/quota.h
new file mode 100644
index 000000000..a6afdbe44
--- /dev/null
+++ b/include/sys/quota.h
@@ -0,0 +1,158 @@
+/* This just represents the non-kernel parts of <linux/quota.h>.
+ *
+ * here's the corresponding copyright:
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Elz at The University of Melbourne.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Version: $Id: quota.h,v 1.1 2002/01/03 04:00:09 andersen Exp $
+ */
+
+#ifndef _SYS_QUOTA_H
+#define _SYS_QUOTA_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+/*
+ * Convert diskblocks to blocks and the other way around.
+ * currently only to fool the BSD source. :-)
+ */
+#define dbtob(num) ((num) << 10)
+#define btodb(num) ((num) >> 10)
+
+/*
+ * Convert count of filesystem blocks to diskquota blocks, meant
+ * for filesystems where i_blksize != BLOCK_SIZE
+ */
+#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE)
+
+/*
+ * Definitions for disk quotas imposed on the average user
+ * (big brother finally hits Linux).
+ *
+ * The following constants define the amount of time given a user
+ * before the soft limits are treated as hard limits (usually resulting
+ * in an allocation failure). The timer is started when the user crosses
+ * their soft limit, it is reset when they go below their soft limit.
+ */
+#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
+#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
+
+#define MAXQUOTAS 2
+#define USRQUOTA 0 /* element used for user quotas */
+#define GRPQUOTA 1 /* element used for group quotas */
+
+/*
+ * Definitions for the default names of the quotas files.
+ */
+#define INITQFNAMES { \
+ "user", /* USRQUOTA */ \
+ "group", /* GRPQUOTA */ \
+ "undefined", \
+};
+
+#define QUOTAFILENAME "quota"
+#define QUOTAGROUP "staff"
+
+#define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */
+#define NR_DQUOTS 256 /* Number of quotas active at one time */
+
+/*
+ * Command definitions for the 'quotactl' system call.
+ * The commands are broken into a main command defined below
+ * and a subcommand that is used to convey the type of
+ * quota that is being manipulated (see above).
+ */
+#define SUBCMDMASK 0x00ff
+#define SUBCMDSHIFT 8
+#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
+
+#define Q_QUOTAON 0x0100 /* enable quotas */
+#define Q_QUOTAOFF 0x0200 /* disable quotas */
+#define Q_GETQUOTA 0x0300 /* get limits and usage */
+#define Q_SETQUOTA 0x0400 /* set limits and usage */
+#define Q_SETUSE 0x0500 /* set usage */
+#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
+#define Q_SETQLIM 0x0700 /* set limits */
+#define Q_GETSTATS 0x0800 /* get collected stats */
+#define Q_RSQUASH 0x1000 /* set root_squash option */
+
+/*
+ * The following structure defines the format of the disk quota file
+ * (as it appears on disk) - the file is an array of these structures
+ * indexed by user or group number.
+ */
+struct dqblk
+ {
+ u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
+ u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */
+ u_int32_t dqb_curblocks; /* current block count */
+ u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */
+ u_int32_t dqb_isoftlimit; /* preferred inode limit */
+ u_int32_t dqb_curinodes; /* current # allocated inodes */
+ time_t dqb_btime; /* time limit for excessive disk use */
+ time_t dqb_itime; /* time limit for excessive files */
+ };
+
+/*
+ * Shorthand notation.
+ */
+#define dq_bhardlimit dq_dqb.dqb_bhardlimit
+#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
+#define dq_curblocks dq_dqb.dqb_curblocks
+#define dq_ihardlimit dq_dqb.dqb_ihardlimit
+#define dq_isoftlimit dq_dqb.dqb_isoftlimit
+#define dq_curinodes dq_dqb.dqb_curinodes
+#define dq_btime dq_dqb.dqb_btime
+#define dq_itime dq_dqb.dqb_itime
+
+#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
+
+struct dqstats
+ {
+ u_int32_t lookups;
+ u_int32_t drops;
+ u_int32_t reads;
+ u_int32_t writes;
+ u_int32_t cache_hits;
+ u_int32_t pages_allocated;
+ u_int32_t allocated_dquots;
+ u_int32_t free_dquots;
+ u_int32_t syncs;
+ };
+
+__BEGIN_DECLS
+
+extern int quotactl (int __cmd, const char *__special, int __id,
+ caddr_t __addr) __THROW;
+
+__END_DECLS
+
+#endif /* sys/quota.h */
diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h
new file mode 100644
index 000000000..ea474048c
--- /dev/null
+++ b/include/sys/sendfile.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 1998, 1999, 2001 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_SENDFILE_H
+#define _SYS_SENDFILE_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+#ifdef __USE_FILE_OFFSET64
+# error "<sys/sendfile.h> cannot be used with _FILE_OFFSET_BITS=64"
+#endif
+
+__BEGIN_DECLS
+
+/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
+ descriptor OUT_FD. */
+extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *offset,
+ size_t __count) __THROW;
+
+__END_DECLS
+
+#endif /* sys/sendfile.h */
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 36a2ba5c2..e93beadc1 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -1004,6 +1004,12 @@ _syscall1(int, get_kernel_syms, struct kernel_sym *, table);
#endif
//#define __NR_quotactl 131
+#ifdef __NR_quotactl
+#ifdef L_quotactl
+#include <sys/quota.h>
+_syscall4(int, quotactl, int, cmd, const char *, special , int, id, caddr_t, addr);
+#endif
+#endif
//#define __NR_getpgid 132
#ifdef L_getpgid
@@ -1019,7 +1025,6 @@ _syscall1(int, fchdir, int, fd);
//#define __NR_bdflush 134
#ifdef L_bdflush
#include <sys/kdaemon.h>
-
_syscall2(int, bdflush, int, __func, long int, __data);
#endif
@@ -1030,8 +1035,10 @@ _syscall2(int, bdflush, int, __func, long int, __data);
//#define __NR_afs_syscall 137
//#define __NR_setfsuid 138
+//setfsuid EXTRA setfsuid i:i setfsuid
//#define __NR_setfsgid 139
+//setfsgid EXTRA setfsgid i:i setfsgid
//#define __NR__llseek 140
#ifdef L__llseek
@@ -1136,13 +1143,68 @@ _syscall1(pid_t, getsid, pid_t, pid);
#endif
//#define __NR_sched_setparam 154
+#ifdef __NR_sched_setparam
+#ifdef L_sched_setparam
+#include <sched.h>
+_syscall2(int, sched_setparam, pid_t, pid, const struct sched_param *, p);
+#endif
+#endif
+
//#define __NR_sched_getparam 155
+#ifdef __NR_sched_getparam
+#ifdef L_sched_getparam
+#include <sched.h>
+_syscall2(int, sched_getparam, pid_t, pid, struct sched_param *, p);
+#endif
+#endif
+
//#define __NR_sched_setscheduler 156
+#ifdef __NR_sched_setscheduler
+#ifdef L_sched_setscheduler
+#include <sched.h>
+_syscall3(int, sched_setscheduler, pid_t, pid, int, policy, const struct sched_param *, p);
+#endif
+#endif
+
//#define __NR_sched_getscheduler 157
+#ifdef __NR_sched_getscheduler
+#ifdef L_sched_getscheduler
+#include <sched.h>
+_syscall1(int, sched_getscheduler, pid_t, pid);
+#endif
+#endif
+
//#define __NR_sched_yield 158
+#ifdef __NR_sched_yield
+#ifdef L_sched_yield
+#include <sched.h>
+_syscall0(int, sched_yield);
+#endif
+#endif
+
//#define __NR_sched_get_priority_max 159
+#ifdef __NR_sched_get_priority_max
+#ifdef L_sched_get_priority_max
+#include <sched.h>
+_syscall1(int, sched_get_priority_max, int, policy);
+#endif
+#endif
+
//#define __NR_sched_get_priority_min 160
+#ifdef __NR_sched_get_priority_min
+#ifdef L_sched_get_priority_min
+#include <sched.h>
+_syscall1(int, sched_get_priority_min, int, policy);
+#endif
+#endif
+
//#define __NR_sched_rr_get_interval 161
+#ifdef __NR_sched_rr_get_interval
+#ifdef L_sched_rr_get_interval
+#include <sched.h>
+_syscall2(int, sched_rr_get_interval, pid_t, pid, struct timespec *, tp);
+#endif
+#endif
//#define __NR_nanosleep 162
#ifdef L_nanosleep
@@ -1184,9 +1246,12 @@ _syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout
#endif
//#define __NR_nfsservctl 169
+//nfsservctl EXTRA nfsservctl i:ipp nfsservctl
+
//#define __NR_setresgid 170
//#define __NR_getresgid 171
//#define __NR_prctl 172
+
//#define __NR_rt_sigreturn 173
//#define __NR_rt_sigaction 174
#ifdef __NR_rt_sigaction
@@ -1286,8 +1351,21 @@ _syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group);
#endif
//#define __NR_sigaltstack 186
+#ifdef __NR_sigaltstack
+#ifdef L_sigaltstack
+#include <signal.h>
+_syscall2(int, sigaltstack, const struct sigaltstack *, ss, struct sigaltstack *, oss);
+#endif
+#endif
//#define __NR_sendfile 187
+#ifdef __NR_sendfile
+#ifdef L_sendfile
+#include <unistd.h>
+#include <sys/sendfile.h>
+_syscall4(ssize_t,sendfile, int, out_fd, int, in_fd, off_t *, offset, size_t, count)
+#endif
+#endif
//#define __NR_getpmsg 188
@@ -1296,22 +1374,29 @@ _syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group);
//#define __NR_vfork 190
//See sysdeps/linux/<arch>vfork.[cS] for architecture specific implementation...
-#ifdef __UCLIBC_HAVE_LFS__
+//#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
+//#define __NR_mmap2 192
+
//#define __NR_truncate64 193
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L_truncate64
#include <unistd.h>
_syscall2(int, truncate64, const char *, path, __off64_t, length);
#endif
+#endif /* __UCLIBC_HAVE_LFS__ */
//#define __NR_ftruncate64 194
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L_ftruncate64
#include <unistd.h>
_syscall2(int, ftruncate64, int, fd, __off64_t, length);
#endif
+#endif /* __UCLIBC_HAVE_LFS__ */
//#define __NR_stat64 195
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L___stat64
#include <unistd.h>
#include "statfix64.h"
@@ -1338,8 +1423,10 @@ int stat64(const char *file_name, struct libc_stat64 *buf)
return(__xstat64(0, file_name, buf));
}
#endif
+#endif /* __UCLIBC_HAVE_LFS__ */
//#define __NR_lstat64 196
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L___lstat64
#include <unistd.h>
#include "statfix64.h"
@@ -1366,8 +1453,10 @@ int lstat64(const char *file_name, struct libc_stat64 *buf)
return(__lxstat64(0, file_name, buf));
}
#endif
+#endif /* __UCLIBC_HAVE_LFS__ */
//#define __NR_fstat64 197
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L___fstat64
#include <unistd.h>
#include "statfix64.h"
@@ -1394,20 +1483,50 @@ int fstat64(int filedes, struct libc_stat64 *buf)
return(__fxstat64(0, filedes, buf));
}
#endif
+#endif /* __UCLIBC_HAVE_LFS__ */
-//#define __NR_getdents64 220
+//#define __NR_lchown32 198
+//#define __NR_getuid32 199
+//#define __NR_getgid32 200
+//#define __NR_geteuid32 201
+//#define __NR_getegid32 202
+//#define __NR_setreuid32 203
+//#define __NR_setregid32 204
+//#define __NR_getgroups32 205
+//#define __NR_setgroups32 206
+//#define __NR_fchown32 207
+//#define __NR_setresuid32 208
+//#define __NR_getresuid32 209
+//#define __NR_setresgid32 210
+//#define __NR_getresgid32 211
+//#define __NR_chown32 212
+//#define __NR_setuid32 213
+//#define __NR_setgid32 214
+//#define __NR_setfsuid32 215
+//#define __NR_setfsgid32 216
+//#define __NR_pivot_root 217
+#ifdef __NR_pivot_root
+#ifdef L_pivot_root
+_syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
+#endif
+#endif
+
+//#define __NR_mincore 218
+//#define __NR_madvise 219
+//#define __NR_madvise1 219 /* delete when C lib stub is removed */
+
+//#define __NR_getdents64 220
+#ifdef __UCLIBC_HAVE_LFS__
#ifdef L_getdents64
#include <unistd.h>
#include <dirent.h>
_syscall3(int, getdents64, int, fd, char *, dirp, size_t, count);
#endif
-
-
-//#define __NR_fcntl64 221
-
-
#endif /* __UCLIBC_HAVE_LFS__ */
-
+//#define __NR_fcntl64 221
+//#define __NR_security 223 /* syscall for security modules */
+//#define __NR_gettid 224
+//#define __NR_readahead 225