summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2011-07-07 01:23:56 +0000
committertedu <tedu@openbsd.org>2011-07-07 01:23:56 +0000
commit064a70df2947cd408192e4c86a3202a098b605ab (patch)
treec9b9fcbe77db1797c5c754bc50d4594c8227f8f7
parentregen syscalls (diff)
downloadwireguard-openbsd-064a70df2947cd408192e4c86a3202a098b605ab.tar.xz
wireguard-openbsd-064a70df2947cd408192e4c86a3202a098b605ab.zip
remove old files
-rw-r--r--sys/compat/common/kern_exit_43.c108
-rw-r--r--sys/compat/common/kern_info_43.c362
-rw-r--r--sys/compat/common/kern_resource_43.c100
-rw-r--r--sys/compat/common/kern_sig_43.c210
-rw-r--r--sys/compat/common/uipc_syscalls_43.c309
-rw-r--r--sys/compat/common/vfs_syscalls_43.c438
6 files changed, 0 insertions, 1527 deletions
diff --git a/sys/compat/common/kern_exit_43.c b/sys/compat/common/kern_exit_43.c
deleted file mode 100644
index 216b5353c20..00000000000
--- a/sys/compat/common/kern_exit_43.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $OpenBSD: kern_exit_43.c,v 1.7 2003/06/02 23:27:59 millert Exp $ */
-/* $NetBSD: kern_exit_43.c,v 1.3 1995/10/07 06:26:20 mycroft Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- * 3. 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.
- *
- * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/wait.h>
-#include <sys/file.h>
-#include <sys/vnode.h>
-#include <sys/syslog.h>
-#include <sys/malloc.h>
-#include <sys/resourcevar.h>
-#include <sys/ptrace.h>
-#include <sys/acct.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <compat/common/compat_util.h>
-
-#include <uvm/uvm_extern.h>
-#ifdef m68k
-#include <machine/frame.h>
-#include <machine/psl.h>
-#define GETPS(rp) ((struct frame *)(rp))->f_sr
-#else
-#define GETPS(rp) (rp)[PS]
-#endif
-
-int
-compat_43_sys_wait(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- caddr_t sg = stackgap_init(p->p_emul);
- int error;
-
- struct sys_wait4_args /* {
- syscallarg(int) pid;
- syscallarg(int *) status;
- syscallarg(int) options;
- syscallarg(struct rusage *) rusage;
- } */ a;
-
-#ifdef m68k
- if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) {
- SCARG(&a, options) = 0;
- SCARG(&a, rusage) = NULL;
- } else {
- SCARG(&a, options) = p->p_md.md_regs[R0];
- SCARG(&a, rusage) = (struct rusage *)p->p_md.md_regs[R1];
- }
-#else
- SCARG(&a, options) = 0;
- SCARG(&a, rusage) = NULL;
-#endif
- SCARG(&a, pid) = WAIT_ANY;
- SCARG(&a, status) = stackgap_alloc(&sg, sizeof(SCARG(&a, status)));
- if ((error = sys_wait4(p, &a, retval)) != 0)
- return error;
- return copyin(SCARG(&a, status), &retval[1], sizeof(retval[1]));
-}
diff --git a/sys/compat/common/kern_info_43.c b/sys/compat/common/kern_info_43.c
deleted file mode 100644
index 50742ade663..00000000000
--- a/sys/compat/common/kern_info_43.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* $OpenBSD: kern_info_43.c,v 1.16 2011/03/12 04:54:28 guenther Exp $ */
-/* $NetBSD: kern_info_43.c,v 1.5 1996/02/04 02:02:22 christos Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- * 3. 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.
- *
- * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/filedesc.h>
-#include <sys/kernel.h>
-#include <sys/vnode.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/unistd.h>
-#include <sys/resourcevar.h>
-#include <uvm/uvm_extern.h>
-#include <sys/sysctl.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-int
-compat_43_sys_getdtablesize(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- *retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);
- return (0);
-}
-
-
-/* ARGSUSED */
-int
-compat_43_sys_gethostid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- *(int32_t *)retval = hostid;
- return (0);
-}
-
-
-/*ARGSUSED*/
-int
-compat_43_sys_gethostname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_gethostname_args /* {
- syscallarg(char *) hostname;
- syscallarg(u_int) len;
- } */ *uap = v;
- int name;
- size_t sz;
-
- name = KERN_HOSTNAME;
- sz = SCARG(uap, len);
- return (kern_sysctl(&name, 1, SCARG(uap, hostname), &sz, 0, 0, p));
-}
-
-#define KINFO_PROC (0<<8)
-#define KINFO_RT (1<<8)
-#define KINFO_VNODE (2<<8)
-#define KINFO_FILE (3<<8)
-#define KINFO_METER (4<<8)
-#define KINFO_LOADAVG (5<<8)
-#define KINFO_CLOCKRATE (6<<8)
-#define KINFO_BSDI_SYSINFO (101<<8)
-
-
-/*
- * The string data is appended to the end of the bsdi_si structure during
- * copyout. The "char *" offsets in the bsdi_si struct are relative to the
- * base of the bsdi_si struct.
- */
-struct bsdi_si {
- char *machine;
- char *cpu_model;
- long ncpu;
- long cpuspeed;
- long hwflags;
- u_long physmem;
- u_long usermem;
- u_long pagesize;
-
- char *ostype;
- char *osrelease;
- long os_revision;
- long posix1_version;
- char *version;
-
- long hz;
- long profhz;
- int ngroups_max;
- long arg_max;
- long open_max;
- long child_max;
-
- struct timeval boottime;
- char *hostname;
-};
-
-/* Non-standard BSDI extension - only present on their 4.3 net-2 releases */
-#define KINFO_BSDI_SYSINFO (101<<8)
-
-/*
- * XXX this is bloat, but I hope it's better here than on the potentially
- * limited kernel stack... -Peter
- */
-
-struct {
- char *bsdi_machine; /* "i386" on BSD/386 */
- char *pad0;
- long pad1;
- long pad2;
- long pad3;
- u_long pad4;
- u_long pad5;
- u_long pad6;
-
- char *bsdi_ostype; /* "BSD/386" on BSD/386 */
- char *bsdi_osrelease; /* "1.1" on BSD/386 */
- long pad7;
- long pad8;
- char *pad9;
-
- long pad10;
- long pad11;
- int pad12;
- long pad13;
- quad_t pad14;
- long pad15;
-
- struct timeval pad16;
- /* we dont set this, because BSDI's uname used gethostname() instead */
- char *bsdi_hostname; /* hostname on BSD/386 */
-
- /* the actual string data is appended here */
-
-} bsdi_si;
-/*
- * this data is appended to the end of the bsdi_si structure during copyout.
- * The "char *" offsets are relative to the base of the bsdi_si struct.
- * This contains "OpenBSD\01.2-BUILT-nnnnnn\0i386\0", and these strings
- * should not exceed the length of the buffer here... (or else!! :-)
- */
-char bsdi_strings[80]; /* It had better be less than this! */
-
-int
-compat_43_sys_getkerninfo(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_getkerninfo_args /* {
- syscallarg(int) op;
- syscallarg(char *) where;
- syscallarg(int *) size;
- syscallarg(int) arg;
- } */ *uap = v;
- int error, name[5];
- size_t size;
-
- extern char machine[];
-
- if (SCARG(uap, size) && (error = copyin((caddr_t)SCARG(uap, size),
- (caddr_t)&size, sizeof(size))))
- return (error);
-
- switch (SCARG(uap, op) & 0xff00) {
-
- case KINFO_RT:
- name[0] = PF_ROUTE;
- name[1] = 0;
- name[2] = (SCARG(uap, op) & 0xff0000) >> 16;
- name[3] = SCARG(uap, op) & 0xff;
- name[4] = SCARG(uap, arg);
- error =
- net_sysctl(name, 5, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_VNODE:
- name[0] = KERN_VNODE;
- error =
- kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_FILE:
- name[0] = KERN_FILE;
- error =
- kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_METER:
- name[0] = VM_METER;
- error =
- uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_LOADAVG:
- name[0] = VM_LOADAVG;
- error =
- uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_CLOCKRATE:
- name[0] = KERN_CLOCKRATE;
- error =
- kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
- break;
-
- case KINFO_BSDI_SYSINFO: {
- /*
- * this is pretty crude, but it's just enough for uname()
- * from BSDI's 1.x libc to work.
- */
-
- u_int needed;
- u_int left;
- char *s;
-
- bzero((char *)&bsdi_si, sizeof(bsdi_si));
- bzero(bsdi_strings, sizeof(bsdi_strings));
-
- s = bsdi_strings;
-
- bsdi_si.bsdi_ostype = ((char *)(s - bsdi_strings)) +
- sizeof(bsdi_si);
- strlcpy(s, ostype, bsdi_strings + sizeof bsdi_strings - s);
- s += strlen(s) + 1;
-
- bsdi_si.bsdi_osrelease = ((char *)(s - bsdi_strings)) +
- sizeof(bsdi_si);
- strlcpy(s, osrelease, bsdi_strings + sizeof bsdi_strings - s);
- s += strlen(s) + 1;
-
- bsdi_si.bsdi_machine = ((char *)(s - bsdi_strings)) +
- sizeof(bsdi_si);
- strlcpy(s, machine, bsdi_strings + sizeof bsdi_strings - s);
- s += strlen(s) + 1;
-
- needed = sizeof(bsdi_si) + (s - bsdi_strings);
-
- if (SCARG(uap, where) == NULL) {
- /* process is asking how much buffer to supply.. */
- size = needed;
- error = 0;
- break;
- }
-
- /* if too much buffer supplied, trim it down */
- if (size > needed)
- size = needed;
-
- /* how much of the buffer is remaining */
- left = size;
-
- if ((error = copyout((char *)&bsdi_si, SCARG(uap, where),
- left)) != 0)
- break;
-
- /* is there any point in continuing? */
- if (left > sizeof(bsdi_si))
- left -= sizeof(bsdi_si);
- else
- break;
-
- error = copyout(&bsdi_strings, SCARG(uap, where) +
- sizeof(bsdi_si), left);
-
- break;
- }
-
- default:
- return (EOPNOTSUPP);
- }
- if (error)
- return (error);
- *retval = size;
- if (SCARG(uap, size))
- error = copyout((caddr_t)&size, (caddr_t)SCARG(uap, size),
- sizeof(size));
- return (error);
-}
-
-
-/* ARGSUSED */
-int
-compat_43_sys_sethostid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_sethostid_args /* {
- syscallarg(int32_t) hostid;
- } */ *uap = v;
- int error;
-
- if ((error = suser(p, 0)) != 0)
- return (error);
- hostid = SCARG(uap, hostid);
- return (0);
-}
-
-
-/* ARGSUSED */
-int
-compat_43_sys_sethostname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_sethostname_args *uap = v;
- int name;
- int error;
-
- if ((error = suser(p, 0)) != 0)
- return (error);
- name = KERN_HOSTNAME;
- return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
- SCARG(uap, len), p));
-}
diff --git a/sys/compat/common/kern_resource_43.c b/sys/compat/common/kern_resource_43.c
deleted file mode 100644
index eab871e2480..00000000000
--- a/sys/compat/common/kern_resource_43.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: kern_resource_43.c,v 1.5 2003/06/02 23:27:59 millert Exp $ */
-/* $NetBSD: kern_resource_43.c,v 1.4 1996/03/14 19:31:46 christos Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- * 3. 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.
- *
- * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/file.h>
-#include <sys/resourcevar.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <uvm/uvm_extern.h>
-
-/* ARGSUSED */
-int
-compat_43_sys_getrlimit(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_getrlimit_args /* {
- syscallarg(int) which;
- syscallarg(struct ogetrlimit *) rlp;
- } */ *uap = v;
- struct orlimit olim;
-
- if (SCARG(uap, which) < 0 || SCARG(uap, which) >= RLIM_NLIMITS)
- return (EINVAL);
- olim.rlim_cur = p->p_rlimit[SCARG(uap, which)].rlim_cur;
- if (olim.rlim_cur == -1)
- olim.rlim_cur = 0x7fffffff;
- olim.rlim_max = p->p_rlimit[SCARG(uap, which)].rlim_max;
- if (olim.rlim_max == -1)
- olim.rlim_max = 0x7fffffff;
- return (copyout((caddr_t)&olim, (caddr_t)SCARG(uap, rlp),
- sizeof(olim)));
-}
-
-/* ARGSUSED */
-int
-compat_43_sys_setrlimit(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_setrlimit_args /* {
- syscallarg(int) which;
- syscallarg(struct ogetrlimit *) rlp;
- } */ *uap = v;
- struct orlimit olim;
- struct rlimit lim;
- int error;
-
- error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&olim,
- sizeof (struct orlimit));
- if (error)
- return (error);
- lim.rlim_cur = olim.rlim_cur;
- lim.rlim_max = olim.rlim_max;
- return (dosetrlimit(p, SCARG(uap, which), &lim));
-}
diff --git a/sys/compat/common/kern_sig_43.c b/sys/compat/common/kern_sig_43.c
deleted file mode 100644
index 09a796eca3c..00000000000
--- a/sys/compat/common/kern_sig_43.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $OpenBSD: kern_sig_43.c,v 1.12 2011/07/05 04:48:02 guenther Exp $ */
-/* $NetBSD: kern_sig_43.c,v 1.7 1996/03/14 19:31:47 christos Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- * 3. 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.
- *
- * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
- */
-
-#include <sys/param.h>
-#include <sys/signalvar.h>
-#include <sys/resourcevar.h>
-#include <sys/namei.h>
-#include <sys/vnode.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/times.h>
-#include <sys/buf.h>
-#include <sys/acct.h>
-#include <sys/file.h>
-#include <sys/kernel.h>
-#include <sys/wait.h>
-#include <sys/ktrace.h>
-#include <sys/syslog.h>
-#include <sys/stat.h>
-#include <sys/core.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-int
-compat_43_sys_sigblock(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_sigblock_args /* {
- syscallarg(int) mask;
- } */ *uap = v;
- int s;
-
- s = splhigh();
- *retval = p->p_sigmask;
- p->p_sigmask |= SCARG(uap, mask) &~ sigcantmask;
- splx(s);
- return (0);
-}
-
-
-int
-compat_43_sys_sigsetmask(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_sigsetmask_args /* {
- syscallarg(int) mask;
- } */ *uap = v;
- int s;
-
- s = splhigh();
- *retval = p->p_sigmask;
- p->p_sigmask = SCARG(uap, mask) &~ sigcantmask;
- splx(s);
- return (0);
-}
-
-
-/* ARGSUSED */
-int
-compat_43_sys_sigstack(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_sigstack_args /* {
- syscallarg(struct sigstack *) nss;
- syscallarg(struct sigstack *) oss;
- } */ *uap = v;
- struct sigstack ss;
- int error = 0;
-
- if (SCARG(uap, oss)) {
- ss.ss_sp = p->p_sigstk.ss_sp;
- ss.ss_onstack = p->p_sigstk.ss_flags & SS_ONSTACK;
- if ((error = copyout(&ss, SCARG(uap, oss), sizeof(ss))))
- return (error);
- }
- if (SCARG(uap, nss) == 0)
- return (0);
- error = copyin(SCARG(uap, nss), &ss, sizeof(ss));
- if (error)
- return (error);
- if (p->p_sigstk.ss_flags & SS_ONSTACK)
- return (EPERM);
- if (ss.ss_onstack)
- return (EINVAL);
- p->p_sigstk.ss_sp = ss.ss_sp;
- p->p_sigstk.ss_size = 0;
- p->p_sigstk.ss_flags = 0;
- return (0);
-}
-
-/*
- * Generalized interface signal handler, 4.3-compatible.
- */
-/* ARGSUSED */
-int
-compat_43_sys_sigvec(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_sigvec_args /* {
- syscallarg(int) signum;
- syscallarg(struct sigvec *) nsv;
- syscallarg(struct sigvec *) osv;
- } */ *uap = v;
- struct sigvec vec;
- register struct sigacts *ps = p->p_sigacts;
- register struct sigvec *sv;
- register int signum;
- int bit, error;
-
- signum = SCARG(uap, signum);
- if (signum <= 0 || signum >= NSIG ||
- signum == SIGKILL || signum == SIGSTOP)
- return (EINVAL);
- sv = &vec;
- if (SCARG(uap, osv)) {
- *(sig_t *)&sv->sv_handler = ps->ps_sigact[signum];
- sv->sv_mask = ps->ps_catchmask[signum];
- bit = sigmask(signum);
- sv->sv_flags = 0;
- if ((ps->ps_sigonstack & bit) != 0)
- sv->sv_flags |= SV_ONSTACK;
- if ((ps->ps_sigintr & bit) != 0)
- sv->sv_flags |= SV_INTERRUPT;
- if ((ps->ps_sigreset & bit) != 0)
- sv->sv_flags |= SV_RESETHAND;
- if (ps->ps_flags & SAS_NOCLDSTOP)
- sv->sv_flags |= SA_NOCLDSTOP;
- sv->sv_mask &= ~bit;
- error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, osv),
- sizeof (vec));
- if (error)
- return (error);
- }
- if (SCARG(uap, nsv)) {
- error = copyin((caddr_t)SCARG(uap, nsv), (caddr_t)sv,
- sizeof (vec));
- if (error)
- return (error);
- sv->sv_flags ^= SA_RESTART; /* opposite of SV_INTERRUPT */
- setsigvec(p, signum, (struct sigaction *)sv);
- }
- return (0);
-}
-
-
-/* ARGSUSED */
-int
-compat_43_sys_killpg(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_killpg_args /* {
- syscallarg(int) pgid;
- syscallarg(int) signum;
- } */ *uap = v;
-
- if ((u_int)SCARG(uap, signum) >= NSIG)
- return (EINVAL);
- return (killpg1(p, SCARG(uap, signum), SCARG(uap, pgid), 0));
-}
diff --git a/sys/compat/common/uipc_syscalls_43.c b/sys/compat/common/uipc_syscalls_43.c
deleted file mode 100644
index f047c1b609e..00000000000
--- a/sys/compat/common/uipc_syscalls_43.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/* $OpenBSD: uipc_syscalls_43.c,v 1.8 2007/10/30 12:09:22 gilles Exp $ */
-/* $NetBSD: uipc_syscalls_43.c,v 1.5 1996/03/14 19:31:50 christos Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- * 3. 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.
- *
- * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/filedesc.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/unistd.h>
-#include <sys/resourcevar.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-int
-compat_43_sys_accept(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_accept_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) name;
- syscallarg(int *) anamelen;
- } */ *uap = v;
- int error;
-
- if ((error = sys_accept(p, uap, retval)) != 0)
- return error;
-
- if (SCARG(uap, name)) {
- struct sockaddr sa;
-
- if ((error = copyin(SCARG(uap, name), &sa, sizeof(sa))) != 0)
- return error;
-
- ((struct osockaddr*) &sa)->sa_family = sa.sa_family;
-
- if ((error = copyout(&sa, SCARG(uap, name), sizeof(sa))) != 0)
- return error;
- }
- return 0;
-}
-
-
-int
-compat_43_sys_getpeername(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_getpeername_args /* {
- syscallarg(int) fdes;
- syscallarg(caddr_t) asa;
- syscallarg(int *) alen;
- } */ *uap = v;
- struct sockaddr sa;
-
- int error;
-
- if ((error = sys_getpeername(p, uap, retval)) != 0)
- return error;
-
- if ((error = copyin(SCARG(uap, asa), &sa, sizeof(sa))) != 0)
- return error;
-
- ((struct osockaddr*) &sa)->sa_family = sa.sa_family;
-
- if ((error = copyout(&sa, SCARG(uap, asa), sizeof(sa))) != 0)
- return error;
-
- return 0;
-}
-
-
-int
-compat_43_sys_getsockname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_getsockname_args /* {
- syscallarg(int) fdes;
- syscallarg(caddr_t) asa;
- syscallarg(int *) alen;
- } */ *uap = v;
- struct sockaddr sa;
- int error;
-
- if ((error = sys_getsockname(p, uap, retval)) != 0)
- return error;
-
- if ((error = copyin(SCARG(uap, asa), &sa, sizeof(sa))) != 0)
- return error;
-
- ((struct osockaddr*) &sa)->sa_family = sa.sa_family;
-
- if ((error = copyout(&sa, SCARG(uap, asa), sizeof(sa))) != 0)
- return error;
-
- return 0;
-}
-
-
-int
-compat_43_sys_recv(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_recv_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) buf;
- syscallarg(int) len;
- syscallarg(int) flags;
- } */ *uap = v;
- struct msghdr msg;
- struct iovec aiov;
-
- msg.msg_name = 0;
- msg.msg_namelen = 0;
- msg.msg_iov = &aiov;
- msg.msg_iovlen = 1;
- aiov.iov_base = SCARG(uap, buf);
- aiov.iov_len = SCARG(uap, len);
- msg.msg_control = 0;
- msg.msg_flags = SCARG(uap, flags);
- return (recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval));
-}
-
-
-#ifdef MSG_COMPAT
-int
-compat_43_sys_recvfrom(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_recvfrom_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) buf;
- syscallarg(size_t) len;
- syscallarg(int) flags;
- syscallarg(caddr_t) from;
- syscallarg(int *) fromlenaddr;
- } */ *uap = v;
-
- SCARG(uap, flags) |= MSG_COMPAT;
- return (sys_recvfrom(p, uap, retval));
-}
-#endif
-
-
-#ifdef MSG_COMPAT
-/*
- * Old recvmsg. This code takes advantage of the fact that the old msghdr
- * overlays the new one, missing only the flags, and with the (old) access
- * rights where the control fields are now.
- */
-int
-compat_43_sys_recvmsg(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_recvmsg_args /* {
- syscallarg(int) s;
- syscallarg(struct omsghdr *) msg;
- syscallarg(int) flags;
- } */ *uap = v;
- struct msghdr msg;
- struct iovec aiov[UIO_SMALLIOV], *iov;
- int error;
-
- error = copyin((caddr_t)SCARG(uap, msg), (caddr_t)&msg,
- sizeof (struct omsghdr));
- if (error)
- return (error);
- if (msg.msg_iovlen <= 0 || msg.msg_iovlen > IOV_MAX)
- return (EMSGSIZE);
- if (msg.msg_iovlen > UIO_SMALLIOV)
- iov = malloc(sizeof(struct iovec) * msg.msg_iovlen,
- M_IOV, M_WAITOK);
- else
- iov = aiov;
- msg.msg_flags = SCARG(uap, flags) | MSG_COMPAT;
- error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
- (unsigned)(msg.msg_iovlen * sizeof (struct iovec)));
- if (error)
- goto done;
- msg.msg_iov = iov;
- error = recvit(p, SCARG(uap, s), &msg,
- (caddr_t)&SCARG(uap, msg)->msg_namelen, retval);
-
- if (msg.msg_controllen && error == 0)
- error = copyout((caddr_t)&msg.msg_controllen,
- (caddr_t)&SCARG(uap, msg)->msg_accrightslen, sizeof (int));
-done:
- if (iov != aiov)
- free(iov, M_IOV);
- return (error);
-}
-#endif
-
-int
-compat_43_sys_send(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_send_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) buf;
- syscallarg(int) len;
- syscallarg(int) flags;
- } */ *uap = v;
- struct msghdr msg;
- struct iovec aiov;
-
- msg.msg_name = 0;
- msg.msg_namelen = 0;
- msg.msg_iov = &aiov;
- msg.msg_iovlen = 1;
- aiov.iov_base = SCARG(uap, buf);
- aiov.iov_len = SCARG(uap, len);
- msg.msg_control = 0;
- msg.msg_flags = 0;
- return (sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval));
-}
-
-#ifdef MSG_COMPAT
-int
-compat_43_sys_sendmsg(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_sendmsg_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) msg;
- syscallarg(int) flags;
- } */ *uap = v;
- struct msghdr msg;
- struct iovec aiov[UIO_SMALLIOV], *iov;
- int error;
-
- error = copyin(SCARG(uap, msg), (caddr_t)&msg,
- sizeof (struct omsghdr));
- if (error)
- return (error);
- if (msg.msg_iovlen <= 0 || msg.msg_iovlen > IOV_MAX)
- return (EMSGSIZE);
- if (msg.msg_iovlen > UIO_SMALLIOV)
- iov = malloc(sizeof(struct iovec) * msg.msg_iovlen,
- M_IOV, M_WAITOK);
- else
- iov = aiov;
- error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
- (unsigned)(msg.msg_iovlen * sizeof (struct iovec)));
- if (error)
- goto done;
- msg.msg_flags = MSG_COMPAT;
- msg.msg_iov = iov;
- error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
-done:
- if (iov != aiov)
- free(iov, M_IOV);
- return (error);
-}
-#endif
diff --git a/sys/compat/common/vfs_syscalls_43.c b/sys/compat/common/vfs_syscalls_43.c
deleted file mode 100644
index fd14d857d8b..00000000000
--- a/sys/compat/common/vfs_syscalls_43.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/* $OpenBSD: vfs_syscalls_43.c,v 1.28 2007/10/30 18:13:45 chl Exp $ */
-/* $NetBSD: vfs_syscalls_43.c,v 1.4 1996/03/14 19:31:52 christos Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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.
- * 3. 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.
- *
- * @(#)vfs_syscalls.c 8.28 (Berkeley) 12/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/filedesc.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#include <sys/vnode.h>
-#include <sys/namei.h>
-#include <sys/dirent.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/unistd.h>
-#include <sys/resourcevar.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <sys/pipe.h>
-
-static void cvtstat(struct stat *, struct stat43 *);
-
-/*
- * Convert from a new to an old stat structure.
- */
-static void
-cvtstat(st, ost)
- struct stat *st;
- struct stat43 *ost;
-{
-
- ost->st_dev = st->st_dev;
- ost->st_ino = st->st_ino;
- ost->st_mode = st->st_mode;
- ost->st_nlink = st->st_nlink;
- ost->st_uid = st->st_uid;
- ost->st_gid = st->st_gid;
- ost->st_rdev = st->st_rdev;
- if (st->st_size < (quad_t)1 << 32)
- ost->st_size = st->st_size;
- else
- ost->st_size = -2;
- ost->st_atime = st->st_atime;
- ost->st_mtime = st->st_mtime;
- ost->st_ctime = st->st_ctime;
- ost->st_blksize = st->st_blksize;
- ost->st_blocks = st->st_blocks;
- ost->st_flags = st->st_flags;
- ost->st_gen = st->st_gen;
-}
-
-/*
- * Get file status; this version follows links.
- */
-/* ARGSUSED */
-int
-compat_43_sys_stat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_stat_args /* {
- syscallarg(char *) path;
- syscallarg(struct stat43 *) ub;
- } */ *uap = v;
- struct stat sb;
- struct stat43 osb;
- int error;
- struct nameidata nd;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
- SCARG(uap, path), p);
- if ((error = namei(&nd)) != 0)
- return (error);
- error = vn_stat(nd.ni_vp, &sb, p);
- vput(nd.ni_vp);
- if (error)
- return (error);
- /* Don't let non-root see generation numbers (for NFS security) */
- if (suser(p, 0))
- sb.st_gen = 0;
- cvtstat(&sb, &osb);
- error = copyout(&osb, SCARG(uap, ub), sizeof(osb));
- return (error);
-}
-
-
-/*
- * Get file status; this version does not follow links.
- */
-/* ARGSUSED */
-int
-compat_43_sys_lstat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_lstat_args /* {
- syscallarg(char *) path;
- syscallarg(struct stat43 *) ub;
- } */ *uap = v;
- struct stat sb;
- struct stat43 osb;
- int error;
- struct nameidata nd;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
- SCARG(uap, path), p);
- if ((error = namei(&nd)) != 0)
- return (error);
- error = vn_stat(nd.ni_vp, &sb, p);
- vput(nd.ni_vp);
- if (error)
- return (error);
- /* Don't let non-root see generation numbers (for NFS security) */
- if (suser(p, 0))
- sb.st_gen = 0;
- cvtstat(&sb, &osb);
- error = copyout(&osb, SCARG(uap, ub), sizeof(osb));
- return (error);
-}
-
-/*
- * Return status information about a file descriptor.
- */
-/* ARGSUSED */
-int
-compat_43_sys_fstat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct compat_43_sys_fstat_args /* {
- syscallarg(int) fd;
- syscallarg(struct stat43 *) sb;
- } */ *uap = v;
- int fd = SCARG(uap, fd);
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct stat ub;
- struct stat43 oub;
- int error;
-
- if ((fp = fd_getfile(fdp, fd)) == NULL)
- return (EBADF);
- FREF(fp);
- error = (*fp->f_ops->fo_stat)(fp, &ub, p);
- FRELE(fp);
- if (error == 0) {
- /* Don't let non-root see generation numbers
- (for NFS security) */
- if (suser(p, 0))
- ub.st_gen = 0;
- cvtstat(&ub, &oub);
- error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
- }
- return (error);
-}
-
-/*
- * Truncate a file given a file descriptor.
- */
-/* ARGSUSED */
-int
-compat_43_sys_ftruncate(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_ftruncate_args /* {
- syscallarg(int) fd;
- syscallarg(long) length;
- } */ *uap = v;
- struct sys_ftruncate_args /* {
- syscallarg(int) fd;
- syscallarg(int) pad;
- syscallarg(off_t) length;
- } */ nuap;
-
- SCARG(&nuap, fd) = SCARG(uap, fd);
- SCARG(&nuap, length) = SCARG(uap, length);
- return (sys_ftruncate(p, &nuap, retval));
-}
-
-/*
- * Truncate a file given its path name.
- */
-/* ARGSUSED */
-int
-compat_43_sys_truncate(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_truncate_args /* {
- syscallarg(char *) path;
- syscallarg(long) length;
- } */ *uap = v;
- struct sys_truncate_args /* {
- syscallarg(char *) path;
- syscallarg(int) pad;
- syscallarg(off_t) length;
- } */ nuap;
-
- SCARG(&nuap, path) = SCARG(uap, path);
- SCARG(&nuap, length) = SCARG(uap, length);
- return (sys_truncate(p, &nuap, retval));
-}
-
-
-/*
- * Reposition read/write file offset.
- */
-int
-compat_43_sys_lseek(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_lseek_args /* {
- syscallarg(int) fd;
- syscallarg(long) offset;
- syscallarg(int) whence;
- } */ *uap = v;
- struct sys_lseek_args /* {
- syscallarg(int) fd;
- syscallarg(int) pad;
- syscallarg(off_t) offset;
- syscallarg(int) whence;
- } */ nuap;
- off_t qret;
- int error;
-
- SCARG(&nuap, fd) = SCARG(uap, fd);
- SCARG(&nuap, offset) = SCARG(uap, offset);
- SCARG(&nuap, whence) = SCARG(uap, whence);
- error = sys_lseek(p, &nuap, (register_t *)&qret);
- *(long *)retval = qret;
- return (error);
-}
-
-
-/*
- * Create a file.
- */
-int
-compat_43_sys_creat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_creat_args /* {
- syscallarg(char *) path;
- syscallarg(mode_t) mode;
- } */ *uap = v;
- struct sys_open_args /* {
- syscallarg(char *) path;
- syscallarg(int) flags;
- syscallarg(mode_t) mode;
- } */ nuap;
-
- SCARG(&nuap, path) = SCARG(uap, path);
- SCARG(&nuap, mode) = SCARG(uap, mode);
- SCARG(&nuap, flags) = O_WRONLY | O_CREAT | O_TRUNC;
- return (sys_open(p, &nuap, retval));
-}
-
-/*ARGSUSED*/
-int
-compat_43_sys_quota(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- return (ENOSYS);
-}
-
-
-/*
- * Read a block of directory entries in a file system independent format.
- */
-int
-compat_43_sys_getdirentries(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct compat_43_sys_getdirentries_args /* {
- syscallarg(int) fd;
- syscallarg(char *) buf;
- syscallarg(int) count;
- syscallarg(long *) basep;
- } */ *uap = v;
- struct vnode *vp;
- struct file *fp;
- struct uio auio, kuio;
- struct iovec aiov, kiov;
- struct dirent *dp, *edp;
- caddr_t dirbuf;
- int error, eofflag, readcnt;
- long loff;
-
- if (SCARG(uap, count) < 0)
- return EINVAL;
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
- return (error);
- if ((fp->f_flag & FREAD) == 0) {
- error = EBADF;
- goto bad;
- }
- vp = (struct vnode *)fp->f_data;
- if (vp->v_type != VDIR) {
- error = EINVAL;
- goto bad;
- }
- aiov.iov_base = SCARG(uap, buf);
- aiov.iov_len = SCARG(uap, count);
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_procp = p;
- auio.uio_resid = SCARG(uap, count);
-
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- loff = auio.uio_offset = fp->f_offset;
-# if (BYTE_ORDER != LITTLE_ENDIAN)
- if (vp->v_mount->mnt_maxsymlinklen <= 0) {
- error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag,
- (int *)0, (u_long **)0);
- fp->f_offset = auio.uio_offset;
- } else
-# endif
- {
- u_int nbytes = SCARG(uap, count);
-
- nbytes = min(nbytes, MAXBSIZE);
-
- kuio = auio;
- kuio.uio_iov = &kiov;
- kuio.uio_segflg = UIO_SYSSPACE;
- kiov.iov_len = nbytes;
- dirbuf = (caddr_t)malloc(nbytes, M_TEMP, M_WAITOK);
- kiov.iov_base = dirbuf;
-
- error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
- 0, 0);
- fp->f_offset = kuio.uio_offset;
- if (error == 0) {
- readcnt = nbytes - kuio.uio_resid;
- edp = (struct dirent *)&dirbuf[readcnt];
- for (dp = (struct dirent *)dirbuf; dp < edp; ) {
-# if (BYTE_ORDER == LITTLE_ENDIAN)
- /*
- * The expected low byte of
- * dp->d_namlen is our dp->d_type.
- * The high MBZ byte of dp->d_namlen
- * is our dp->d_namlen.
- */
- dp->d_type = dp->d_namlen;
- dp->d_namlen = 0;
-# else
- /*
- * The dp->d_type is the high byte
- * of the expected dp->d_namlen,
- * so must be zero'ed.
- */
- dp->d_type = 0;
-# endif
- if (dp->d_reclen > 0) {
- dp = (struct dirent *)
- ((char *)dp + dp->d_reclen);
- } else {
- error = EIO;
- break;
- }
- }
- if (dp >= edp)
- error = uiomove(dirbuf, readcnt, &auio);
- }
- free(dirbuf, M_TEMP);
- }
- VOP_UNLOCK(vp, 0, p);
- if (error)
- goto bad;
- error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep),
- sizeof(long));
- *retval = SCARG(uap, count) - auio.uio_resid;
-bad:
- FRELE(fp);
- return (error);
-}