summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2016-03-02 15:41:47 +0000
committernaddy <naddy@openbsd.org>2016-03-02 15:41:47 +0000
commit3ff801c032f3258b94ac6d01d574c0da4c0cc94a (patch)
treee685de69d6a67343dc4896743c70fd8a77574cc1
parentHandle wcwidth() and mbtowc() failures in better style and drop (diff)
downloadwireguard-openbsd-3ff801c032f3258b94ac6d01d574c0da4c0cc94a.tar.xz
wireguard-openbsd-3ff801c032f3258b94ac6d01d574c0da4c0cc94a.zip
remove the Linux emulation code, no longer referenced by anything
-rw-r--r--sys/compat/common/compat_dir.c129
-rw-r--r--sys/compat/common/compat_dir.h33
-rw-r--r--sys/compat/common/compat_util.c208
-rw-r--r--sys/compat/common/compat_util.h51
-rw-r--r--sys/compat/linux/Makefile13
-rw-r--r--sys/compat/linux/files.linux32
-rw-r--r--sys/compat/linux/linux_blkio.c123
-rw-r--r--sys/compat/linux/linux_blkio.h61
-rw-r--r--sys/compat/linux/linux_cdrom.c293
-rw-r--r--sys/compat/linux/linux_cdrom.h155
-rw-r--r--sys/compat/linux/linux_dirent.h58
-rw-r--r--sys/compat/linux/linux_dummy.c144
-rw-r--r--sys/compat/linux/linux_emuldata.h57
-rw-r--r--sys/compat/linux/linux_errno.h159
-rw-r--r--sys/compat/linux/linux_error.c131
-rw-r--r--sys/compat/linux/linux_exec.c266
-rw-r--r--sys/compat/linux/linux_exec.h44
-rw-r--r--sys/compat/linux/linux_fcntl.h103
-rw-r--r--sys/compat/linux/linux_fdio.c150
-rw-r--r--sys/compat/linux/linux_fdio.h201
-rw-r--r--sys/compat/linux/linux_file.c975
-rw-r--r--sys/compat/linux/linux_file64.c358
-rw-r--r--sys/compat/linux/linux_futex.c753
-rw-r--r--sys/compat/linux/linux_futex.h77
-rw-r--r--sys/compat/linux/linux_hdio.c184
-rw-r--r--sys/compat/linux/linux_hdio.h89
-rw-r--r--sys/compat/linux/linux_ioctl.c90
-rw-r--r--sys/compat/linux/linux_ioctl.h91
-rw-r--r--sys/compat/linux/linux_ipc.c762
-rw-r--r--sys/compat/linux/linux_ipc.h65
-rw-r--r--sys/compat/linux/linux_ipccall.h55
-rw-r--r--sys/compat/linux/linux_misc.c1720
-rw-r--r--sys/compat/linux/linux_misc.h94
-rw-r--r--sys/compat/linux/linux_mmap.h54
-rw-r--r--sys/compat/linux/linux_mount.c82
-rw-r--r--sys/compat/linux/linux_msg.h94
-rw-r--r--sys/compat/linux/linux_resource.c156
-rw-r--r--sys/compat/linux/linux_resource.h55
-rw-r--r--sys/compat/linux/linux_sched.c414
-rw-r--r--sys/compat/linux/linux_sched.h70
-rw-r--r--sys/compat/linux/linux_sem.h73
-rw-r--r--sys/compat/linux/linux_shm.h64
-rw-r--r--sys/compat/linux/linux_signal.c935
-rw-r--r--sys/compat/linux/linux_signal.h148
-rw-r--r--sys/compat/linux/linux_socket.c1511
-rw-r--r--sys/compat/linux/linux_socket.h167
-rw-r--r--sys/compat/linux/linux_socketcall.h177
-rw-r--r--sys/compat/linux/linux_sockio.h60
-rw-r--r--sys/compat/linux/linux_syscall.h778
-rw-r--r--sys/compat/linux/linux_syscallargs.h940
-rw-r--r--sys/compat/linux/linux_syscalls.c369
-rw-r--r--sys/compat/linux/linux_sysent.c726
-rw-r--r--sys/compat/linux/linux_termios.c720
-rw-r--r--sys/compat/linux/linux_termios.h251
-rw-r--r--sys/compat/linux/linux_time.c335
-rw-r--r--sys/compat/linux/linux_time.h48
-rw-r--r--sys/compat/linux/linux_types.h248
-rw-r--r--sys/compat/linux/linux_util.h49
-rw-r--r--sys/compat/linux/syscalls.conf13
-rw-r--r--sys/compat/linux/syscalls.master495
60 files changed, 0 insertions, 16756 deletions
diff --git a/sys/compat/common/compat_dir.c b/sys/compat/common/compat_dir.c
deleted file mode 100644
index 76b8772645f..00000000000
--- a/sys/compat/common/compat_dir.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: compat_dir.c,v 1.11 2014/12/16 21:25:28 tedu Exp $ */
-
-/*
- * Copyright (c) 2000 Constantine Sapuntzakis
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/lock.h>
-#include <sys/dirent.h>
-
-#include <compat/common/compat_dir.h>
-
-int
-readdir_with_callback(struct file *fp, off_t *off, u_long nbytes,
- int (*appendfunc)(void *, struct dirent *), void *arg)
-{
- struct dirent *bdp;
- caddr_t inp, buf;
- int buflen;
- struct uio auio;
- struct iovec aiov;
- int eofflag = 0;
- int error, len, reclen;
- off_t newoff = *off;
- struct vnode *vp;
- struct vattr va;
-
- if ((fp->f_flag & FREAD) == 0)
- return (EBADF);
-
- vp = (struct vnode *)fp->f_data;
-
- if (vp->v_type != VDIR)
- return (EINVAL);
-
- if ((error = VOP_GETATTR(vp, &va, fp->f_cred, curproc)) != 0)
- return (error);
-
- buflen = min(MAXBSIZE, nbytes);
- buflen = max(buflen, va.va_blocksize);
- buf = malloc(buflen, M_TEMP, M_WAITOK);
- error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
- if (error) {
- free(buf, M_TEMP, 0);
- return (error);
- }
-
-again:
- aiov.iov_base = buf;
- aiov.iov_len = buflen;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = curproc;
- auio.uio_resid = buflen;
- auio.uio_offset = newoff;
-
- error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag);
- *off = auio.uio_offset;
- if (error)
- goto out;
-
- if ((len = buflen - auio.uio_resid) <= 0)
- goto eof;
-
- inp = buf;
-
- for (; len > 0; len -= reclen, inp += reclen) {
- bdp = (struct dirent *)inp;
- reclen = bdp->d_reclen;
-
- if (len < reclen)
- break;
-
- if (reclen & 3) {
- error = EFAULT;
- goto out;
- }
-
- /* Skip holes */
- if (bdp->d_fileno != 0) {
- if ((error = (*appendfunc) (arg, bdp)) != 0) {
- if (error == ENOMEM)
- error = 0;
- break;
- }
- }
- }
-
- if (len <= 0 && !eofflag)
- goto again;
-
-eof:
-out:
- VOP_UNLOCK(vp, 0, curproc);
- free(buf, M_TEMP, 0);
- return (error);
-}
diff --git a/sys/compat/common/compat_dir.h b/sys/compat/common/compat_dir.h
deleted file mode 100644
index 08811879210..00000000000
--- a/sys/compat/common/compat_dir.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: compat_dir.h,v 1.3 2013/08/13 05:52:21 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Constantine Sapuntzakis
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#ifdef _KERNEL
-
-int readdir_with_callback(struct file *, off_t *, u_long,
- int (*append_func) (void *, struct dirent *), void *);
-
-#endif
diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c
deleted file mode 100644
index 0b368ec2ae4..00000000000
--- a/sys/compat/common/compat_util.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: compat_util.c,v 1.18 2015/11/07 08:02:29 semarie Exp $ */
-/* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */
-
-/*
- * Copyright (c) 1994 Christos Zoulas
- * Copyright (c) 1995 Frank van der Linden
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/stat.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/signalvar.h>
-#include <sys/vnode.h>
-#include <sys/pledge.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <compat/common/compat_util.h>
-
-/*
- * Search an alternate path before passing pathname arguments on
- * to system calls. Useful for keeping a separate 'emulation tree'.
- *
- * If cflag is set, we check if an attempt can be made to create
- * the named file, i.e. we check if the directory it should
- * be in exists.
- */
-int
-emul_find(struct proc *p, caddr_t *sgp, const char *prefix,
- char *path, char **pbuf, int cflag)
-{
- struct nameidata nd;
- struct nameidata ndroot;
- struct vattr vat;
- struct vattr vatroot;
- int error;
- char *ptr, *buf, *cp;
- const char *pr;
- size_t sz, len;
-
- buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
- *pbuf = path;
-
- for (ptr = buf, pr = prefix; (*ptr = *pr) != '\0'; ptr++, pr++)
- continue;
-
- sz = MAXPATHLEN - (ptr - buf);
-
- /*
- * If sgp is not given then the path is already in kernel space
- */
- if (sgp == NULL)
- error = copystr(path, ptr, sz, &len);
- else
- error = copyinstr(path, ptr, sz, &len);
-
- if (error)
- goto bad;
-
- if (*ptr != '/') {
- error = EINVAL;
- goto bad;
- }
-
- /*
- * We know that there is a / somewhere in this pathname.
- * Search backwards for it, to find the file's parent dir
- * to see if it exists in the alternate tree. If it does,
- * and we want to create a file (cflag is set). We don't
- * need to worry about the root comparison in this case.
- */
-
- if (cflag) {
- for (cp = &ptr[len] - 1; *cp != '/'; cp--)
- ;
- *cp = '\0';
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
- nd.ni_pledge = PLEDGE_EXEC;
-
- if ((error = namei(&nd)) != 0)
- goto bad;
-
- *cp = '/';
- } else {
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
- nd.ni_pledge = PLEDGE_EXEC;
-
- if ((error = namei(&nd)) != 0)
- goto bad;
-
- /*
- * We now compare the vnode of the emulation root to the one
- * vnode asked. If they resolve to be the same, then we
- * ignore the match so that the real root gets used.
- * This avoids the problem of traversing "../.." to find the
- * root directory and never finding it, because "/" resolves
- * to the emulation root directory. This is expensive :-(
- */
- /* XXX: prototype should have const here for NDINIT */
- NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix, p);
- ndroot.ni_pledge = PLEDGE_EXEC;
-
- if ((error = namei(&ndroot)) != 0)
- goto bad2;
-
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0)
- goto bad3;
-
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
- != 0)
- goto bad3;
-
- if (vat.va_fsid == vatroot.va_fsid &&
- vat.va_fileid == vatroot.va_fileid) {
- error = ENOENT;
- goto bad3;
- }
- }
- if (sgp == NULL)
- *pbuf = buf;
- else {
- sz = &ptr[len] - buf;
- *pbuf = stackgap_alloc(sgp, sz + 1);
- if (*pbuf == NULL) {
- error = ENAMETOOLONG;
- goto bad;
- }
- if ((error = copyout(buf, *pbuf, sz)) != 0) {
- *pbuf = path;
- goto bad;
- }
- free(buf, M_TEMP, 0);
- }
-
- vrele(nd.ni_vp);
- if (!cflag)
- vrele(ndroot.ni_vp);
- return error;
-
-bad3:
- vrele(ndroot.ni_vp);
-bad2:
- vrele(nd.ni_vp);
-bad:
- free(buf, M_TEMP, 0);
- return error;
-}
-
-caddr_t
-stackgap_init(struct proc *p)
-{
- struct process *pr = p->p_p;
-
- if (pr->ps_stackgap == 0) {
- if (uvm_map(&pr->ps_vmspace->vm_map, &pr->ps_stackgap,
- round_page(STACKGAPLEN), NULL, 0, 0,
- UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
- MAP_INHERIT_COPY, MADV_RANDOM, UVM_FLAG_COPYONW)))
- sigexit(p, SIGILL);
- }
-
- return (caddr_t)pr->ps_stackgap;
-}
-
-void *
-stackgap_alloc(caddr_t *sgp, size_t sz)
-{
- void *n = (void *) *sgp;
- caddr_t nsgp;
-
- sz = ALIGN(sz);
- nsgp = *sgp + sz;
- if (nsgp > (caddr_t)trunc_page((vaddr_t)n) + STACKGAPLEN)
- return NULL;
- *sgp = nsgp;
- return n;
-}
diff --git a/sys/compat/common/compat_util.h b/sys/compat/common/compat_util.h
deleted file mode 100644
index 782902a5d1a..00000000000
--- a/sys/compat/common/compat_util.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: compat_util.h,v 1.9 2014/03/26 05:23:42 guenther Exp $ */
-/* $NetBSD: compat_util.h,v 1.1 1995/06/24 20:16:05 christos Exp $ */
-
-/*
- * Copyright (c) 1994 Christos Zoulas
- * Copyright (c) 1995 Frank van der Linden
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#ifndef _COMPAT_UTIL_H_
-#define _COMPAT_UTIL_H_
-
-#include <sys/exec.h>
-
-struct proc;
-
-caddr_t stackgap_init(struct proc *);
-void *stackgap_alloc(caddr_t *, size_t);
-
-int emul_find(struct proc *, caddr_t *, const char *, char *, char **, int);
-
-#define CHECK_ALT_EXIST(p, sgp, root, path) \
- emul_find(p, sgp, root, path, &(path), 0)
-
-#define CHECK_ALT_CREAT(p, sgp, root, path) \
- emul_find(p, sgp, root, path, &(path), 1)
-
-#endif /* !_COMPAT_UTIL_H_ */
diff --git a/sys/compat/linux/Makefile b/sys/compat/linux/Makefile
deleted file mode 100644
index 53781d8fef6..00000000000
--- a/sys/compat/linux/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2014/09/01 05:20:54 guenther Exp $
-# $NetBSD: Makefile,v 1.1 1995/02/28 23:26:21 fvdl Exp $
-
-DEP= syscalls.conf syscalls.master ../../kern/makesyscalls.sh
-OBJS= linux_sysent.c linux_syscalls.c linux_syscall.h linux_syscallargs.h
-
-all:
- @echo "Doing nothing. Did you want make syscalls?"
-
-syscalls: linux_sysent.c
-
-${OBJS}: ${DEP}
- sh ../../kern/makesyscalls.sh syscalls.conf syscalls.master
diff --git a/sys/compat/linux/files.linux b/sys/compat/linux/files.linux
deleted file mode 100644
index 4e265e3fde2..00000000000
--- a/sys/compat/linux/files.linux
+++ /dev/null
@@ -1,32 +0,0 @@
-# $OpenBSD: files.linux,v 1.17 2011/09/18 02:23:18 pirofti Exp $
-# $NetBSD: files.linux,v 1.4 1996/03/08 04:55:59 mycroft Exp $
-#
-# Config.new file description for machine-independent Linux compat code.
-# Included by ports that need it.
-
-# ports should define any machine-specific files they need in their
-# own file lists.
-
-file compat/linux/linux_blkio.c compat_linux
-file compat/linux/linux_cdrom.c compat_linux
-file compat/linux/linux_error.c compat_linux
-file compat/linux/linux_exec.c compat_linux
-file compat/linux/linux_fdio.c compat_linux
-file compat/linux/linux_file.c compat_linux
-file compat/linux/linux_file64.c compat_linux
-file compat/linux/linux_hdio.c compat_linux
-file compat/linux/linux_ioctl.c compat_linux
-file compat/linux/linux_ipc.c compat_linux
-file compat/linux/linux_misc.c compat_linux
-file compat/linux/linux_mount.c compat_linux
-file compat/linux/linux_resource.c compat_linux
-file compat/linux/linux_sched.c compat_linux
-file compat/linux/linux_signal.c compat_linux
-file compat/linux/linux_socket.c compat_linux
-file compat/linux/linux_syscalls.c compat_linux & syscall_debug
-file compat/linux/linux_sysent.c compat_linux
-file compat/linux/linux_termios.c compat_linux
-file compat/linux/linux_time.c compat_linux
-file compat/linux/linux_futex.c compat_linux
-file compat/linux/linux_dummy.c compat_linux
-
diff --git a/sys/compat/linux/linux_blkio.c b/sys/compat/linux/linux_blkio.c
deleted file mode 100644
index 287ae3c7140..00000000000
--- a/sys/compat/linux/linux_blkio.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: linux_blkio.c,v 1.9 2012/04/22 05:43:14 guenther Exp $ */
-/* $NetBSD: linux_blkio.c,v 1.3 2001/01/18 17:48:04 tv Exp $ */
-
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/disklabel.h>
-#include <sys/dkio.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_blkio.h>
-
-#include <compat/linux/linux_syscallargs.h>
-
-int
-linux_ioctl_blkio(struct proc *p, struct linux_sys_ioctl_args *uap,
- register_t *retval)
-{
- u_long com;
- long size;
- int error;
- struct filedesc *fdp;
- struct file *fp;
- int (*ioctlf)(struct file *, u_long, caddr_t, struct proc *);
- struct partinfo partp;
- struct disklabel label;
-
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
- return (EBADF);
- FREF(fp);
- error = 0;
- ioctlf = fp->f_ops->fo_ioctl;
- com = SCARG(uap, com);
-
- switch (com) {
- case LINUX_BLKGETSIZE:
- /*
- * Try to get the partition size of this device. If that
- * fails, it may be a disk without label; try to get
- * the default label and compute the size from it.
- */
- error = ioctlf(fp, DIOCGPART, (caddr_t)&partp, p);
- if (error != 0) {
- error = ioctlf(fp, DIOCGDINFO, (caddr_t)&label, p);
- if (error != 0)
- break;
- size = label.d_nsectors * label.d_ntracks *
- label.d_ncylinders;
- } else
- /* XXX ignores > 32bit blocks */
- size = DL_GETPSIZE(partp.part);
- error = copyout(&size, SCARG(uap, data), sizeof size);
- break;
- case LINUX_BLKSECTGET:
- error = ioctlf(fp, DIOCGDINFO, (caddr_t)&label, p);
- if (error != 0)
- break;
- error = copyout(&label.d_secsize, SCARG(uap, data),
- sizeof label.d_secsize);
- break;
- case LINUX_BLKROSET:
- case LINUX_BLKROGET:
- case LINUX_BLKRRPART:
- case LINUX_BLKFLSBUF:
- case LINUX_BLKRASET:
- case LINUX_BLKRAGET:
- case LINUX_BLKFRASET:
- case LINUX_BLKFRAGET:
- case LINUX_BLKSECTSET:
- case LINUX_BLKSSZGET:
- case LINUX_BLKPG:
- default:
- error = ENOTTY;
- }
-
- FRELE(fp, p);
- return error;
-}
diff --git a/sys/compat/linux/linux_blkio.h b/sys/compat/linux/linux_blkio.h
deleted file mode 100644
index b31cca814fd..00000000000
--- a/sys/compat/linux/linux_blkio.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: linux_blkio.h,v 1.2 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_blkio.h,v 1.2 2001/01/18 17:48:04 tv Exp $ */
-
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-/*
- * Definitions for ioctl calls that work on filesystems, as defined
- * in <linux/fs.h>
- */
-
-#ifndef _LINUX_BLKIO_H_
-#define _LINUX_BLKIO_H_
-
-#define LINUX_BLKROSET _LINUX_IO(0x12, 93)
-#define LINUX_BLKROGET _LINUX_IO(0x12, 94)
-#define LINUX_BLKRRPART _LINUX_IO(0x12, 95)
-#define LINUX_BLKGETSIZE _LINUX_IO(0x12, 96)
-#define LINUX_BLKFLSBUF _LINUX_IO(0x12, 97)
-#define LINUX_BLKRASET _LINUX_IO(0x12, 98)
-#define LINUX_BLKRAGET _LINUX_IO(0x12, 99)
-#define LINUX_BLKFRASET _LINUX_IO(0x12, 100)
-#define LINUX_BLKFRAGET _LINUX_IO(0x12, 101)
-#define LINUX_BLKSECTSET _LINUX_IO(0x12, 102)
-#define LINUX_BLKSECTGET _LINUX_IO(0x12, 103)
-#define LINUX_BLKSSZGET _LINUX_IO(0x12, 104)
-#define LINUX_BLKPG _LINUX_IO(0x12, 105)
-
-#endif /* _LINUX_BLKIO_H_ */
diff --git a/sys/compat/linux/linux_cdrom.c b/sys/compat/linux/linux_cdrom.c
deleted file mode 100644
index 033a94bd8bb..00000000000
--- a/sys/compat/linux/linux_cdrom.c
+++ /dev/null
@@ -1,293 +0,0 @@
-
-/* $OpenBSD: linux_cdrom.c,v 1.12 2015/04/30 09:20:51 mpi Exp $ */
-/*
- * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niels Provos.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/cdio.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_cdrom.h>
-
-void bsd_addr_to_linux_addr(union msf_lba *bsd,
- union linux_cdrom_addr *linux, int format);
-
-void
-bsd_addr_to_linux_addr(bsd, linux, format)
- union msf_lba *bsd;
- union linux_cdrom_addr *linux;
- int format;
-{
- if (format == CD_MSF_FORMAT) {
- linux->msf.minute = bsd->msf.minute;
- linux->msf.second = bsd->msf.second;
- linux->msf.frame = bsd->msf.frame;
- } else
- linux->lba = bsd->lba;
-}
-
-int
-linux_ioctl_cdrom(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ioctl_args /* {
- syscallarg(int) fd;
- syscallarg(u_long) com;
- syscallarg(caddr_t) data;
- } */ *uap = v;
- struct file *fp;
- struct filedesc *fdp;
- caddr_t sg;
- u_long com, arg;
- struct sys_ioctl_args ia;
- int error;
-
- union {
- struct cd_toc_entry te;
- struct cd_sub_channel_info scinfo;
- } data;
- union {
- struct ioc_toc_header th;
- struct ioc_read_toc_entry tes;
- struct ioc_play_track ti;
- struct ioc_play_msf msf;
- struct ioc_play_blocks blk;
- struct ioc_read_subchannel sc;
- struct ioc_vol vol;
- } tmpb;
- union {
- struct linux_cdrom_tochdr th;
- struct linux_cdrom_tocentry te;
- struct linux_cdrom_ti ti;
- struct linux_cdrom_msf msf;
- struct linux_cdrom_blk blk;
- struct linux_cdrom_subchnl sc;
- struct linux_cdrom_volctrl vol;
- } tmpl;
-
-
- fdp = p->p_fd;
- if ((fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
- return (EBADF);
- FREF(fp);
-
- com = SCARG(uap, com);
- retval[0] = 0;
-
- switch (com) {
- case LINUX_CDROMREADTOCHDR:
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOREADTOCHEADER,
- (caddr_t)&tmpb.th, p);
- if (error)
- goto out;
- tmpl.th.cdth_trk0 = tmpb.th.starting_track;
- tmpl.th.cdth_trk1 = tmpb.th.ending_track;
- error = copyout(&tmpl, SCARG(uap, data), sizeof tmpl.th);
- goto out;
- case LINUX_CDROMREADTOCENTRY:
- error = copyin(SCARG(uap, data), &tmpl.te, sizeof tmpl.te);
- if (error)
- goto out;
-
- sg = stackgap_init(p);
-
- memset(&tmpb.tes, 0, sizeof tmpb.tes);
- tmpb.tes.starting_track = tmpl.te.cdte_track;
- tmpb.tes.address_format = (tmpl.te.cdte_format == LINUX_CDROM_MSF)
- ? CD_MSF_FORMAT : CD_LBA_FORMAT;
- tmpb.tes.data_len = sizeof(struct cd_toc_entry);
- tmpb.tes.data = stackgap_alloc(&sg, tmpb.tes.data_len);
-
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOREADTOCENTRYS,
- (caddr_t)&tmpb.tes, p);
- if (error)
- goto out;
- if ((error = copyin(tmpb.tes.data, &data.te, sizeof data.te)))
- goto out;
-
- tmpl.te.cdte_ctrl = data.te.control;
- tmpl.te.cdte_adr = data.te.addr_type;
- tmpl.te.cdte_track = data.te.track;
- tmpl.te.cdte_datamode = CD_TRACK_INFO;
- bsd_addr_to_linux_addr(&data.te.addr, &tmpl.te.cdte_addr,
- tmpb.tes.address_format);
- error = copyout(&tmpl, SCARG(uap, data), sizeof tmpl.te);
- goto out;
- case LINUX_CDROMSUBCHNL:
- error = copyin(SCARG(uap, data), &tmpl.sc, sizeof tmpl.sc);
- if (error)
- goto out;
-
- sg = stackgap_init(p);
-
- memset(&tmpb.sc, 0, sizeof tmpb.sc);
- tmpb.sc.data_format = CD_CURRENT_POSITION;
- tmpb.sc.address_format = (tmpl.sc.cdsc_format == LINUX_CDROM_MSF)
- ? CD_MSF_FORMAT : CD_LBA_FORMAT;
- tmpb.sc.data_len = sizeof(struct cd_sub_channel_info);
- tmpb.sc.data = stackgap_alloc(&sg, tmpb.sc.data_len);
-
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCREADSUBCHANNEL,
- (caddr_t)&tmpb.sc, p);
- if (error)
- goto out;
- if ((error = copyin(tmpb.sc.data, &data.scinfo, sizeof data.scinfo)))
- goto out;
-
- tmpl.sc.cdsc_audiostatus = data.scinfo.header.audio_status;
- tmpl.sc.cdsc_adr = data.scinfo.what.position.addr_type;
- tmpl.sc.cdsc_ctrl = data.scinfo.what.position.control;
- tmpl.sc.cdsc_trk = data.scinfo.what.position.track_number;
- tmpl.sc.cdsc_ind = data.scinfo.what.position.index_number;
- bsd_addr_to_linux_addr(&data.scinfo.what.position.absaddr,
- &tmpl.sc.cdsc_absaddr,
- tmpb.sc.address_format);
- bsd_addr_to_linux_addr(&data.scinfo.what.position.reladdr,
- &tmpl.sc.cdsc_reladdr,
- tmpb.sc.address_format);
-
- error = copyout(&tmpl, SCARG(uap, data), sizeof tmpl.sc);
- goto out;
- case LINUX_CDROMPLAYTRKIND:
- error = copyin(SCARG(uap, data), &tmpl.ti, sizeof tmpl.ti);
- if (error)
- goto out;
-
- tmpb.ti.start_track = tmpl.ti.cdti_trk0;
- tmpb.ti.start_index = tmpl.ti.cdti_ind0;
- tmpb.ti.end_track = tmpl.ti.cdti_trk1;
- tmpb.ti.end_index = tmpl.ti.cdti_ind1;
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCPLAYTRACKS,
- (caddr_t)&tmpb.ti, p);
- goto out;
- case LINUX_CDROMPLAYMSF:
- error = copyin(SCARG(uap, data), &tmpl.msf, sizeof tmpl.msf);
- if (error)
- goto out;
-
- tmpb.msf.start_m = tmpl.msf.cdmsf_min0;
- tmpb.msf.start_s = tmpl.msf.cdmsf_sec0;
- tmpb.msf.start_f = tmpl.msf.cdmsf_frame0;
- tmpb.msf.end_m = tmpl.msf.cdmsf_min1;
- tmpb.msf.end_s = tmpl.msf.cdmsf_sec1;
- tmpb.msf.end_f = tmpl.msf.cdmsf_frame1;
-
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCPLAYMSF,
- (caddr_t)&tmpb.msf, p);
- goto out;
- case LINUX_CDROMPLAYBLK:
- error = copyin(SCARG(uap, data), &tmpl.blk, sizeof tmpl.blk);
- if (error)
- goto out;
-
- tmpb.blk.blk = tmpl.blk.from;
- tmpb.blk.len = tmpl.blk.len;
-
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCPLAYBLOCKS,
- (caddr_t)&tmpb.blk, p);
- goto out;
- case LINUX_CDROMVOLCTRL:
- error = copyin(SCARG(uap, data), &tmpl.vol, sizeof tmpl.vol);
- if (error)
- goto out;
-
- tmpb.vol.vol[0] = tmpl.vol.channel0;
- tmpb.vol.vol[1] = tmpl.vol.channel1;
- tmpb.vol.vol[2] = tmpl.vol.channel2;
- tmpb.vol.vol[3] = tmpl.vol.channel3;
-
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCSETVOL,
- (caddr_t)&tmpb.vol, p);
- goto out;
- case LINUX_CDROMVOLREAD:
- error = (*fp->f_ops->fo_ioctl)(fp, CDIOCGETVOL,
- (caddr_t)&tmpb.vol, p);
- if (error)
- goto out;
-
- tmpl.vol.channel0 = tmpb.vol.vol[0];
- tmpl.vol.channel1 = tmpb.vol.vol[1];
- tmpl.vol.channel2 = tmpb.vol.vol[2];
- tmpl.vol.channel3 = tmpb.vol.vol[3];
-
- error = copyout(&tmpl.vol, SCARG(uap, data), sizeof tmpl.vol);
- goto out;
- case LINUX_CDROMPAUSE:
- SCARG(&ia, com) = CDIOCPAUSE;
- break;
- case LINUX_CDROMRESUME:
- SCARG(&ia, com) = CDIOCRESUME;
- break;
- case LINUX_CDROMSTOP:
- SCARG(&ia, com) = CDIOCSTOP;
- break;
- case LINUX_CDROMSTART:
- SCARG(&ia, com) = CDIOCSTART;
- break;
- case LINUX_CDROMEJECT_SW:
- error = copyin(SCARG(uap, data), &arg, sizeof arg);
- if (error)
- goto out;
- SCARG(&ia, com) = arg ? CDIOCALLOW : CDIOCPREVENT;
- break;
- case LINUX_CDROMEJECT:
- SCARG(&ia, com) = CDIOCEJECT;
- break;
- case LINUX_CDROMRESET:
- SCARG(&ia, com) = CDIOCRESET;
- break;
- default:
- printf("linux_ioctl_cdrom: invalid ioctl %08lx\n", com);
- error = EINVAL;
- goto out;
- }
-
- SCARG(&ia, fd) = SCARG(uap, fd);
- SCARG(&ia, data) = SCARG(uap, data);
- error = sys_ioctl(p, &ia, retval);
-
-out:
- FRELE(fp, p);
- return (error);
-}
diff --git a/sys/compat/linux/linux_cdrom.h b/sys/compat/linux/linux_cdrom.h
deleted file mode 100644
index 6d94c6132e7..00000000000
--- a/sys/compat/linux/linux_cdrom.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $OpenBSD: linux_cdrom.h,v 1.2 1997/12/10 00:01:40 provos Exp $ */
-/*
- * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niels Provos.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-struct linux_cdrom_blk
-{
- unsigned from;
- unsigned short len;
-};
-
-
-struct linux_cdrom_msf
-{
- u_char cdmsf_min0; /* start */
- u_char cdmsf_sec0;
- u_char cdmsf_frame0;
- u_char cdmsf_min1; /* end */
- u_char cdmsf_sec1;
- u_char cdmsf_frame1;
-};
-
-struct linux_cdrom_ti
-{
- u_char cdti_trk0; /* start */
- u_char cdti_ind0;
- u_char cdti_trk1; /* end */
- u_char cdti_ind1;
-};
-
-struct linux_cdrom_tochdr
-{
- u_char cdth_trk0; /* start */
- u_char cdth_trk1; /* end */
-};
-
-struct linux_cdrom_msf0
-{
- u_char minute;
- u_char second;
- u_char frame;
-};
-
-union linux_cdrom_addr
-{
- struct linux_cdrom_msf0 msf;
- int lba;
-};
-
-struct linux_cdrom_tocentry
-{
- u_char cdte_track;
- u_char cdte_adr :4;
- u_char cdte_ctrl :4;
- u_char cdte_format;
- union linux_cdrom_addr cdte_addr;
- u_char cdte_datamode;
-};
-
-#define LINUX_CDROM_LBA 0x01
-#define LINUX_CDROM_MSF 0x02
-
-#define LINUX_CDROM_DATA_TRACK 0x04
-
-#define LINUX_CDROM_LEADOUT 0xAA
-
-struct linux_cdrom_subchnl
-{
- u_char cdsc_format;
- u_char cdsc_audiostatus;
- u_char cdsc_adr: 4;
- u_char cdsc_ctrl: 4;
- u_char cdsc_trk;
- u_char cdsc_ind;
- union linux_cdrom_addr cdsc_absaddr;
- union linux_cdrom_addr cdsc_reladdr;
-};
-
-struct linux_cdrom_mcn {
- u_char medium_catalog_number[14];
-};
-
-
-struct linux_cdrom_volctrl
-{
- u_char channel0;
- u_char channel1;
- u_char channel2;
- u_char channel3;
-};
-
-struct linux_cdrom_read
-{
- int cdread_lba;
- caddr_t cdread_bufaddr;
- int cdread_buflen;
-};
-
-#define LINUX_CDROMPAUSE 0x5301
-#define LINUX_CDROMRESUME 0x5302
-#define LINUX_CDROMPLAYMSF 0x5303
-#define LINUX_CDROMPLAYTRKIND 0x5304
-
-#define LINUX_CDROMREADTOCHDR 0x5305
-#define LINUX_CDROMREADTOCENTRY 0x5306
-
-#define LINUX_CDROMSTOP 0x5307
-#define LINUX_CDROMSTART 0x5308
-
-#define LINUX_CDROMEJECT 0x5309
-
-#define LINUX_CDROMVOLCTRL 0x530a
-
-#define LINUX_CDROMSUBCHNL 0x530b
-
-#define LINUX_CDROMREADMODE2 0x530c
-#define LINUX_CDROMREADMODE1 0x530d
-#define LINUX_CDROMREADAUDIO 0x530e
-
-#define LINUX_CDROMEJECT_SW 0x530f
-
-#define LINUX_CDROMMULTISESSION 0x5310
-
-#define LINUX_CDROM_GET_UPC 0x5311
-
-#define LINUX_CDROMRESET 0x5312
-#define LINUX_CDROMVOLREAD 0x5313
-
-#define LINUX_CDROMPLAYBLK 0x5317
diff --git a/sys/compat/linux/linux_dirent.h b/sys/compat/linux/linux_dirent.h
deleted file mode 100644
index 95194e7521c..00000000000
--- a/sys/compat/linux/linux_dirent.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: linux_dirent.h,v 1.4 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_dirent.h,v 1.3 1995/10/07 06:26:59 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_DIRENT_H_
-#define _LINUX_DIRENT_H_
-
-#define LINUX_MAXNAMLEN 255
-
-struct linux_dirent {
- linux_ino_t d_ino;
- linux_off_t d_off;
- u_short d_reclen;
- char d_name[LINUX_MAXNAMLEN + 1];
-};
-
-struct linux_dirent64 {
- linux_ino64_t d_ino;
- linux_off64_t d_off;
- u_short d_reclen;
- u_char d_type;
- char d_name[LINUX_MAXNAMLEN + 1];
-};
-
-#define LINUX_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp)
-#define LINUX_RECLEN(de,namlen) ALIGN((LINUX_NAMEOFF(de) + (namlen) + 1))
-
-#endif /* !_LINUX_DIRENT_H_ */
diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c
deleted file mode 100644
index 268e9718b55..00000000000
--- a/sys/compat/linux/linux_dummy.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $OpenBSD: linux_dummy.c,v 1.20 2012/06/19 11:31:39 pirofti Exp $ */
-
-/*-
- * Copyright (c) 1994-1995 Søren Schmidt
- * 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
- * in this position and unchanged.
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $FreeBSD: src/sys/i386/linux/linux_dummy.c,v 1.21 2000/01/29 12:45:35 peter Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-
-#define DUMMY(s) \
-int \
-linux_sys_ ## s(p, v, retval) \
- struct proc *p; \
- void *v; \
- register_t *retval; \
-{ \
- return (unsupported_msg(p, #s)); \
-}
-
-static int
-unsupported_msg(struct proc *p, const char *fname)
-{
- printf("linux: syscall %s is obsolete or not implemented (pid=%ld)\n",
- fname, (long)p->p_p->ps_pid);
- return (ENOSYS);
-}
-
-DUMMY(ostat); /* #18 */
-#ifdef PTRACE
-DUMMY(ptrace); /* #26 */
-#endif
-DUMMY(ofstat); /* #28 */
-DUMMY(stty); /* #31 */
-DUMMY(gtty); /* #32 */
-DUMMY(ftime); /* #35 */
-DUMMY(prof); /* #44 */
-DUMMY(phys); /* #52 */
-DUMMY(lock); /* #53 */
-DUMMY(mpx); /* #56 */
-DUMMY(ulimit); /* #58 */
-DUMMY(ustat); /* #62 */
-#ifndef __i386__
-DUMMY(ioperm); /* #101 */
-#endif
-DUMMY(klog); /* #103 */
-#ifndef __i386__
-DUMMY(iopl); /* #110 */
-#endif
-DUMMY(vhangup); /* #111 */
-DUMMY(idle); /* #112 */
-DUMMY(vm86old); /* #113 */
-DUMMY(swapoff); /* #115 */
-#ifndef __i386__
-DUMMY(modify_ldt); /* #123 */
-#endif
-DUMMY(adjtimex); /* #124 */
-DUMMY(create_module); /* #127 */
-DUMMY(init_module); /* #128 */
-DUMMY(delete_module); /* #129 */
-DUMMY(get_kernel_syms); /* #130 */
-DUMMY(quotactl); /* #131 */
-DUMMY(bdflush); /* #134 */
-DUMMY(sysfs); /* #135 */
-DUMMY(afs_syscall); /* #137 */
-DUMMY(mlockall); /* #152 */
-DUMMY(munlockall); /* #153 */
-DUMMY(sched_rr_get_interval); /* #161 */
-DUMMY(vm86); /* #166 */
-DUMMY(query_module); /* #167 */
-DUMMY(nfsservctl); /* #169 */
-DUMMY(rt_sigtimedwait); /* #177 */
-DUMMY(rt_queueinfo); /* #178 */
-DUMMY(capget); /* #184 */
-DUMMY(capset); /* #185 */
-DUMMY(sendfile); /* #187 */
-DUMMY(getpmsg); /* #188 */
-DUMMY(putpmsg); /* #189 */
-DUMMY(lchown); /* #198 */
-DUMMY(fchown); /* #207 */
-DUMMY(setfsgid); /* #216 */
-DUMMY(pivot_root); /* #217 */
-DUMMY(mincore); /* #218 */
-DUMMY(fadvise64); /* #250 */
-DUMMY(epoll_create); /* #254 */
-DUMMY(epoll_ctl); /* #255 */
-DUMMY(epoll_wait); /* #256 */
-DUMMY(epoll_pwait); /* #319 */
-DUMMY(eventfd); /* #323 */
-DUMMY(eventfd2); /* #328 */
-DUMMY(epoll_create1); /* #329 */
-
-
-#define DUMMY_XATTR(s) \
-int \
-linux_sys_ ## s ## xattr(p, v, retval) \
- struct proc *p; \
- void *v; \
- register_t *retval; \
-{ \
- return (ENOATTR); \
-}
-DUMMY_XATTR(set);
-DUMMY_XATTR(lset);
-DUMMY_XATTR(fset);
-DUMMY_XATTR(get);
-DUMMY_XATTR(lget);
-DUMMY_XATTR(fget);
-DUMMY_XATTR(list);
-DUMMY_XATTR(llist);
-DUMMY_XATTR(flist);
-DUMMY_XATTR(remove);
-DUMMY_XATTR(lremove);
-DUMMY_XATTR(fremove);
diff --git a/sys/compat/linux/linux_emuldata.h b/sys/compat/linux/linux_emuldata.h
deleted file mode 100644
index 1235db308ae..00000000000
--- a/sys/compat/linux/linux_emuldata.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: linux_emuldata.h,v 1.9 2012/05/24 01:19:16 guenther Exp $ */
-/* $NetBSD: linux_emuldata.h,v 1.4 2002/02/15 16:48:02 christos Exp $ */
-/*-
- * Copyright (c) 1998,2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Eric Haszlakiewicz.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-#ifndef _LINUX_EMULDATA_H_
-#define _LINUX_EMULDATA_H_
-
-/*
- * This is auxiliary data the linux compat code
- * needs to do its work. A pointer to it is
- * stored in the emuldata field of the proc
- * structure.
- */
-struct linux_emuldata {
- caddr_t p_break; /* Cached per-process break value */
-
- void *child_set_tid; /* Let the child set the thread ID at start */
- void *child_clear_tid; /* Let the child clear the thread ID on exit */
- unsigned child_tls_base;/* Set the Thread Local Storage on clone */
- int set_tls_base; /* boolean: should my_tls_base be used? */
-
- /* Same as above, passed by the parent when forking. */
- void *my_set_tid;
- void *my_clear_tid;
- unsigned my_tls_base;
-
- struct linux_robust_list_head *led_robust_head;
-
- int pdeath_signal; /* parent death signal */
-};
-#endif /* !_LINUX_EMULDATA_H_ */
diff --git a/sys/compat/linux/linux_errno.h b/sys/compat/linux/linux_errno.h
deleted file mode 100644
index 54f95987018..00000000000
--- a/sys/compat/linux/linux_errno.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $OpenBSD: linux_errno.h,v 1.3 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_errno.h,v 1.1 1995/02/28 23:25:34 fvdl Exp $ */
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_ERRNO_H_
-#define _LINUX_ERRNO_H_
-
-#define LINUX_EPERM 1
-#define LINUX_ENOENT 2
-#define LINUX_ESRCH 3
-#define LINUX_EINTR 4
-#define LINUX_EIO 5
-#define LINUX_ENXIO 6
-#define LINUX_E2BIG 7
-#define LINUX_ENOEXEC 8
-#define LINUX_EBADF 9
-#define LINUX_ECHILD 10
-#define LINUX_EAGAIN 11
-#define LINUX_ENOMEM 12
-#define LINUX_EACCES 13
-#define LINUX_EFAULT 14
-#define LINUX_ENOTBLK 15
-#define LINUX_EBUSY 16
-#define LINUX_EEXIST 17
-#define LINUX_EXDEV 18
-#define LINUX_ENODEV 19
-#define LINUX_ENOTDIR 20
-#define LINUX_EISDIR 21
-#define LINUX_EINVAL 22
-#define LINUX_ENFILE 23
-#define LINUX_EMFILE 24
-#define LINUX_ENOTTY 25
-#define LINUX_ETXTBSY 26
-#define LINUX_EFBIG 27
-#define LINUX_ENOSPC 28
-#define LINUX_ESPIPE 29
-#define LINUX_EROFS 30
-#define LINUX_EMLINK 31
-#define LINUX_EPIPE 32
-#define LINUX_EDOM 33
-#define LINUX_ERANGE 34
-#define LINUX_EDEADLK 35
-#define LINUX_ENAMETOOLONG 36
-#define LINUX_ENOLCK 37
-#define LINUX_ENOSYS 38
-#define LINUX_ENOTEMPTY 39
-#define LINUX_ELOOP 40
-#define LINUX_ENOMSG 42
-#define LINUX_EIDRM 43
-#define LINUX_ECHRNG 44
-#define LINUX_EL2NSYNC 45
-#define LINUX_EL3HLT 46
-#define LINUX_EL3RST 47
-#define LINUX_ELNRNG 48
-#define LINUX_EUNATCH 49
-#define LINUX_ENOCSI 50
-#define LINUX_EL2HLT 51
-#define LINUX_EBADE 52
-#define LINUX_EBADR 53
-#define LINUX_EXFULL 54
-#define LINUX_ENOANO 55
-#define LINUX_EBADRQC 56
-#define LINUX_EBADSLT 57
-#define LINUX_EDEADLOCK 58
-#define LINUX_EBFONT 59
-#define LINUX_ENOSTR 60
-#define LINUX_ENODATA 61
-#define LINUX_ETIME 62
-#define LINUX_ENOSR 63
-#define LINUX_ENONET 64
-#define LINUX_ENOPKG 65
-#define LINUX_EREMOTE 66
-#define LINUX_ENOLINK 67
-#define LINUX_EADV 68
-#define LINUX_ESRMNT 69
-#define LINUX_ECOMM 70
-#define LINUX_EPROTO 71
-#define LINUX_EMULTIHOP 72
-#define LINUX_EDOTDOT 73
-#define LINUX_EBADMSG 74
-#define LINUX_EOVERFLOW 75
-#define LINUX_ENOTUNIQ 76
-#define LINUX_EBADFD 77
-#define LINUX_EREMCHG 78
-#define LINUX_ELIBACC 79
-#define LINUX_ELIBBAD 80
-#define LINUX_ELIBSCN 81
-#define LINUX_ELIBMAX 82
-#define LINUX_ELIBEXEC 83
-#define LINUX_EILSEQ 84
-#define LINUX_ERESTART 85
-#define LINUX_ESTRPIPE 86
-#define LINUX_EUSERS 87
-#define LINUX_ENOTSOCK 88
-#define LINUX_EDESTADDRREQ 89
-#define LINUX_EMSGSIZE 90
-#define LINUX_EPROTOTYPE 91
-#define LINUX_ENOPROTOOPT 92
-#define LINUX_EPROTONOSUPPORT 93
-#define LINUX_ESOCKTNOSUPPORT 94
-#define LINUX_EOPNOTSUPP 95
-#define LINUX_EPFNOSUPPORT 96
-#define LINUX_EAFNOSUPPORT 97
-#define LINUX_EADDRINUSE 98
-#define LINUX_EADDRNOTAVAIL 99
-#define LINUX_ENETDOWN 100
-#define LINUX_ENETUNREACH 101
-#define LINUX_ENETRESET 102
-#define LINUX_ECONNABORTED 103
-#define LINUX_ECONNRESET 104
-#define LINUX_ENOBUFS 105
-#define LINUX_EISCONN 106
-#define LINUX_ENOTCONN 107
-#define LINUX_ESHUTDOWN 108
-#define LINUX_ETOOMANYREFS 109
-#define LINUX_ETIMEDOUT 110
-#define LINUX_ECONNREFUSED 111
-#define LINUX_EHOSTDOWN 112
-#define LINUX_EHOSTUNREACH 113
-#define LINUX_EALREADY 114
-#define LINUX_EINPROGRESS 115
-#define LINUX_ESTALE 116
-#define LINUX_EUCLEAN 117
-#define LINUX_ENOTNAM 118
-#define LINUX_ENAVAIL 119
-#define LINUX_EISNAM 120
-#define LINUX_EREMOTEIO 121
-#define LINUX_EDQUOT 122
-
-#endif /* !_LINUX_ERRNO_H_ */
diff --git a/sys/compat/linux/linux_error.c b/sys/compat/linux/linux_error.c
deleted file mode 100644
index 707669b26d3..00000000000
--- a/sys/compat/linux/linux_error.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $OpenBSD: linux_error.c,v 1.5 2009/10/28 16:38:43 jsg Exp $ */
-/* $NetBSD: linux_error.c,v 1.2 1995/04/22 19:48:32 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/errno.h>
-#include <compat/linux/linux_errno.h>
-
-int linux_error[1 + ELAST] = {
- 0,
- -LINUX_EPERM,
- -LINUX_ENOENT,
- -LINUX_ESRCH,
- -LINUX_EINTR,
- -LINUX_EIO,
- -LINUX_ENXIO,
- -LINUX_E2BIG,
- -LINUX_ENOEXEC,
- -LINUX_EBADF,
- -LINUX_ECHILD,
- -LINUX_EDEADLK,
- -LINUX_ENOMEM,
- -LINUX_EACCES,
- -LINUX_EFAULT,
- -LINUX_ENOTBLK,
- -LINUX_EBUSY,
- -LINUX_EEXIST,
- -LINUX_EXDEV,
- -LINUX_ENODEV,
- -LINUX_ENOTDIR,
- -LINUX_EISDIR,
- -LINUX_EINVAL,
- -LINUX_ENFILE,
- -LINUX_EMFILE,
- -LINUX_ENOTTY,
- -LINUX_ETXTBSY,
- -LINUX_EFBIG,
- -LINUX_ENOSPC,
- -LINUX_ESPIPE,
- -LINUX_EROFS,
- -LINUX_EMLINK,
- -LINUX_EPIPE,
- -LINUX_EDOM,
- -LINUX_ERANGE,
- -LINUX_EAGAIN,
- -LINUX_EINPROGRESS,
- -LINUX_EALREADY,
- -LINUX_ENOTSOCK,
- -LINUX_EDESTADDRREQ,
- -LINUX_EMSGSIZE,
- -LINUX_EPROTOTYPE,
- -LINUX_ENOPROTOOPT,
- -LINUX_EPROTONOSUPPORT,
- -LINUX_ESOCKTNOSUPPORT,
- -LINUX_EOPNOTSUPP,
- -LINUX_EPFNOSUPPORT,
- -LINUX_EAFNOSUPPORT,
- -LINUX_EADDRINUSE,
- -LINUX_EADDRNOTAVAIL,
- -LINUX_ENETDOWN,
- -LINUX_ENETUNREACH,
- -LINUX_ENETRESET,
- -LINUX_ECONNABORTED,
- -LINUX_ECONNRESET,
- -LINUX_ENOBUFS,
- -LINUX_EISCONN,
- -LINUX_ENOTCONN,
- -LINUX_ESHUTDOWN,
- -LINUX_ETOOMANYREFS,
- -LINUX_ETIMEDOUT,
- -LINUX_ECONNREFUSED,
- -LINUX_ELOOP,
- -LINUX_ENAMETOOLONG,
- -LINUX_EHOSTDOWN,
- -LINUX_EHOSTUNREACH,
- -LINUX_ENOTEMPTY,
- -LINUX_ENOSYS, /* not mapped (EPROCLIM) */
- -LINUX_EUSERS,
- -LINUX_EDQUOT,
- -LINUX_ESTALE,
- -LINUX_EREMOTE,
- -LINUX_ENOSYS, /* not mapped (EBADRPC) */
- -LINUX_ENOSYS, /* not mapped (ERPCMISMATCH) */
- -LINUX_ENOSYS, /* not mapped (EPROGUNAVAIL) */
- -LINUX_ENOSYS, /* not mapped (EPROGMISMATCH) */
- -LINUX_ENOSYS, /* not mapped (EPROCUNAVAIL) */
- -LINUX_ENOLCK,
- -LINUX_ENOSYS,
- -LINUX_ENOSYS, /* not mapped (EFTYPE) */
- -LINUX_ENOSYS, /* not mapped (EAUTH) */
- -LINUX_ENOSYS, /* not mapped (ENEEDAUTH) */
- -LINUX_ENOSYS, /* not mapped (EIPSEC) */
- -LINUX_EOPNOTSUPP, /* what is ENOATTR? */
- -LINUX_EILSEQ,
- -LINUX_ENOSYS, /* not mapped (ENOMEDIUM) */
- -LINUX_ENOSYS, /* not mapped (EMEDIUMTYPE) */
- -LINUX_EOVERFLOW,
- -LINUX_ENOSYS, /* not mapped (ECANCELED) */
- -LINUX_EIDRM,
- -LINUX_ENOMSG,
- -LINUX_ENOSYS /* not mapped (ENOTSUP) */
-};
diff --git a/sys/compat/linux/linux_exec.c b/sys/compat/linux/linux_exec.c
deleted file mode 100644
index 4982f3bb1fe..00000000000
--- a/sys/compat/linux/linux_exec.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* $OpenBSD: linux_exec.c,v 1.43 2015/05/05 02:13:47 guenther Exp $ */
-/* $NetBSD: linux_exec.c,v 1.13 1996/04/05 00:01:10 christos Exp $ */
-
-/*-
- * Copyright (c) 1994, 1995, 1998, 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas, Frank van der Linden, Eric Haszlakiewicz and
- * Thor Lancelot Simon.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/namei.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/exec.h>
-#include <sys/exec_elf.h>
-
-#include <sys/mman.h>
-#include <sys/syscallargs.h>
-#include <sys/signalvar.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/linux_machdep.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_syscall.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_exec.h>
-#include <compat/linux/linux_emuldata.h>
-
-#define LINUX_ELF_AUX_ARGSIZ (sizeof(AuxInfo) * 8 / sizeof(char *))
-
-
-const char linux_emul_path[] = "/emul/linux";
-extern int linux_error[];
-extern char linux_sigcode[], linux_esigcode[];
-extern struct sysent linux_sysent[];
-#ifdef SYSCALL_DEBUG
-extern char *linux_syscallnames[];
-#endif
-
-extern struct mutex futex_lock;
-extern void futex_pool_init(void);
-
-void linux_e_proc_exec(struct proc *, struct exec_package *);
-void linux_e_proc_fork(struct proc *, struct proc *);
-void linux_e_proc_exit(struct proc *);
-void linux_e_proc_init(struct proc *, struct vmspace *);
-
-struct emul emul_linux_elf = {
- "linux",
- linux_error,
- linux_sendsig,
- LINUX_SYS_syscall,
- LINUX_SYS_MAXSYSCALL,
- linux_sysent,
-#ifdef SYSCALL_DEBUG
- linux_syscallnames,
-#else
- NULL,
-#endif
- LINUX_ELF_AUX_ARGSIZ,
- elf32_copyargs,
- setregs,
- exec_elf32_fixup,
- NULL, /* coredump */
- linux_sigcode,
- linux_esigcode,
- 0,
- NULL,
- linux_e_proc_exec,
- linux_e_proc_fork,
- linux_e_proc_exit,
-};
-
-/*
- * Allocate per-process structures. Called when executing Linux
- * process. We can reuse the old emuldata - if it's not null,
- * the executed process is of same emulation as original forked one.
- */
-void
-linux_e_proc_init(struct proc *p, struct vmspace *vmspace)
-{
- if (!p->p_emuldata) {
- /* allocate new Linux emuldata */
- p->p_emuldata = malloc(sizeof(struct linux_emuldata),
- M_EMULDATA, M_WAITOK|M_ZERO);
- }
- else {
- memset(p->p_emuldata, '\0', sizeof(struct linux_emuldata));
- }
-
- /* Set the process idea of the break to the real value */
- ((struct linux_emuldata *)(p->p_emuldata))->p_break =
- vmspace->vm_daddr + ptoa(vmspace->vm_dsize);
-}
-
-void
-linux_e_proc_exec(struct proc *p, struct exec_package *epp)
-{
- /* exec, use our vmspace */
- linux_e_proc_init(p, p->p_vmspace);
-}
-
-/*
- * Emulation per-process exit hook.
- */
-void
-linux_e_proc_exit(struct proc *p)
-{
- struct linux_emuldata *emul = p->p_emuldata;
-
- if (emul->my_clear_tid) {
- pid_t zero = 0;
-
- if (copyout(&zero, emul->my_clear_tid, sizeof(zero)))
- psignal(p, SIGSEGV);
- /*
- * not yet: futex(my_clear_tid, FUTEX_WAKE, 1, NULL, NULL, 0)
- */
- }
-
- /* free Linux emuldata and set the pointer to null */
- free(p->p_emuldata, M_EMULDATA, 0);
- p->p_emuldata = NULL;
-}
-
-/*
- * Emulation fork hook.
- */
-void
-linux_e_proc_fork(struct proc *p, struct proc *parent)
-{
- struct linux_emuldata *emul;
- struct linux_emuldata *parent_emul;
-
- /* Allocate new emuldata for the new process. */
- p->p_emuldata = NULL;
-
- /* fork, use parent's vmspace (our vmspace may not be setup yet) */
- linux_e_proc_init(p, parent->p_vmspace);
-
- emul = p->p_emuldata;
- parent_emul = parent->p_emuldata;
-
- emul->my_set_tid = parent_emul->child_set_tid;
- emul->my_clear_tid = parent_emul->child_clear_tid;
- emul->my_tls_base = parent_emul->child_tls_base;
- emul->set_tls_base = parent_emul->set_tls_base;
-}
-
-int
-exec_linux_elf32_makecmds(struct proc *p, struct exec_package *epp)
-{
- if (!(emul_linux_elf.e_flags & EMUL_ENABLED))
- return (ENOEXEC);
-
- return exec_elf32_makecmds(p, epp);
-}
-
-int
-linux_elf_probe(struct proc *p, struct exec_package *epp, char *itp,
- u_long *pos)
-{
- Elf32_Ehdr *eh = epp->ep_hdr;
- char *bp, *brand;
- int error;
- size_t len;
-
- if (!(emul_linux_elf.e_flags & EMUL_ENABLED))
- return (ENOEXEC);
-
- /*
- * Modern Linux binaries carry an identification note.
- */
- if (ELFNAME(os_pt_note)(p, epp, epp->ep_hdr, "GNU", 4, 0x10) == 0) {
- goto recognized;
- }
-
- brand = elf32_check_brand(eh);
- if (brand != NULL && strcmp(brand, "Linux") != 0)
- return (EINVAL);
-
- /*
- * If this is a static binary, do not allow it to run, as it
- * has not been identified. We'll give non-static binaries a
- * chance to run, as the Linux ld.so name is usually unique
- * enough to clear any ambiguity.
- */
- if (itp == NULL)
- return (EINVAL);
-
-recognized:
- if (itp) {
- if ((error = emul_find(p, NULL, linux_emul_path, itp, &bp, 0)))
- return (error);
- error = copystr(bp, itp, MAXPATHLEN, &len);
- free(bp, M_TEMP, 0);
- if (error)
- return (error);
- }
- epp->ep_emul = &emul_linux_elf;
- *pos = ELF32_NO_ADDR;
-
- mtx_init(&futex_lock, IPL_NONE);
- futex_pool_init();
-
- return (0);
-}
-
-/*
- * Execve(2). Just check the alternate emulation path, and pass it on
- * to the regular execve().
- */
-int
-linux_sys_execve(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_execve_args /* {
- syscallarg(char *) path;
- syscallarg(char **) argv;
- syscallarg(char **) envp;
- } */ *uap = v;
- struct sys_execve_args ap;
- caddr_t sg;
-
- sg = stackgap_init(p);
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&ap, path) = SCARG(uap, path);
- SCARG(&ap, argp) = SCARG(uap, argp);
- SCARG(&ap, envp) = SCARG(uap, envp);
-
- return (sys_execve(p, &ap, retval));
-}
diff --git a/sys/compat/linux/linux_exec.h b/sys/compat/linux/linux_exec.h
deleted file mode 100644
index 0ea3f408025..00000000000
--- a/sys/compat/linux/linux_exec.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: linux_exec.h,v 1.10 2013/11/03 14:32:32 pirofti Exp $ */
-/* $NetBSD: linux_exec.h,v 1.5 1995/10/07 06:27:01 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#ifndef _LINUX_EXEC_H_
-#define _LINUX_EXEC_H_
-
-int exec_linux_elf32_makecmds(struct proc *, struct exec_package *);
-
-int linux_elf_probe(struct proc *, struct exec_package *, char *,
- u_long *);
-
-#endif /* !_LINUX_EXEC_H_ */
diff --git a/sys/compat/linux/linux_fcntl.h b/sys/compat/linux/linux_fcntl.h
deleted file mode 100644
index ea99f3c366b..00000000000
--- a/sys/compat/linux/linux_fcntl.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: linux_fcntl.h,v 1.4 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_fcntl.h,v 1.1 1995/02/28 23:25:40 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * Various flag values used in Linux for open(2) and fcntl(2).
- */
-
-#ifndef _LINUX_FCNTL_H_
-#define _LINUX_FCNTL_H_
-
-/* read/write mode for open(2) (as usual) */
-#define LINUX_O_RDONLY 0x0000
-#define LINUX_O_WRONLY 0x0001
-#define LINUX_O_RDWR 0x0002
-#define LINUX_O_ACCMODE 0x0003
-
-/* flags used in open(2) */
-#define LINUX_O_CREAT 0x0040
-#define LINUX_O_EXCL 0x0080
-#define LINUX_O_NOCTTY 0x0100
-#define LINUX_O_TRUNC 0x0200
-#define LINUX_O_APPEND 0x0400
-#define LINUX_O_NDELAY 0x0800
-#define LINUX_O_SYNC 0x1000
-
-#define LINUX_FASYNC 0x2000
-
-/* fcntl(2) operations */
-#define LINUX_F_DUPFD 0
-#define LINUX_F_GETFD 1
-#define LINUX_F_SETFD 2
-#define LINUX_F_GETFL 3
-#define LINUX_F_SETFL 4
-#define LINUX_F_GETLK 5
-#define LINUX_F_SETLK 6
-#define LINUX_F_SETLKW 7
-#define LINUX_F_SETOWN 8
-#define LINUX_F_GETOWN 9
-
-#define LINUX_F_GETLK64 12
-#define LINUX_F_SETLK64 13
-#define LINUX_F_SETLKW64 14
-
-#define LINUX_F_RDLCK 0
-#define LINUX_F_WRLCK 1
-#define LINUX_F_UNLCK 2
-
-#define LINUX_LOCK_EX 4
-#define LINUX_LOCK_SH 8
-
-/*
- * The arguments in the flock structure have a different order from the
- * BSD structure.
- */
-
-struct linux_flock {
- short l_type;
- short l_whence;
- linux_off_t l_start;
- linux_off_t l_len;
- linux_pid_t l_pid;
-};
-
-struct linux_flock64 {
- short l_type;
- short l_whence;
- linux_loff_t l_start;
- linux_loff_t l_len;
- linux_pid_t l_pid;
-};
-
-#endif /* _LINUX_FCNTL_H_ */
diff --git a/sys/compat/linux/linux_fdio.c b/sys/compat/linux/linux_fdio.c
deleted file mode 100644
index e84801153d4..00000000000
--- a/sys/compat/linux/linux_fdio.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: linux_fdio.c,v 1.7 2012/04/22 05:43:14 guenther Exp $ */
-/* $NetBSD: linux_fdio.c,v 1.1 2000/12/10 14:12:16 fvdl Exp $ */
-
-/*
- * Copyright (c) 2000 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/disklabel.h>
-
-#include <sys/syscallargs.h>
-
-#include <dev/isa/fdreg.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_fdio.h>
-
-#include <machine/ioctl_fd.h>
-
-#include <compat/linux/linux_syscallargs.h>
-
-int
-linux_ioctl_fdio(struct proc *p, struct linux_sys_ioctl_args *uap,
- register_t *retval)
-{
- struct filedesc *fdp;
- struct file *fp;
- int error;
- int (*ioctlf)(struct file *, u_long, caddr_t, struct proc *);
- u_long com;
- struct fd_type fparams;
- struct linux_floppy_struct lflop;
- struct linux_floppy_drive_struct ldrive;
-
- com = (u_long)SCARG(uap, data);
-
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
- return (EBADF);
-
- FREF(fp);
- com = SCARG(uap, com);
- ioctlf = fp->f_ops->fo_ioctl;
-
- retval[0] = error = 0;
-
- switch (com) {
- case LINUX_FDMSGON:
- case LINUX_FDMSGOFF:
- case LINUX_FDTWADDLE:
- case LINUX_FDCLRPRM:
- /* whatever you say */
- break;
- case LINUX_FDPOLLDRVSTAT:
- /*
- * Just fill in some innocent defaults.
- */
- memset(&ldrive, 0, sizeof ldrive);
- ldrive.fd_ref = 1;
- ldrive.maxblock = 2;
- ldrive.maxtrack = ldrive.track = 1;
- ldrive.flags = LINUX_FD_DISK_WRITABLE;
- error = copyout(&ldrive, SCARG(uap, data), sizeof ldrive);
- break;
- case LINUX_FDGETPRM:
- error = ioctlf(fp, FD_GTYPE, (caddr_t)&fparams, p);
- if (error != 0)
- break;
- lflop.size = fparams.heads * fparams.sectrac * fparams.tracks;
- lflop.sect = fparams.sectrac;
- lflop.head = fparams.heads;
- lflop.track = fparams.tracks;
- lflop.stretch = fparams.step == 2 ? 1 : 0;
- lflop.spec1 = fparams.steprate;
- lflop.gap = fparams.gap1;
- lflop.fmt_gap = fparams.gap2;
- lflop.rate = fparams.rate;
-
- error = copyout(&lflop, SCARG(uap, data), sizeof lflop);
- break;
- case LINUX_FDSETPRM:
- /*
- * Should use FDIOCSETFORMAT here, iff its interface
- * is extended.
- */
- case LINUX_FDDEFPRM:
- case LINUX_FDFMTBEG:
- case LINUX_FDFMTTRK:
- case LINUX_FDFMTEND:
- case LINUX_FDSETEMSGTRESH:
- case LINUX_FDFLUSH:
- case LINUX_FDSETMAXERRS:
- case LINUX_FDGETMAXERRS:
- case LINUX_FDGETDRVTYP:
- case LINUX_FDSETDRVPRM:
- case LINUX_FDGETDRVPRM:
- case LINUX_FDGETDRVSTAT:
- case LINUX_FDRESET:
- case LINUX_FDGETFDCSTAT:
- case LINUX_FDWERRORCLR:
- case LINUX_FDWERRORGET:
- case LINUX_FDRAWCMD:
- case LINUX_FDEJECT:
- default:
- error = EINVAL;
- }
-
- FRELE(fp, p);
- return 0;
-}
diff --git a/sys/compat/linux/linux_fdio.h b/sys/compat/linux/linux_fdio.h
deleted file mode 100644
index bfa141fee86..00000000000
--- a/sys/compat/linux/linux_fdio.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* $OpenBSD: linux_fdio.h,v 1.2 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_fdio.h,v 1.1 2000/12/10 14:12:16 fvdl Exp $ */
-
-/*
- * Copyright (c) 2000 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-#ifndef _LINUX_FDIO_H_
-#define _LINUX_FDIO_H_
-
-/*
- * Linux floppy ioctl call structures and defines.
- */
-
-struct linux_floppy_struct {
- u_int size;
- u_int sect;
- u_int head;
- u_int track;
- u_int stretch;
- u_char gap;
- u_char rate;
- u_char spec1;
- u_char fmt_gap;
- const char *name;
-};
-
-struct linux_floppy_max_errors {
- u_int abort;
- u_int read_track;
- u_int reset;
- u_int recal;
- u_int reporting;
-};
-
-struct linux_floppy_drive_params {
- char cmos;
- u_long max_dtr;
- u_long hlt;
- u_long hut;
- u_long srt;
- u_long spinup;
- u_long spindown;
- u_char spindown_offset;
- u_char select_delay;
- u_char rps;
- u_char tracks;
- u_long timeout;
- u_char interleave_sect;
- struct linux_floppy_max_errors max_errors;
- char flags;
- char read_track;
- short autodetect[8];
- int checkfreq;
- int native_format;
-};
-
-struct linux_floppy_drive_struct {
- u_long flags;
- u_long spinup_date;
- u_long select_date;
- u_long first_read_date;
- short probed_format;
- short track;
- short maxblock;
- short maxtrack;
- int generation;
- int keep_data;
- int fd_ref;
- int fd_device;
- u_long last_checked;
- char *dmabuf;
- int bufblocks;
-};
-
-#define LINUX_FD_NEED_TWADDLE 0x01
-#define LINUX_FD_VERIFY 0x02
-#define LINUX_FD_DISK_NEWCHANGE 0x04
-#define LINUX_FD_DISK_CHANGED 0x10
-#define LINUX_FD_DISK_WRITABLE 0x20
-
-
-struct linux_floppy_fdc_state {
- int spec1;
- int spec2;
- int dtr;
- u_char version;
- u_char dor;
- u_long address;
- u_int rawcmd:2;
- u_int reset:1;
- u_int need_configure:1;
- u_int perp_mode:2;
- u_int has_fifo:1;
- u_int driver_version;
- u_char track[4];
-};
-
-struct linux_floppy_write_errors {
- u_int write_errors;
- u_long first_error_sector;
- u_int first_error_generation;
- u_long last_error_sector;
- u_int last_error_generation;
- u_int badness;
-};
-
-struct linux_floppy_raw_cmd {
- u_int flags;
- void *data;
- caddr_t kernel_data;
- struct floppy_raw_cmd *next;
- long length;
- long phys_length;
- int buffer_length;
- u_char rate;
- u_char cmd_count;
- u_char cmd[16];
- u_char reply_count;
- u_char reply[16];
- int track;
- int resultcode;
- int reserved1;
- int reserved2;
-};
-
-struct linux_format_descr {
- u_int device;
- u_int head;
- u_int track;
-};
-
-typedef char linux_floppy_drive_name[16];
-
-#define LINUX_FDCLRPRM _LINUX_IO(2, 0x41)
-#define LINUX_FDSETPRM _LINUX_IOW(2, 0x42, struct linux_floppy_struct)
-#define LINUX_FDDEFPRM _LINUX_IOW(2, 0x43, struct linux_floppy_struct)
-#define LINUX_FDGETPRM _LINUX_IOR(2, 0x04, struct linux_floppy_struct)
-#define LINUX_FDMSGON _LINUX_IO(2, 0x45)
-#define LINUX_FDMSGOFF _LINUX_IO(2, 0x46)
-#define LINUX_FDFMTBEG _LINUX_IO(2, 0x47)
-#define LINUX_FDFMTTRK _LINUX_IOW(2, 0x48, struct linux_format_descr)
-#define LINUX_FDFMTEND _LINUX_IO(2, 0x49)
-#define LINUX_FDSETEMSGTRESH _LINUX_IO(2, 0x4a)
-#define LINUX_FDFLUSH _LINUX_IO(2, 0x4b)
-#define LINUX_FDSETMAXERRS \
- _LINUX_IOW(2, 0x4c, struct linux_floppy_max_errors)
-#define LINUX_FDGETMAXERRS \
- _LINUX_IOR(2, 0x0e, struct linux_floppy_max_errors)
-#define LINUX_FDGETDRVTYP _LINUX_IOR(2, 0x0f, linux_floppy_drive_name)
-/* 0x90 is not a typo, that's how it's listed in the Linux include file */
-#define LINUX_FDSETDRVPRM \
- _LINUX_IOW(2, 0x90, struct linux_floppy_drive_params)
-#define LINUX_FDGETDRVPRM \
- _LINUX_IOR(2, 0x11, struct linux_floppy_drive_params)
-#define LINUX_FDGETDRVSTAT \
- _LINUX_IOR(2, 0x12, struct linux_floppy_drive_struct)
-#define LINUX_FDPOLLDRVSTAT \
- _LINUX_IOR(2, 0x13, struct linux_floppy_drive_struct)
-#define LINUX_FDRESET _LINUX_IO(2, 0x54)
-#define LINUX_FDGETFDCSTAT \
- _LINUX_IOR(2, 0x15, struct linux_floppy_fdc_state)
-#define LINUX_FDWERRORCLR _LINUX_IO(2, 0x56)
-#define LINUX_FDWERRORGET \
- _LINUX_IOR(2, 0x17, struct linux_floppy_write_errors)
-#define LINUX_FDRAWCMD _LINUX_IO(2, 0x58)
-#define LINUX_FDTWADDLE _LINUX_IO(2, 0x59)
-#define LINUX_FDEJECT _LINUX_IO(2, 0x5a)
-
-#endif /* _LINUX_FDIO_H_ */
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
deleted file mode 100644
index 96df18a5e4e..00000000000
--- a/sys/compat/linux/linux_file.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/* $OpenBSD: linux_file.c,v 1.30 2014/03/26 05:23:42 guenther Exp $ */
-/* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/mount.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/stdint.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_fcntl.h>
-#include <compat/linux/linux_util.h>
-
-#include <machine/linux_machdep.h>
-
-static int linux_to_bsd_ioflags(int);
-static int bsd_to_linux_ioflags(int);
-static void bsd_to_linux_flock(struct flock *, struct linux_flock *);
-static void linux_to_bsd_flock(struct linux_flock *, struct flock *);
-static int bsd_to_linux_stat(struct stat *, struct linux_stat *);
-static int linux_stat1(struct proc *, void *, register_t *, int);
-
-
-/*
- * Some file-related calls are handled here. The usual flag conversion
- * an structure conversion is done, and alternate emul path searching.
- */
-
-/*
- * The next two functions convert between the Linux and OpenBSD values
- * of the flags used in open(2) and fcntl(2).
- */
-static int
-linux_to_bsd_ioflags(lflags)
- int lflags;
-{
- int res = 0;
-
- res |= cvtto_bsd_mask(lflags, LINUX_O_WRONLY, O_WRONLY);
- res |= cvtto_bsd_mask(lflags, LINUX_O_RDONLY, O_RDONLY);
- res |= cvtto_bsd_mask(lflags, LINUX_O_RDWR, O_RDWR);
- res |= cvtto_bsd_mask(lflags, LINUX_O_CREAT, O_CREAT);
- res |= cvtto_bsd_mask(lflags, LINUX_O_EXCL, O_EXCL);
- res |= cvtto_bsd_mask(lflags, LINUX_O_NOCTTY, O_NOCTTY);
- res |= cvtto_bsd_mask(lflags, LINUX_O_TRUNC, O_TRUNC);
- res |= cvtto_bsd_mask(lflags, LINUX_O_NDELAY, O_NDELAY);
- res |= cvtto_bsd_mask(lflags, LINUX_O_SYNC, O_SYNC);
- res |= cvtto_bsd_mask(lflags, LINUX_FASYNC, O_ASYNC);
- res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
-
- return res;
-}
-
-static int
-bsd_to_linux_ioflags(bflags)
- int bflags;
-{
- int res = 0;
-
- res |= cvtto_linux_mask(bflags, O_WRONLY, LINUX_O_WRONLY);
- res |= cvtto_linux_mask(bflags, O_RDONLY, LINUX_O_RDONLY);
- res |= cvtto_linux_mask(bflags, O_RDWR, LINUX_O_RDWR);
- res |= cvtto_linux_mask(bflags, O_CREAT, LINUX_O_CREAT);
- res |= cvtto_linux_mask(bflags, O_EXCL, LINUX_O_EXCL);
- res |= cvtto_linux_mask(bflags, O_NOCTTY, LINUX_O_NOCTTY);
- res |= cvtto_linux_mask(bflags, O_TRUNC, LINUX_O_TRUNC);
- res |= cvtto_linux_mask(bflags, O_NDELAY, LINUX_O_NDELAY);
- res |= cvtto_linux_mask(bflags, O_SYNC, LINUX_O_SYNC);
- res |= cvtto_linux_mask(bflags, O_ASYNC, LINUX_FASYNC);
- res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
-
- return res;
-}
-
-/*
- * creat(2) is an obsolete function, but it's present as a Linux
- * system call, so let's deal with it.
- *
- * Just call open(2) with the TRUNC, CREAT and WRONLY flags.
- */
-int
-linux_sys_creat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_creat_args /* {
- syscallarg(char *) path;
- syscallarg(int) mode;
- } */ *uap = v;
- struct sys_open_args oa;
- caddr_t sg;
-
- sg = stackgap_init(p);
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
-
- SCARG(&oa, path) = SCARG(uap, path);
- SCARG(&oa, flags) = O_CREAT | O_TRUNC | O_WRONLY;
- SCARG(&oa, mode) = SCARG(uap, mode);
-
- return sys_open(p, &oa, retval);
-}
-
-/*
- * open(2). Take care of the different flag values, and let the
- * OpenBSD syscall do the real work. See if this operation
- * gives the current process a controlling terminal.
- * (XXX is this necessary?)
- */
-int
-linux_sys_open(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_open_args /* {
- syscallarg(char *) path;
- syscallarg(int) flags;
- syscallarg(int) mode;
- } */ *uap = v;
- int error, fl;
- struct sys_open_args boa;
- caddr_t sg;
-
- sg = stackgap_init(p);
-
- fl = linux_to_bsd_ioflags(SCARG(uap, flags));
-
- if (fl & O_CREAT)
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
- else
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&boa, path) = SCARG(uap, path);
- SCARG(&boa, flags) = fl;
- SCARG(&boa, mode) = SCARG(uap, mode);
-
- if ((error = sys_open(p, &boa, retval)))
- return error;
-
- /*
- * this bit from sunos_misc.c (and svr4_fcntl.c).
- * If we are a session leader, and we don't have a controlling
- * terminal yet, and the O_NOCTTY flag is not set, try to make
- * this the controlling terminal.
- */
- if (!(fl & O_NOCTTY) && SESS_LEADER(p->p_p) &&
- !(p->p_p->ps_flags & PS_CONTROLT)) {
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
-
- if ((fp = fd_getfile(fdp, *retval)) == NULL)
- return (EBADF);
- FREF(fp);
- if (fp->f_type == DTYPE_VNODE)
- (fp->f_ops->fo_ioctl) (fp, TIOCSCTTY, (caddr_t) 0, p);
- FRELE(fp, p);
- }
- return 0;
-}
-
-int
-linux_sys_lseek(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_lseek_args /* {
- syscallarg(int) fd;
- syscallarg(long) offset;
- syscallarg(int) whence;
- } */ *uap = v;
- struct sys_lseek_args bla;
-
- SCARG(&bla, fd) = SCARG(uap, fd);
- SCARG(&bla, offset) = SCARG(uap, offset);
- SCARG(&bla, whence) = SCARG(uap, whence);
-
- return sys_lseek(p, &bla, retval);
-}
-
-/*
- * This appears to be part of a Linux attempt to switch to 64 bits file sizes.
- */
-int
-linux_sys_llseek(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_llseek_args /* {
- syscallarg(int) fd;
- syscallarg(uint32_t) ohigh;
- syscallarg(uint32_t) olow;
- syscallarg(caddr_t) res;
- syscallarg(int) whence;
- } */ *uap = v;
- struct sys_lseek_args bla;
- int error;
- off_t off;
-
- off = SCARG(uap, olow) | (((off_t) SCARG(uap, ohigh)) << 32);
-
- SCARG(&bla, fd) = SCARG(uap, fd);
- SCARG(&bla, offset) = off;
- SCARG(&bla, whence) = SCARG(uap, whence);
-
- if ((error = sys_lseek(p, &bla, retval)))
- return error;
-
- if ((error = copyout(retval, SCARG(uap, res), sizeof (off_t))))
- return error;
-
- retval[0] = 0;
- return 0;
-}
-
-/*
- * The next two functions take care of converting the flock
- * structure back and forth between Linux and OpenBSD format.
- * The only difference in the structures is the order of
- * the fields, and the 'whence' value.
- */
-static void
-bsd_to_linux_flock(bfp, lfp)
- struct flock *bfp;
- struct linux_flock *lfp;
-{
-
- lfp->l_start = bfp->l_start;
- lfp->l_len = bfp->l_len;
- lfp->l_pid = bfp->l_pid;
- lfp->l_whence = bfp->l_whence;
- switch (bfp->l_type) {
- case F_RDLCK:
- lfp->l_type = LINUX_F_RDLCK;
- break;
- case F_UNLCK:
- lfp->l_type = LINUX_F_UNLCK;
- break;
- case F_WRLCK:
- lfp->l_type = LINUX_F_WRLCK;
- break;
- }
-}
-
-static void
-linux_to_bsd_flock(lfp, bfp)
- struct linux_flock *lfp;
- struct flock *bfp;
-{
-
- bfp->l_start = lfp->l_start;
- bfp->l_len = lfp->l_len;
- bfp->l_pid = lfp->l_pid;
- bfp->l_whence = lfp->l_whence;
- switch (lfp->l_type) {
- case LINUX_F_RDLCK:
- bfp->l_type = F_RDLCK;
- break;
- case LINUX_F_UNLCK:
- bfp->l_type = F_UNLCK;
- break;
- case LINUX_F_WRLCK:
- bfp->l_type = F_WRLCK;
- break;
- }
-}
-
-/*
- * Most actions in the fcntl() call are straightforward; simply
- * pass control to the OpenBSD system call. A few commands need
- * conversions after the actual system call has done its work,
- * because the flag values and lock structure are different.
- */
-int
-linux_sys_fcntl(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fcntl_args /* {
- syscallarg(int) fd;
- syscallarg(int) cmd;
- syscallarg(void *) arg;
- } */ *uap = v;
- int fd, cmd, error;
- intptr_t val;
- caddr_t arg, sg;
- struct linux_flock lfl;
- struct flock *bfp, bfl;
- struct sys_fcntl_args fca;
- struct filedesc *fdp;
- struct file *fp;
- struct vnode *vp;
- struct vattr va;
- long pgid;
- struct pgrp *pgrp;
- struct tty *tp, *(*d_tty)(dev_t);
-
- fd = SCARG(uap, fd);
- cmd = SCARG(uap, cmd);
- arg = (caddr_t) SCARG(uap, arg);
-
- switch (cmd) {
- case LINUX_F_DUPFD:
- cmd = F_DUPFD;
- break;
- case LINUX_F_GETFD:
- cmd = F_GETFD;
- break;
- case LINUX_F_SETFD:
- cmd = F_SETFD;
- break;
- case LINUX_F_GETFL:
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = F_GETFL;
- SCARG(&fca, arg) = arg;
- if ((error = sys_fcntl(p, &fca, retval)))
- return error;
- retval[0] = bsd_to_linux_ioflags(retval[0]);
- return 0;
- case LINUX_F_SETFL:
- val = linux_to_bsd_ioflags((intptr_t)SCARG(uap, arg));
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = F_SETFL;
- SCARG(&fca, arg) = (caddr_t) val;
- return sys_fcntl(p, &fca, retval);
- case LINUX_F_GETLK:
- sg = stackgap_init(p);
- if ((error = copyin(arg, &lfl, sizeof lfl)))
- return error;
- linux_to_bsd_flock(&lfl, &bfl);
- bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = F_GETLK;
- SCARG(&fca, arg) = bfp;
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- if ((error = sys_fcntl(p, &fca, retval)))
- return error;
- if ((error = copyin(bfp, &bfl, sizeof bfl)))
- return error;
- bsd_to_linux_flock(&bfl, &lfl);
- error = copyout(&lfl, arg, sizeof lfl);
- return error;
- break;
- case LINUX_F_SETLK:
- case LINUX_F_SETLKW:
- cmd = (cmd == LINUX_F_SETLK ? F_SETLK : F_SETLKW);
- if ((error = copyin(arg, &lfl, sizeof lfl)))
- return error;
- linux_to_bsd_flock(&lfl, &bfl);
- sg = stackgap_init(p);
- bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = cmd;
- SCARG(&fca, arg) = bfp;
- return sys_fcntl(p, &fca, retval);
- break;
- case LINUX_F_SETOWN:
- case LINUX_F_GETOWN:
- /*
- * We need to route around the normal fcntl() for these calls,
- * since it uses TIOC{G,S}PGRP, which is too restrictive for
- * Linux F_{G,S}ETOWN semantics. For sockets, this problem
- * does not exist.
- */
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, fd)) == NULL)
- return (EBADF);
- if (fp->f_type == DTYPE_SOCKET) {
- cmd = cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN;
- break;
- }
- vp = (struct vnode *)fp->f_data;
- if (vp->v_type != VCHR)
- return EINVAL;
- FREF(fp);
- error = VOP_GETATTR(vp, &va, p->p_ucred, p);
- FRELE(fp, p);
- if (error)
- return error;
- d_tty = cdevsw[major(va.va_rdev)].d_tty;
- if (!d_tty || (!(tp = (*d_tty)(va.va_rdev))))
- return EINVAL;
- if (cmd == LINUX_F_GETOWN) {
- retval[0] = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
- return 0;
- }
- if ((long)arg <= 0) {
- pgid = -(long)arg;
- } else {
- struct process *pr = prfind((long)arg);
- if (pr == 0)
- return (ESRCH);
- pgid = (long)pr->ps_pgrp->pg_id;
- }
- pgrp = pgfind(pgid);
- if (pgrp == NULL || pgrp->pg_session != p->p_p->ps_session)
- return EPERM;
- tp->t_pgrp = pgrp;
- return 0;
- default:
- return EOPNOTSUPP;
- }
-
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = cmd;
- SCARG(&fca, arg) = arg;
-
- return sys_fcntl(p, &fca, retval);
-}
-
-/*
- * Convert a OpenBSD stat structure to a Linux stat structure.
- * Only the order of the fields and the padding in the structure
- * is different. linux_fakedev is a machine-dependent function
- * which optionally converts device driver major/minor numbers
- * (XXX horrible, but what can you do against code that compares
- * things against constant major device numbers? sigh)
- */
-static int
-bsd_to_linux_stat(bsp, lsp)
- struct stat *bsp;
- struct linux_stat *lsp;
-{
- if (bsp->st_ino > LINUX_INO_MAX)
- return EOVERFLOW;
-
- lsp->lst_dev = bsp->st_dev;
- lsp->lst_ino = (linux_ino_t)bsp->st_ino;
- lsp->lst_mode = bsp->st_mode;
- lsp->lst_nlink = bsp->st_nlink;
- lsp->lst_uid = bsp->st_uid;
- lsp->lst_gid = bsp->st_gid;
- lsp->lst_rdev = linux_fakedev(bsp->st_rdev);
- lsp->lst_size = bsp->st_size;
- lsp->lst_blksize = bsp->st_blksize;
- lsp->lst_blocks = bsp->st_blocks;
- lsp->lst_atime = bsp->st_atime;
- lsp->lst_mtime = bsp->st_mtime;
- lsp->lst_ctime = bsp->st_ctime;
-
- return 0;
-}
-
-/*
- * The stat functions below are plain sailing. stat and lstat are handled
- * by one function to avoid code duplication.
- */
-int
-linux_sys_fstat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fstat_args /* {
- syscallarg(int) fd;
- syscallarg(linux_stat *) sp;
- } */ *uap = v;
- struct sys_fstat_args fsa;
- struct linux_stat tmplst;
- struct stat *st,tmpst;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
-
- st = stackgap_alloc(&sg, sizeof (struct stat));
-
- SCARG(&fsa, fd) = SCARG(uap, fd);
- SCARG(&fsa, sb) = st;
-
- if ((error = sys_fstat(p, &fsa, retval)))
- return error;
-
- if ((error = copyin(st, &tmpst, sizeof tmpst)))
- return error;
-
- if ((error = bsd_to_linux_stat(&tmpst, &tmplst)))
- return error;
-
- if ((error = copyout(&tmplst, SCARG(uap, sp), sizeof tmplst)))
- return error;
-
- return 0;
-}
-
-static int
-linux_stat1(p, v, retval, dolstat)
- struct proc *p;
- void *v;
- register_t *retval;
- int dolstat;
-{
- struct sys_stat_args sa;
- struct linux_stat tmplst;
- struct stat *st, tmpst;
- caddr_t sg;
- int error;
- struct linux_sys_stat_args *uap = v;
-
- sg = stackgap_init(p);
-
- st = stackgap_alloc(&sg, sizeof (struct stat));
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&sa, ub) = st;
- SCARG(&sa, path) = SCARG(uap, path);
-
- if ((error = (dolstat ? sys_lstat(p, &sa, retval) :
- sys_stat(p, &sa, retval))))
- return error;
-
- if ((error = copyin(st, &tmpst, sizeof tmpst)))
- return error;
-
- if ((error = bsd_to_linux_stat(&tmpst, &tmplst)))
- return error;
-
- if ((error = copyout(&tmplst, SCARG(uap, sp), sizeof tmplst)))
- return error;
-
- return 0;
-}
-
-int
-linux_sys_stat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_stat_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_stat *) sp;
- } */ *uap = v;
-
- return linux_stat1(p, uap, retval, 0);
-}
-
-int
-linux_sys_lstat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_lstat_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_stat *) sp;
- } */ *uap = v;
-
- return linux_stat1(p, uap, retval, 1);
-}
-
-/*
- * The following syscalls are mostly here because of the alternate path check.
- */
-int
-linux_sys_access(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_access_args /* {
- syscallarg(char *) path;
- syscallarg(int) flags;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_access(p, uap, retval);
-}
-
-int
-linux_sys_unlink(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-
-{
- struct linux_sys_unlink_args /* {
- syscallarg(char *) path;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_unlink(p, uap, retval);
-}
-
-int
-linux_sys_chdir(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_chdir_args /* {
- syscallarg(char *) path;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_chdir(p, uap, retval);
-}
-
-int
-linux_sys_mknod(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_mknod_args /* {
- syscallarg(char *) path;
- syscallarg(int) mode;
- syscallarg(int) dev;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
- struct sys_mkfifo_args bma;
-
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
-
- /*
- * BSD handles FIFOs separately
- */
- if (S_ISFIFO(SCARG(uap, mode))) {
- SCARG(&bma, path) = SCARG(uap, path);
- SCARG(&bma, mode) = SCARG(uap, mode);
- return sys_mkfifo(p, uap, retval);
- } else
- return sys_mknod(p, uap, retval);
-}
-
-int
-linux_sys_chmod(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_chmod_args /* {
- syscallarg(char *) path;
- syscallarg(int) mode;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_chmod(p, uap, retval);
-}
-
-int
-linux_sys_chown(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_chown_args /* {
- syscallarg(char *) path;
- syscallarg(uid_t) uid;
- syscallarg(gid_t) gid;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_chown(p, uap, retval);
-}
-
-int
-linux_sys_chown16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_chown16_args /* {
- syscallarg(char *) path;
- syscallarg(int) uid;
- syscallarg(int) gid;
- } */ *uap = v;
- struct sys_chown_args bca;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&bca, path) = SCARG(uap, path);
- SCARG(&bca, uid) = ((linux_uid_t)SCARG(uap, uid) == (linux_uid_t)-1) ?
- (uid_t)-1 : SCARG(uap, uid);
- SCARG(&bca, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
- (gid_t)-1 : SCARG(uap, gid);
-
- return sys_chown(p, &bca, retval);
-}
-
-int
-linux_sys_fchown16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fchown16_args /* {
- syscallarg(int) fd;
- syscallarg(int) uid;
- syscallarg(int) gid;
- } */ *uap = v;
- struct sys_fchown_args bfa;
-
- SCARG(&bfa, fd) = SCARG(uap, fd);
- SCARG(&bfa, uid) = ((linux_uid_t)SCARG(uap, uid) == (linux_uid_t)-1) ?
- (uid_t)-1 : SCARG(uap, uid);
- SCARG(&bfa, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
- (gid_t)-1 : SCARG(uap, gid);
-
- return sys_fchown(p, &bfa, retval);
-}
-
-int
-linux_sys_lchown16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_lchown16_args /* {
- syscallarg(char *) path;
- syscallarg(int) uid;
- syscallarg(int) gid;
- } */ *uap = v;
- struct sys_lchown_args bla;
-
- SCARG(&bla, path) = SCARG(uap, path);
- SCARG(&bla, uid) = ((linux_uid_t)SCARG(uap, uid) == (linux_uid_t)-1) ?
- (uid_t)-1 : SCARG(uap, uid);
- SCARG(&bla, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
- (gid_t)-1 : SCARG(uap, gid);
-
- return sys_lchown(p, &bla, retval);
-}
-
-int
-linux_sys_rename(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rename_args /* {
- syscallarg(char *) from;
- syscallarg(char *) to;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
-
- return sys_rename(p, uap, retval);
-}
-
-int
-linux_sys_mkdir(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_mkdir_args /* {
- syscallarg(char *) path;
- syscallarg(int) mode;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
-
- return sys_mkdir(p, uap, retval);
-}
-
-int
-linux_sys_rmdir(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rmdir_args /* {
- syscallarg(char *) path;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- return sys_rmdir(p, uap, retval);
-}
-
-int
-linux_sys_symlink(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_symlink_args /* {
- syscallarg(char *) path;
- syscallarg(char *) to;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
- LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
-
- return sys_symlink(p, uap, retval);
-}
-
-int
-linux_sys_readlink(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_readlink_args /* {
- syscallarg(char *) name;
- syscallarg(char *) buf;
- syscallarg(int) count;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, name));
-
- return sys_readlink(p, uap, retval);
-}
-
-int
-linux_sys_ftruncate(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ftruncate_args /* {
- syscallarg(int) fd;
- syscallarg(long) length;
- } */ *uap = v;
- struct sys_ftruncate_args sta;
-
- SCARG(&sta, fd) = SCARG(uap, fd);
- SCARG(&sta, length) = SCARG(uap, length);
-
- return sys_ftruncate(p, uap, retval);
-}
-
-int
-linux_sys_truncate(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_truncate_args /* {
- syscallarg(char *) path;
- syscallarg(long) length;
- } */ *uap = v;
- caddr_t sg = stackgap_init(p);
- struct sys_truncate_args sta;
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&sta, path) = SCARG(uap, path);
- SCARG(&sta, length) = SCARG(uap, length);
-
- return sys_truncate(p, &sta, retval);
-}
-
-/*
- * This is just fsync() for now (just as it is in the Linux kernel)
- */
-int
-linux_sys_fdatasync(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fdatasync_args /* {
- syscallarg(int) fd;
- } */ *uap = v;
- return sys_fsync(p, uap, retval);
-}
-
-/*
- * pread(2).
- */
-int
-linux_sys_pread(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_pread_args /* {
- syscallarg(int) fd;
- syscallarg(void *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(linux_off_t) offset;
- } */ *uap = v;
- struct sys_pread_args pra;
-
- SCARG(&pra, fd) = SCARG(uap, fd);
- SCARG(&pra, buf) = SCARG(uap, buf);
- SCARG(&pra, nbyte) = SCARG(uap, nbyte);
- SCARG(&pra, offset) = SCARG(uap, offset);
-
- return sys_pread(p, &pra, retval);
-}
-
-/*
- * pwrite(2).
- */
-int
-linux_sys_pwrite(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_pwrite_args /* {
- syscallarg(int) fd;
- syscallarg(char *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(linux_off_t) offset;
- } */ *uap = v;
- struct sys_pwrite_args pra;
-
- SCARG(&pra, fd) = SCARG(uap, fd);
- SCARG(&pra, buf) = SCARG(uap, buf);
- SCARG(&pra, nbyte) = SCARG(uap, nbyte);
- SCARG(&pra, offset) = SCARG(uap, offset);
-
- return sys_pwrite(p, &pra, retval);
-}
diff --git a/sys/compat/linux/linux_file64.c b/sys/compat/linux/linux_file64.c
deleted file mode 100644
index 8578b6bcdd7..00000000000
--- a/sys/compat/linux/linux_file64.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* $OpenBSD: linux_file64.c,v 1.10 2014/09/14 14:17:23 jsg Exp $ */
-/* $NetBSD: linux_file64.c,v 1.2 2000/12/12 22:24:56 jdolecek Exp $ */
-
-/*-
- * Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Frank van der Linden and Eric Haszlakiewicz.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Linux 64bit filesystem calls. Used on 32bit archs, not used on 64bit ones.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/mount.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_fcntl.h>
-#include <compat/linux/linux_util.h>
-
-#include <machine/linux_machdep.h>
-
-
-void bsd_to_linux_flock64(struct flock *, struct linux_flock64 *);
-void linux_to_bsd_flock64(struct linux_flock64 *, struct flock *);
-static int bsd_to_linux_stat(struct stat *, struct linux_stat64 *);
-static int linux_do_stat64(struct proc *, void *, register_t *, int);
-
-/*
- * Convert a OpenBSD stat structure to a Linux stat structure.
- * Only the order of the fields and the padding in the structure
- * is different. linux_fakedev is a machine-dependent function
- * which optionally converts device driver major/minor numbers
- * (XXX horrible, but what can you do against code that compares
- * things against constant major device numbers? sigh)
- */
-static int
-bsd_to_linux_stat(bsp, lsp)
- struct stat *bsp;
- struct linux_stat64 *lsp;
-{
- lsp->lst_dev = bsp->st_dev;
- lsp->lst_ino = (linux_ino64_t)bsp->st_ino;
- lsp->lst_mode = (linux_mode_t)bsp->st_mode;
- if (bsp->st_nlink >= (1 << 15))
- lsp->lst_nlink = (1 << 15) - 1;
- else
- lsp->lst_nlink = (linux_nlink_t)bsp->st_nlink;
- lsp->lst_uid = bsp->st_uid;
- lsp->lst_gid = bsp->st_gid;
- lsp->lst_rdev = linux_fakedev(bsp->st_rdev);
- lsp->lst_size = bsp->st_size;
- lsp->lst_blksize = bsp->st_blksize;
- lsp->lst_blocks = bsp->st_blocks;
- lsp->lst_atime = bsp->st_atime;
- lsp->lst_mtime = bsp->st_mtime;
- lsp->lst_ctime = bsp->st_ctime;
-#if LINUX_STAT64_HAS_BROKEN_ST_INO
- if (bsp->st_ino > LINUX_INO_MAX)
- return EOVERFLOW;
- lsp->__lst_ino = (linux_ino_t)bsp->st_ino;
-#endif
-
- return 0;
-}
-
-/*
- * The stat functions below are plain sailing. stat and lstat are handled
- * by one function to avoid code duplication.
- */
-int
-linux_sys_fstat64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fstat64_args /* {
- syscallarg(int) fd;
- syscallarg(linux_stat64 *) sp;
- } */ *uap = v;
- struct sys_fstat_args fsa;
- struct linux_stat64 tmplst;
- struct stat *st,tmpst;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
-
- st = stackgap_alloc(&sg, sizeof (struct stat));
-
- SCARG(&fsa, fd) = SCARG(uap, fd);
- SCARG(&fsa, sb) = st;
-
- if ((error = sys_fstat(p, &fsa, retval)))
- return error;
-
- if ((error = copyin(st, &tmpst, sizeof tmpst)))
- return error;
-
- if ((error = bsd_to_linux_stat(&tmpst, &tmplst)))
- return error;
-
- if ((error = copyout(&tmplst, SCARG(uap, sp), sizeof tmplst)))
- return error;
-
- return 0;
-}
-
-static int
-linux_do_stat64(p, v, retval, dolstat)
- struct proc *p;
- void *v;
- register_t *retval;
- int dolstat;
-{
- struct sys_stat_args sa;
- struct linux_stat64 tmplst;
- struct stat *st, tmpst;
- caddr_t sg;
- int error;
- struct linux_sys_stat64_args *uap = v;
-
- sg = stackgap_init(p);
- st = stackgap_alloc(&sg, sizeof (struct stat));
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&sa, ub) = st;
- SCARG(&sa, path) = SCARG(uap, path);
-
- if ((error = (dolstat ? sys_lstat(p, &sa, retval) :
- sys_stat(p, &sa, retval))))
- return error;
-
- if ((error = copyin(st, &tmpst, sizeof tmpst)))
- return error;
-
- if ((error = bsd_to_linux_stat(&tmpst, &tmplst)))
- return error;
-
- if ((error = copyout(&tmplst, SCARG(uap, sp), sizeof tmplst)))
- return error;
-
- return 0;
-}
-
-int
-linux_sys_stat64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_stat64_args /* {
- syscallarg(const char *) path;
- syscallarg(struct linux_stat64 *) sp;
- } */ *uap = v;
-
- return linux_do_stat64(p, uap, retval, 0);
-}
-
-int
-linux_sys_lstat64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_lstat64_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_stat64 *) sp;
- } */ *uap = v;
-
- return linux_do_stat64(p, uap, retval, 1);
-}
-
-int
-linux_sys_truncate64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_truncate64_args /* {
- syscallarg(char *) path;
- syscallarg(off_t) length;
- } */ *uap = v;
- struct sys_truncate_args ta;
- caddr_t sg = stackgap_init(p);
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&ta, path) = SCARG(uap, path);
- SCARG(&ta, length) = SCARG(uap, length);
-
- return sys_truncate(p, &ta, retval);
-}
-
-/*
- * This is needed due to padding in OpenBSD's sys_ftruncate_args
- */
-int
-linux_sys_ftruncate64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ftruncate64_args /* {
- syscallarg(int) fd;
- syscallarg(off_t) length;
- } */ *uap = v;
- struct sys_ftruncate_args fta;
-
- SCARG(&fta, fd) = SCARG(uap, fd);
- SCARG(&fta, length) = SCARG(uap, length);
-
- return sys_ftruncate(p, &fta, retval);
-}
-
-/*
- * The next two functions take care of converting the flock
- * structure back and forth between Linux and OpenBSD format.
- * The only difference in the structures is the order of
- * the fields, and the 'whence' value.
- */
-void
-bsd_to_linux_flock64(struct flock *bfp, struct linux_flock64 *lfp)
-{
- lfp->l_start = bfp->l_start;
- lfp->l_len = bfp->l_len;
- lfp->l_pid = bfp->l_pid;
- lfp->l_whence = bfp->l_whence;
- switch (bfp->l_type) {
- case F_RDLCK:
- lfp->l_type = LINUX_F_RDLCK;
- break;
- case F_UNLCK:
- lfp->l_type = LINUX_F_UNLCK;
- break;
- case F_WRLCK:
- lfp->l_type = LINUX_F_WRLCK;
- break;
- }
-}
-
-void
-linux_to_bsd_flock64(struct linux_flock64 *lfp, struct flock *bfp)
-{
- bfp->l_start = lfp->l_start;
- bfp->l_len = lfp->l_len;
- bfp->l_pid = lfp->l_pid;
- bfp->l_whence = lfp->l_whence;
- switch (lfp->l_type) {
- case LINUX_F_RDLCK:
- bfp->l_type = F_RDLCK;
- break;
- case LINUX_F_UNLCK:
- bfp->l_type = F_UNLCK;
- break;
- case LINUX_F_WRLCK:
- bfp->l_type = F_WRLCK;
- break;
- }
-}
-
-int
-linux_sys_fcntl64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fcntl64_args /* {
- syscallarg(u_int) fd;
- syscallarg(u_int) cmd;
- syscallarg(void *) arg;
- } */ *uap = v;
- int fd, cmd, error;
- caddr_t arg, sg;
- struct linux_flock64 lfl;
- struct flock *bfp, bfl;
- struct sys_fcntl_args fca;
-
- fd = SCARG(uap, fd);
- cmd = SCARG(uap, cmd);
- arg = (caddr_t) SCARG(uap, arg);
-
- switch (cmd) {
- case LINUX_F_GETLK64:
- sg = stackgap_init(p);
- if ((error = copyin(arg, &lfl, sizeof lfl)))
- return error;
- linux_to_bsd_flock64(&lfl, &bfl);
- bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = F_GETLK;
- SCARG(&fca, arg) = bfp;
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- if ((error = sys_fcntl(p, &fca, retval)))
- return error;
- if ((error = copyin(bfp, &bfl, sizeof bfl)))
- return error;
- bsd_to_linux_flock64(&bfl, &lfl);
- error = copyout(&lfl, arg, sizeof lfl);
- return (error);
- case LINUX_F_SETLK64:
- case LINUX_F_SETLKW64:
- cmd = (cmd == LINUX_F_SETLK64 ? F_SETLK : F_SETLKW);
- if ((error = copyin(arg, &lfl, sizeof lfl)))
- return error;
- linux_to_bsd_flock64(&lfl, &bfl);
- sg = stackgap_init(p);
- bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
- if ((error = copyout(&bfl, bfp, sizeof bfl)))
- return error;
- SCARG(&fca, fd) = fd;
- SCARG(&fca, cmd) = cmd;
- SCARG(&fca, arg) = bfp;
- return (sys_fcntl(p, &fca, retval));
- default:
- return (linux_sys_fcntl(p, v, retval));
- }
- /* NOTREACHED */
-}
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
deleted file mode 100644
index 89f57fde583..00000000000
--- a/sys/compat/linux/linux_futex.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/* $OpenBSD: linux_futex.c,v 1.17 2015/09/04 11:51:29 kettenis Exp $ */
-/* $NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */
-
-/*-
- * Copyright (c) 2011 Paul Irofti <pirofti@openbsd.org>
- * Copyright (c) 2005 Emmanuel Dreyfus, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Emmanuel Dreyfus
- * 4. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/signal.h>
-#include <sys/stdint.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/pool.h>
-#include <sys/kernel.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_fcntl.h>
-#include <compat/linux/linux_misc.h>
-#include <compat/linux/linux_mmap.h>
-#include <compat/linux/linux_sched.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_dirent.h>
-#include <compat/linux/linux_emuldata.h>
-
-#include <compat/linux/linux_time.h>
-#include <compat/linux/linux_futex.h>
-
-#ifdef COMPATFUTEX_DEBUG
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x)
-#endif
-
-struct pool futex_pool;
-struct pool futex_wp_pool;
-int futex_pool_initialized;
-
-struct futex;
-
-struct waiting_proc {
- struct proc *p;
- struct futex *wp_new_futex;
- TAILQ_ENTRY(waiting_proc) wp_list;
- TAILQ_ENTRY(waiting_proc) wp_rqlist;
-};
-
-struct futex {
- void *f_uaddr;
- int f_refcount;
- LIST_ENTRY(futex) f_list;
- TAILQ_HEAD(, waiting_proc) f_waiting_proc;
- TAILQ_HEAD(, waiting_proc) f_requeue_proc;
-};
-
-static LIST_HEAD(futex_list, futex) futex_list;
-
-struct mutex futex_lock;
-void futex_pool_init(void);
-
-int linux_do_futex(struct proc *, const struct linux_sys_futex_args *,
- register_t *, struct timespec *);
-
-struct futex * futex_get(void *);
-void futex_ref(struct futex *);
-void futex_put(struct futex *);
-
-int futex_sleep(struct futex **, struct proc *, int, struct waiting_proc *);
-int futex_wake(struct futex *, int, struct futex *, int);
-int futex_atomic_op(struct proc *, int, void *);
-
-int futex_itimespecfix(struct timespec *ts);
-
-int
-linux_sys_futex(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_futex_args /* {
- syscallarg(int *) uaddr;
- syscallarg(int) op;
- syscallarg(int) val;
- syscallarg(const struct linux_timespec *) timeout;
- syscallarg(int *) uaddr2;
- syscallarg(int) val3;
- } */ *uap = v;
-
- struct linux_timespec lts;
- struct timespec ts = {0, 0};
- int error;
-
- if ((SCARG(uap, op) & ~LINUX_FUTEX_PRIVATE_FLAG) == LINUX_FUTEX_WAIT &&
- SCARG(uap, timeout) != NULL) {
- if ((error = copyin(SCARG(uap, timeout),
- &lts, sizeof(lts))) != 0) {
- return error;
- }
- linux_to_bsd_timespec(&ts, &lts);
- }
-
- return linux_do_futex(p, uap, retval, &ts);
-}
-
-int
-linux_do_futex(struct proc *p, const struct linux_sys_futex_args *uap,
- register_t *retval, struct timespec *ts)
-{
- /* {
- syscallarg(int *) uaddr;
- syscallarg(int) op;
- syscallarg(int) val;
- syscallarg(const struct linux_timespec *) timeout;
- syscallarg(int *) uaddr2;
- syscallarg(int) val3;
- } */
- int ret;
- int error = 0;
- struct futex *f;
- struct futex *newf;
- int timeout_hz;
- struct timeval tv;
- struct futex *f2;
- struct waiting_proc *wp;
- int op_ret;
-
- int uaddr_val;
- int args_val = SCARG(uap, val);
-
-#ifdef COMPATFUTEX_DEBUG
- int tid = p->p_pid + THREAD_PID_OFFSET;
-#endif
-
- /*
- * Our implementation provides only private futexes. Most of the apps
- * should use private futexes but don't claim so. Therefore we treat
- * all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works
- * in most cases (ie. when futexes are not shared on file descriptor
- * or between different processes).
- */
- switch (SCARG(uap, op) & ~LINUX_FUTEX_PRIVATE_FLAG) {
- case LINUX_FUTEX_WAIT:
-
- DPRINTF(("FUTEX_WAIT\n"));
- mtx_enter(&futex_lock);
- if ((error = copyin(SCARG(uap, uaddr),
- &uaddr_val, sizeof(uaddr_val))) != 0) {
- mtx_leave(&futex_lock);
- return error;
- }
-
- DPRINTF(("FUTEX_WAIT %d: Sleep if [%8.8X] %d == %d\n", tid,
- SCARG(uap, uaddr), uaddr_val, args_val));
-
- /* Sleep only if [uaddr] == val */
- if (uaddr_val != args_val) {
- mtx_leave(&futex_lock);
- return EWOULDBLOCK;
- }
-
- /* Check for infinity */
- if (ts->tv_sec == 0 && ts->tv_nsec == 0) {
- timeout_hz = 0;
- } else {
- if ((error = futex_itimespecfix(ts)) != 0) {
- mtx_leave(&futex_lock);
- return error;
- }
- TIMESPEC_TO_TIMEVAL(&tv, ts);
- timeout_hz = tvtohz(&tv);
- }
-
- /*
- * If the user process requests a non null timeout,
- * make sure we do not turn it into an infinite
- * timeout because timeout_hz is 0.
- *
- * We use a minimal timeout of 1/hz. Maybe it would make
- * sense to just return ETIMEDOUT without sleeping.
- */
- if (SCARG(uap, timeout) != NULL && timeout_hz == 0)
- timeout_hz = 1;
-
- DPRINTF(("FUTEX_WAIT %d: Sleep for %lld.%09lds (%dhz)\n",
- tid, (long long)ts->tv_sec, ts->tv_nsec, timeout_hz));
-
- wp = pool_get(&futex_wp_pool, PR_NOWAIT);
- if (wp == NULL) {
- DPRINTF(("FUTEX_WAIT %d: Couldn't fetch a new wp from"
- "futex_wp_pool.\n", tid));
- mtx_leave(&futex_lock);
- return EAGAIN;
- }
- DPRINTF(("FUTEX_WAIT: get wp %p\n", wp));
-
- f = futex_get(SCARG(uap, uaddr));
- ret = futex_sleep(&f, p, timeout_hz, wp);
- futex_put(f);
- mtx_leave(&futex_lock);
-
- DPRINTF(("FUTEX_WAIT: put wp %p\n", wp));
- pool_put(&futex_wp_pool, wp);
-
- DPRINTF(("FUTEX_WAIT %d: Woke up from uaddr %8.8X with "
- "ret = %d\n", tid, SCARG(uap, uaddr), ret));
-
- *retval = ret ? -1 : 0;
- switch (ret) {
- case EWOULDBLOCK: /* timeout */
- return ETIMEDOUT;
- break;
- case EINTR: /* signal */
- return EINTR;
- break;
- case 0: /* FUTEX_WAKE received */
- DPRINTF(("FUTEX_WAIT %d: uaddr = %p, got it\n",
- tid, SCARG(uap, uaddr)));
- return 0;
- break;
- default:
- DPRINTF(("FUTEX_WAIT: unexpected ret = %d\n", ret));
- break;
- }
-
- /* NOTREACHED */
- break;
-
- case LINUX_FUTEX_WAKE:
- /*
- * XXX: Linux is able cope with different addresses
- * corresponding to the same mapped memory in the sleeping
- * and the waker process(es).
- */
- DPRINTF(("FUTEX_WAKE %d: uaddr = %p, val = %d\n",
- tid, SCARG(uap, uaddr), args_val));
-
- if (args_val < 0)
- return EINVAL;
-
- mtx_enter(&futex_lock);
- f = futex_get(SCARG(uap, uaddr));
- *retval = futex_wake(f, args_val, NULL, 0);
- futex_put(f);
- mtx_leave(&futex_lock);
-
- break;
-
- case LINUX_FUTEX_CMP_REQUEUE:
-
- DPRINTF(("FUTEX_CMP_REQUEUE\n"));
- if (args_val < 0)
- return EINVAL;
-
- /*
- * Don't allow using the same address for requeueing.
- *
- * glibc seems to cope with this.
- */
- if (SCARG(uap, uaddr) == SCARG(uap, uaddr2)) {
- return EINVAL;
- }
-
- mtx_enter(&futex_lock);
- if ((error = copyin(SCARG(uap, uaddr),
- &uaddr_val, sizeof(uaddr_val))) != 0) {
- mtx_leave(&futex_lock);
- return error;
- }
-
- DPRINTF(("FUTEX_CMP_REQUEUE %d: Check for possible race "
- "condition [%8.8X] %d != %d", tid, SCARG(uap, uaddr),
- uaddr_val, SCARG(uap, val3)));
- if (uaddr_val != SCARG(uap, val3)) {
- mtx_leave(&futex_lock);
- return EAGAIN;
- }
-
- /* Following code is the same as REQUEUE */
- DPRINTF(("FUTEX_CMP_REQUEUE %d: Wakeup %d processes and requeue"
- " waiters at %8.8X\n", tid, SCARG(uap, val),
- SCARG(uap, uaddr2)));
-
- f = futex_get(SCARG(uap, uaddr));
- newf = futex_get(SCARG(uap, uaddr2));
- /*
- * Check if uaddr2 is in use.
- * If true, return EINVAL to avoid deadlock.
- *
- * glibc seems to cope with this.
- */
- if (newf->f_refcount != 1) {
- futex_put(f);
- futex_put(newf);
- mtx_leave(&futex_lock);
- return (EINVAL);
- }
-
- *retval = futex_wake(f, args_val, newf,
- (int)(unsigned long)SCARG(uap, timeout));
- futex_put(f);
- futex_put(newf);
- mtx_leave(&futex_lock);
-
- break;
-
- case LINUX_FUTEX_REQUEUE:
- DPRINTF(("FUTEX_REQUEUE %d: Wakeup %d processes and requeue "
- "waiters at %8.8X\n", tid, SCARG(uap, val),
- SCARG(uap, uaddr2)));
-
- if (args_val < 0)
- return EINVAL;
-
- mtx_enter(&futex_lock);
- f = futex_get(SCARG(uap, uaddr));
- newf = futex_get(SCARG(uap, uaddr2));
- *retval = futex_wake(f, args_val, newf,
- (int)(unsigned long)SCARG(uap, timeout));
- futex_put(f);
- futex_put(newf);
- mtx_leave(&futex_lock);
-
- break;
-
- case LINUX_FUTEX_FD:
- DPRINTF(("linux_sys_futex: unimplemented op %d\n",
- SCARG(uap, op)));
- return ENOSYS;
- case LINUX_FUTEX_WAKE_OP:
- DPRINTF(("FUTEX_WAKE_OP %d: uaddr = %p, op = %d, "
- "val = %d, uaddr2 = %p, val3 = %d\n",
- tid, SCARG(uap, uaddr), SCARG(uap, op), args_val,
- SCARG(uap, uaddr2), SCARG(uap, val3)));
-
- if (args_val < 0)
- return EINVAL;
-
- mtx_enter(&futex_lock);
- f = futex_get(SCARG(uap, uaddr));
- f2 = futex_get(SCARG(uap, uaddr2));
- mtx_leave(&futex_lock);
-
- /*
- * This function returns a positive number as results and
- * negative as errors
- */
- op_ret = futex_atomic_op(p, SCARG(uap, val3),
- SCARG(uap, uaddr2));
- if (op_ret < 0) {
- futex_put(f);
- futex_put(f2);
- return -op_ret;
- }
-
- mtx_enter(&futex_lock);
- ret = futex_wake(f, args_val, NULL, 0);
- futex_put(f);
- if (op_ret > 0) {
- op_ret = 0;
- /*
- * Linux abuses the address of the timespec parameter
- * as the number of retries
- */
- op_ret += futex_wake(f2,
- (int)(unsigned long)SCARG(uap, timeout), NULL, 0);
- ret += op_ret;
- }
- futex_put(f2);
- mtx_leave(&futex_lock);
- *retval = ret;
- break;
- default:
- DPRINTF(("linux_sys_futex: unknown op %d\n",
- SCARG(uap, op)));
- return ENOSYS;
- }
- return 0;
-}
-
-void
-futex_pool_init(void)
-{
- DPRINTF(("Inside futex_pool_init()\n"));
-
- if (!futex_pool_initialized) {
- pool_init(&futex_pool, sizeof(struct futex), 0, 0,
- PR_WAITOK | PR_DEBUGCHK, "futexpl", NULL);
- pool_init(&futex_wp_pool, sizeof(struct waiting_proc), 0, 0,
- PR_WAITOK | PR_DEBUGCHK, "futexwppl", NULL);
- futex_pool_initialized = 1;
- }
-}
-
-/*
- * Get a futex.
- * If we have an existing one, we will return that with the refcount bumped.
- * Otherwise we will allocate and hook up a new one.
- * Must be called with futex_lock held, but we may unlock it in order to
- * sleep for allocation.
- */
-struct futex *
-futex_get(void *uaddr)
-{
- struct futex *f, *newf;
-
- MUTEX_ASSERT_LOCKED(&futex_lock);
- LIST_FOREACH(f, &futex_list, f_list) {
- if (f->f_uaddr == uaddr) {
- f->f_refcount++;
- return f;
- }
- }
- mtx_leave(&futex_lock);
-
- /* Not found, create it */
- newf = pool_get(&futex_pool, PR_WAITOK|PR_ZERO);
- DPRINTF(("futex_get: get %p\n", newf));
-
- mtx_enter(&futex_lock);
- /* Did someone else create it in the meantime? */
- LIST_FOREACH(f, &futex_list, f_list) {
- if (f->f_uaddr == uaddr) {
- f->f_refcount++;
- DPRINTF(("futex_get: put %p (found %p)\n", newf, f));
- pool_put(&futex_pool, newf);
- return f;
- }
- }
- newf->f_uaddr = uaddr;
- newf->f_refcount = 1;
- TAILQ_INIT(&newf->f_waiting_proc);
- TAILQ_INIT(&newf->f_requeue_proc);
- LIST_INSERT_HEAD(&futex_list, newf, f_list);
-
- return newf;
-}
-
-/*
- * Grab a reference on a futex.
- * The futex lock must be locked.
- */
-void
-futex_ref(struct futex *f)
-{
- MUTEX_ASSERT_LOCKED(&futex_lock);
- f->f_refcount++;
-}
-
-/*
- * Release our reference on the futex.
- * must be called with the futex_lock held.
- */
-void
-futex_put(struct futex *f)
-{
- DPRINTF(("futex_put: put %p ref %d\n", f, f->f_refcount));
- MUTEX_ASSERT_LOCKED(&futex_lock);
- KASSERT(f->f_refcount > 0);
- f->f_refcount--;
- if (f->f_refcount == 0) {
- KASSERT(TAILQ_EMPTY(&f->f_waiting_proc));
- KASSERT(TAILQ_EMPTY(&f->f_requeue_proc));
- LIST_REMOVE(f, f_list);
- pool_put(&futex_pool, f);
- }
-}
-
-int
-futex_sleep(struct futex **fp, struct proc *p, int timeout,
- struct waiting_proc *wp)
-{
- struct futex *f, *newf;
- int ret;
-
- MUTEX_ASSERT_LOCKED(&futex_lock);
-
- f = *fp;
- wp->p = p;
- wp->wp_new_futex = NULL;
-
- DPRINTF(("futex_sleep: sleep on futex %p\n", f));
-
- do {
- TAILQ_INSERT_TAIL(&f->f_waiting_proc, wp, wp_list);
-
- ret = msleep(f, &futex_lock, PUSER | PCATCH, "futex_sleep",
- timeout);
-
- TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
-
- /* did futex_wake() tells us to requeue? if not, we're done! */
- newf = wp->wp_new_futex;
- if (newf == NULL)
- break;
-
- /* yes, so clean up our requeue bits... */
- DPRINTF(("futex_sleep: requeue futex %p\n", newf));
- wp->wp_new_futex = NULL;
- TAILQ_REMOVE(&newf->f_requeue_proc, wp, wp_rqlist);
-
- /*
- * ...and discard our reference to the old futex.
- * The requeuing has already given us a reference
- * to the new one.
- */
- futex_put(f);
- *fp = f = newf;
-
- /* only restart if msleep() didn't fail (timeout or signal) */
- } while (ret == 0);
-
- return ret;
-}
-
-int
-futex_wake(struct futex *f, int n, struct futex *newf, int n2)
-{
- struct waiting_proc *wp;
- int count = 0;
-
- KASSERT(newf != f);
- MUTEX_ASSERT_LOCKED(&futex_lock);
-
- /*
- * first, wake up any threads sleeping on this futex.
- * note that sleeping threads are not in the process of requeueing.
- */
- if (!TAILQ_EMPTY(&f->f_waiting_proc))
- wakeup(f); /* only call wakeup once */
- TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) {
- KASSERT(wp->wp_new_futex == NULL);
-
- DPRINTF(("futex_wake: signal futex %p ref %d\n",
- f, f->f_refcount));
- if (count <= n) {
- count++;
- } else {
- if (newf == NULL)
- break;
-
- /* matching futex_put() is called by the other thread */
- futex_ref(newf);
- wp->wp_new_futex = newf;
- TAILQ_INSERT_TAIL(&newf->f_requeue_proc, wp, wp_rqlist);
- DPRINTF(("futex_wake: requeue newf %p ref %d\n",
- newf, newf->f_refcount));
- if (count - n >= n2)
- goto out;
- }
- }
-
- /*
- * next, deal with threads that are requeuing to this futex.
- * we don't need to signal these threads, any thread on the
- * requeue list has already been signaled but hasn't had a chance
- * to run and requeue itself yet. if we would normally wake
- * a thread, just remove the requeue info. if we would normally
- * requeue a thread, change the requeue target.
- */
- while ((wp = TAILQ_FIRST(&f->f_requeue_proc)) != NULL) {
- /* XXX: talk to oga, should mtx_enter again, recursive */
- KASSERT(wp->wp_new_futex == f);
-
- DPRINTF(("futex_wake: unrequeue f %p ref %d\n",
- f, f->f_refcount));
- wp->wp_new_futex = NULL;
- TAILQ_REMOVE(&f->f_requeue_proc, wp, wp_rqlist);
- futex_put(f);
-
- if (count <= n) {
- count++;
- } else {
- if (newf == NULL) {
- break;
- }
-
- /*matching futex_put() is called by the other thread.*/
- futex_ref(newf);
- wp->wp_new_futex = newf;
- TAILQ_INSERT_TAIL(&newf->f_requeue_proc, wp, wp_rqlist);
- DPRINTF(("futex_wake: rerequeue newf %p ref %d\n",
- newf, newf->f_refcount));
- if (count - n >= n2)
- break;
- }
- }
-
-out:
- return count;
-}
-
-int
-futex_atomic_op(struct proc *p, int encoded_op, void *uaddr)
-{
- const int op = (encoded_op >> 28) & 7;
- const int cmp = (encoded_op >> 24) & 15;
- const int cmparg = (encoded_op << 20) >> 20;
- int oparg = (encoded_op << 8) >> 20;
- int error, oldval, cval;
-
- if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
- oparg = 1 << oparg;
-
- if (copyin(uaddr, &cval, sizeof(int)) != 0)
- return -EFAULT;
-
- for (;;) {
- int nval;
-
- switch (op) {
- case FUTEX_OP_SET:
- nval = oparg;
- break;
- case FUTEX_OP_ADD:
- nval = cval + oparg;
- break;
- case FUTEX_OP_OR:
- nval = cval | oparg;
- break;
- case FUTEX_OP_ANDN:
- nval = cval & ~oparg;
- break;
- case FUTEX_OP_XOR:
- nval = cval ^ oparg;
- break;
- default:
- return -ENOSYS;
- }
-
- oldval = nval;
- error = futex_atomic_ucas_int32(uaddr, cval, nval);
- if (oldval == cval || error) {
- break;
- }
- cval = oldval;
- }
-
- if (error)
- return -EFAULT;
-
- switch (cmp) {
- case FUTEX_OP_CMP_EQ:
- return (oldval == cmparg);
- case FUTEX_OP_CMP_NE:
- return (oldval != cmparg);
- case FUTEX_OP_CMP_LT:
- return (oldval < cmparg);
- case FUTEX_OP_CMP_GE:
- return (oldval >= cmparg);
- case FUTEX_OP_CMP_LE:
- return (oldval <= cmparg);
- case FUTEX_OP_CMP_GT:
- return (oldval > cmparg);
- default:
- return -ENOSYS;
- }
-}
-
-int
-linux_sys_set_robust_list(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_set_robust_list_args /* {
- syscallarg(struct linux_robust_list_head *) head;
- syscallarg(size_t) len;
- } */ *uap = v;
- struct linux_emuldata *led;
-
- if (SCARG(uap, len) != sizeof(struct linux_robust_list_head))
- return EINVAL;
- led = p->p_emuldata;
- led->led_robust_head = SCARG(uap, head);
- *retval = 0;
- return 0;
-}
-
-int
-linux_sys_get_robust_list(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_get_robust_list_args /* {
- syscallarg(int) pid;
- syscallarg(struct linux_robust_list_head **) head;
- syscallarg(size_t *) len;
- } */ *uap = v;
- struct proc *q;
- struct linux_emuldata *led;
- struct linux_robust_list_head *head;
- size_t len;
- int error = 0;
-
- if (!SCARG(uap, pid)) {
- led = p->p_emuldata;
- head = led->led_robust_head;
- } else {
- if (!SCARG(uap, pid))
- q = p;
- else if ((q = pfind(SCARG(uap, pid))) == NULL)
- return ESRCH;
- else if (p->p_p != q->p_p)
- return EPERM;
-
- led = q->p_emuldata;
- head = led->led_robust_head;
- }
-
- len = sizeof(*head);
- error = copyout(&len, SCARG(uap, len), sizeof(len));
- if (error)
- return error;
- return copyout(&head, SCARG(uap, head), sizeof(head));
-}
-
-int
-futex_itimespecfix(struct timespec *ts)
-{
- if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000)
- return EINVAL;
- if (ts->tv_sec == 0 && ts->tv_nsec != 0 && ts->tv_nsec < tick * 1000)
- ts->tv_nsec = tick * 1000;
- return 0;
-}
-
diff --git a/sys/compat/linux/linux_futex.h b/sys/compat/linux/linux_futex.h
deleted file mode 100644
index ca1d0f35ef8..00000000000
--- a/sys/compat/linux/linux_futex.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: linux_futex.h,v 1.1 2011/09/18 02:23:18 pirofti Exp $ */
-/* $NetBSD: linux_futex.h,v 1.4 2010/07/07 01:30:35 chs Exp $ */
-
-/*-
- * Copyright (c) 2005 Emmanuel Dreyfus, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Emmanuel Dreyfus
- * 4. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR 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 AUTHOR 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.
- */
-
-#ifndef _LINUX_FUTEX_H_
-#define _LINUX_FUTEX_H_
-
-#define LINUX_FUTEX_WAIT 0
-#define LINUX_FUTEX_WAKE 1
-#define LINUX_FUTEX_FD 2
-#define LINUX_FUTEX_REQUEUE 3
-#define LINUX_FUTEX_CMP_REQUEUE 4
-#define LINUX_FUTEX_WAKE_OP 5
-
-#define LINUX_FUTEX_PRIVATE_FLAG 128
-
-#define FUTEX_OP_SET 0
-#define FUTEX_OP_ADD 1
-#define FUTEX_OP_OR 2
-#define FUTEX_OP_ANDN 3
-#define FUTEX_OP_XOR 4
-
-#define FUTEX_OP_OPARG_SHIFT 8
-
-#define FUTEX_OP_CMP_EQ 0
-#define FUTEX_OP_CMP_NE 1
-#define FUTEX_OP_CMP_LT 2
-#define FUTEX_OP_CMP_LE 3
-#define FUTEX_OP_CMP_GT 4
-#define FUTEX_OP_CMP_GE 5
-
-struct linux_robust_list {
- struct linux_robust_list *next;
-};
-
-struct linux_robust_list_head {
- struct linux_robust_list list;
- unsigned long futex_offset;
- struct linux_robust_list *pending_list;
-};
-
-#define FUTEX_WAITERS 0x80000000
-#define FUTEX_OWNER_DIED 0x40000000
-#define FUTEX_TID_MASK 0x3fffffff
-
-
-#endif /* !_LINUX_FUTEX_H_ */
diff --git a/sys/compat/linux/linux_hdio.c b/sys/compat/linux/linux_hdio.c
deleted file mode 100644
index bb4c4cde98e..00000000000
--- a/sys/compat/linux/linux_hdio.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $OpenBSD: linux_hdio.c,v 1.9 2014/03/26 05:23:42 guenther Exp $ */
-/* $NetBSD: linux_hdio.c,v 1.1 2000/12/10 14:12:17 fvdl Exp $ */
-
-/*
- * Copyright (c) 2000 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/disklabel.h>
-#include <sys/dkio.h>
-
-#include <dev/ata/atareg.h>
-#include <dev/ic/wdcreg.h>
-#include <sys/ataio.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_hdio.h>
-
-#include <compat/linux/linux_syscallargs.h>
-
-int
-linux_ioctl_hdio(struct proc *p, struct linux_sys_ioctl_args *uap,
- register_t *retval)
-{
- u_long com;
- int error, error1;
- caddr_t sg;
- struct filedesc *fdp;
- struct file *fp;
- int (*ioctlf)(struct file *, u_long, caddr_t, struct proc *);
- struct ataparams *atap, ata;
- struct atareq req;
- struct disklabel label, *labp;
- struct partinfo partp;
- struct linux_hd_geometry hdg;
- struct linux_hd_big_geometry hdg_big;
-
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
- return (EBADF);
-
- FREF(fp);
- com = SCARG(uap, com);
- ioctlf = fp->f_ops->fo_ioctl;
- retval[0] = error = 0;
-
- com = SCARG(uap, com);
-
- switch (com) {
- case LINUX_HDIO_OBSOLETE_IDENTITY:
- case LINUX_HDIO_GET_IDENTITY:
- sg = stackgap_init(p);
- atap = stackgap_alloc(&sg, DEV_BSIZE);
- if (atap == NULL) {
- error = ENOMEM;
- break;
- }
-
- req.flags = ATACMD_READ;
- req.command = WDCC_IDENTIFY;
- req.databuf = (caddr_t)atap;
- req.datalen = DEV_BSIZE;
- req.timeout = 1000;
- error = ioctlf(fp, ATAIOCCOMMAND, (caddr_t)&req, p);
- if (error != 0)
- break;
- if (req.retsts != ATACMD_OK) {
- error = EIO;
- break;
- }
- error = copyin(atap, &ata, sizeof ata);
- if (error != 0)
- break;
- /*
- * 142 is the size of the old structure used by Linux,
- * which doesn't seem to be defined anywhere anymore.
- */
- error = copyout(&ata, SCARG(uap, data),
- com == LINUX_HDIO_GET_IDENTITY ? sizeof ata : 142);
- break;
- case LINUX_HDIO_GETGEO:
- error = linux_machdepioctl(p, uap, retval);
- if (error == 0)
- break;
- error = ioctlf(fp, DIOCGDINFO, (caddr_t)&label, p);
- error1 = ioctlf(fp, DIOCGPART, (caddr_t)&partp, p);
- if (error != 0 && error1 != 0) {
- error = error1;
- break;
- }
- labp = error != 0 ? &label : partp.disklab;
- hdg.start = error1 != 0 ? DL_GETPOFFSET(partp.part) & 0x7fffffff: 0;
- hdg.heads = labp->d_ntracks;
- hdg.cylinders = labp->d_ncylinders;
- hdg.sectors = labp->d_nsectors;
- error = copyout(&hdg, SCARG(uap, data), sizeof hdg);
- break;
- case LINUX_HDIO_GETGEO_BIG:
- error = linux_machdepioctl(p, uap, retval);
- if (error == 0)
- break;
- case LINUX_HDIO_GETGEO_BIG_RAW:
- error = ioctlf(fp, DIOCGDINFO, (caddr_t)&label, p);
- error1 = ioctlf(fp, DIOCGPART, (caddr_t)&partp, p);
- if (error != 0 && error1 != 0) {
- error = error1;
- break;
- }
- labp = error != 0 ? &label : partp.disklab;
- hdg_big.start = error1 != 0 ? DL_GETPOFFSET(partp.part) & 0x7fffffff : 0;
- hdg_big.heads = labp->d_ntracks;
- hdg_big.cylinders = labp->d_ncylinders;
- hdg_big.sectors = labp->d_nsectors;
- error = copyout(&hdg_big, SCARG(uap, data), sizeof hdg_big);
- break;
- case LINUX_HDIO_GET_UNMASKINTR:
- case LINUX_HDIO_GET_MULTCOUNT:
- case LINUX_HDIO_GET_KEEPSETTINGS:
- case LINUX_HDIO_GET_32BIT:
- case LINUX_HDIO_GET_NOWERR:
- case LINUX_HDIO_GET_DMA:
- case LINUX_HDIO_GET_NICE:
- case LINUX_HDIO_DRIVE_RESET:
- case LINUX_HDIO_TRISTATE_HWIF:
- case LINUX_HDIO_DRIVE_TASK:
- case LINUX_HDIO_DRIVE_CMD:
- case LINUX_HDIO_SET_MULTCOUNT:
- case LINUX_HDIO_SET_UNMASKINTR:
- case LINUX_HDIO_SET_KEEPSETTINGS:
- case LINUX_HDIO_SET_32BIT:
- case LINUX_HDIO_SET_NOWERR:
- case LINUX_HDIO_SET_DMA:
- case LINUX_HDIO_SET_PIO_MODE:
- case LINUX_HDIO_SCAN_HWIF:
- case LINUX_HDIO_SET_NICE:
- case LINUX_HDIO_UNREGISTER_HWIF:
- error = EINVAL;
- }
-
- FRELE(fp, p);
- return error;
-}
diff --git a/sys/compat/linux/linux_hdio.h b/sys/compat/linux/linux_hdio.h
deleted file mode 100644
index dc6cac20041..00000000000
--- a/sys/compat/linux/linux_hdio.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $OpenBSD: linux_hdio.h,v 1.2 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_hdio.h,v 1.1 2000/12/10 14:12:17 fvdl Exp $ */
-
-/*
- * Copyright (c) 2000 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Frank van der Linden for Wasabi Systems, 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
-
-#ifndef _LINUX_HDIO_H_
-#define _LINUX_HDIO_H_
-
-/*
- * Linux 'hd' (mostly really IDE disk) ioctl calls.
- */
-
-#define LINUX_HDIO_GETGEO 0x0301
-#define LINUX_HDIO_GETGEO_BIG 0x0330
-#define LINUX_HDIO_GETGEO_BIG_RAW 0x0331
-#define LINUX_HDIO_GET_UNMASKINTR 0x0302
-#define LINUX_HDIO_GET_MULTCOUNT 0x0304
-#define LINUX_HDIO_OBSOLETE_IDENTITY 0x0307
-#define LINUX_HDIO_GET_KEEPSETTINGS 0x0308
-#define LINUX_HDIO_GET_32BIT 0x0309
-#define LINUX_HDIO_GET_NOWERR 0x030a
-#define LINUX_HDIO_GET_DMA 0x030b
-#define LINUX_HDIO_GET_NICE 0x030c
-#define LINUX_HDIO_GET_IDENTITY 0x030d
-
-#define LINUX_HDIO_DRIVE_RESET 0x031c
-#define LINUX_HDIO_TRISTATE_HWIF 0x031d
-#define LINUX_HDIO_DRIVE_TASK 0x031e
-#define LINUX_HDIO_DRIVE_CMD 0x031f
-
-#define LINUX_HDIO_SET_MULTCOUNT 0x0321
-#define LINUX_HDIO_SET_UNMASKINTR 0x0322
-#define LINUX_HDIO_SET_KEEPSETTINGS 0x0323
-#define LINUX_HDIO_SET_32BIT 0x0324
-#define LINUX_HDIO_SET_NOWERR 0x0325
-#define LINUX_HDIO_SET_DMA 0x0326
-#define LINUX_HDIO_SET_PIO_MODE 0x0327
-#define LINUX_HDIO_SCAN_HWIF 0x0328
-#define LINUX_HDIO_SET_NICE 0x0329
-#define LINUX_HDIO_UNREGISTER_HWIF 0x032a
-
-struct linux_hd_geometry {
- u_char heads;
- u_char sectors;
- u_short cylinders;
- u_long start;
-};
-
-struct linux_hd_big_geometry {
- u_char heads;
- u_char sectors;
- u_int cylinders;
- u_long start;
-};
-
-#endif /* _LINUX_HDIO_H_ */
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
deleted file mode 100644
index e856668b41e..00000000000
--- a/sys/compat/linux/linux_ioctl.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: linux_ioctl.c,v 1.12 2015/04/19 08:37:32 ratchov Exp $ */
-/* $NetBSD: linux_ioctl.c,v 1.14 1996/04/05 00:01:28 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-
-#include <sys/socket.h>
-#include <net/if.h>
-#include <sys/sockio.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_ioctl.h>
-
-/*
- * Most ioctl command are just converted to their OpenBSD values,
- * and passed on. The ones that take structure pointers and (flag)
- * values need some massaging. This is done the usual way by
- * allocating stackgap memory, letting the actual ioctl call do its
- * work their and converting back the data afterwards.
- */
-int
-linux_sys_ioctl(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- register struct linux_sys_ioctl_args /* {
- syscallarg(int) fd;
- syscallarg(u_long) com;
- syscallarg(caddr_t) data;
- } */ *uap = v;
-
- switch (LINUX_IOCGROUP(SCARG(uap, com))) {
- case 't':
- case 'f':
- case 'T': /* XXX MIDI sequencer uses 'T' as well */
- return linux_ioctl_termios(p, uap, retval);
- case 'S':
- return linux_ioctl_cdrom(p, uap, retval);
- case 'r': /* VFAT ioctls; not yet support */
- return (EINVAL);
- case 0x89:
- return linux_ioctl_socket(p, uap, retval);
- case 0x03:
- return linux_ioctl_hdio(p, uap, retval);
- case 0x02:
- return linux_ioctl_fdio(p, uap, retval);
- case 0x12:
- return linux_ioctl_blkio(p, uap, retval);
- default:
- return linux_machdepioctl(p, uap, retval);
- }
-}
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
deleted file mode 100644
index e70a69205c1..00000000000
--- a/sys/compat/linux/linux_ioctl.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $OpenBSD: linux_ioctl.h,v 1.8 2015/04/19 08:37:32 ratchov Exp $ */
-/* $NetBSD: linux_ioctl.h,v 1.4 1996/04/05 00:01:36 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#define _LINUX_IOC_NRBITS 8
-#define _LINUX_IOC_TYPEBITS 8
-#define _LINUX_IOC_SIZEBITS 14
-#define _LINUX_IOC_DIRBITS 2
-
-#define _LINUX_IOC_NRSHIFT 0
-
-#define _LINUX_IOC_NONE 0U
-#define _LINUX_IOC_WRITE 1U
-#define _LINUX_IOC_READ 2U
-
-#define _LINUX_IOC_NRMASK ((1 << _LINUX_IOC_NRBITS) - 1)
-#define _LINUX_IOC_TYPEMASK ((1 << _LINUX_IOC_TYPEBITS) - 1)
-#define _LINUX_IOC_SIZEMASK ((1 << _LINUX_IOC_SIZEBITS) - 1)
-#define _LINUX_IOC_DIRMASK ((1 << _LINUX_IOC_DIRBITS) - 1)
-
-#define _LINUX_IOC_TYPESHIFT (_LINUX_IOC_NRSHIFT + _LINUX_IOC_NRBITS)
-#define _LINUX_IOC_SIZESHIFT (_LINUX_IOC_TYPESHIFT + _LINUX_IOC_TYPEBITS)
-#define _LINUX_IOC_DIRSHIFT (_LINUX_IOC_SIZESHIFT + _LINUX_IOC_SIZEBITS)
-
-#define _LINUX_IOC(dir,type,nr,size) \
- (((nr) << _LINUX_IOC_NRSHIFT) | \
- ((type) << _LINUX_IOC_TYPESHIFT) | \
- ((size) << _LINUX_IOC_SIZESHIFT) | \
- ((dir) << _LINUX_IOC_DIRSHIFT))
-
-#define _LINUX_IO(type,nr) \
- _LINUX_IOC(_LINUX_IOC_NONE,(type),(nr),0)
-#define _LINUX_IOR(type,nr,size) \
- _LINUX_IOC(_LINUX_IOC_READ,(type),(nr),sizeof(size))
-#define _LINUX_IOW(type,nr,size) \
- _LINUX_IOC(_LINUX_IOC_WRITE,(type),(nr),sizeof(size))
-#define _LINUX_IOWR(type,nr,size) \
- _LINUX_IOC(_LINUX_IOC_READ|_LINUX_IOC_WRITE,(type),(nr),sizeof(size))
-
-#define _LINUX_IOC_DIR(nr) \
- (((nr) >> _LINUX_IOC_DIRSHIFT) & _LINUX_IOC_DIRMASK)
-#define _LINUX_IOC_TYPE(nr) \
- (((nr) >> _LINUX_IOC_TYPESHIFT) & _LINUX_IOC_TYPEMASK)
-#define _LINUX_IOC_NR(nr) \
- (((nr) >> _LINUX_IOC_NRSHIFT) & _LINUX_IOC_NRMASK)
-#define _LINUX_IOC_SIZE(nr) \
- (((nr) >> _LINUX_IOC_SIZESHIFT) & _LINUX_IOC_SIZEMASK)
-
-#define LINUX_IOCGROUP(x) _LINUX_IOC_TYPE(x)
-
-struct linux_sys_ioctl_args;
-int linux_machdepioctl(struct proc *, void *, register_t *);
-int linux_ioctl_termios(struct proc *, void *, register_t *);
-int linux_ioctl_cdrom(struct proc *, void *, register_t *);
-int linux_ioctl_socket(struct proc *, void *, register_t *);
-int linux_ioctl_hdio(struct proc *, struct linux_sys_ioctl_args *,
- register_t *);
-int linux_ioctl_fdio(struct proc *, struct linux_sys_ioctl_args *,
- register_t *);
-int linux_ioctl_blkio(struct proc *, struct linux_sys_ioctl_args *,
- register_t *);
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
deleted file mode 100644
index 35f153e9bd5..00000000000
--- a/sys/compat/linux/linux_ipc.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/* $OpenBSD: linux_ipc.c,v 1.18 2014/09/14 14:17:23 jsg Exp $ */
-/* $NetBSD: linux_ipc.c,v 1.10 1996/04/05 00:01:44 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#include <sys/msg.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <sys/malloc.h>
-#include <sys/mman.h>
-#include <sys/systm.h>
-#include <sys/stat.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_ipc.h>
-#include <compat/linux/linux_msg.h>
-#include <compat/linux/linux_shm.h>
-#include <compat/linux/linux_sem.h>
-#include <compat/linux/linux_ipccall.h>
-
-/*
- * Stuff to deal with the SysV ipc/shm/semaphore interface in Linux.
- * The main difference is, that Linux handles it all via one
- * system call, which has the usual maximum amount of 5 arguments.
- * This results in a kludge for calls that take 6 of them.
- *
- * The SYSVXXXX options have to be enabled to get the appropriate
- * functions to work.
- */
-
-#ifdef SYSVSEM
-int linux_semop(struct proc *, void *, register_t *);
-int linux_semget(struct proc *, void *, register_t *);
-int linux_semctl(struct proc *, void *, register_t *);
-int bsd_to_linux_semid_ds(struct semid_ds *, struct linux_semid_ds *);
-void linux_to_bsd_semid_ds(struct linux_semid_ds *, struct semid_ds *);
-#endif
-
-#ifdef SYSVMSG
-int linux_msgsnd(struct proc *, void *, register_t *);
-int linux_msgrcv(struct proc *, void *, register_t *);
-int linux_msgget(struct proc *, void *, register_t *);
-int linux_msgctl(struct proc *, void *, register_t *);
-void linux_to_bsd_msqid_ds(struct linux_msqid_ds *, struct msqid_ds *);
-int bsd_to_linux_msqid_ds(struct msqid_ds *, struct linux_msqid_ds *);
-#endif
-
-#ifdef SYSVSHM
-int linux_shmat(struct proc *, void *, register_t *);
-int linux_shmdt(struct proc *, void *, register_t *);
-int linux_shmget(struct proc *, void *, register_t *);
-int linux_shmctl(struct proc *, void *, register_t *);
-void linux_to_bsd_shmid_ds(struct linux_shmid_ds *, struct shmid_ds *);
-int bsd_to_linux_shmid_ds(struct shmid_ds *, struct linux_shmid_ds *);
-#endif
-
-#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
-void linux_to_bsd_ipc_perm(struct linux_ipc_perm *, struct ipc_perm *);
-void bsd_to_linux_ipc_perm(struct ipc_perm *, struct linux_ipc_perm *);
-#endif
-
-int
-linux_sys_ipc(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
-
- switch (SCARG(uap, what)) {
-#ifdef SYSVSEM
- case LINUX_SYS_semop:
- return linux_semop(p, uap, retval);
- case LINUX_SYS_semget:
- return linux_semget(p, uap, retval);
- case LINUX_SYS_semctl:
- return linux_semctl(p, uap, retval);
-#endif
-#ifdef SYSVMSG
- case LINUX_SYS_msgsnd:
- return linux_msgsnd(p, uap, retval);
- case LINUX_SYS_msgrcv:
- return linux_msgrcv(p, uap, retval);
- case LINUX_SYS_msgget:
- return linux_msgget(p, uap, retval);
- case LINUX_SYS_msgctl:
- return linux_msgctl(p, uap, retval);
-#endif
-#ifdef SYSVSHM
- case LINUX_SYS_shmat:
- return linux_shmat(p, uap, retval);
- case LINUX_SYS_shmdt:
- return linux_shmdt(p, uap, retval);
- case LINUX_SYS_shmget:
- return linux_shmget(p, uap, retval);
- case LINUX_SYS_shmctl:
- return linux_shmctl(p, uap, retval);
-#endif
- default:
- return ENOSYS;
- }
-}
-
-#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
-/*
- * Convert between Linux and OpenBSD ipc_perm structures. Only the
- * order of the fields is different.
- */
-void
-linux_to_bsd_ipc_perm(lpp, bpp)
- struct linux_ipc_perm *lpp;
- struct ipc_perm *bpp;
-{
-
- bpp->key = lpp->l_key;
- bpp->uid = lpp->l_uid;
- bpp->gid = lpp->l_gid;
- bpp->cuid = lpp->l_cuid;
- bpp->cgid = lpp->l_cgid;
- bpp->mode = lpp->l_mode;
- bpp->seq = lpp->l_seq;
-}
-
-void
-bsd_to_linux_ipc_perm(bpp, lpp)
- struct ipc_perm *bpp;
- struct linux_ipc_perm *lpp;
-{
-
- lpp->l_key = bpp->key;
- lpp->l_uid = bpp->uid;
- lpp->l_gid = bpp->gid;
- lpp->l_cuid = bpp->cuid;
- lpp->l_cgid = bpp->cgid;
- lpp->l_mode = bpp->mode;
- lpp->l_seq = bpp->seq;
-}
-#endif
-
-#ifdef SYSVSEM
-/*
- * Semaphore operations. Most constants and structures are the same on
- * both systems. Only semctl() needs some extra work.
- */
-
-/*
- * Convert between Linux and OpenBSD semid_ds structures.
- */
-int
-bsd_to_linux_semid_ds(bs, ls)
- struct semid_ds *bs;
- struct linux_semid_ds *ls;
-{
-
- bsd_to_linux_ipc_perm(&bs->sem_perm, &ls->l_sem_perm);
- if (bs->sem_otime > LINUX_TIME_MAX)
- return EOVERFLOW;
- ls->l_sem_otime = (linux_time_t)bs->sem_otime;
- if (bs->sem_ctime > LINUX_TIME_MAX)
- return EOVERFLOW;
- ls->l_sem_ctime = (linux_time_t)bs->sem_ctime;
- ls->l_sem_nsems = bs->sem_nsems;
- ls->l_sem_base = bs->sem_base;
-
- return 0;
-}
-
-void
-linux_to_bsd_semid_ds(ls, bs)
- struct linux_semid_ds *ls;
- struct semid_ds *bs;
-{
-
- linux_to_bsd_ipc_perm(&ls->l_sem_perm, &bs->sem_perm);
- bs->sem_otime = ls->l_sem_otime;
- bs->sem_ctime = ls->l_sem_ctime;
- bs->sem_nsems = ls->l_sem_nsems;
- bs->sem_base = ls->l_sem_base;
-}
-
-int
-linux_semop(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_semop_args bsa;
-
- SCARG(&bsa, semid) = SCARG(uap, a1);
- SCARG(&bsa, sops) = (struct sembuf *)SCARG(uap, ptr);
- SCARG(&bsa, nsops) = SCARG(uap, a2);
-
- return sys_semop(p, &bsa, retval);
-}
-
-int
-linux_semget(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_semget_args bsa;
-
- SCARG(&bsa, key) = (key_t)SCARG(uap, a1);
- SCARG(&bsa, nsems) = SCARG(uap, a2);
- SCARG(&bsa, semflg) = SCARG(uap, a3);
-
- return sys_semget(p, &bsa, retval);
-}
-
-/*
- * Most of this can be handled by directly passing the arguments on,
- * buf IPC_* require a lot of copy{in,out} because of the extra indirection
- * (we are passed a pointer to a union cointaining a pointer to a semid_ds
- * structure.
- */
-int
-linux_semctl(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- caddr_t sg, unptr, dsp, ldsp;
- int error, cmd;
- struct sys___semctl_args bsa;
- struct linux_semid_ds lm;
- struct semid_ds bm;
-
- SCARG(&bsa, semid) = SCARG(uap, a1);
- SCARG(&bsa, semnum) = SCARG(uap, a2);
- SCARG(&bsa, cmd) = SCARG(uap, a3);
- SCARG(&bsa, arg) = (union semun *)SCARG(uap, ptr);
- switch(SCARG(uap, a3)) {
- case LINUX_GETVAL:
- cmd = GETVAL;
- break;
- case LINUX_GETPID:
- cmd = GETPID;
- break;
- case LINUX_GETNCNT:
- cmd = GETNCNT;
- break;
- case LINUX_GETZCNT:
- cmd = GETZCNT;
- break;
- case LINUX_SETVAL:
- cmd = SETVAL;
- break;
- case LINUX_IPC_RMID:
- cmd = IPC_RMID;
- break;
- case LINUX_IPC_SET:
- if ((error = copyin(SCARG(uap, ptr), &ldsp, sizeof ldsp)))
- return error;
- if ((error = copyin(ldsp, (caddr_t)&lm, sizeof lm)))
- return error;
- linux_to_bsd_semid_ds(&lm, &bm);
- sg = stackgap_init(p);
- unptr = stackgap_alloc(&sg, sizeof (union semun));
- dsp = stackgap_alloc(&sg, sizeof (struct semid_ds));
- if ((error = copyout((caddr_t)&bm, dsp, sizeof bm)))
- return error;
- if ((error = copyout((caddr_t)&dsp, unptr, sizeof dsp)))
- return error;
- SCARG(&bsa, arg) = (union semun *)unptr;
- return sys___semctl(p, &bsa, retval);
- case LINUX_IPC_STAT:
- sg = stackgap_init(p);
- unptr = stackgap_alloc(&sg, sizeof (union semun));
- dsp = stackgap_alloc(&sg, sizeof (struct semid_ds));
- if ((error = copyout((caddr_t)&dsp, unptr, sizeof dsp)))
- return error;
- SCARG(&bsa, arg) = (union semun *)unptr;
- if ((error = sys___semctl(p, &bsa, retval)))
- return error;
- if ((error = copyin(dsp, (caddr_t)&bm, sizeof bm)))
- return error;
- if ((error = bsd_to_linux_semid_ds(&bm, &lm)))
- return error;
- if ((error = copyin(SCARG(uap, ptr), &ldsp, sizeof ldsp)))
- return error;
- return copyout((caddr_t)&lm, ldsp, sizeof lm);
- default:
- return EINVAL;
- }
- SCARG(&bsa, cmd) = cmd;
-
- return sys___semctl(p, &bsa, retval);
-}
-#endif /* SYSVSEM */
-
-#ifdef SYSVMSG
-
-void
-linux_to_bsd_msqid_ds(lmp, bmp)
- struct linux_msqid_ds *lmp;
- struct msqid_ds *bmp;
-{
-
- linux_to_bsd_ipc_perm(&lmp->l_msg_perm, &bmp->msg_perm);
- bmp->msg_first = lmp->l_msg_first;
- bmp->msg_last = lmp->l_msg_last;
- bmp->msg_cbytes = lmp->l_msg_cbytes;
- bmp->msg_qnum = lmp->l_msg_qnum;
- bmp->msg_qbytes = lmp->l_msg_qbytes;
- bmp->msg_lspid = lmp->l_msg_lspid;
- bmp->msg_lrpid = lmp->l_msg_lrpid;
- bmp->msg_stime = lmp->l_msg_stime;
- bmp->msg_rtime = lmp->l_msg_rtime;
- bmp->msg_ctime = lmp->l_msg_ctime;
-}
-
-int
-bsd_to_linux_msqid_ds(bmp, lmp)
- struct msqid_ds *bmp;
- struct linux_msqid_ds *lmp;
-{
-
- bsd_to_linux_ipc_perm(&bmp->msg_perm, &lmp->l_msg_perm);
- lmp->l_msg_first = bmp->msg_first;
- lmp->l_msg_last = bmp->msg_last;
- lmp->l_msg_cbytes = bmp->msg_cbytes;
- lmp->l_msg_qnum = bmp->msg_qnum;
- lmp->l_msg_qbytes = bmp->msg_qbytes;
- lmp->l_msg_lspid = bmp->msg_lspid;
- lmp->l_msg_lrpid = bmp->msg_lrpid;
-
- if (bmp->msg_stime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lmp->l_msg_stime = (linux_time_t)bmp->msg_stime;
- if (bmp->msg_rtime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lmp->l_msg_rtime = (linux_time_t)bmp->msg_rtime;
- if (bmp->msg_ctime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lmp->l_msg_ctime = (linux_time_t)bmp->msg_ctime;
-
- return 0;
-}
-
-int
-linux_msgsnd(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_msgsnd_args bma;
-
- SCARG(&bma, msqid) = SCARG(uap, a1);
- SCARG(&bma, msgp) = SCARG(uap, ptr);
- SCARG(&bma, msgsz) = SCARG(uap, a2);
- SCARG(&bma, msgflg) = SCARG(uap, a3);
-
- return sys_msgsnd(p, &bma, retval);
-}
-
-int
-linux_msgrcv(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_msgrcv_args bma;
- struct linux_msgrcv_msgarg kluge;
- int error;
-
- if ((error = copyin(SCARG(uap, ptr), &kluge, sizeof kluge)))
- return error;
-
- SCARG(&bma, msqid) = SCARG(uap, a1);
- SCARG(&bma, msgp) = kluge.msg;
- SCARG(&bma, msgsz) = SCARG(uap, a2);
- SCARG(&bma, msgtyp) = kluge.type;
- SCARG(&bma, msgflg) = SCARG(uap, a3);
-
- return sys_msgrcv(p, &bma, retval);
-}
-
-int
-linux_msgget(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_msgget_args bma;
-
- SCARG(&bma, key) = (key_t)SCARG(uap, a1);
- SCARG(&bma, msgflg) = SCARG(uap, a2);
-
- return sys_msgget(p, &bma, retval);
-}
-
-int
-linux_msgctl(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_msgctl_args bma;
- caddr_t umsgptr, sg;
- struct linux_msqid_ds lm;
- struct msqid_ds bm;
- int error;
-
- SCARG(&bma, msqid) = SCARG(uap, a1);
- SCARG(&bma, cmd) = SCARG(uap, a2);
- switch (SCARG(uap, a2)) {
- case LINUX_IPC_RMID:
- return sys_msgctl(p, &bma, retval);
- case LINUX_IPC_SET:
- if ((error = copyin(SCARG(uap, ptr), (caddr_t)&lm, sizeof lm)))
- return error;
- linux_to_bsd_msqid_ds(&lm, &bm);
- sg = stackgap_init(p);
- umsgptr = stackgap_alloc(&sg, sizeof bm);
- if ((error = copyout((caddr_t)&bm, umsgptr, sizeof bm)))
- return error;
- SCARG(&bma, buf) = (struct msqid_ds *)umsgptr;
- return sys_msgctl(p, &bma, retval);
- case LINUX_IPC_STAT:
- sg = stackgap_init(p);
- umsgptr = stackgap_alloc(&sg, sizeof (struct msqid_ds));
- SCARG(&bma, buf) = (struct msqid_ds *)umsgptr;
- if ((error = sys_msgctl(p, &bma, retval)))
- return error;
- if ((error = copyin(umsgptr, (caddr_t)&bm, sizeof bm)))
- return error;
- if ((error = bsd_to_linux_msqid_ds(&bm, &lm)))
- return error;
- return copyout((caddr_t)&lm, SCARG(uap, ptr), sizeof lm);
- }
- return EINVAL;
-}
-#endif /* SYSVMSG */
-
-#ifdef SYSVSHM
-/*
- * shmat(2). Very straightforward, except that Linux passes a pointer
- * in which the return value is to be passed. This is subsequently
- * handled by libc, apparently.
- */
-int
-linux_shmat(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_shmat_args bsa;
- int error;
-
- SCARG(&bsa, shmid) = SCARG(uap, a1);
- SCARG(&bsa, shmaddr) = SCARG(uap, ptr);
- SCARG(&bsa, shmflg) = SCARG(uap, a2);
-
- if ((error = sys_shmat(p, &bsa, retval)))
- return error;
-
- if ((error = copyout(&retval[0], (caddr_t) SCARG(uap, a3),
- sizeof retval[0])))
- return error;
-
- retval[0] = 0;
- return 0;
-}
-
-/*
- * shmdt(): this could have been mapped directly, if it wasn't for
- * the extra indirection by the linux_ipc system call.
- */
-int
-linux_shmdt(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_shmdt_args bsa;
-
- SCARG(&bsa, shmaddr) = SCARG(uap, ptr);
-
- return sys_shmdt(p, &bsa, retval);
-}
-
-/*
- * Same story as shmdt.
- */
-int
-linux_shmget(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- struct sys_shmget_args bsa;
-
- SCARG(&bsa, key) = SCARG(uap, a1);
- SCARG(&bsa, size) = SCARG(uap, a2);
- SCARG(&bsa, shmflg) = SCARG(uap, a3);
-
- return sys_shmget(p, &bsa, retval);
-}
-
-/*
- * Convert between Linux and OpenBSD shmid_ds structures.
- * The order of the fields is once again the difference, and
- * we also need a place to store the internal data pointer
- * in, which is unfortunately stored in this structure.
- *
- * We abuse a Linux internal field for that.
- */
-void
-linux_to_bsd_shmid_ds(lsp, bsp)
- struct linux_shmid_ds *lsp;
- struct shmid_ds *bsp;
-{
-
- linux_to_bsd_ipc_perm(&lsp->l_shm_perm, &bsp->shm_perm);
- bsp->shm_segsz = lsp->l_shm_segsz;
- bsp->shm_lpid = lsp->l_shm_lpid;
- bsp->shm_cpid = lsp->l_shm_cpid;
- bsp->shm_nattch = lsp->l_shm_nattch;
- bsp->shm_atime = lsp->l_shm_atime;
- bsp->shm_dtime = lsp->l_shm_dtime;
- bsp->shm_ctime = lsp->l_shm_ctime;
- bsp->shm_internal = lsp->l_private2; /* XXX Oh well. */
-}
-
-int
-bsd_to_linux_shmid_ds(bsp, lsp)
- struct shmid_ds *bsp;
- struct linux_shmid_ds *lsp;
-{
-
- bsd_to_linux_ipc_perm(&bsp->shm_perm, &lsp->l_shm_perm);
- lsp->l_shm_segsz = bsp->shm_segsz;
- lsp->l_shm_lpid = bsp->shm_lpid;
- lsp->l_shm_cpid = bsp->shm_cpid;
- lsp->l_shm_nattch = bsp->shm_nattch;
- if (bsp->shm_atime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lsp->l_shm_atime = (linux_time_t)bsp->shm_atime;
- if (bsp->shm_dtime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lsp->l_shm_dtime = (linux_time_t)bsp->shm_dtime;
- if (bsp->shm_ctime > LINUX_TIME_MAX)
- return EOVERFLOW;
- lsp->l_shm_ctime = (linux_time_t)bsp->shm_ctime;
- lsp->l_private2 = bsp->shm_internal; /* XXX */
-
- return 0;
-}
-
-/*
- * shmctl. Not implemented (for now): IPC_INFO, SHM_INFO, SHM_STAT
- * SHM_LOCK and SHM_UNLOCK are passed on, but currently not implemented
- * by OpenBSD itself.
- *
- * The usual structure conversion and massaging is done.
- */
-int
-linux_shmctl(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ipc_args /* {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
- } */ *uap = v;
- int error;
- caddr_t sg;
- struct sys_shmctl_args bsa;
- struct shmid_ds *bsp, bs;
- struct linux_shmid_ds lseg;
-
- switch (SCARG(uap, a2)) {
- case LINUX_IPC_STAT:
- sg = stackgap_init(p);
- bsp = stackgap_alloc(&sg, sizeof (struct shmid_ds));
- SCARG(&bsa, shmid) = SCARG(uap, a1);
- SCARG(&bsa, cmd) = IPC_STAT;
- SCARG(&bsa, buf) = bsp;
- if ((error = sys_shmctl(p, &bsa, retval)))
- return error;
- if ((error = copyin((caddr_t) bsp, (caddr_t) &bs, sizeof bs)))
- return error;
- if ((error = bsd_to_linux_shmid_ds(&bs, &lseg)))
- return error;
- return copyout((caddr_t) &lseg, SCARG(uap, ptr), sizeof lseg);
- case LINUX_IPC_SET:
- if ((error = copyin(SCARG(uap, ptr), (caddr_t) &lseg,
- sizeof lseg)))
- return error;
- linux_to_bsd_shmid_ds(&lseg, &bs);
- sg = stackgap_init(p);
- bsp = stackgap_alloc(&sg, sizeof (struct shmid_ds));
- if ((error = copyout((caddr_t) &bs, (caddr_t) bsp, sizeof bs)))
- return error;
- SCARG(&bsa, shmid) = SCARG(uap, a1);
- SCARG(&bsa, cmd) = IPC_SET;
- SCARG(&bsa, buf) = bsp;
- return sys_shmctl(p, &bsa, retval);
- case LINUX_IPC_RMID:
- case LINUX_SHM_LOCK:
- case LINUX_SHM_UNLOCK:
- SCARG(&bsa, shmid) = SCARG(uap, a1);
- switch (SCARG(uap, a2)) {
- case LINUX_IPC_RMID:
- SCARG(&bsa, cmd) = IPC_RMID;
- break;
- case LINUX_SHM_LOCK:
- SCARG(&bsa, cmd) = SHM_LOCK;
- break;
- case LINUX_SHM_UNLOCK:
- SCARG(&bsa, cmd) = SHM_UNLOCK;
- break;
- }
- SCARG(&bsa, buf) = NULL;
- return sys_shmctl(p, &bsa, retval);
- case LINUX_IPC_INFO:
- case LINUX_SHM_STAT:
- case LINUX_SHM_INFO:
- default:
- return EINVAL;
- }
-}
-#endif /* SYSVSHM */
-
-int
-linux_sys_pipe2(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_pipe2_args *uap = v;
- struct sys_pipe_args pargs;
-
- /*
- * We don't really support pipe2, but glibc falls back to pipe
- * if we signal that.
- */
- if (SCARG(uap, flags) != 0)
- return ENOSYS;
-
- /* If no flag is set then this is a plain pipe call. */
- SCARG(&pargs, fdp) = SCARG(uap, fdp);
- return sys_pipe(p, &pargs, retval);
-}
diff --git a/sys/compat/linux/linux_ipc.h b/sys/compat/linux/linux_ipc.h
deleted file mode 100644
index cfd7ff781d7..00000000000
--- a/sys/compat/linux/linux_ipc.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: linux_ipc.h,v 1.4 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_ipc.h,v 1.1 1995/02/28 23:25:47 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_IPC_H_
-#define _LINUX_IPC_H_
-
-/*
- * Structs and values to handle the SYSV ipc/shm/msg calls implemented
- * in Linux. Most values match the OpenBSD values (as they are both derived
- * from SysV values). Values that are the same may not be defined here.
- */
-
-typedef int linux_key_t;
-
-/*
- * The only thing different about the Linux ipc_perm structure is the
- * order of the fields.
- */
-struct linux_ipc_perm {
- linux_key_t l_key;
- ushort l_uid;
- ushort l_gid;
- ushort l_cuid;
- ushort l_cgid;
- ushort l_mode;
- ushort l_seq;
-};
-
-#define LINUX_IPC_RMID 0
-#define LINUX_IPC_SET 1
-#define LINUX_IPC_STAT 2
-#define LINUX_IPC_INFO 3
-
-#endif /* _LINUX_IPC_H_ */
diff --git a/sys/compat/linux/linux_ipccall.h b/sys/compat/linux/linux_ipccall.h
deleted file mode 100644
index dc55fbe4682..00000000000
--- a/sys/compat/linux/linux_ipccall.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: linux_ipccall.h,v 1.3 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_ipccall.h,v 1.2 1995/08/15 21:14:33 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_IPC_CALL_H_
-#define _LINUX_IPC_CALL_H_
-
-/*
- * Defines for the numbers passes as the first argument to the
- * linux_ipc() call, and based on which the actual system calls
- * are made.
- */
-#define LINUX_SYS_semop 1
-#define LINUX_SYS_semget 2
-#define LINUX_SYS_semctl 3
-#define LINUX_SYS_msgsnd 11
-#define LINUX_SYS_msgrcv 12
-#define LINUX_SYS_msgget 13
-#define LINUX_SYS_msgctl 14
-#define LINUX_SYS_shmat 21
-#define LINUX_SYS_shmdt 22
-#define LINUX_SYS_shmget 23
-#define LINUX_SYS_shmctl 24
-
-#endif /* _LINUX_IPC_CALL_H_ */
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
deleted file mode 100644
index a55274f1245..00000000000
--- a/sys/compat/linux/linux_misc.c
+++ /dev/null
@@ -1,1720 +0,0 @@
-/* $OpenBSD: linux_misc.c,v 1.95 2015/09/13 17:08:03 guenther Exp $ */
-/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
-
-/*-
- * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Frank van der Linden and Eric Haszlakiewicz; by Jason R. Thorpe
- * of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Linux compatibility module. Try to deal with various Linux system calls.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/dirent.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/swap.h>
-#include <sys/resourcevar.h>
-#include <sys/signal.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-#include <sys/vnode.h>
-#include <sys/uio.h>
-#include <sys/wait.h>
-#include <sys/utsname.h>
-#include <sys/unistd.h>
-
-#include <sys/syscallargs.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_time.h>
-#include <compat/linux/linux_fcntl.h>
-#include <compat/linux/linux_misc.h>
-#include <compat/linux/linux_mmap.h>
-#include <compat/linux/linux_sched.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_dirent.h>
-#include <compat/linux/linux_emuldata.h>
-
-#include <compat/common/compat_dir.h>
-
-/* linux_misc.c */
-void bsd_to_linux_statfs(const struct statfs *, struct linux_statfs *);
-void bsd_to_linux_statfs64(const struct statfs *, struct linux_statfs64 *);
-int linux_select1(struct proc *, register_t *, int, fd_set *,
- fd_set *, fd_set *, struct linux_timeval *);
-int getdents_common(struct proc *, void *, register_t *, int);
-void linux_to_bsd_mmap_args(struct sys_mmap_args *,
- const struct linux_sys_mmap2_args *);
-void bsd_to_linux_rusage(struct linux_rusage *, const struct rusage *);
-void bsd_to_linux_wstat(int *);
-
-
-/*
- * The information on a terminated (or stopped) process needs
- * to be converted in order for Linux binaries to get a valid signal
- * number out of it.
- */
-void
-bsd_to_linux_wstat(status)
- int *status;
-{
-
- if (WIFSIGNALED(*status))
- *status = (*status & ~0177) |
- bsd_to_linux_sig[WTERMSIG(*status)];
- else if (WIFSTOPPED(*status))
- *status = (*status & ~0xff00) |
- (bsd_to_linux_sig[WSTOPSIG(*status)] << 8);
-}
-
-/*
- * Convert an rusage to Linux format: small time_t in the timevals
- */
-void
-bsd_to_linux_rusage(struct linux_rusage *lrup, const struct rusage *rup)
-{
- bsd_to_linux_timeval(&lrup->ru_utime, &rup->ru_utime);
- bsd_to_linux_timeval(&lrup->ru_utime, &rup->ru_utime);
- memcpy(&lrup->ru_maxrss, &rup->ru_maxrss,
- offsetof(struct rusage, ru_nivcsw) -
- offsetof(struct rusage, ru_maxrss) +
- sizeof(lrup->ru_nivcsw));
-}
-
-/*
- * waitpid(2). Just forward on to linux_sys_wait4 with a NULL rusage.
- */
-int
-linux_sys_waitpid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_waitpid_args /* {
- syscallarg(int) pid;
- syscallarg(int *) status;
- syscallarg(int) options;
- } */ *uap = v;
- struct sys_wait4_args linux_w4a;
-
- SCARG(&linux_w4a, pid) = SCARG(uap, pid);
- SCARG(&linux_w4a, status) = SCARG(uap, status);
- SCARG(&linux_w4a, options) = SCARG(uap, options);
- SCARG(&linux_w4a, rusage) = NULL;
-
- return (linux_sys_wait4(p, &linux_w4a, retval));
-}
-
-/*
- * wait4(2): handle conversion of the options on entry and status and rusage
- * on return.
- */
-int
-linux_sys_wait4(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_wait4_args /* {
- syscallarg(int) pid;
- syscallarg(int *) status;
- syscallarg(int) options;
- syscallarg(struct linux_rusage *) rusage;
- } */ *uap = v;
- struct rusage ru;
- int error, status, linux_options, options;
-
- linux_options = SCARG(uap, options);
- options = 0;
- if (linux_options & ~(LINUX_WAIT4_WNOHANG|LINUX_WAIT4_WUNTRACED))
- return (EINVAL);
-
- if (linux_options & LINUX_WAIT4_WNOHANG)
- options |= WNOHANG;
- if (linux_options & LINUX_WAIT4_WUNTRACED)
- options |= WUNTRACED;
-
- if ((error = dowait4(p, SCARG(uap, pid),
- SCARG(uap, status) ? &status : NULL, options,
- SCARG(uap, rusage) ? &ru : NULL, retval)))
- return error;
-
- atomic_clearbits_int(&p->p_siglist, sigmask(SIGCHLD));
-
- if (SCARG(uap, rusage) != NULL) {
- struct linux_rusage lru;
-
- bsd_to_linux_rusage(&lru, &ru);
- if ((error = copyout(&lru, SCARG(uap, rusage), sizeof lru)))
- return error;
- }
- if (SCARG(uap, status) != NULL) {
- bsd_to_linux_wstat(&status);
- return copyout(&status, SCARG(uap, status), sizeof status);
- }
-
- return 0;
-}
-
-/*
- * getrusage(2): convert rusage on return
- */
-int
-linux_sys_getrusage(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_getrusage_args /* {
- syscallarg(int) who;
- syscallarg(struct linux_rusage *) rusage;
- } */ *uap = v;
- struct rusage ru;
- int error;
-
- error = dogetrusage(p, SCARG(uap, who), &ru);
- if (error == 0) {
- struct linux_rusage lru;
-
- bsd_to_linux_rusage(&lru, &ru);
- error = copyout(&lru, SCARG(uap, rusage), sizeof lru);
- }
- return error;
-}
-
-
-int
-linux_sys_setresgid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setresgid16_args /* {
- syscallarg(u_int16_t) rgid;
- syscallarg(u_int16_t) egid;
- syscallarg(u_int16_t) sgid;
- } */ *uap = v;
- struct sys_setresgid_args nuap;
- u_int16_t rgid, egid, sgid;
-
- rgid = SCARG(uap, rgid);
- SCARG(&nuap, rgid) = (rgid == (u_int16_t)-1) ? (gid_t)-1 : rgid;
- egid = SCARG(uap, egid);
- SCARG(&nuap, egid) = (egid == (u_int16_t)-1) ? (gid_t)-1 : egid;
- sgid = SCARG(uap, sgid);
- SCARG(&nuap, sgid) = (sgid == (u_int16_t)-1) ? (gid_t)-1 : sgid;
-
- return sys_setresgid(p, &nuap, retval);
-}
-
-int
-linux_sys_getresgid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_getresgid16_args /* {
- syscallarg(u_int16_t *) rgid;
- syscallarg(u_int16_t *) egid;
- syscallarg(u_int16_t *) sgid;
- } */ *uap = v;
- struct sys_getresgid_args nuap;
-
- SCARG(&nuap, rgid) = (gid_t *)SCARG(uap, rgid);
- SCARG(&nuap, egid) = (gid_t *)SCARG(uap, egid);
- SCARG(&nuap, sgid) = (gid_t *)SCARG(uap, sgid);
-
- return sys_getresgid(p, &nuap, retval);
-}
-
-int
-linux_sys_setresuid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setresuid16_args /* {
- syscallarg(u_int16_t) ruid;
- syscallarg(u_int16_t) euid;
- syscallarg(u_int16_t) suid;
- } */ *uap = v;
- struct sys_setresuid_args nuap;
- u_int16_t ruid, euid, suid;
-
- ruid = SCARG(uap, ruid);
- SCARG(&nuap, ruid) = (ruid == (u_int16_t)-1) ? (uid_t)-1 : ruid;
- euid = SCARG(uap, euid);
- SCARG(&nuap, euid) = (euid == (u_int16_t)-1) ? (uid_t)-1 : euid;
- suid = SCARG(uap, suid);
- SCARG(&nuap, suid) = (suid == (u_int16_t)-1) ? (uid_t)-1 : suid;
-
- return sys_setresuid(p, &nuap, retval);
-}
-
-int
-linux_sys_getresuid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_getresuid16_args /* {
- syscallarg(u_int16_t *) ruid;
- syscallarg(u_int16_t *) euid;
- syscallarg(u_int16_t *) suid;
- } */ *uap = v;
- struct sys_getresuid_args nuap;
-
- SCARG(&nuap, ruid) = (uid_t *)SCARG(uap, ruid);
- SCARG(&nuap, euid) = (uid_t *)SCARG(uap, euid);
- SCARG(&nuap, suid) = (uid_t *)SCARG(uap, suid);
-
- return sys_getresuid(p, &nuap, retval);
-}
-
-/*
- * This is the old brk(2) call. I don't think anything in the Linux
- * world uses this anymore
- */
-int
-linux_sys_break(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-#if 0
- struct linux_sys_brk_args /* {
- syscallarg(char *) nsize;
- } */ *uap = v;
-#endif
-
- return ENOSYS;
-}
-
-/*
- * Linux brk(2). The check if the new address is >= the old one is
- * done in the kernel in Linux. OpenBSD does it in the library.
- */
-int
-linux_sys_brk(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_brk_args /* {
- syscallarg(char *) nsize;
- } */ *uap = v;
- char *nbrk = SCARG(uap, nsize);
- struct sys_obreak_args oba;
- struct vmspace *vm = p->p_vmspace;
- struct linux_emuldata *ed = (struct linux_emuldata*)p->p_emuldata;
-
- SCARG(&oba, nsize) = nbrk;
-
- if ((caddr_t) nbrk > vm->vm_daddr && sys_obreak(p, &oba, retval) == 0)
- ed->p_break = (char*)nbrk;
- else
- nbrk = ed->p_break;
-
- retval[0] = (register_t)nbrk;
-
- return 0;
-}
-
-/*
- * I wonder why Linux has gettimeofday() _and_ time().. Still, we
- * need to deal with it.
- */
-int
-linux_sys_time(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_time_args /* {
- linux_time_t *t;
- } */ *uap = v;
- struct timeval atv;
- linux_time_t tt;
- int error;
-
- microtime(&atv);
-
- if (atv.tv_sec > LINUX_TIME_MAX)
- return (EOVERFLOW);
- tt = (linux_time_t)atv.tv_sec;
- if (SCARG(uap, t) && (error = copyout(&tt, SCARG(uap, t), sizeof tt)))
- return error;
-
- retval[0] = tt;
- return 0;
-}
-
-/*
- * Convert BSD statfs structure to Linux statfs structure.
- * The Linux structure has less fields, and it also wants
- * the length of a name in a dir entry in a field, which
- * we fake (probably the wrong way).
- */
-void
-bsd_to_linux_statfs(const struct statfs *bsp, struct linux_statfs *lsp)
-{
-
- /*
- * Convert BSD filesystem names to Linux filesystem type numbers
- * where possible. Linux statfs uses a value of -1 to indicate
- * an unsupported field.
- */
- if (!strcmp(bsp->f_fstypename, MOUNT_FFS) ||
- !strcmp(bsp->f_fstypename, MOUNT_MFS))
- lsp->l_ftype = LINUX_FSTYPE_FFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NFS))
- lsp->l_ftype = LINUX_FSTYPE_NFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_MSDOS))
- lsp->l_ftype = LINUX_FSTYPE_MSDOS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_EXT2FS))
- lsp->l_ftype = LINUX_FSTYPE_EXT2FS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_CD9660))
- lsp->l_ftype = LINUX_FSTYPE_CD9660;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NCPFS))
- lsp->l_ftype = LINUX_FSTYPE_NCPFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NTFS))
- lsp->l_ftype = LINUX_FSTYPE_NTFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_UDF))
- lsp->l_ftype = LINUX_FSTYPE_UDF;
- else if (!strcmp(bsp->f_fstypename, MOUNT_AFS))
- lsp->l_ftype = LINUX_FSTYPE_AFS;
- else
- lsp->l_ftype = -1;
-
- lsp->l_fbsize = bsp->f_bsize;
- lsp->l_fblocks = bsp->f_blocks;
- lsp->l_fbfree = bsp->f_bfree;
- lsp->l_fbavail = bsp->f_bavail;
- lsp->l_ffiles = bsp->f_files;
- lsp->l_fffree = bsp->f_ffree;
- lsp->l_ffsid.val[0] = bsp->f_fsid.val[0];
- lsp->l_ffsid.val[1] = bsp->f_fsid.val[1];
- lsp->l_fnamelen = MAXNAMLEN; /* XXX */
-}
-
-/*
- * Implement the fs stat functions. Straightforward.
- */
-int
-linux_sys_statfs(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_statfs_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_statfs *) sp;
- } */ *uap = v;
- struct statfs btmp, *bsp;
- struct linux_statfs ltmp;
- struct sys_statfs_args bsa;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
- bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&bsa, path) = SCARG(uap, path);
- SCARG(&bsa, buf) = bsp;
-
- if ((error = sys_statfs(p, &bsa, retval)))
- return error;
-
- if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
- return error;
-
- bsd_to_linux_statfs(&btmp, &ltmp);
-
- return copyout((caddr_t) &ltmp, (caddr_t) SCARG(uap, sp), sizeof ltmp);
-}
-
-void
-bsd_to_linux_statfs64(const struct statfs *bsp, struct linux_statfs64 *lsp)
-{
-
- /*
- * Convert BSD filesystem names to Linux filesystem type numbers
- * where possible. Linux statfs uses a value of -1 to indicate
- * an unsupported field.
- */
- if (!strcmp(bsp->f_fstypename, MOUNT_FFS) ||
- !strcmp(bsp->f_fstypename, MOUNT_MFS))
- lsp->l_ftype = LINUX_FSTYPE_FFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NFS))
- lsp->l_ftype = LINUX_FSTYPE_NFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_MSDOS))
- lsp->l_ftype = LINUX_FSTYPE_MSDOS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_EXT2FS))
- lsp->l_ftype = LINUX_FSTYPE_EXT2FS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_CD9660))
- lsp->l_ftype = LINUX_FSTYPE_CD9660;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NCPFS))
- lsp->l_ftype = LINUX_FSTYPE_NCPFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_NTFS))
- lsp->l_ftype = LINUX_FSTYPE_NTFS;
- else if (!strcmp(bsp->f_fstypename, MOUNT_UDF))
- lsp->l_ftype = LINUX_FSTYPE_UDF;
- else if (!strcmp(bsp->f_fstypename, MOUNT_AFS))
- lsp->l_ftype = LINUX_FSTYPE_AFS;
- else
- lsp->l_ftype = -1;
-
- lsp->l_fbsize = bsp->f_bsize;
- lsp->l_fblocks = bsp->f_blocks;
- lsp->l_fbfree = bsp->f_bfree;
- lsp->l_fbavail = bsp->f_bavail;
- lsp->l_ffiles = bsp->f_files;
- lsp->l_fffree = bsp->f_ffree;
- lsp->l_ffsid.val[0] = bsp->f_fsid.val[0];
- lsp->l_ffsid.val[1] = bsp->f_fsid.val[1];
- lsp->l_fnamelen = MAXNAMLEN; /* XXX */
-}
-
-int
-linux_sys_statfs64(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_statfs64_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_statfs64 *) sp;
- } */ *uap = v;
- struct statfs btmp, *bsp;
- struct linux_statfs64 ltmp;
- struct sys_statfs_args bsa;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
- bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
-
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&bsa, path) = SCARG(uap, path);
- SCARG(&bsa, buf) = bsp;
-
- if ((error = sys_statfs(p, &bsa, retval)))
- return error;
-
- if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
- return error;
-
- bsd_to_linux_statfs64(&btmp, &ltmp);
-
- return copyout((caddr_t) &ltmp, (caddr_t) SCARG(uap, sp), sizeof ltmp);
-}
-
-int
-linux_sys_fstatfs(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_fstatfs_args /* {
- syscallarg(int) fd;
- syscallarg(struct linux_statfs *) sp;
- } */ *uap = v;
- struct statfs btmp, *bsp;
- struct linux_statfs ltmp;
- struct sys_fstatfs_args bsa;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
- bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
-
- SCARG(&bsa, fd) = SCARG(uap, fd);
- SCARG(&bsa, buf) = bsp;
-
- if ((error = sys_fstatfs(p, &bsa, retval)))
- return error;
-
- if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
- return error;
-
- bsd_to_linux_statfs(&btmp, &ltmp);
-
- return copyout((caddr_t) &ltmp, (caddr_t) SCARG(uap, sp), sizeof ltmp);
-}
-
-int
-linux_sys_fstatfs64(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_fstatfs64_args /* {
- syscallarg(int) fd;
- syscallarg(struct linux_statfs64 *) sp;
- } */ *uap = v;
- struct statfs btmp, *bsp;
- struct linux_statfs64 ltmp;
- struct sys_fstatfs_args bsa;
- caddr_t sg;
- int error;
-
- sg = stackgap_init(p);
- bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
-
- SCARG(&bsa, fd) = SCARG(uap, fd);
- SCARG(&bsa, buf) = bsp;
-
- if ((error = sys_fstatfs(p, &bsa, retval)))
- return error;
-
- if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
- return error;
-
- bsd_to_linux_statfs64(&btmp, &ltmp);
-
- return copyout((caddr_t) &ltmp, (caddr_t) SCARG(uap, sp), sizeof ltmp);
-}
-/*
- * uname(). Just copy the info from the various strings stored in the
- * kernel, and put it in the Linux utsname structure. That structure
- * is almost the same as the OpenBSD one, only it has fields 65 characters
- * long, and an extra domainname field.
- */
-int
-linux_sys_uname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_uname_args /* {
- syscallarg(struct linux_utsname *) up;
- } */ *uap = v;
- extern char hostname[], machine[], domainname[];
- struct linux_utsname luts;
- int len;
- char *cp;
-
- strlcpy(luts.l_sysname, ostype, sizeof(luts.l_sysname));
- strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
- strlcpy(luts.l_release, osrelease, sizeof(luts.l_release));
- strlcpy(luts.l_version, version, sizeof(luts.l_version));
- strlcpy(luts.l_machine, machine, sizeof(luts.l_machine));
- strlcpy(luts.l_domainname, domainname, sizeof(luts.l_domainname));
-
- /* This part taken from the uname() in libc */
- len = sizeof(luts.l_version);
- for (cp = luts.l_version; len--; ++cp)
- if (*cp == '\n' || *cp == '\t')
- *cp = (len > 1) ? ' ' : '\0';
-
- return copyout(&luts, SCARG(uap, up), sizeof(luts));
-}
-
-int
-linux_sys_olduname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_uname_args /* {
- syscallarg(struct linux_oldutsname *) up;
- } */ *uap = v;
- extern char hostname[], machine[];
- struct linux_oldutsname luts;
- int len;
- char *cp;
-
- strlcpy(luts.l_sysname, ostype, sizeof(luts.l_sysname));
- strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
- strlcpy(luts.l_release, osrelease, sizeof(luts.l_release));
- strlcpy(luts.l_version, version, sizeof(luts.l_version));
- strlcpy(luts.l_machine, machine, sizeof(luts.l_machine));
-
- /* This part taken from the uname() in libc */
- len = sizeof(luts.l_version);
- for (cp = luts.l_version; len--; ++cp)
- if (*cp == '\n' || *cp == '\t')
- *cp = (len > 1) ? ' ' : '\0';
-
- return copyout(&luts, SCARG(uap, up), sizeof(luts));
-}
-
-int
-linux_sys_oldolduname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_uname_args /* {
- syscallarg(struct linux_oldoldutsname *) up;
- } */ *uap = v;
- extern char hostname[], machine[];
- struct linux_oldoldutsname luts;
- int len;
- char *cp;
-
- strlcpy(luts.l_sysname, ostype, sizeof(luts.l_sysname));
- strlcpy(luts.l_nodename, hostname, sizeof(luts.l_nodename));
- strlcpy(luts.l_release, osrelease, sizeof(luts.l_release));
- strlcpy(luts.l_version, version, sizeof(luts.l_version));
- strlcpy(luts.l_machine, machine, sizeof(luts.l_machine));
-
- /* This part taken from the uname() in libc */
- len = sizeof(luts.l_version);
- for (cp = luts.l_version; len--; ++cp)
- if (*cp == '\n' || *cp == '\t')
- *cp = (len > 1) ? ' ' : '\0';
-
- return copyout(&luts, SCARG(uap, up), sizeof(luts));
-}
-
-int
-linux_sys_sethostname(struct proc *p, void *v, register_t *retval)
-{
- struct linux_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));
-}
-
-/*
- * Linux wants to pass everything to a syscall in registers. However,
- * mmap() has 6 of them. Oops: out of register error. They just pass
- * everything in a structure.
- */
-int
-linux_sys_mmap(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_mmap_args /* {
- syscallarg(struct linux_mmap *) lmp;
- } */ *uap = v;
- struct linux_mmap lmap;
- struct linux_sys_mmap2_args nlmap;
- struct sys_mmap_args cma;
- int error;
-
- if ((error = copyin(SCARG(uap, lmp), &lmap, sizeof lmap)))
- return error;
-
- if (lmap.lm_pos & PAGE_MASK)
- return EINVAL;
-
- /* repackage into something sane */
- SCARG(&nlmap,addr) = (unsigned long)lmap.lm_addr;
- SCARG(&nlmap,len) = lmap.lm_len;
- SCARG(&nlmap,prot) = lmap.lm_prot;
- SCARG(&nlmap,flags) = lmap.lm_flags;
- SCARG(&nlmap,fd) = lmap.lm_fd;
- SCARG(&nlmap,offset) = (unsigned)lmap.lm_pos;
-
- linux_to_bsd_mmap_args(&cma, &nlmap);
- SCARG(&cma, pos) = (off_t)SCARG(&nlmap, offset);
-
- return sys_mmap(p, &cma, retval);
-}
-
-/*
- * Guts of most architectures' mmap64() implementations. This shares
- * its list of arguments with linux_sys_mmap().
- *
- * The difference in linux_sys_mmap2() is that "offset" is actually
- * (offset / pagesize), not an absolute byte count. This translation
- * to pagesize offsets is done inside glibc between the mmap64() call
- * point, and the actual syscall.
- */
-int
-linux_sys_mmap2(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_mmap2_args /* {
- syscallarg(unsigned long) addr;
- syscallarg(size_t) len;
- syscallarg(int) prot;
- syscallarg(int) flags;
- syscallarg(int) fd;
- syscallarg(linux_off_t) offset;
- } */ *uap = v;
- struct sys_mmap_args cma;
-
- linux_to_bsd_mmap_args(&cma, uap);
- SCARG(&cma, pos) = ((off_t)SCARG(uap, offset)) << PAGE_SHIFT;
-
- return sys_mmap(p, &cma, retval);
-}
-
-void
-linux_to_bsd_mmap_args(cma, uap)
- struct sys_mmap_args *cma;
- const struct linux_sys_mmap2_args *uap;
-{
- int flags = 0, fl = SCARG(uap, flags);
-
- flags |= cvtto_bsd_mask(fl, LINUX_MAP_SHARED, MAP_SHARED);
- flags |= cvtto_bsd_mask(fl, LINUX_MAP_PRIVATE, MAP_PRIVATE);
- flags |= cvtto_bsd_mask(fl, LINUX_MAP_FIXED, MAP_FIXED);
- flags |= cvtto_bsd_mask(fl, LINUX_MAP_ANON, MAP_ANON);
- /* XXX XAX ERH: Any other flags here? There are more defined... */
-
- SCARG(cma, addr) = (void *)SCARG(uap, addr);
- SCARG(cma, len) = SCARG(uap, len);
- SCARG(cma, prot) = SCARG(uap, prot);
- if (SCARG(cma, prot) & PROT_WRITE) /* XXX */
- SCARG(cma, prot) |= PROT_READ;
- SCARG(cma, flags) = flags;
- SCARG(cma, fd) = flags & MAP_ANON ? -1 : SCARG(uap, fd);
- SCARG(cma, pad) = 0;
-}
-
-int
-linux_sys_mremap(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- struct linux_sys_mremap_args /* {
- syscallarg(void *) old_address;
- syscallarg(size_t) old_size;
- syscallarg(size_t) new_size;
- syscallarg(u_long) flags;
- } */ *uap = v;
- struct sys_munmap_args mua;
- size_t old_size, new_size;
- int error;
-
- old_size = round_page(SCARG(uap, old_size));
- new_size = round_page(SCARG(uap, new_size));
-
- /*
- * Growing mapped region.
- */
- if (new_size > old_size) {
- /*
- * XXX Implement me. What we probably want to do is
- * XXX dig out the guts of the old mapping, mmap that
- * XXX object again with the new size, then munmap
- * XXX the old mapping.
- */
- *retval = 0;
- return (ENOMEM);
- }
- /*
- * Shrinking mapped region.
- */
- if (new_size < old_size) {
- SCARG(&mua, addr) = (caddr_t)SCARG(uap, old_address) + new_size;
- SCARG(&mua, len) = old_size - new_size;
- error = sys_munmap(p, &mua, retval);
- *retval = error ? 0 : (register_t)SCARG(uap, old_address);
- return (error);
- }
-
- /*
- * No change.
- */
- *retval = (register_t)SCARG(uap, old_address);
- return (0);
-
-}
-
-/*
- * This code is partly stolen from src/lib/libc/gen/times.c
- * XXX - CLK_TCK isn't declared in /sys, just in <time.h>, done here
- */
-
-#define CLK_TCK 100
-#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
-
-int
-linux_sys_times(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_times_args /* {
- syscallarg(struct linux_tms *) tms;
- } */ *uap = v;
- struct timeval t, ut, st;
- struct linux_tms ltms;
- time_t ticks;
- int error;
-
- calcru(&p->p_p->ps_tu, &ut, &st, NULL);
-
- ticks = CONVTCK(ut);
- if (ticks > LINUX_TIME_MAX)
- return EOVERFLOW;
- ltms.ltms_utime = (linux_clock_t)ticks;
-
- ticks = CONVTCK(st);
- if (ticks > LINUX_TIME_MAX)
- return EOVERFLOW;
- ltms.ltms_stime = (linux_clock_t)ticks;
-
- ticks = CONVTCK(p->p_p->ps_cru.ru_utime);
- if (ticks > LINUX_TIME_MAX)
- return EOVERFLOW;
- ltms.ltms_cutime = (linux_clock_t)ticks;
-
- ticks = CONVTCK(p->p_p->ps_cru.ru_stime);
- if (ticks > LINUX_TIME_MAX)
- return EOVERFLOW;
- ltms.ltms_cstime = (linux_clock_t)ticks;
-
- if ((error = copyout(&ltms, SCARG(uap, tms), sizeof ltms)))
- return error;
-
- microuptime(&t);
-
- retval[0] = ((linux_clock_t)(CONVTCK(t)));
- return 0;
-}
-
-/*
- * Alarm. This is a libc call which uses setitimer(2) in OpenBSD.
- * Fiddle with the timers to make it work.
- */
-int
-linux_sys_alarm(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_alarm_args /* {
- syscallarg(unsigned int) secs;
- } */ *uap = v;
- struct process *pr;
- struct itimerval *itp, it;
- struct timeval tv;
- int s;
- int timo;
- linux_time_t seconds_due = 0;
-
- pr = p->p_p;
- itp = &pr->ps_timer[ITIMER_REAL];
- s = splclock();
- /*
- * Clear any pending timer alarms.
- */
- getmicrouptime(&tv);
- timeout_del(&pr->ps_realit_to);
- timerclear(&itp->it_interval);
- if (timerisset(&itp->it_value) &&
- timercmp(&itp->it_value, &tv, >))
- timersub(&itp->it_value, &tv, &itp->it_value);
- /*
- * Return how many seconds were left (rounded up)
- */
- if (itp->it_value.tv_sec > LINUX_TIME_MAX) {
- splx(s);
- return EOVERFLOW;
- }
- seconds_due = (linux_time_t)itp->it_value.tv_sec;
- if (itp->it_value.tv_usec) {
- if (seconds_due == LINUX_TIME_MAX) {
- splx(s);
- return EOVERFLOW;
- }
- seconds_due++;
- }
- retval[0] = seconds_due;
-
- /*
- * alarm(0) just resets the timer.
- */
- if (SCARG(uap, secs) == 0) {
- timerclear(&itp->it_value);
- splx(s);
- return 0;
- }
-
- /*
- * Check the new alarm time for sanity, and set it.
- */
- timerclear(&it.it_interval);
- it.it_value.tv_sec = SCARG(uap, secs);
- it.it_value.tv_usec = 0;
- if (itimerfix(&it.it_value)) {
- splx(s);
- return (EINVAL);
- }
-
- if (timerisset(&it.it_value)) {
- timo = tvtohz(&it.it_value);
- timeradd(&it.it_value, &tv, &it.it_value);
- timeout_add(&pr->ps_realit_to, timo);
- }
- pr->ps_timer[ITIMER_REAL] = it;
- splx(s);
-
- return 0;
-}
-
-/*
- * utime(). Do conversion to things that utimes() understands,
- * and pass it on.
- */
-int
-linux_sys_utime(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_utime_args /* {
- syscallarg(char *) path;
- syscallarg(struct linux_utimbuf *)times;
- } */ *uap = v;
- caddr_t sg;
- int error;
- struct sys_utimes_args ua;
- struct timeval tv[2], *tvp;
- struct linux_utimbuf lut;
-
- sg = stackgap_init(p);
- tvp = (struct timeval *) stackgap_alloc(&sg, sizeof(tv));
- LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-
- SCARG(&ua, path) = SCARG(uap, path);
-
- if (SCARG(uap, times) != NULL) {
- if ((error = copyin(SCARG(uap, times), &lut, sizeof lut)))
- return error;
- tv[0].tv_usec = tv[1].tv_usec = 0;
- tv[0].tv_sec = lut.l_actime;
- tv[1].tv_sec = lut.l_modtime;
- if ((error = copyout(tv, tvp, sizeof tv)))
- return error;
- SCARG(&ua, tptr) = tvp;
- }
- else
- SCARG(&ua, tptr) = NULL;
-
- return sys_utimes(p, &ua, retval);
-}
-
-/*
- * The old Linux readdir was only able to read one entry at a time,
- * even though it had a 'count' argument. In fact, the emulation
- * of the old call was better than the original, because it did handle
- * the count arg properly. Don't bother with it anymore now, and use
- * it to distinguish between old and new. The difference is that the
- * newer one actually does multiple entries, and the reclen field
- * really is the reclen, not the namelength.
- */
-int
-linux_sys_readdir(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_readdir_args /* {
- syscallarg(int) fd;
- syscallarg(struct linux_dirent *) dent;
- syscallarg(unsigned int) count;
- } */ *uap = v;
-
- SCARG(uap, count) = 1;
-
- return linux_sys_getdents(p, uap, retval);
-}
-
-/*
- * Linux 'readdir' call. This code is mostly taken from the
- * SunOS getdents call (see compat/sunos/sunos_misc.c), though
- * an attempt has been made to keep it a little cleaner (failing
- * miserably, because of the cruft needed if count 1 is passed).
- *
- * The d_off field should contain the offset of the next valid entry,
- * but in Linux it has the offset of the entry itself. We emulate
- * that bug here.
- *
- * Read in BSD-style entries, convert them, and copy them out.
- *
- * Note that this doesn't handle union-mounted filesystems.
- */
-int linux_readdir_callback(void *, struct dirent *);
-
-struct linux_readdir_callback_args {
- caddr_t outp;
- int resid;
- int oldcall;
- int is64bit;
-};
-
-int
-linux_readdir_callback(arg, bdp)
- void *arg;
- struct dirent *bdp;
-{
- struct linux_dirent64 idb64;
- struct linux_dirent idb;
- struct linux_readdir_callback_args *cb = arg;
- int linux_reclen;
- int error;
-
- if (cb->oldcall == 2)
- return (ENOMEM);
-
- linux_reclen = (cb->is64bit) ?
- LINUX_RECLEN(&idb64, bdp->d_namlen) :
- LINUX_RECLEN(&idb, bdp->d_namlen);
-
- if (cb->resid < linux_reclen)
- return (ENOMEM);
-
- if (cb->is64bit) {
- idb64.d_ino = (linux_ino64_t)bdp->d_fileno;
- idb64.d_off = (linux_off64_t)bdp->d_off;
- idb64.d_reclen = (u_short)linux_reclen;
- idb64.d_type = bdp->d_type;
- strlcpy(idb64.d_name, bdp->d_name, sizeof(idb64.d_name));
- error = copyout((caddr_t)&idb64, cb->outp, linux_reclen);
- } else {
- if (bdp->d_fileno > LINUX_INO_MAX)
- return EOVERFLOW;
- idb.d_ino = (linux_ino_t)bdp->d_fileno;
- if (cb->oldcall) {
- /*
- * The old readdir() call misuses the offset
- * and reclen fields.
- */
- idb.d_off = (linux_off_t)linux_reclen;
- idb.d_reclen = (u_short)bdp->d_namlen;
- } else {
- idb.d_off = (linux_off_t)bdp->d_off;
- idb.d_reclen = (u_short)linux_reclen;
- }
- strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
- error = copyout((caddr_t)&idb, cb->outp, linux_reclen);
- }
- if (error)
- return (error);
-
- /* advance output past Linux-shaped entry */
- cb->outp += linux_reclen;
- cb->resid -= linux_reclen;
-
- if (cb->oldcall == 1)
- ++cb->oldcall;
-
- return (0);
-}
-
-int
-linux_sys_getdents64(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- return getdents_common(p, v, retval, 1);
-}
-
-int
-linux_sys_getdents(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- return getdents_common(p, v, retval, 0);
-}
-
-int
-getdents_common(p, v, retval, is64bit)
- struct proc *p;
- void *v;
- register_t *retval;
- int is64bit;
-{
- struct linux_sys_getdents_args /* {
- syscallarg(int) fd;
- syscallarg(void *) dirent;
- syscallarg(unsigned) count;
- } */ *uap = v;
- struct linux_readdir_callback_args args;
- struct file *fp;
- int error;
- int nbytes = SCARG(uap, count);
-
- if ((error = getvnode(p, SCARG(uap, fd), &fp)) != 0)
- return (error);
-
- if (nbytes == 1) { /* emulating old, broken behaviour */
- /* readdir(2) case. Always struct dirent. */
- if (is64bit) {
- FRELE(fp, p);
- return (EINVAL);
- }
- nbytes = sizeof(struct linux_dirent);
- args.oldcall = 1;
- } else {
- args.oldcall = 0;
- }
-
- args.resid = nbytes;
- args.outp = (caddr_t)SCARG(uap, dirent);
- args.is64bit = is64bit;
-
- if ((error = readdir_with_callback(fp, &fp->f_offset, nbytes,
- linux_readdir_callback, &args)) != 0)
- goto exit;
-
- *retval = nbytes - args.resid;
-
- exit:
- FRELE(fp, p);
- return (error);
-}
-
-/*
- * Not sure why the arguments to this older version of select() were put
- * into a structure, because there are 5, and that can be handled all
- * in registers on the i386 like Linux wants to.
- */
-int
-linux_sys_oldselect(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_oldselect_args /* {
- syscallarg(struct linux_select *) lsp;
- } */ *uap = v;
- struct linux_select ls;
- int error;
-
- if ((error = copyin(SCARG(uap, lsp), &ls, sizeof(ls))))
- return error;
-
- return linux_select1(p, retval, ls.nfds, ls.readfds, ls.writefds,
- ls.exceptfds, ls.timeout);
-}
-
-/*
- * Even when just using registers to pass arguments to syscalls you can
- * have 5 of them on the i386. So this newer version of select() does
- * this.
- */
-int
-linux_sys_select(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_select_args /* {
- syscallarg(int) nfds;
- syscallarg(fd_set *) readfds;
- syscallarg(fd_set *) writefds;
- syscallarg(fd_set *) exceptfds;
- syscallarg(struct linux_timeval *) timeout;
- } */ *uap = v;
-
- return linux_select1(p, retval, SCARG(uap, nfds), SCARG(uap, readfds),
- SCARG(uap, writefds), SCARG(uap, exceptfds), SCARG(uap, timeout));
-}
-
-/*
- * Common code for the old and new versions of select(). A couple of
- * things are important:
- * 1) return the amount of time left in the 'timeout' parameter
- * 2) select never returns ERESTART on Linux, always return EINTR
- */
-int
-linux_select1(struct proc *p, register_t *retval, int nfds, fd_set *readfds,
- fd_set *writefds, fd_set *exceptfds, struct linux_timeval *timeout)
-{
- struct sys_select_args bsa;
- struct linux_timeval lutv;
- struct timeval tv0, tv1, utv, *tvp;
- caddr_t sg;
- int error;
-
- SCARG(&bsa, nd) = nfds;
- SCARG(&bsa, in) = readfds;
- SCARG(&bsa, ou) = writefds;
- SCARG(&bsa, ex) = exceptfds;
-
- /*
- * Store current time for computation of the amount of
- * time left.
- */
- if (timeout) {
- if ((error = copyin(timeout, &lutv, sizeof(lutv))))
- return error;
- linux_to_bsd_timeval(&utv, &lutv);
- if (itimerfix(&utv)) {
- /*
- * The timeval was invalid. Convert it to something
- * valid that will act as it does under Linux.
- */
- utv.tv_sec += utv.tv_usec / 1000000;
- utv.tv_usec %= 1000000;
- if (utv.tv_usec < 0) {
- utv.tv_sec -= 1;
- utv.tv_usec += 1000000;
- }
- if (utv.tv_sec < 0)
- timerclear(&utv);
- }
-
- sg = stackgap_init(p);
- tvp = stackgap_alloc(&sg, sizeof(utv));
- if ((error = copyout(&utv, tvp, sizeof(utv))))
- return error;
- SCARG(&bsa, tv) = tvp;
- microtime(&tv0);
- } else
- SCARG(&bsa, tv) = NULL;
-
- error = sys_select(p, &bsa, retval);
- if (error) {
- /*
- * See fs/select.c in the Linux kernel. Without this,
- * Maelstrom doesn't work.
- */
- if (error == ERESTART)
- error = EINTR;
- else if (error != EINTR)
- return error;
- }
-
- if (timeout) {
- if (*retval) {
- /*
- * Compute how much time was left of the timeout,
- * by subtracting the current time and the time
- * before we started the call, and subtracting
- * that result from the user-supplied value.
- */
- microtime(&tv1);
- timersub(&tv1, &tv0, &tv1);
- timersub(&utv, &tv1, &utv);
- if (utv.tv_sec < 0)
- timerclear(&utv);
- } else
- timerclear(&utv);
- bsd_to_linux_timeval(&lutv, &utv); /* can't fail */
- if ((error = copyout(&lutv, timeout, sizeof(lutv))))
- return error;
- }
-
- return (error);
-}
-
-/*
- * Get the process group of a certain process. Look it up
- * and return the value.
- */
-int
-linux_sys_getpgid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_getpgid_args /* {
- syscallarg(int) pid;
- } */ *uap = v;
- struct process *targpr;
-
- if (SCARG(uap, pid) != 0 && SCARG(uap, pid) != p->p_p->ps_pid) {
- if ((targpr = prfind(SCARG(uap, pid))) == 0)
- return ESRCH;
- }
- else
- targpr = p->p_p;
-
- retval[0] = targpr->ps_pgid;
- return 0;
-}
-
-/*
- * Set the 'personality' (emulation mode) for the current process. Only
- * accept the Linux personality here (0). This call is needed because
- * the Linux ELF crt0 issues it in an ugly kludge to make sure that
- * ELF binaries run in Linux mode, not SVR4 mode.
- */
-int
-linux_sys_personality(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_personality_args /* {
- syscallarg(int) per;
- } */ *uap = v;
-
- if (SCARG(uap, per) != 0)
- return EINVAL;
- retval[0] = 0;
- return 0;
-}
-
-/*
- * The calls are here because of type conversions.
- */
-int
-linux_sys_setreuid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setreuid16_args /* {
- syscallarg(int) ruid;
- syscallarg(int) euid;
- } */ *uap = v;
- struct sys_setreuid_args bsa;
-
- SCARG(&bsa, ruid) = ((linux_uid_t)SCARG(uap, ruid) == (linux_uid_t)-1) ?
- (uid_t)-1 : SCARG(uap, ruid);
- SCARG(&bsa, euid) = ((linux_uid_t)SCARG(uap, euid) == (linux_uid_t)-1) ?
- (uid_t)-1 : SCARG(uap, euid);
-
- return sys_setreuid(p, &bsa, retval);
-}
-
-int
-linux_sys_setregid16(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setregid16_args /* {
- syscallarg(int) rgid;
- syscallarg(int) egid;
- } */ *uap = v;
- struct sys_setregid_args bsa;
-
- SCARG(&bsa, rgid) = ((linux_gid_t)SCARG(uap, rgid) == (linux_gid_t)-1) ?
- (uid_t)-1 : SCARG(uap, rgid);
- SCARG(&bsa, egid) = ((linux_gid_t)SCARG(uap, egid) == (linux_gid_t)-1) ?
- (uid_t)-1 : SCARG(uap, egid);
-
- return sys_setregid(p, &bsa, retval);
-}
-
-int
-linux_sys___sysctl(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys___sysctl_args /* {
- syscallarg(struct linux___sysctl *) lsp;
- } */ *uap = v;
- struct linux___sysctl ls;
- struct sys_sysctl_args bsa;
- int error;
-
- if ((error = copyin(SCARG(uap, lsp), &ls, sizeof ls)))
- return error;
- SCARG(&bsa, name) = ls.name;
- SCARG(&bsa, namelen) = ls.namelen;
- SCARG(&bsa, old) = ls.old;
- SCARG(&bsa, oldlenp) = ls.oldlenp;
- SCARG(&bsa, new) = ls.new;
- SCARG(&bsa, newlen) = ls.newlen;
-
- return sys_sysctl(p, &bsa, retval);
-}
-
-/*
- * We have nonexistent fsuid equal to uid.
- * If modification is requested, refuse.
- */
-int
-linux_sys_setfsuid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setfsuid_args /* {
- syscallarg(uid_t) uid;
- } */ *uap = v;
- uid_t uid;
-
- uid = SCARG(uap, uid);
- if (p->p_ucred->cr_ruid != uid)
- return sys_nosys(p, v, retval);
- else
- return (0);
-}
-
-int
-linux_sys_getfsuid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- return sys_getuid(p, v, retval);
-}
-
-
-int
-linux_sys_nice(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_nice_args /* {
- syscallarg(int) incr;
- } */ *uap = v;
- struct sys_setpriority_args bsa;
-
- SCARG(&bsa, which) = PRIO_PROCESS;
- SCARG(&bsa, who) = 0;
- SCARG(&bsa, prio) = SCARG(uap, incr);
- return sys_setpriority(p, &bsa, retval);
-}
-
-int
-linux_sys_getpid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- *retval = p->p_p->ps_pid;
- return (0);
-}
-
-linux_pid_t
-linux_sys_gettid(struct proc *p, void *v, register_t *retval)
-{
- *retval = p->p_pid + THREAD_PID_OFFSET;
- return (0);
-}
-
-int
-linux_sys_getuid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- *retval = p->p_ucred->cr_ruid;
- return (0);
-}
-
-int
-linux_sys_getgid(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-
- *retval = p->p_ucred->cr_rgid;
- return (0);
-}
-
-
-/*
- * sysinfo()
- */
-/* ARGSUSED */
-int
-linux_sys_sysinfo(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sysinfo_args /* {
- syscallarg(struct linux_sysinfo *) sysinfo;
- } */ *uap = v;
- struct linux_sysinfo si;
- struct loadavg *la;
- extern long bufpages;
- struct timeval tv;
-
- getmicrouptime(&tv);
- if (tv.tv_sec > LINUX_TIME_MAX)
- return EOVERFLOW;
- si.uptime = (linux_time_t)tv.tv_sec;
- la = &averunnable;
- si.loads[0] = la->ldavg[0] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
- si.loads[1] = la->ldavg[1] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
- si.loads[2] = la->ldavg[2] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
- si.totalram = ptoa(physmem);
- si.freeram = uvmexp.free * uvmexp.pagesize;
- si.sharedram = 0;/* XXX */
- si.bufferram = bufpages * PAGE_SIZE;
- si.totalswap = uvmexp.swpages * PAGE_SIZE;
- si.freeswap = (uvmexp.swpages - uvmexp.swpginuse) * PAGE_SIZE;
- si.procs = nthreads;
- /* The following are only present in newer Linux kernels. */
- si.totalbig = 0;
- si.freebig = 0;
- si.mem_unit = 1;
-
- return (copyout(&si, SCARG(uap, sysinfo), sizeof(si)));
-}
-
-int
-linux_sys_mprotect(struct proc *p, void *v, register_t *retval)
-{
- struct sys_mprotect_args *uap = v;
-
- if (SCARG(uap, prot) & (PROT_WRITE | PROT_EXEC))
- SCARG(uap, prot) |= PROT_READ;
- return (sys_mprotect(p, uap, retval));
-}
-
-int
-linux_sys_setdomainname(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_setdomainname_args *uap = v;
- int error, mib[1];
-
- if ((error = suser(p, 0)))
- return (error);
- mib[0] = KERN_DOMAINNAME;
- return (kern_sysctl(mib, 1, NULL, NULL, SCARG(uap, name),
- SCARG(uap, len), p));
-}
-
-int
-linux_sys_swapon(struct proc *p, void *v, register_t *retval)
-{
- struct sys_swapctl_args ua;
- struct linux_sys_swapon_args /* {
- syscallarg(const char *) name;
- } */ *uap = v;
-
- SCARG(&ua, cmd) = SWAP_ON;
- SCARG(&ua, arg) = (void *)SCARG(uap, name);
- SCARG(&ua, misc) = 0; /* priority */
- return (sys_swapctl(p, &ua, retval));
-}
-
-int
-linux_sys_prctl(struct proc *p, void *v, register_t *retval)
-{
- int error = 0, max_size, pdeath_signal;
- char comm[LINUX_MAX_COMM_LEN];
- struct linux_emuldata *ed = (struct linux_emuldata*)p->p_emuldata;
-
- struct linux_sys_prctl_args /* {
- int option;
- unsigned long arg2;
- unsigned long arg3;
- unsigned long arg4;
- unsigned long arg5;
- } */ *uap = v;
-
- switch (SCARG(uap, option)) {
- case LINUX_PR_SET_PDEATHSIG:
- if (SCARG(uap, arg2) >= LINUX__NSIG)
- return (EINVAL);
- ed->pdeath_signal = SCARG(uap, arg2);
- break;
- case LINUX_PR_GET_PDEATHSIG:
- pdeath_signal = ed->pdeath_signal;
- error = copyout(&pdeath_signal, (void *)SCARG(uap, arg2),
- sizeof(pdeath_signal));
- break;
- case LINUX_PR_GET_KEEPCAPS:
- /*
- * Indicate that we always clear the effective and
- * permitted capability sets when the user id becomes
- * non-zero (actually the capability sets are simply
- * always zero in the current implementation).
- */
- *retval = 0;
- break;
- case LINUX_PR_SET_KEEPCAPS:
- /*
- * Ignore requests to keep the effective and permitted
- * capability sets when the user id becomes non-zero.
- */
- break;
- case LINUX_PR_SET_NAME:
- /*
- * To be on the safe side we need to make sure not to
- * overflow the size a linux program expects. We already
- * do this here in the copyin, so that we don't need to
- * check on copyout.
- */
- max_size = MIN(sizeof(comm), sizeof(p->p_comm));
- error = copyinstr((void *)SCARG(uap, arg2), comm,
- max_size, NULL);
-
- /* Linux silently truncates the name if it is too long. */
- if (error == ENAMETOOLONG) {
- /*
- * XXX: copyinstr() isn't documented to populate the
- * array completely, so do a copyin() to be on the
- * safe side. This should be changed in case copyinstr()
- * is changed to guarantee this.
- */
- error = copyin((void *)SCARG(uap, arg2), comm,
- max_size - 1);
- comm[max_size - 1] = '\0';
- }
- if (error)
- return (error);
- strlcpy(p->p_comm, comm, sizeof(p->p_comm));
- break;
- case LINUX_PR_GET_NAME:
- strlcpy(comm, p->p_comm, sizeof(comm));
- error = copyout(comm, (void *)SCARG(uap, arg2),
- strlen(comm) + 1);
- break;
- default:
- printf("linux_sys_prctl: unsupported option %d\n",
- SCARG(uap, option));
- error = EINVAL;
- break;
- }
-
- return (error);
-}
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
deleted file mode 100644
index c4e5924d4c8..00000000000
--- a/sys/compat/linux/linux_misc.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: linux_misc.h,v 1.7 2013/10/25 04:51:39 guenther Exp $ */
-/* $NetBSD: linux_misc.h,v 1.3 1999/05/13 00:31:57 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Eric Haszlakiewicz.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _LINUX_MISC_H_
-#define _LINUX_MISC_H_
-
-/* defined for prctl(2) */
-#define LINUX_PR_SET_PDEATHSIG 1 /* Second arg is signal. */
-#define LINUX_PR_GET_PDEATHSIG 2 /*
- * Second arg is a ptr to return the
- * signal.
- */
-#define LINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */
-#define LINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */
-#define LINUX_PR_SET_NAME 15 /* Set process name. */
-#define LINUX_PR_GET_NAME 16 /* Get process name. */
-
-#define LINUX_MAX_COMM_LEN 16 /* Maximum length of process name. */
-
-/* This looks very unportable to me, but this is how Linux defines it. */
-struct linux_sysinfo {
- long uptime;
- unsigned long loads[3];
-#define LINUX_SYSINFO_LOADS_SCALE 65536
- unsigned long totalram;
- unsigned long freeram;
- unsigned long sharedram;
- unsigned long bufferram;
- unsigned long totalswap;
- unsigned long freeswap;
- unsigned short procs;
- unsigned long totalbig;
- unsigned long freebig;
- unsigned int mem_unit;
- char _f[20-2*sizeof(long)-sizeof(int)];
-};
-
-struct linux_rusage {
- struct linux_timeval ru_utime; /* user time used */
- struct linux_timeval ru_stime; /* system time used */
- long ru_maxrss; /* max resident set size */
- long ru_ixrss; /* integral shared text memory size */
- long ru_idrss; /* integral unshared data " */
- long ru_isrss; /* integral unshared stack " */
- long ru_minflt; /* page reclaims */
- long ru_majflt; /* page faults */
- long ru_nswap; /* swaps */
- long ru_inblock; /* block input operations */
- long ru_oublock; /* block output operations */
- long ru_msgsnd; /* messages sent */
- long ru_msgrcv; /* messages received */
- long ru_nsignals; /* signals received */
- long ru_nvcsw; /* voluntary context switches */
- long ru_nivcsw; /* involuntary " */
-};
-
-
-/*
- * Options passed to the Linux wait4() system call.
- */
-#define LINUX_WAIT4_WNOHANG 0x00000001
-#define LINUX_WAIT4_WUNTRACED 0x00000002
-#define LINUX_WAIT4_WCLONE 0x80000000
-
-#endif /* !_LINUX_MISC_H_ */
diff --git a/sys/compat/linux/linux_mmap.h b/sys/compat/linux/linux_mmap.h
deleted file mode 100644
index 66c68c39f60..00000000000
--- a/sys/compat/linux/linux_mmap.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: linux_mmap.h,v 1.3 2011/04/05 22:54:30 pirofti Exp $ */
-/* $NetBSD: linux_mmap.h,v 1.1 1995/02/28 23:25:52 fvdl Exp $ */
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_MMAP_H_
-#define _LINUX_MMAP_H_
-
-#define LINUX_PROT_NONE 0x00
-#define LINUX_PROT_READ 0x01
-#define LINUX_PROT_WRITE 0x02
-#define LINUX_PROT_EXEC 0x04
-
-#define LINUX_MAP_SHARED 0x0001
-#define LINUX_MAP_PRIVATE 0x0002
-
-#define LINUX_MAP_FIXED 0x0010
-#define LINUX_MAP_ANON 0x0020
-
-/* the following flags are silently ignored */
-
-#define LINUX_MAP_GROWSDOWN 0x0400
-#define LINUX_MAP_DENYWRITE 0x0800
-#define LINUX_MAP_EXECUTABLE 0x1000
-
-#endif /* !_LINUX_MMAP_H_ */
diff --git a/sys/compat/linux/linux_mount.c b/sys/compat/linux/linux_mount.c
deleted file mode 100644
index 453e1ad44b3..00000000000
--- a/sys/compat/linux/linux_mount.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: linux_mount.c,v 1.4 1996/10/16 12:25:26 deraadt Exp $ */
-
-/*
- * Copyright (c) 1996 Erik Theisen
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/file.h>
-#include <sys/mount.h>
-#include <sys/filedesc.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_errno.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-
-/*
- * These are just dummy mount/umount functions
- * who's purpose is to satisfy brain dead code
- * that bindly calls mount(). They always
- * return EPERM.
- *
- * You really shouldn't be running code via
- * emulation that mounts FSs.
- */
-int
-linux_sys_mount(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_mount_args /* {
- syscallarg(char *) specialfile;
- syscallarg(char *) dir;
- syscallarg(char *) filesystemtype;
- syscallarg(long) rwflag;
- syscallarg(void *) data;
- } *uap = v */ ;
- return EPERM;
-}
-
-int
-linux_sys_umount(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_umount_args /* {
- syscallarg(char *) specialfile;
- } *uap = v */ ;
- return EPERM;
-}
diff --git a/sys/compat/linux/linux_msg.h b/sys/compat/linux/linux_msg.h
deleted file mode 100644
index e3e591f6223..00000000000
--- a/sys/compat/linux/linux_msg.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: linux_msg.h,v 1.3 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_msg.h,v 1.2 1995/08/15 21:14:34 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_MSG_H_
-#define _LINUX_MSG_H_
-
-/*
- * msq_id_ds structure. Mostly the same fields, except for some internal
- * ones.
- */
-struct linux_msqid_ds {
- struct linux_ipc_perm l_msg_perm;
- void *l_msg_first;
- void *l_msg_last;
- linux_time_t l_msg_stime;
- linux_time_t l_msg_rtime;
- linux_time_t l_msg_ctime;
- void *l_wwait; /* Linux internal */
- void *l_rwait; /* Linux internal */
- ushort l_msg_cbytes;
- ushort l_msg_qnum;
- ushort l_msg_qbytes;
- ushort l_msg_lspid;
- ushort l_msg_lrpid;
-};
-
-#define LINUX_MSG_NOERROR 0x1000
-#define LINUX_MSG_EXCEPT 0x2000
-
-/*
- * The notorious anonymous message structure.
- */
-struct linux_mymsg {
- long l_mtype;
- char l_mtext[1];
-};
-
-/*
- * This kludge is used for the 6th argument to the msgrcv system
- * call, to get around the maximum of 5 arguments to a syscall in Linux.
- */
-struct linux_msgrcv_msgarg {
- struct linux_mymsg *msg;
- int type;
-};
-/*
- * For msgctl calls.
- */
-struct linux_msginfo {
- int l_msgpool;
- int l_msgmap;
- int l_msgmax;
- int l_msgmnb;
- int l_msgmni;
- int l_msgssz;
- int l_msgtql;
- ushort l_msgseg;
-};
-
-#define LINUX_MSG_STAT 11
-#define LINUX_MSG_INFO 12
-
-#endif /* _LINUX_MSG_H_ */
diff --git a/sys/compat/linux/linux_resource.c b/sys/compat/linux/linux_resource.c
deleted file mode 100644
index e07433aa2fb..00000000000
--- a/sys/compat/linux/linux_resource.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: linux_resource.c,v 1.6 2012/09/05 17:13:37 deraadt Exp $ */
-
-/*
- * Copyright (c) 2000 Niklas Hallqvist
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * Linux "resource" syscall emulation
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/resource.h>
-#include <sys/resourcevar.h>
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_resource.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-
-/* linux_resource.c */
-int linux_to_bsd_rlimit(u_int);
-int linux_dogetrlimit(struct proc *, void *, register_t *, rlim_t);
-
-static u_int linux_to_bsd_rlimit_map[] = {
- RLIMIT_CPU,
- RLIMIT_FSIZE,
- RLIMIT_DATA,
- RLIMIT_STACK,
- RLIMIT_CORE,
- RLIMIT_RSS,
- RLIMIT_NPROC,
- RLIMIT_NOFILE,
- RLIMIT_MEMLOCK,
- RLIM_NLIMITS /* LINUX_RLIMIT_AS not supported */
-};
-
-int
-linux_to_bsd_rlimit(which)
- u_int which;
-{
- if (which >= LINUX_RLIM_NLIMITS)
- return (RLIM_NLIMITS);
- return (linux_to_bsd_rlimit_map[which]);
-}
-
-
-struct compat_sys_setrlimit_args {
- syscallarg(int) which;
- syscallarg(struct olimit *) rlp;
-};
-
-struct compat_linux_rlimit {
- int32_t rlim_cur; /* current (soft) limit */
- int32_t rlim_max; /* maximum value for rlim_cur */
-};
-
-int compat_sys_setrlimit(struct proc *p, void *v, register_t *retval);
-int
-compat_sys_setrlimit(struct proc *p, void *v, register_t *retval)
-{
- struct compat_sys_setrlimit_args *uap = v;
- struct compat_linux_rlimit olim;
- struct rlimit lim;
- int error;
-
- error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&olim,
- sizeof (olim));
- if (error)
- return (error);
- lim.rlim_cur = olim.rlim_cur;
- lim.rlim_max = olim.rlim_max;
- return (dosetrlimit(p, SCARG(uap, which), &lim));
-}
-
-int
-linux_sys_setrlimit(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_setrlimit_args /* {
- syscallarg(u_int) which;
- syscallarg(struct linux_rlimit *) rlp;
- } */ *uap = v;
-
- SCARG(uap, which) = linux_to_bsd_rlimit(SCARG(uap, which));
- if (SCARG(uap, which) == RLIM_NLIMITS)
- return (EINVAL);
- return (compat_sys_setrlimit(p, v, retval));
-}
-
-int
-linux_dogetrlimit(p, v, retval, max)
- struct proc *p;
- void *v;
- register_t *retval;
- rlim_t max;
-{
- struct linux_sys_getrlimit_args /* {
- syscallarg(u_int) which;
- syscallarg(struct linux_rlimit *) rlp;
- } */ *uap = v;
- u_int which;
- struct linux_rlimit rlim;
-
- which = linux_to_bsd_rlimit(SCARG(uap, which));
- if (which == RLIM_NLIMITS)
- return (EINVAL);
-
- rlim.rlim_cur = MIN(p->p_rlimit[which].rlim_cur, max);
- rlim.rlim_max = MIN(p->p_rlimit[which].rlim_max, max);
- return (copyout(&rlim, SCARG(uap, rlp), sizeof rlim));
-}
-
-int
-linux_sys_getrlimit(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- return (linux_dogetrlimit(p, v, retval, LINUX_OLD_RLIM_INFINITY));
-}
-
-int
-linux_sys_ugetrlimit(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- return (linux_dogetrlimit(p, v, retval, LINUX_RLIM_INFINITY));
-}
diff --git a/sys/compat/linux/linux_resource.h b/sys/compat/linux/linux_resource.h
deleted file mode 100644
index c163a123fe6..00000000000
--- a/sys/compat/linux/linux_resource.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: linux_resource.h,v 1.2 2003/06/03 20:49:28 deraadt Exp $ */
-
-/*
- * Copyright (c) 2000 Niklas Hallqvist
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_RESOURCE_H_
-#define _LINUX_RESOURCE_H_
-
-/*
- * Resource limits
- */
-#define LINUX_RLIMIT_CPU 0 /* cpu time in milliseconds */
-#define LINUX_RLIMIT_FSIZE 1 /* maximum file size */
-#define LINUX_RLIMIT_DATA 2 /* data size */
-#define LINUX_RLIMIT_STACK 3 /* stack size */
-#define LINUX_RLIMIT_CORE 4 /* core file size */
-#define LINUX_RLIMIT_RSS 5 /* resident set size */
-#define LINUX_RLIMIT_NPROC 6 /* number of processes */
-#define LINUX_RLIMIT_NOFILE 7 /* number of open files */
-#define LINUX_RLIMIT_MEMLOCK 8 /* locked-in-memory address space */
-#define LINUX_RLIMIT_AS 9 /* address space limit */
-
-#define LINUX_RLIM_NLIMITS 10 /* number of resource limits */
-
-#define LINUX_RLIM_INFINITY 0xFFFFFFFF
-#define LINUX_OLD_RLIM_INFINITY 0x7FFFFFFF
-
-struct linux_rlimit {
- u_long rlim_cur;
- u_long rlim_max;
-};
-
-#endif /* !_LINUX_RESOURCE_H_ */
diff --git a/sys/compat/linux/linux_sched.c b/sys/compat/linux/linux_sched.c
deleted file mode 100644
index f71820b4818..00000000000
--- a/sys/compat/linux/linux_sched.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* $OpenBSD: linux_sched.c,v 1.18 2014/07/09 14:42:53 guenther Exp $ */
-/* $NetBSD: linux_sched.c,v 1.6 2000/05/28 05:49:05 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center; by Matthias Scheler.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Linux compatibility module. Try to deal with scheduler related syscalls.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/syscallargs.h>
-#include <sys/signalvar.h>
-
-#include <machine/cpu.h>
-#include <machine/pcb.h>
-#include <machine/linux_machdep.h>
-
-#include <compat/linux/linux_emuldata.h>
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_sched.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-
-void linux_child_return(void *);
-
-int
-linux_sys_clone(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_clone_args *uap = v;
- struct linux_emuldata *emul = p->p_emuldata;
- int cflags = SCARG(uap, flags);
- int flags = FORK_TFORK;
- int error = 0;
-
- /*
- * We only support certain bits. The Linux crew keep adding more,
- * so let's test for anything outside of what we support and complain
- * about them. Not everything in this list is completely supported,
- * they just aren't _always_ an error.
- */
- if (cflags & ~(LINUX_CLONE_CSIGNAL | LINUX_CLONE_VM | LINUX_CLONE_FS |
- LINUX_CLONE_FILES | LINUX_CLONE_SIGHAND | LINUX_CLONE_VFORK |
- LINUX_CLONE_PARENT | LINUX_CLONE_THREAD | LINUX_CLONE_SYSVSEM |
- LINUX_CLONE_DETACHED | LINUX_CLONE_UNTRACED | LINUX_CLONE_SETTLS |
- LINUX_CLONE_PARENT_SETTID | LINUX_CLONE_CHILD_CLEARTID |
- LINUX_CLONE_CHILD_SETTID))
- return (EINVAL);
-
- if (cflags & LINUX_CLONE_VM)
- flags |= FORK_SHAREVM;
- if (cflags & LINUX_CLONE_FILES)
- flags |= FORK_SHAREFILES;
- if (cflags & LINUX_CLONE_SIGHAND) {
- /* According to Linux, CLONE_SIGHAND requires CLONE_VM */
- if ((cflags & LINUX_CLONE_VM) == 0)
- return (EINVAL);
- flags |= FORK_SIGHAND;
- }
- if (cflags & LINUX_CLONE_VFORK)
- flags |= FORK_PPWAIT;
- if (cflags & LINUX_CLONE_THREAD) {
- /*
- * Linux agrees with us: CLONE_THREAD requires
- * CLONE_SIGHAND. Unlike Linux, we also also require
- * CLONE_FS and CLONE_SYSVSEM. Also, we decree it
- * to be incompatible with CLONE_VFORK, as I don't
- * want to work out whether that's 100% safe.
- * Requires CLONE_FILES so that the rest of the kernel
- * can assume that threads share an fd table.
- */
-#define REQUIRED \
- ( LINUX_CLONE_SIGHAND \
- | LINUX_CLONE_FS \
- | LINUX_CLONE_SYSVSEM \
- | LINUX_CLONE_FILES \
- )
-#define BANNED \
- LINUX_CLONE_VFORK
- if ((cflags & (REQUIRED | BANNED)) != REQUIRED)
- return (EINVAL);
- flags |= FORK_THREAD;
- } else {
- /*
- * These are only supported with CLONE_THREAD. Arguably,
- * CLONE_FS should be in this list, because we don't
- * support sharing of working directory and root directory
- * (chdir + chroot) except via threads. On the other
- * hand, we tie the sharing of umask to the sharing of
- * files, so a process that doesn't request CLONE_FS but
- * does ask for CLONE_FILES is going to get some of the
- * former's effect. Some programs (e.g., Opera) at least
- * _seem_ to work if we let it through, so we'll just
- * cross our fingers for now and silently ignore it if
- * CLONE_FILES was also requested.
- */
- if (cflags & (LINUX_CLONE_PARENT | LINUX_CLONE_SYSVSEM))
- return (EINVAL);
- if ((cflags & (LINUX_CLONE_FS | LINUX_CLONE_FILES)) ==
- LINUX_CLONE_FS)
- return (EINVAL);
-
- /* We don't support alternate exit signals. */
- if ((cflags & LINUX_CLONE_CSIGNAL) != LINUX_SIGCHLD)
- return (EINVAL);
- }
- /*
- * Since we don't support CLONE_PTRACE, the CLONE_UNTRACED
- * flag can be silently ignored. CLONE_DETACHED is always
- * ignored by Linux.
- */
- if (cflags & LINUX_CLONE_CHILD_SETTID)
- emul->child_set_tid = SCARG(uap, child_tidptr);
- else
- emul->child_set_tid = NULL;
-
- if (cflags & LINUX_CLONE_CHILD_CLEARTID)
- emul->child_clear_tid = SCARG(uap, child_tidptr);
- else
- emul->child_clear_tid = NULL;
-
- if (cflags & LINUX_CLONE_PARENT_SETTID)
- if (SCARG(uap, parent_tidptr) == NULL)
- return (EINVAL);
-
- if (cflags & LINUX_CLONE_SETTLS) {
- struct l_segment_descriptor ldesc;
-
- error = copyin(SCARG(uap, tls), &ldesc, sizeof(ldesc));
- if (error)
- return (error);
-
- if (ldesc.entry_number != GUGS_SEL)
- return (EINVAL);
- emul->child_tls_base = ldesc.base_addr;
- emul->set_tls_base = 1;
- }
- else
- emul->set_tls_base = 0;
-
- error = fork1(p, flags, SCARG(uap, stack), 0, linux_child_return,
- NULL, retval, NULL);
- if (error)
- return error;
-
- if (cflags & LINUX_CLONE_PARENT_SETTID) {
- pid_t pid = retval[0];
-
- error = copyout(&pid, SCARG(uap, parent_tidptr), sizeof(pid));
- }
- return (error);
-}
-
-int
-linux_sys_sched_setparam(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_setparam_args /* {
- syscallarg(linux_pid_t) pid;
- syscallarg(const struct linux_sched_param *) sp;
- } */ *uap = v;
- int error;
- struct linux_sched_param lp;
- struct proc *p;
-
- /*
- * We only check for valid parameters and return afterwards.
- */
-
- if (SCARG(uap, pid) < 0 || SCARG(uap, sp) == NULL)
- return (EINVAL);
-
- error = copyin(SCARG(uap, sp), &lp, sizeof(lp));
- if (error)
- return (error);
-
- if (SCARG(uap, pid) != 0) {
- struct ucred *uc = cp->p_ucred;
-
- if ((p = pfind(SCARG(uap, pid))) == NULL)
- return (ESRCH);
- if (!(cp == p ||
- uc->cr_uid == 0 ||
- uc->cr_ruid == p->p_ucred->cr_ruid ||
- uc->cr_uid == p->p_ucred->cr_ruid ||
- uc->cr_ruid == p->p_ucred->cr_uid ||
- uc->cr_uid == p->p_ucred->cr_uid))
- return (EPERM);
- }
-
- return (0);
-}
-
-int
-linux_sys_sched_getparam(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_getparam_args /* {
- syscallarg(linux_pid_t) pid;
- syscallarg(struct linux_sched_param *) sp;
- } */ *uap = v;
- struct proc *p;
- struct linux_sched_param lp;
-
- /*
- * We only check for valid parameters and return a dummy priority
- * afterwards.
- */
- if (SCARG(uap, pid) < 0 || SCARG(uap, sp) == NULL)
- return (EINVAL);
-
- if (SCARG(uap, pid) != 0) {
- struct ucred *uc = cp->p_ucred;
-
- if ((p = pfind(SCARG(uap, pid))) == NULL)
- return (ESRCH);
- if (!(cp == p ||
- uc->cr_uid == 0 ||
- uc->cr_ruid == p->p_ucred->cr_ruid ||
- uc->cr_uid == p->p_ucred->cr_ruid ||
- uc->cr_ruid == p->p_ucred->cr_uid ||
- uc->cr_uid == p->p_ucred->cr_uid))
- return (EPERM);
- }
-
- lp.sched_priority = 0;
- return (copyout(&lp, SCARG(uap, sp), sizeof lp));
-}
-
-int
-linux_sys_sched_setscheduler(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_setscheduler_args /* {
- syscallarg(linux_pid_t) pid;
- syscallarg(int) policy;
- syscallarg(cont struct linux_sched_scheduler *) sp;
- } */ *uap = v;
- int error;
- struct linux_sched_param lp;
- struct proc *p;
-
- /*
- * We only check for valid parameters and return afterwards.
- */
-
- if (SCARG(uap, pid) < 0 || SCARG(uap, sp) == NULL)
- return (EINVAL);
-
- error = copyin(SCARG(uap, sp), &lp, sizeof(lp));
- if (error)
- return (error);
-
- if (SCARG(uap, pid) != 0) {
- struct ucred *uc = cp->p_ucred;
-
- if ((p = pfind(SCARG(uap, pid))) == NULL)
- return (ESRCH);
- if (!(cp == p ||
- uc->cr_uid == 0 ||
- uc->cr_ruid == p->p_ucred->cr_ruid ||
- uc->cr_uid == p->p_ucred->cr_ruid ||
- uc->cr_ruid == p->p_ucred->cr_uid ||
- uc->cr_uid == p->p_ucred->cr_uid))
- return (EPERM);
- }
-
- /*
- * We can't emulate anything but the default scheduling policy.
- */
- if (SCARG(uap, policy) != LINUX_SCHED_OTHER || lp.sched_priority != 0)
- return (EINVAL);
-
- return (0);
-}
-
-int
-linux_sys_sched_getscheduler(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_getscheduler_args /* {
- syscallarg(linux_pid_t) pid;
- } */ *uap = v;
- struct proc *p;
-
- *retval = -1;
-
- /*
- * We only check for valid parameters and return afterwards.
- */
-
- if (SCARG(uap, pid) != 0) {
- struct ucred *uc = cp->p_ucred;
-
- if ((p = pfind(SCARG(uap, pid))) == NULL)
- return (ESRCH);
- if (!(cp == p ||
- uc->cr_uid == 0 ||
- uc->cr_ruid == p->p_ucred->cr_ruid ||
- uc->cr_uid == p->p_ucred->cr_ruid ||
- uc->cr_ruid == p->p_ucred->cr_uid ||
- uc->cr_uid == p->p_ucred->cr_uid))
- return (EPERM);
- }
-
- /*
- * We can't emulate anything but the default scheduling policy.
- */
- *retval = LINUX_SCHED_OTHER;
- return (0);
-}
-
-int
-linux_sys_sched_yield(struct proc *cp, void *v, register_t *retval)
-{
- need_resched(curcpu());
- return (0);
-}
-
-int
-linux_sys_sched_get_priority_max(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_get_priority_max_args /* {
- syscallarg(int) policy;
- } */ *uap = v;
-
- /*
- * We can't emulate anything but the default scheduling policy.
- */
- if (SCARG(uap, policy) != LINUX_SCHED_OTHER) {
- *retval = -1;
- return (EINVAL);
- }
-
- *retval = 0;
- return (0);
-}
-
-int
-linux_sys_sched_get_priority_min(struct proc *cp, void *v, register_t *retval)
-{
- struct linux_sys_sched_get_priority_min_args /* {
- syscallarg(int) policy;
- } */ *uap = v;
-
- /*
- * We can't emulate anything but the default scheduling policy.
- */
- if (SCARG(uap, policy) != LINUX_SCHED_OTHER) {
- *retval = -1;
- return (EINVAL);
- }
-
- *retval = 0;
- return (0);
-}
-
-int
-linux_sys_set_tid_address(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_set_tid_address_args *uap = v;
- struct linux_emuldata *emul = p->p_emuldata;
-
- emul->my_clear_tid = SCARG(uap, tidptr);
-
- *retval = p->p_p->ps_pid;
- return 0;
-}
-
-void
-linux_child_return(void *arg)
-{
- struct proc *p = (struct proc *)arg;
- struct linux_emuldata *emul = p->p_emuldata;
-
- if (emul->set_tls_base)
- i386_set_threadbase(p, emul->my_tls_base, TSEG_GS);
-
- if (emul->my_set_tid) {
- pid_t pid = p->p_pid + THREAD_PID_OFFSET;
-
- if (copyout(&pid, emul->my_set_tid, sizeof(pid)))
- psignal(p, SIGSEGV);
- }
-
- child_return(p);
-}
diff --git a/sys/compat/linux/linux_sched.h b/sys/compat/linux/linux_sched.h
deleted file mode 100644
index 0cfba5caf2f..00000000000
--- a/sys/compat/linux/linux_sched.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: linux_sched.h,v 1.4 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_sched.h,v 1.1 1999/05/12 19:49:09 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _LINUX_SCHED_H_
-#define _LINUX_SCHED_H_
-
-/*
- * Flags passed to the Linux __clone(2) system call.
- */
-#define LINUX_CLONE_CSIGNAL 0x000000ff /* signal to be sent at exit */
-#define LINUX_CLONE_VM 0x00000100 /* share address space */
-#define LINUX_CLONE_FS 0x00000200 /* share "file system" info */
-#define LINUX_CLONE_FILES 0x00000400 /* share file descriptors */
-#define LINUX_CLONE_SIGHAND 0x00000800 /* share signal actions */
-#define LINUX_CLONE_PID 0x00001000 /* no longer supported */
-#define LINUX_CLONE_PTRACE 0x00002000 /* ptrace(2) continues on
- child */
-#define LINUX_CLONE_VFORK 0x00004000 /* parent blocks until child
- exits */
-#define LINUX_CLONE_PARENT 0x00008000 /* create sibling, not child */
-#define LINUX_CLONE_THREAD 0x00010000 /* new thread */
-#define LINUX_CLONE_NEWNS 0x00020000 /* don't share mount changes */
-#define LINUX_CLONE_SYSVSEM 0x00040000 /* share sysV SEM_UNDO */
-#define LINUX_CLONE_SETTLS 0x00080000 /* new thread-local-storage? */
-#define LINUX_CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
-#define LINUX_CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
-#define LINUX_CLONE_DETACHED 0x00400000 /* Unused, ignored */
-#define LINUX_CLONE_UNTRACED 0x00800000 /* undo LINUX_CLONE_PTRACE */
-#define LINUX_CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
-#define LINUX_CLONE_STOPPED 0x02000000 /* Start in stopped state */
-
-struct linux_sched_param {
- int sched_priority;
-};
-
-#define LINUX_SCHED_OTHER 0
-#define LINUX_SCHED_FIFO 1
-#define LINUX_SCHED_RR 2
-
-#endif /* _LINUX_SCHED_H_ */
diff --git a/sys/compat/linux/linux_sem.h b/sys/compat/linux/linux_sem.h
deleted file mode 100644
index c2aa18792e1..00000000000
--- a/sys/compat/linux/linux_sem.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: linux_sem.h,v 1.3 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_sem.h,v 1.1 1995/08/15 21:14:35 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SEM_H_
-#define _LINUX_SEM_H_
-
-/*
- * Operations for semctl(2), in addition to IPC_STAT and IPC_SET
- */
-#define LINUX_GETPID 11
-#define LINUX_GETVAL 12
-#define LINUX_GETALL 13
-#define LINUX_GETNCNT 14
-#define LINUX_GETZCNT 15
-#define LINUX_SETVAL 16
-#define LINUX_SETALL 17
-
-/*
- * Linux semid_ds structure. Internally used pointer fields are not
- * important to us and have been changed to void *
- */
-
-struct linux_semid_ds {
- struct linux_ipc_perm l_sem_perm;
- linux_time_t l_sem_otime;
- linux_time_t l_sem_ctime;
- void *l_sem_base;
- void *l_eventn;
- void *l_eventz;
- void *l_undo;
- ushort l_sem_nsems;
-};
-
-union linux_semun {
- int l_val;
- struct linux_semid_ds *l_buf;
- ushort *l_array;
- void *l___buf; /* For unsupported IPC_INFO */
- void *l___pad;
-};
-
-#endif /* _LINUX_SEM_H_ */
diff --git a/sys/compat/linux/linux_shm.h b/sys/compat/linux/linux_shm.h
deleted file mode 100644
index 72534306657..00000000000
--- a/sys/compat/linux/linux_shm.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: linux_shm.h,v 1.3 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_shm.h,v 1.1 1995/02/28 23:25:57 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SHM_H_
-#define _LINUX_SHM_H_
-
-/*
- * shm segment control structure
- */
-struct linux_shmid_ds {
- struct linux_ipc_perm l_shm_perm;
- int l_shm_segsz;
- linux_time_t l_shm_atime;
- linux_time_t l_shm_dtime;
- linux_time_t l_shm_ctime;
- ushort l_shm_cpid;
- ushort l_shm_lpid;
- short l_shm_nattch;
- ushort l_private1;
- void *l_private2;
- void *l_private3;
-};
-
-#define LINUX_SHM_RDONLY 0x1000
-#define LINUX_SHM_RND 0x2000
-#define LINUX_SHM_REMAP 0x4000
-
-#define LINUX_SHM_LOCK 11
-#define LINUX_SHM_UNLOCK 12
-#define LINUX_SHM_STAT 13
-#define LINUX_SHM_INFO 14
-
-#endif /* _LINUX_SHM_H_ */
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
deleted file mode 100644
index b4d474f7205..00000000000
--- a/sys/compat/linux/linux_signal.c
+++ /dev/null
@@ -1,935 +0,0 @@
-/* $OpenBSD: linux_signal.c,v 1.18 2015/02/09 13:41:24 pelikan Exp $ */
-/* $NetBSD: linux_signal.c,v 1.10 1996/04/04 23:51:36 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * heavily from: svr4_signal.c,v 1.7 1995/01/09 01:04:21 christos Exp
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/kernel.h>
-#include <sys/signal.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-
-#define sigemptyset(s) memset((s), 0, sizeof(*(s)))
-#define sigismember(s, n) (*(s) & sigmask(n))
-#define sigaddset(s, n) (*(s) |= sigmask(n))
-
-/* Locally used defines (in bsd<->linux conversion functions): */
-#define linux_sigmask(n) (1 << ((n) - 1))
-#define linux_sigemptyset(s) memset((s), 0, sizeof(*(s)))
-#define linux_sigismember(s, n) ((s)->sig[((n) - 1) / LINUX__NSIG_BPW] \
- & (1 << ((n) - 1) % LINUX__NSIG_BPW))
-#define linux_sigaddset(s, n) ((s)->sig[((n) - 1) / LINUX__NSIG_BPW] \
- |= (1 << ((n) - 1) % LINUX__NSIG_BPW))
-
-int bsd_to_linux_sig[NSIG] = {
- 0,
- LINUX_SIGHUP,
- LINUX_SIGINT,
- LINUX_SIGQUIT,
- LINUX_SIGILL,
- LINUX_SIGTRAP,
- LINUX_SIGABRT,
- LINUX_NSIG, /* XXX Kludge to get RT signal #32 to work */
- LINUX_SIGFPE,
- LINUX_SIGKILL,
- LINUX_SIGBUS,
- LINUX_SIGSEGV,
- LINUX_NSIG + 1, /* XXX Kludge to get RT signal #32 to work */
- LINUX_SIGPIPE,
- LINUX_SIGALRM,
- LINUX_SIGTERM,
- LINUX_SIGURG,
- LINUX_SIGSTOP,
- LINUX_SIGTSTP,
- LINUX_SIGCONT,
- LINUX_SIGCHLD,
- LINUX_SIGTTIN,
- LINUX_SIGTTOU,
- LINUX_SIGIO,
- LINUX_SIGXCPU,
- LINUX_SIGXFSZ,
- LINUX_SIGVTALRM,
- LINUX_SIGPROF,
- LINUX_SIGWINCH,
- 0, /* SIGINFO */
- LINUX_SIGUSR1,
- LINUX_SIGUSR2,
- 0, /* SIGTHR */
-};
-
-int linux_to_bsd_sig[LINUX__NSIG] = {
- 0,
- SIGHUP,
- SIGINT,
- SIGQUIT,
- SIGILL,
- SIGTRAP,
- SIGABRT,
- SIGBUS,
- SIGFPE,
- SIGKILL,
- SIGUSR1,
- SIGSEGV,
- SIGUSR2,
- SIGPIPE,
- SIGALRM,
- SIGTERM,
- 0, /* SIGSTKFLT */
- SIGCHLD,
- SIGCONT,
- SIGSTOP,
- SIGTSTP,
- SIGTTIN,
- SIGTTOU,
- SIGURG,
- SIGXCPU,
- SIGXFSZ,
- SIGVTALRM,
- SIGPROF,
- SIGWINCH,
- SIGIO,
- 0, /* SIGUNUSED */
- 0,
- SIGEMT, /* XXX Gruesome hack for linuxthreads: */
- SIGSYS, /* Map 1st 2 RT signals onto ones we handle. */
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-/*
- * Convert between Linux and BSD signal sets.
- */
-void
-linux_old_to_bsd_sigset(lss, bss)
- const linux_old_sigset_t *lss;
- sigset_t *bss;
-{
- linux_old_extra_to_bsd_sigset(lss, (const unsigned long *) 0, bss);
-}
-
-void
-bsd_to_linux_old_sigset(bss, lss)
- const sigset_t *bss;
- linux_old_sigset_t *lss;
-{
- bsd_to_linux_old_extra_sigset(bss, lss, (unsigned long *) 0);
-}
-
-void
-linux_old_extra_to_bsd_sigset(lss, extra, bss)
- const linux_old_sigset_t *lss;
- const unsigned long *extra;
- sigset_t *bss;
-{
- linux_sigset_t lsnew;
-
- /* convert old sigset to new sigset */
- linux_sigemptyset(&lsnew);
- lsnew.sig[0] = *lss;
- if (extra)
- bcopy(extra, &lsnew.sig[1],
- sizeof(linux_sigset_t) - sizeof(linux_old_sigset_t));
-
- linux_to_bsd_sigset(&lsnew, bss);
-}
-
-void
-bsd_to_linux_old_extra_sigset(bss, lss, extra)
- const sigset_t *bss;
- linux_old_sigset_t *lss;
- unsigned long *extra;
-{
- linux_sigset_t lsnew;
-
- bsd_to_linux_sigset(bss, &lsnew);
-
- /* convert new sigset to old sigset */
- *lss = lsnew.sig[0];
- if (extra)
- bcopy(&lsnew.sig[1], extra,
- sizeof(linux_sigset_t) - sizeof(linux_old_sigset_t));
-}
-
-void
-linux_to_bsd_sigset(lss, bss)
- const linux_sigset_t *lss;
- sigset_t *bss;
-{
- int i, newsig;
-
- sigemptyset(bss);
- for (i = 1; i < LINUX__NSIG; i++) {
- if (linux_sigismember(lss, i)) {
- newsig = linux_to_bsd_sig[i];
- if (newsig)
- sigaddset(bss, newsig);
- }
- }
-}
-
-void
-bsd_to_linux_sigset(bss, lss)
- const sigset_t *bss;
- linux_sigset_t *lss;
-{
- int i, newsig;
-
- linux_sigemptyset(lss);
- for (i = 1; i < NSIG; i++) {
- if (sigismember(bss, i)) {
- newsig = bsd_to_linux_sig[i];
- if (newsig)
- linux_sigaddset(lss, newsig);
- }
- }
-}
-
-/*
- * Convert between Linux and BSD sigaction structures. Linux has
- * one extra field (sa_restorer) which we don't support.
- */
-void
-linux_old_to_bsd_sigaction(lsa, bsa)
- struct linux_old_sigaction *lsa;
- struct sigaction *bsa;
-{
-
- bsa->sa_handler = lsa->sa__handler;
- linux_old_to_bsd_sigset(&lsa->sa_mask, &bsa->sa_mask);
- bsa->sa_flags = 0;
- if ((lsa->sa_flags & LINUX_SA_ONSTACK) != 0)
- bsa->sa_flags |= SA_ONSTACK;
- if ((lsa->sa_flags & LINUX_SA_RESTART) != 0)
- bsa->sa_flags |= SA_RESTART;
- if ((lsa->sa_flags & LINUX_SA_ONESHOT) != 0)
- bsa->sa_flags |= SA_RESETHAND;
- if ((lsa->sa_flags & LINUX_SA_NOCLDSTOP) != 0)
- bsa->sa_flags |= SA_NOCLDSTOP;
- if ((lsa->sa_flags & LINUX_SA_NOMASK) != 0)
- bsa->sa_flags |= SA_NODEFER;
-}
-
-void
-bsd_to_linux_old_sigaction(bsa, lsa)
- struct sigaction *bsa;
- struct linux_old_sigaction *lsa;
-{
-
- lsa->sa__handler = bsa->sa_handler;
- bsd_to_linux_old_sigset(&bsa->sa_mask, &lsa->sa_mask);
- lsa->sa_flags = 0;
- if ((bsa->sa_flags & SA_NOCLDSTOP) != 0)
- lsa->sa_flags |= LINUX_SA_NOCLDSTOP;
- if ((bsa->sa_flags & SA_ONSTACK) != 0)
- lsa->sa_flags |= LINUX_SA_ONSTACK;
- if ((bsa->sa_flags & SA_RESTART) != 0)
- lsa->sa_flags |= LINUX_SA_RESTART;
- if ((bsa->sa_flags & SA_NODEFER) != 0)
- lsa->sa_flags |= LINUX_SA_NOMASK;
- if ((bsa->sa_flags & SA_RESETHAND) != 0)
- lsa->sa_flags |= LINUX_SA_ONESHOT;
- lsa->sa_restorer = NULL;
-}
-
-void
-linux_to_bsd_sigaction(lsa, bsa)
- struct linux_sigaction *lsa;
- struct sigaction *bsa;
-{
-
- bsa->sa_handler = lsa->sa__handler;
- linux_to_bsd_sigset(&lsa->sa_mask, &bsa->sa_mask);
- bsa->sa_flags = 0;
- if ((lsa->sa_flags & LINUX_SA_NOCLDSTOP) != 0)
- bsa->sa_flags |= SA_NOCLDSTOP;
- if ((lsa->sa_flags & LINUX_SA_ONSTACK) != 0)
- bsa->sa_flags |= SA_ONSTACK;
- if ((lsa->sa_flags & LINUX_SA_RESTART) != 0)
- bsa->sa_flags |= SA_RESTART;
- if ((lsa->sa_flags & LINUX_SA_ONESHOT) != 0)
- bsa->sa_flags |= SA_RESETHAND;
- if ((lsa->sa_flags & LINUX_SA_NOMASK) != 0)
- bsa->sa_flags |= SA_NODEFER;
- if ((lsa->sa_flags & LINUX_SA_SIGINFO) != 0)
- bsa->sa_flags |= SA_SIGINFO;
-}
-
-void
-bsd_to_linux_sigaction(bsa, lsa)
- struct sigaction *bsa;
- struct linux_sigaction *lsa;
-{
-
- /* Clear sa_flags and sa_restorer (if it exists) */
- memset(lsa, 0, sizeof(struct linux_sigaction));
-
- /* ...and fill in the mask and flags */
- bsd_to_linux_sigset(&bsa->sa_mask, &lsa->sa_mask);
- if ((bsa->sa_flags & SA_NOCLDSTOP) != 0)
- lsa->sa_flags |= LINUX_SA_NOCLDSTOP;
- if ((bsa->sa_flags & SA_ONSTACK) != 0)
- lsa->sa_flags |= LINUX_SA_ONSTACK;
- if ((bsa->sa_flags & SA_RESTART) != 0)
- lsa->sa_flags |= LINUX_SA_RESTART;
- if ((bsa->sa_flags & SA_NODEFER) != 0)
- lsa->sa_flags |= LINUX_SA_NOMASK;
- if ((bsa->sa_flags & SA_RESETHAND) != 0)
- lsa->sa_flags |= LINUX_SA_ONESHOT;
- if ((bsa->sa_flags & SA_SIGINFO) != 0)
- lsa->sa_flags |= LINUX_SA_SIGINFO;
- lsa->sa__handler = bsa->sa_handler;
-}
-
-int
-linux_to_bsd_signal(int linuxsig, int *bsdsig)
-{
- if (linuxsig < 0 || linuxsig >= LINUX__NSIG)
- return (EINVAL);
-
- *bsdsig = linux_to_bsd_sig[linuxsig];
- return (0);
-}
-
-int
-bsd_to_linux_signal(int bsdsig, int *linuxsig)
-{
- if (bsdsig < 0 || bsdsig >= NSIG)
- return (EINVAL);
-
- *linuxsig = bsd_to_linux_sig[bsdsig];
- return (0);
-}
-
-/*
- * The Linux sigaction() system call. Do the usual conversions,
- * and just call sigaction(). Some flags and values are silently
- * ignored (see above).
- */
-int
-linux_sys_sigaction(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigaction_args /* {
- syscallarg(int) signum;
- syscallarg(struct linux_old_sigaction *) nsa;
- syscallarg(struct linux_old_sigaction *) osa;
- } */ *uap = v;
- struct linux_old_sigaction *nlsa, *olsa, tmplsa;
- struct sigaction *nbsa, *obsa, tmpbsa;
- struct sys_sigaction_args sa;
- caddr_t sg;
- int error;
-
- if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX__NSIG)
- return (EINVAL);
-
- sg = stackgap_init(p);
- nlsa = SCARG(uap, nsa);
- olsa = SCARG(uap, osa);
-
- if (olsa != NULL)
- obsa = stackgap_alloc(&sg, sizeof(struct sigaction));
- else
- obsa = NULL;
-
- if (nlsa != NULL) {
- nbsa = stackgap_alloc(&sg, sizeof(struct sigaction));
- if ((error = copyin(nlsa, &tmplsa, sizeof(tmplsa))) != 0)
- return (error);
- linux_old_to_bsd_sigaction(&tmplsa, &tmpbsa);
- if ((error = copyout(&tmpbsa, nbsa, sizeof(tmpbsa))) != 0)
- return (error);
- } else
- nbsa = NULL;
-
- SCARG(&sa, signum) = linux_to_bsd_sig[SCARG(uap, signum)];
- SCARG(&sa, nsa) = nbsa;
- SCARG(&sa, osa) = obsa;
-
- /* Silently ignore unknown signals */
- if (SCARG(&sa, signum) == 0) {
- if (obsa != NULL) {
- obsa->sa_handler = SIG_IGN;
- sigemptyset(&obsa->sa_mask);
- obsa->sa_flags = 0;
- }
- }
- else {
- if ((error = sys_sigaction(p, &sa, retval)) != 0)
- return (error);
- }
-
- if (olsa != NULL) {
- if ((error = copyin(obsa, &tmpbsa, sizeof(tmpbsa))) != 0)
- return (error);
- bsd_to_linux_old_sigaction(&tmpbsa, &tmplsa);
- if ((error = copyout(&tmplsa, olsa, sizeof(tmplsa))) != 0)
- return (error);
- }
-
- return (0);
-}
-
-int
-linux_sys_rt_sigaction(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rt_sigaction_args /* {
- syscallarg(int) signum;
- syscallarg(struct linux_sigaction *) nsa;
- syscallarg(struct linux_sigaction *) osa;
- syscallarg(size_t) sigsetsize;
- } */ *uap = v;
- struct linux_sigaction *nlsa, *olsa, tmplsa;
- struct sigaction *nbsa, *obsa, tmpbsa;
- struct sys_sigaction_args sa;
- caddr_t sg;
- int error;
-
- if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t))
- return (EINVAL);
-
- if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX__NSIG)
- return (EINVAL);
-
- sg = stackgap_init(p);
- nlsa = SCARG(uap, nsa);
- olsa = SCARG(uap, osa);
-
- if (olsa != NULL)
- obsa = stackgap_alloc(&sg, sizeof(struct sigaction));
- else
- obsa = NULL;
-
- if (nlsa != NULL) {
- nbsa = stackgap_alloc(&sg, sizeof(struct sigaction));
- if ((error = copyin(nlsa, &tmplsa, sizeof(tmplsa))) != 0)
- return (error);
- linux_to_bsd_sigaction(&tmplsa, &tmpbsa);
- if ((error = copyout(&tmpbsa, nbsa, sizeof(tmpbsa))) != 0)
- return (error);
- }
- else
- nbsa = NULL;
-
- SCARG(&sa, signum) = linux_to_bsd_sig[SCARG(uap, signum)];
- SCARG(&sa, nsa) = nbsa;
- SCARG(&sa, osa) = obsa;
-
- /* Silently ignore unknown signals */
- if (SCARG(&sa, signum) == 0) {
- if (obsa != NULL) {
- obsa->sa_handler = SIG_IGN;
- sigemptyset(&obsa->sa_mask);
- obsa->sa_flags = 0;
- }
- }
- else {
- if ((error = sys_sigaction(p, &sa, retval)) != 0)
- return (error);
- }
-
- if (olsa != NULL) {
- if ((error = copyin(obsa, &tmpbsa, sizeof(tmpbsa))) != 0)
- return (error);
- bsd_to_linux_sigaction(&tmpbsa, &tmplsa);
- if ((error = copyout(&tmplsa, olsa, sizeof(tmplsa))) != 0)
- return (error);
- }
-
- return (0);
-}
-
-/*
- * The Linux signal() system call. I think that the signal() in the C
- * library actually calls sigaction, so I doubt this one is ever used.
- * But hey, it can't hurt having it here. The same restrictions as for
- * sigaction() apply.
- */
-int
-linux_sys_signal(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_signal_args /* {
- syscallarg(int) sig;
- syscallarg(linux_handler_t) handler;
- } */ *uap = v;
- caddr_t sg;
- struct sys_sigaction_args sa_args;
- struct sigaction *osa, *nsa, tmpsa;
- int error;
-
- if (SCARG(uap, sig) < 0 || SCARG(uap, sig) >= LINUX__NSIG)
- return (EINVAL);
-
- sg = stackgap_init(p);
- nsa = stackgap_alloc(&sg, sizeof *nsa);
- osa = stackgap_alloc(&sg, sizeof *osa);
-
- tmpsa.sa_handler = SCARG(uap, handler);
- tmpsa.sa_mask = (sigset_t) 0;
- tmpsa.sa_flags = SA_RESETHAND | SA_NODEFER;
- if ((error = copyout(&tmpsa, nsa, sizeof tmpsa)))
- return (error);
-
- SCARG(&sa_args, signum) = linux_to_bsd_sig[SCARG(uap, sig)];
- SCARG(&sa_args, osa) = osa;
- SCARG(&sa_args, nsa) = nsa;
-
- /* Silently ignore unknown signals */
- if (SCARG(&sa_args, signum) != 0) {
- if ((error = sys_sigaction(p, &sa_args, retval)))
- return (error);
- }
-
- if ((error = copyin(osa, &tmpsa, sizeof *osa)))
- return (error);
- retval[0] = (register_t) tmpsa.sa_handler;
-
- return (0);
-}
-
-/*
- * This is just a copy of the svr4 compat one. I feel so creative now.
- */
-int
-linux_sys_sigprocmask(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigprocmask_args /* {
- syscallarg(int) how;
- syscallarg(linux_old_sigset_t *) set;
- syscallarg(linux_old_sigset_t *) oset;
- } */ *uap = v;
- linux_old_sigset_t ss;
- sigset_t bs;
- int error = 0;
-
- *retval = 0;
-
- if (SCARG(uap, oset) != NULL) {
- /* Fix the return value first if needed */
- bsd_to_linux_old_sigset(&p->p_sigmask, &ss);
- if ((error = copyout(&ss, SCARG(uap, oset), sizeof(ss))) != 0)
- return (error);
- }
-
- if (SCARG(uap, set) == NULL)
- /* Just examine */
- return (0);
-
- if ((error = copyin(SCARG(uap, set), &ss, sizeof(ss))) != 0)
- return (error);
-
- linux_old_to_bsd_sigset(&ss, &bs);
-
- bs &= ~sigcantmask;
- switch (SCARG(uap, how)) {
- case LINUX_SIG_BLOCK:
- atomic_setbits_int(&p->p_sigmask, bs);
- break;
-
- case LINUX_SIG_UNBLOCK:
- atomic_clearbits_int(&p->p_sigmask, bs);
- break;
-
- case LINUX_SIG_SETMASK:
- p->p_sigmask = bs;
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- return (error);
-}
-
-int
-linux_sys_rt_sigprocmask(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rt_sigprocmask_args /* {
- syscallarg(int) how;
- syscallarg(const linux_sigset_t *) set;
- syscallarg(linux_sigset_t *) oset;
- syscallarg(size_t) sigsetsize;
- } */ *uap = v;
- linux_sigset_t ls;
- sigset_t bs;
- int error = 0;
-
- if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t))
- return (EINVAL);
-
- *retval = 0;
-
- if (SCARG(uap, oset) != NULL) {
- /* Fix the return value first if needed */
- bsd_to_linux_sigset(&p->p_sigmask, &ls);
- if ((error = copyout(&ls, SCARG(uap, oset), sizeof(ls))) != 0)
- return (error);
- }
-
- if (SCARG(uap, set) == NULL)
- /* Just examine */
- return (0);
-
- if ((error = copyin(SCARG(uap, set), &ls, sizeof(ls))) != 0)
- return (error);
-
- linux_to_bsd_sigset(&ls, &bs);
-
- bs &= ~sigcantmask;
- switch (SCARG(uap, how)) {
- case LINUX_SIG_BLOCK:
- atomic_setbits_int(&p->p_sigmask, bs);
- break;
-
- case LINUX_SIG_UNBLOCK:
- atomic_clearbits_int(&p->p_sigmask, bs);
- break;
-
- case LINUX_SIG_SETMASK:
- p->p_sigmask = bs;
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- return (error);
-}
-
-/*
- * The functions below really make no distinction between an int
- * and [linux_]sigset_t. This is ok for now, but it might break
- * sometime. Then again, sigset_t is trusted to be an int everywhere
- * else in the kernel too.
- */
-/* ARGSUSED */
-int
-linux_sys_siggetmask(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
-
- bsd_to_linux_old_sigset(&p->p_sigmask, (linux_old_sigset_t *)retval);
- return (0);
-}
-
-/*
- * The following three functions fiddle with a process' signal mask.
- * Convert the signal masks because of the different signal
- * values for Linux. The need for this is the reason why
- * they are here, and have not been mapped directly.
- */
-int
-linux_sys_sigsetmask(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigsetmask_args /* {
- syscallarg(linux_old_sigset_t) mask;
- } */ *uap = v;
- linux_old_sigset_t mask;
- sigset_t bsdsig;
-
- bsd_to_linux_old_sigset(&p->p_sigmask, (linux_old_sigset_t *)retval);
-
- mask = SCARG(uap, mask);
- bsd_to_linux_old_sigset(&bsdsig, &mask);
-
- p->p_sigmask = bsdsig & ~sigcantmask;
-
- return (0);
-}
-
-int
-linux_sys_sigpending(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigpending_args /* {
- syscallarg(linux_old_sigset_t *) mask;
- } */ *uap = v;
- sigset_t bs;
- linux_old_sigset_t ls;
-
- bs = p->p_siglist & p->p_sigmask;
- bsd_to_linux_old_sigset(&bs, &ls);
-
- return (copyout(&ls, SCARG(uap, mask), sizeof ls));
-}
-
-int
-linux_sys_rt_sigpending(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rt_sigpending_args /* {
- syscallarg(linux_sigset_t *) set;
- syscallarg(size_t) sigsetsize;
- } */ *uap = v;
- sigset_t bs;
- linux_sigset_t ls;
-
- if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t))
- return (EINVAL);
-
- bs = p->p_siglist & p->p_sigmask;
- bsd_to_linux_sigset(&bs, &ls);
-
- return (copyout(&ls, SCARG(uap, set), sizeof ls));
-}
-
-int
-linux_sys_sigsuspend(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigsuspend_args /* {
- syscallarg(caddr_t) restart;
- syscallarg(int) oldmask;
- syscallarg(int) mask;
- } */ *uap = v;
- struct sys_sigsuspend_args sa;
- linux_old_sigset_t mask = SCARG(uap, mask);
-
- linux_old_to_bsd_sigset(&mask, &SCARG(&sa, mask));
- return (sys_sigsuspend(p, &sa, retval));
-}
-
-int
-linux_sys_rt_sigsuspend(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_rt_sigsuspend_args /* {
- syscallarg(sigset_t *) unewset;
- syscallarg(size_t) sigsetsize;
- } */ *uap = v;
- struct sys_sigsuspend_args sa;
- linux_sigset_t mask;
- int error;
-
- if (SCARG(uap, sigsetsize) != sizeof(linux_sigset_t))
- return (EINVAL);
-
- error = copyin(SCARG(uap, unewset), &mask, sizeof mask);
- if (error)
- return (error);
-
- linux_to_bsd_sigset(&mask, &SCARG(&sa, mask));
- return (sys_sigsuspend(p, &sa, retval));
-}
-
-/*
- * Linux' sigaltstack structure is just of a different order than BSD's
- * so just shuffle the fields around and call our version.
- */
-int
-linux_sys_sigaltstack(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_sigaltstack_args /* {
- syscallarg(const struct linux_sigaltstack *) nss;
- syscallarg(struct linux_sigaltstack *) oss;
- } */ *uap = v;
- struct linux_sigaltstack linux_ss;
- struct sigaltstack *bsd_nss, *bsd_oss;
- struct sys_sigaltstack_args sa;
- int error;
- caddr_t sg;
-
- sg = stackgap_init(p);
-
- if (SCARG(uap, nss) != NULL) {
- bsd_nss = stackgap_alloc(&sg, sizeof *bsd_nss);
-
- error = copyin(SCARG(uap, nss), &linux_ss, sizeof linux_ss);
- if (error)
- return (error);
-
- bsd_nss->ss_sp = linux_ss.ss_sp;
- bsd_nss->ss_size = linux_ss.ss_size;
- bsd_nss->ss_flags = (linux_ss.ss_flags & LINUX_SS_DISABLE) ?
- SS_DISABLE : 0;
-
- SCARG(&sa, nss) = bsd_nss;
- } else
- SCARG(&sa, nss) = NULL;
-
- if (SCARG(uap, oss) == NULL) {
- SCARG(&sa, oss) = NULL;
- return (sys_sigaltstack(p, &sa, retval));
- }
- SCARG(&sa, oss) = bsd_oss = stackgap_alloc(&sg, sizeof *bsd_oss);
-
- error = sys_sigaltstack(p, &sa, retval);
- if (error)
- return (error);
-
- linux_ss.ss_sp = bsd_oss->ss_sp;
- linux_ss.ss_size = bsd_oss->ss_size;
- linux_ss.ss_flags = 0;
- if (bsd_oss->ss_flags & SS_ONSTACK)
- linux_ss.ss_flags |= LINUX_SS_ONSTACK;
- if (bsd_oss->ss_flags & SS_DISABLE)
- linux_ss.ss_flags |= LINUX_SS_DISABLE;
- return (copyout(&linux_ss, SCARG(uap, oss), sizeof linux_ss));
-}
-
-/*
- * The deprecated pause(2), which is really just an instance
- * of sigsuspend(2).
- */
-int
-linux_sys_pause(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigsuspend_args bsa;
-
- SCARG(&bsa, mask) = p->p_sigmask;
- return (sys_sigsuspend(p, &bsa, retval));
-}
-
-/*
- * Once more: only a signal conversion is needed.
- */
-int
-linux_sys_kill(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_kill_args /* {
- syscallarg(int) pid;
- syscallarg(int) signum;
- } */ *uap = v;
- struct sys_kill_args ka;
-
- SCARG(&ka, pid) = SCARG(uap, pid);
- if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX__NSIG)
- return (EINVAL);
- SCARG(&ka, signum) = linux_to_bsd_sig[SCARG(uap, signum)];
- return (sys_kill(p, &ka, retval));
-}
-
-int
-linux_sys_tgkill(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_tgkill_args /* {
- syscallarg(int) tgid;
- syscallarg(int) tid;
- syscallarg(int) sig;
- }; */ *uap = v;
-
- int error;
- int sig;
- struct sys_kill_args ka;
-
- if (SCARG(uap, tgid) < 0 || SCARG(uap, tid) < 0)
- return (EINVAL);
-
- if ((error = linux_to_bsd_signal(SCARG(uap, sig), &sig)))
- return (error);
-
- /* XXX: Ignoring tgid, behaving like the obsolete linux_sys_tkill */
- SCARG(&ka, pid) = SCARG(uap, tid);
- SCARG(&ka, signum) = sig;
- return (sys_kill(p, &ka, retval));
-}
diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h
deleted file mode 100644
index 26f44aee300..00000000000
--- a/sys/compat/linux/linux_signal.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: linux_signal.h,v 1.9 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_signal.h,v 1.4 1995/08/27 20:51:51 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SIGNAL_H_
-#define _LINUX_SIGNAL_H_
-
-#define LINUX_SIGHUP 1
-#define LINUX_SIGINT 2
-#define LINUX_SIGQUIT 3
-#define LINUX_SIGILL 4
-#define LINUX_SIGTRAP 5
-#define LINUX_SIGABRT 6
-#define LINUX_SIGIOT 6
-#define LINUX_SIGBUS 7
-#define LINUX_SIGFPE 8
-#define LINUX_SIGKILL 9
-#define LINUX_SIGUSR1 10
-#define LINUX_SIGSEGV 11
-#define LINUX_SIGUSR2 12
-#define LINUX_SIGPIPE 13
-#define LINUX_SIGALRM 14
-#define LINUX_SIGTERM 15
-#define LINUX_SIGSTKFLT 16
-#define LINUX_SIGCHLD 17
-#define LINUX_SIGCONT 18
-#define LINUX_SIGSTOP 19
-#define LINUX_SIGTSTP 20
-#define LINUX_SIGTTIN 21
-#define LINUX_SIGTTOU 22
-#define LINUX_SIGURG 23
-#define LINUX_SIGXCPU 24
-#define LINUX_SIGXFSZ 25
-#define LINUX_SIGVTALRM 26
-#define LINUX_SIGPROF 27
-#define LINUX_SIGWINCH 28
-#define LINUX_SIGIO 29
-#define LINUX_SIGPWR 30
-#define LINUX_SIGUNUSED 31
-#define LINUX_NSIG 32
-
-#define LINUX__NSIG 64
-#define LINUX__NSIG_BPW 32
-#define LINUX__NSIG_WORDS (LINUX__NSIG / LINUX__NSIG_BPW)
-
-#define LINUX_SIG_BLOCK 0
-#define LINUX_SIG_UNBLOCK 1
-#define LINUX_SIG_SETMASK 2
-
-typedef u_long linux_old_sigset_t;
-typedef struct {
- u_long sig[LINUX__NSIG_WORDS];
-} linux_sigset_t;
-
-typedef void (*linux_handler_t)(int);
-
-struct linux_old_sigaction {
- linux_handler_t sa__handler;
- linux_old_sigset_t sa_mask;
- u_long sa_flags;
- void (*sa_restorer)(void);
-};
-
-struct linux_sigaction {
- linux_handler_t sa__handler;
- u_long sa_flags;
- void (*sa_restorer)(void);
- linux_sigset_t sa_mask;
-};
-
-/* sa_flags */
-#define LINUX_SA_NOCLDSTOP 0x00000001
-#define LINUX_SA_SIGINFO 0x00000004
-#define LINUX_SA_ONSTACK 0x08000000
-#define LINUX_SA_RESTART 0x10000000
-#define LINUX_SA_INTERRUPT 0x20000000
-#define LINUX_SA_NOMASK 0x40000000
-#define LINUX_SA_ONESHOT 0x80000000
-#define LINUX_SA_ALLBITS 0xf8000001
-
-struct linux_sigaltstack {
- void *ss_sp;
- int ss_flags;
- size_t ss_size;
-};
-
-/* ss_flags */
-#define LINUX_SS_ONSTACK 0x00000001
-#define LINUX_SS_DISABLE 0x00000002
-
-extern int bsd_to_linux_sig[];
-extern int linux_to_bsd_sig[];
-
-void linux_old_to_bsd_sigset(const linux_old_sigset_t *, sigset_t *);
-void bsd_to_linux_old_sigset(const sigset_t *, linux_old_sigset_t *);
-
-void linux_old_extra_to_bsd_sigset(const linux_old_sigset_t *,
- const unsigned long *, sigset_t *);
-void bsd_to_linux_old_extra_sigset(const sigset_t *,
- linux_old_sigset_t *, unsigned long *);
-
-void linux_to_bsd_sigset(const linux_sigset_t *, sigset_t *);
-void bsd_to_linux_sigset(const sigset_t *, linux_sigset_t *);
-
-void linux_old_to_bsd_sigaction(struct linux_old_sigaction *,
- struct sigaction *);
-void bsd_to_linux_old_sigaction(struct sigaction *,
- struct linux_old_sigaction *);
-
-void linux_to_bsd_sigaction(struct linux_sigaction *,
- struct sigaction *);
-void bsd_to_linux_sigaction(struct sigaction *,
- struct linux_sigaction *);
-
-int linux_to_bsd_signal (int, int *);
-int bsd_to_linux_signal (int, int *);
-
-#endif /* !_LINUX_SIGNAL_H_ */
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
deleted file mode 100644
index 1777f1fd43b..00000000000
--- a/sys/compat/linux/linux_socket.c
+++ /dev/null
@@ -1,1511 +0,0 @@
-/* $OpenBSD: linux_socket.c,v 1.61 2015/05/06 08:52:17 mpi Exp $ */
-/* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/domain.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/mbuf.h>
-#include <sys/selinfo.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/un.h>
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/tcp.h>
-#include <sys/mount.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_socket.h>
-#include <compat/linux/linux_socketcall.h>
-#include <compat/linux/linux_sockio.h>
-
-/*
- * All the calls in this file are entered via one common system
- * call in Linux, represented here by linux_socketcall().
- * Arguments for the various calls are on the user stack. A pointer
- * to them is the only thing that is passed. It is up to the various
- * calls to copy them in themselves. To make it look better, they
- * are copied to structures.
- */
-
-static int linux_to_bsd_domain (int);
-static int bsd_to_linux_domain(int);
-
-static int linux_to_bsd_msg_flags(int);
-
-int linux_socket(struct proc *, void *, register_t *);
-int linux_bind(struct proc *, void *, register_t *);
-int linux_connect(struct proc *, void *, register_t *);
-int linux_listen(struct proc *, void *, register_t *);
-int linux_accept(struct proc *, void *, register_t *);
-int linux_getsockname(struct proc *, void *, register_t *);
-int linux_getpeername(struct proc *, void *, register_t *);
-int linux_socketpair(struct proc *, void *, register_t *);
-int linux_send(struct proc *, void *, register_t *);
-int linux_recv(struct proc *, void *, register_t *);
-int linux_sendto(struct proc *, void *, register_t *);
-int linux_recvfrom(struct proc *, void *, register_t *);
-int linux_shutdown(struct proc *, void *, register_t *);
-int linux_to_bsd_sopt_level(int);
-int linux_to_bsd_so_sockopt(int);
-int linux_to_bsd_ip_sockopt(int);
-int linux_to_bsd_tcp_sockopt(int);
-int linux_to_bsd_udp_sockopt(int);
-int linux_setsockopt(struct proc *, void *, register_t *);
-int linux_getsockopt(struct proc *, void *, register_t *);
-int linux_recvmsg(struct proc *, void *, register_t *);
-int linux_sendmsg(struct proc *, void *, register_t *);
-
-int linux_check_hdrincl(struct proc *, int, register_t *, caddr_t *);
-int linux_sendto_hdrincl(struct proc *, struct sys_sendto_args *,
- register_t *, caddr_t *);
-
-int linux_sa_get(struct proc *, caddr_t *, struct sockaddr **,
- const struct linux_sockaddr *, int *);
-int linux_sa_put(struct sockaddr *);
-
-static const int linux_to_bsd_domain_[LINUX_AF_MAX] = {
- AF_UNSPEC,
- AF_UNIX,
- AF_INET,
- -1, /* LINUX_AF_AX25 */
- -1, /* IPX */
- -1 /* APPLETALK */
- -1, /* LINUX_AF_NETROM */
- -1, /* LINUX_AF_BRIDGE */
- -1, /* LINUX_AF_ATMPVC */
- -1, /* LINUX_AF_X25 */
- AF_INET6,
- -1, /* LINUX_AF_ROSE */
- AF_DECnet,
- -1, /* LINUX_AF_NETBEUI */
- -1, /* LINUX_AF_SECURITY */
- -1, /* pseudo_AF_KEY */
- AF_ROUTE, /* LINUX_AF_NETLINK */
- -1, /* LINUX_AF_PACKET */
- -1, /* LINUX_AF_ASH */
- -1, /* LINUX_AF_ECONET */
- -1, /* LINUX_AF_ATMSVC */
- AF_SNA,
- /* rest up to LINUX_AF_MAX-1 is not allocated */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-};
-
-static const int bsd_to_linux_domain_[AF_MAX] = {
- LINUX_AF_UNSPEC,
- LINUX_AF_UNIX,
- LINUX_AF_INET,
- -1, /* AF_IMPLINK */
- -1, /* AF_PUP */
- -1, /* AF_CHAOS */
- -1, /* AF_NS */
- -1, /* AF_ISO */
- -1, /* AF_ECMA */
- -1, /* AF_DATAKIT */
- -1, /* AF_CCITT */
- -1, /* LINUX_AF_SNA */
- -1, /* LINUX_AF_DECnet */
- -1, /* AF_DLI */
- -1, /* AF_LAT */
- -1, /* AF_HYLINK */
- LINUX_AF_APPLETALK,
- -1, /* LINUX_AF_NETLINK */
- -1, /* AF_LINK */
- -1, /* AF_XTP */
- -1, /* AF_COIP */
- -1, /* AF_CNT */
- -1, /* pseudo_AF_RTIP */
- LINUX_AF_IPX,
- LINUX_AF_INET6,
- -1, /* pseudo_AF_PIP */
- -1, /* AF_ISDN */
- -1, /* AF_NATM */
- -1, /* AF_ARP */
- -1, /* LINUX_pseudo_AF_KEY */
- -1, /* pseudo_AF_HDRCMPLT */
-};
-
-/*
- * Convert from Linux to BSD socket domain values
- */
-static int
-linux_to_bsd_domain(ldom)
- int ldom;
-{
- if (ldom < 0 || ldom >= LINUX_AF_MAX)
- return (-1);
-
- return linux_to_bsd_domain_[ldom];
-}
-
-/*
- * Convert from BSD to Linux socket domain values
- */
-static int
-bsd_to_linux_domain(bdom)
- int bdom;
-{
- if (bdom < 0 || bdom >= AF_MAX)
- return (-1);
-
- return bsd_to_linux_domain_[bdom];
-}
-
-/*
- * Convert from Linux to BSD MSG_XXX flags
- */
-static int
-linux_to_bsd_msg_flags(int lflags)
-{
- int flags = 0;
-
- if (lflags & LINUX_MSG_OOB)
- flags |= MSG_OOB;
- if (lflags & LINUX_MSG_PEEK)
- flags |= MSG_PEEK;
- if (lflags & LINUX_MSG_DONTWAIT)
- flags |= MSG_DONTWAIT;
- if (lflags & LINUX_MSG_WAITALL)
- flags |= MSG_WAITALL;
- if (lflags & LINUX_MSG_NOSIGNAL)
- flags |= MSG_NOSIGNAL;
- return (flags);
-}
-
-int
-linux_socket(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_socket_args /* {
- syscallarg(int) domain;
- syscallarg(int) type;
- syscallarg(int) protocol;
- } */ *uap = v;
- struct linux_socket_args lsa;
- struct sys_socket_args bsa;
- int error;
-
- if ((error = copyin(uap, &lsa, sizeof lsa)))
- return error;
-
- SCARG(&bsa, protocol) = lsa.protocol;
- SCARG(&bsa, type) = lsa.type & LINUX_SOCKET_TYPE_MASK;
- SCARG(&bsa, domain) = linux_to_bsd_domain(lsa.domain);
- if (SCARG(&bsa, domain) == -1)
- return (EINVAL);
-
- if (lsa.type & ~(LINUX_SOCKET_TYPE_MASK | LINUX_SOCK_CLOEXEC |
- LINUX_SOCK_NONBLOCK))
- return (EINVAL);
- if (lsa.type & LINUX_SOCK_CLOEXEC)
- SCARG(&bsa, type) |= SOCK_CLOEXEC;
- if (lsa.type & LINUX_SOCK_NONBLOCK)
- SCARG(&bsa, type) |= SOCK_NONBLOCK;
-
- return (sys_socket(p, &bsa, retval));
-}
-
-int
-linux_bind(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_bind_args /* {
- syscallarg(int) s;
- syscallarg(struct linux_sockaddr *) name;
- syscallarg(int) namelen;
- } */ *uap = v;
- struct linux_bind_args lba;
- struct sys_bind_args bba;
- int error;
- int namlen;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lba, sizeof lba)))
- return error;
-
- SCARG(&bba, s) = lba.s;
- namlen = lba.namelen;
- if (lba.name) {
- struct sockaddr *sa;
- caddr_t sg = stackgap_init(p);
-
- error = linux_sa_get(p, &sg, &sa, lba.name, &namlen);
- if (error)
- return (error);
- SCARG(&bba, name) = sa;
- } else
- SCARG(&bba, name) = NULL;
- SCARG(&bba, namelen) = namlen;
-
- return sys_bind(p, &bba, retval);
-}
-
-int
-linux_connect(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_connect_args /* {
- syscallarg(int) s;
- syscallarg(struct linux_sockaddr *) name;
- syscallarg(int) namelen;
- } */ *uap = v;
- struct linux_connect_args lca;
- struct sys_connect_args bca;
- struct sockaddr *sa;
- caddr_t sg = stackgap_init(p);
- int namlen;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lca, sizeof lca)))
- return error;
-
- namlen = lca.namelen;
- error = linux_sa_get(p, &sg, &sa, lca.name, &namlen);
- if (error)
- return (error);
-
- SCARG(&bca, s) = lca.s;
- SCARG(&bca, name) = sa;
- SCARG(&bca, namelen) = (unsigned int)namlen;
-
- error = sys_connect(p, &bca, retval);
-
- if (error == EISCONN) {
- struct sys_getsockopt_args bga;
-#if 0
- struct sys_fcntl_args fca;
-#endif
- void *status, *statusl;
- int stat, statl = sizeof stat;
-
-#if 0
- SCARG(&fca, fd) = lca.s;
- SCARG(&fca, cmd) = F_GETFL;
- SCARG(&fca, arg) = 0;
- if (sys_fcntl(p, &fca, retval) == -1 ||
- (*retval & O_NONBLOCK) == 0)
- return error;
-#endif
-
- status = stackgap_alloc(&sg, sizeof stat);
- statusl = stackgap_alloc(&sg, sizeof statl);
-
- if ((error = copyout(&statl, statusl, sizeof statl)))
- return error;
-
- SCARG(&bga, s) = lca.s;
- SCARG(&bga, level) = SOL_SOCKET;
- SCARG(&bga, name) = SO_ERROR;
- SCARG(&bga, val) = status;
- SCARG(&bga, avalsize) = statusl;
-
- error = sys_getsockopt(p, &bga, retval);
- if (error)
- return error;
- if ((error = copyin(status, &stat, sizeof stat)))
- return error;
- return stat;
- }
- return error;
-}
-
-int
-linux_listen(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_listen_args /* {
- syscallarg(int) s;
- syscallarg(int) backlog;
- } */ *uap = v;
- struct linux_listen_args lla;
- struct sys_listen_args bla;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lla, sizeof lla)))
- return error;
-
- SCARG(&bla, s) = lla.s;
- SCARG(&bla, backlog) = lla.backlog;
-
- return sys_listen(p, &bla, retval);
-}
-
-int
-linux_accept(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_accept_args /* {
- syscallarg(int) s;
- syscallarg(struct sockaddr *) addr;
- syscallarg(int *) namelen;
- } */ *uap = v;
- struct linux_accept_args laa;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &laa, sizeof laa)))
- return error;
-
- if ((error = doaccept(p, laa.s, laa.addr, laa.namelen, 0, retval)))
- return (error);
-
- return (linux_sa_put(laa.addr));
-}
-
-int
-linux_getsockname(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_getsockname_args /* {
- syscallarg(int) s;
- syscallarg(struct sockaddr *) addr;
- syscallarg(int *) namelen;
- } */ *uap = v;
- struct linux_getsockname_args lga;
- struct sys_getsockname_args bga;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lga, sizeof lga)))
- return error;
-
- SCARG(&bga, fdes) = lga.s;
- SCARG(&bga, asa) = lga.addr;
- SCARG(&bga, alen) = lga.namelen;
-
- error = sys_getsockname(p, &bga, retval);
- if (error)
- return (error);
-
- return (linux_sa_put(lga.addr));
-}
-
-int
-linux_getpeername(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_getpeername_args /* {
- syscallarg(int) s;
- syscallarg(struct sockaddr *) addr;
- syscallarg(int *) namelen;
- } */ *uap = v;
- struct linux_getpeername_args lga;
- struct sys_getpeername_args bga;
- int error;
-
- if ((error = copyin(uap, &lga, sizeof lga)))
- return error;
-
- SCARG(&bga, fdes) = lga.s;
- SCARG(&bga, asa) = lga.addr;
- SCARG(&bga, alen) = lga.namelen;
-
- error = sys_getpeername(p, &bga, retval);
- if (error)
- return (error);
-
- return (linux_sa_put(lga.addr));
-}
-
-int
-linux_socketpair(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_socketpair_args /* {
- syscallarg(int) domain;
- syscallarg(int) type;
- syscallarg(int) protocol;
- syscallarg(int *) rsv;
- } */ *uap = v;
- struct linux_socketpair_args lsa;
- struct sys_socketpair_args bsa;
- int error;
-
- if ((error = copyin((caddr_t) uap, &lsa, sizeof lsa)))
- return error;
-
- SCARG(&bsa, domain) = linux_to_bsd_domain(lsa.domain);
- if (SCARG(&bsa, domain) == -1)
- return EINVAL;
- SCARG(&bsa, type) = lsa.type;
- SCARG(&bsa, protocol) = lsa.protocol;
- SCARG(&bsa, rsv) = lsa.rsv;
-
- return sys_socketpair(p, &bsa, retval);
-}
-
-int
-linux_send(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_send_args /* {
- syscallarg(int) s;
- syscallarg(void *) msg;
- syscallarg(int) len;
- syscallarg(int) flags;
- } */ *uap = v;
- struct linux_send_args lsa;
- struct msghdr msg;
- struct iovec aiov;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
- return error;
-
- msg.msg_name = 0;
- msg.msg_namelen = 0;
- msg.msg_iov = &aiov;
- msg.msg_iovlen = 1;
- aiov.iov_base = lsa.msg;
- aiov.iov_len = lsa.len;
- msg.msg_control = 0;
- msg.msg_flags = 0;
-
- return (sendit(p, lsa.s, &msg, linux_to_bsd_msg_flags(lsa.flags),
- retval));
-}
-
-int
-linux_recv(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_recv_args /* {
- syscallarg(int) s;
- syscallarg(void *) msg;
- syscallarg(int) len;
- syscallarg(int) flags;
- } */ *uap = v;
- struct linux_recv_args lra;
- struct msghdr msg;
- struct iovec aiov;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lra, sizeof lra)))
- return error;
-
- msg.msg_name = 0;
- msg.msg_namelen = 0;
- msg.msg_iov = &aiov;
- msg.msg_iovlen = 1;
- aiov.iov_base = lra.msg;
- aiov.iov_len = lra.len;
- msg.msg_control = 0;
- msg.msg_flags = linux_to_bsd_msg_flags(lra.flags);
-
- return (recvit(p, lra.s, &msg, NULL, retval));
-}
-
-int
-linux_check_hdrincl(p, fd, retval, sgp)
- struct proc *p;
- int fd;
- register_t *retval;
- caddr_t *sgp;
-{
- struct sys_getsockopt_args /* {
- int s;
- int level;
- int name;
- caddr_t val;
- int *avalsize;
- } */ gsa;
- int error;
- caddr_t val;
- int *valsize;
- int size_val = sizeof val;
- int optval;
-
- val = stackgap_alloc(sgp, sizeof(optval));
- valsize = stackgap_alloc(sgp, sizeof(size_val));
-
- if ((error = copyout(&size_val, valsize, sizeof(size_val))))
- return (error);
- SCARG(&gsa, s) = fd;
- SCARG(&gsa, level) = IPPROTO_IP;
- SCARG(&gsa, name) = IP_HDRINCL;
- SCARG(&gsa, val) = val;
- SCARG(&gsa, avalsize) = valsize;
-
- if ((error = sys_getsockopt(p, &gsa, retval)))
- return (error);
- if ((error = copyin(val, &optval, sizeof(optval))))
- return (error);
- return (optval == 0);
-}
-
-/*
- * linux_ip_copysize defines how many bytes we should copy
- * from the beginning of the IP packet before we customize it for BSD.
- * It should include all the fields we modify (ip_len and ip_off)
- * and be as small as possible to minimize copying overhead.
- */
-#define linux_ip_copysize 8
-
-int
-linux_sendto_hdrincl(p, bsa, retval, sgp)
- struct proc *p;
- struct sys_sendto_args *bsa;
- register_t *retval;
- caddr_t *sgp;
-{
- struct sys_sendmsg_args ssa;
- struct ip *packet, rpacket;
- struct msghdr *msg, rmsg;
- struct iovec *iov, riov[2];
- int error;
-
- /* Check the packet isn't too small before we mess with it */
- if (SCARG(bsa, len) < linux_ip_copysize)
- return EINVAL;
-
- /*
- * Tweaking the user buffer in place would be bad manners.
- * We create a corrected IP header with just the needed length,
- * then use an iovec to glue it to the rest of the user packet
- * when calling sendmsg().
- */
- packet = (struct ip *)stackgap_alloc(sgp, linux_ip_copysize);
- msg = (struct msghdr *)stackgap_alloc(sgp, sizeof(*msg));
- iov = (struct iovec *)stackgap_alloc(sgp, sizeof(*iov)*2);
-
- /* Make a copy of the beginning of the packet to be sent */
- if ((error = copyin(SCARG(bsa, buf), (caddr_t)&rpacket,
- linux_ip_copysize)))
- return error;
-
- /* Convert fields from Linux to BSD raw IP socket format */
- rpacket.ip_len = SCARG(bsa, len);
- error = copyout(&rpacket, packet, linux_ip_copysize);
- if (error)
- return (error);
-
- riov[0].iov_base = (char *)packet;
- riov[0].iov_len = linux_ip_copysize;
- riov[1].iov_base = (caddr_t)SCARG(bsa, buf) + linux_ip_copysize;
- riov[1].iov_len = SCARG(bsa, len) - linux_ip_copysize;
-
- error = copyout(&riov[0], iov, sizeof(riov));
- if (error)
- return (error);
-
- /* Prepare the msghdr and iovec structures describing the new packet */
- rmsg.msg_name = (void *)SCARG(bsa, to);
- rmsg.msg_namelen = SCARG(bsa, tolen);
- rmsg.msg_iov = iov;
- rmsg.msg_iovlen = 2;
- rmsg.msg_control = NULL;
- rmsg.msg_controllen = 0;
- rmsg.msg_flags = 0;
-
- error = copyout(&riov[0], iov, sizeof(riov));
- if (error)
- return (error);
-
- SCARG(&ssa, s) = SCARG(bsa, s);
- SCARG(&ssa, msg) = msg;
- SCARG(&ssa, flags) = SCARG(bsa, flags);
- return sys_sendmsg(p, &ssa, retval);
-}
-
-int
-linux_sendto(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sendto_args /* {
- syscallarg(int) s;
- syscallarg(void *) msg;
- syscallarg(int) len;
- syscallarg(int) flags;
- syscallarg(linux_sockaddr *) to;
- syscallarg(int) tolen;
- } */ *uap = v;
- struct linux_sendto_args lsa;
- struct sys_sendto_args bsa;
- int error;
- int tolen;
- caddr_t sg = stackgap_init(p);
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
- return error;
-
- SCARG(&bsa, s) = lsa.s;
- SCARG(&bsa, buf) = lsa.msg;
- SCARG(&bsa, len) = lsa.len;
- SCARG(&bsa, flags) = linux_to_bsd_msg_flags(lsa.flags);
- tolen = lsa.tolen;
- if (lsa.to) {
- struct sockaddr *sa;
-
- if ((error = linux_sa_get(p, &sg, &sa, lsa.to, &tolen)))
- return (error);
- SCARG(&bsa, to) = sa;
- } else
- SCARG(&bsa, to) = NULL;
- SCARG(&bsa, tolen) = tolen;
-
- if (linux_check_hdrincl(p, lsa.s, retval, &sg) == 0)
- return linux_sendto_hdrincl(p, &bsa, retval, &sg);
- return sys_sendto(p, &bsa, retval);
-}
-
-int
-linux_recvfrom(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_recvfrom_args /* {
- syscallarg(int) s;
- syscallarg(void *) buf;
- syscallarg(int) len;
- syscallarg(int) flags;
- syscallarg(struct sockaddr *) from;
- syscallarg(int *) fromlen;
- } */ *uap = v;
- struct linux_recvfrom_args lra;
- struct sys_recvfrom_args bra;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lra, sizeof lra)))
- return error;
-
- SCARG(&bra, s) = lra.s;
- SCARG(&bra, buf) = lra.buf;
- SCARG(&bra, len) = lra.len;
- SCARG(&bra, flags) = linux_to_bsd_msg_flags(lra.flags);
- SCARG(&bra, from) = lra.from;
- SCARG(&bra, fromlenaddr) = lra.fromlen;
-
- if ((error = sys_recvfrom(p, &bra, retval)))
- return (error);
-
- if (lra.from && (error = linux_sa_put(lra.from)))
- return (error);
-
- return (0);
-}
-
-int
-linux_shutdown(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_shutdown_args /* {
- syscallarg(int) s;
- syscallarg(int) how;
- } */ *uap = v;
- struct linux_shutdown_args lsa;
- struct sys_shutdown_args bsa;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
- return error;
-
- SCARG(&bsa, s) = lsa.s;
- SCARG(&bsa, how) = lsa.how;
-
- return sys_shutdown(p, &bsa, retval);
-}
-
-/*
- * Convert socket option level from Linux to OpenBSD value. Only SOL_SOCKET
- * is different, the rest matches IPPROTO_* on both systems.
- */
-int
-linux_to_bsd_sopt_level(llevel)
- int llevel;
-{
-
- switch (llevel) {
- case LINUX_SOL_SOCKET:
- return SOL_SOCKET;
- case LINUX_SOL_IP:
- return IPPROTO_IP;
- case LINUX_SOL_TCP:
- return IPPROTO_TCP;
- case LINUX_SOL_UDP:
- return IPPROTO_UDP;
- default:
- return -1;
- }
-}
-
-/*
- * Convert Linux socket level socket option numbers to OpenBSD values.
- */
-int
-linux_to_bsd_so_sockopt(lopt)
- int lopt;
-{
-
- switch (lopt) {
- case LINUX_SO_DEBUG:
- return SO_DEBUG;
- case LINUX_SO_REUSEADDR:
- /*
- * Linux does not implement SO_REUSEPORT, but allows reuse
- * of a host:port pair through SO_REUSEADDR even if the
- * address is not a multicast-address. Effectively, this
- * means that we should use SO_REUSEPORT to allow Linux
- * applications to not receive EADDRINUSE.
- */
- return SO_REUSEPORT;
- case LINUX_SO_TYPE:
- return SO_TYPE;
- case LINUX_SO_ERROR:
- return SO_ERROR;
- case LINUX_SO_DONTROUTE:
- return SO_DONTROUTE;
- case LINUX_SO_BROADCAST:
- return SO_BROADCAST;
- case LINUX_SO_SNDBUF:
- return SO_SNDBUF;
- case LINUX_SO_RCVBUF:
- return SO_RCVBUF;
- case LINUX_SO_KEEPALIVE:
- return SO_KEEPALIVE;
- case LINUX_SO_OOBINLINE:
- return SO_OOBINLINE;
- case LINUX_SO_LINGER:
- return SO_LINGER;
- case LINUX_SO_PRIORITY:
- case LINUX_SO_NO_CHECK:
- default:
- return -1;
- }
-}
-
-/*
- * Convert Linux IP level socket option number to OpenBSD values.
- */
-int
-linux_to_bsd_ip_sockopt(lopt)
- int lopt;
-{
-
- switch (lopt) {
- case LINUX_IP_TOS:
- return IP_TOS;
- case LINUX_IP_TTL:
- return IP_TTL;
- case LINUX_IP_MULTICAST_TTL:
- return IP_MULTICAST_TTL;
- case LINUX_IP_MULTICAST_LOOP:
- return IP_MULTICAST_LOOP;
- case LINUX_IP_MULTICAST_IF:
- return IP_MULTICAST_IF;
- case LINUX_IP_ADD_MEMBERSHIP:
- return IP_ADD_MEMBERSHIP;
- case LINUX_IP_DROP_MEMBERSHIP:
- return IP_DROP_MEMBERSHIP;
- case LINUX_IP_HDRINCL:
- return IP_HDRINCL;
- default:
- return -1;
- }
-}
-
-/*
- * Convert Linux TCP level socket option number to OpenBSD values.
- */
-int
-linux_to_bsd_tcp_sockopt(lopt)
- int lopt;
-{
-
- switch (lopt) {
- case LINUX_TCP_NODELAY:
- return TCP_NODELAY;
- case LINUX_TCP_MAXSEG:
- return TCP_MAXSEG;
- default:
- return -1;
- }
-}
-
-/*
- * Convert Linux UDP level socket option number to OpenBSD values.
- */
-int
-linux_to_bsd_udp_sockopt(lopt)
- int lopt;
-{
-
- switch (lopt) {
- default:
- return -1;
- }
-}
-
-/*
- * Another reasonably straightforward function: setsockopt(2).
- * The level and option numbers are converted; the values passed
- * are not (yet) converted, the ones currently implemented don't
- * need conversion, as they are the same on both systems.
- */
-int
-linux_setsockopt(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_setsockopt_args /* {
- syscallarg(int) s;
- syscallarg(int) level;
- syscallarg(int) optname;
- syscallarg(void *) optval;
- syscallarg(int) optlen;
- } */ *uap = v;
- struct linux_setsockopt_args lsa;
- struct file *fp;
- struct mbuf *m = NULL;
- struct socket *so;
- int error, level, name;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
- return error;
-
- if ((error = getsock(p, lsa.s, &fp)) != 0)
- return error;
-
- level = linux_to_bsd_sopt_level(lsa.level);
- switch (level) {
- case SOL_SOCKET:
- name = linux_to_bsd_so_sockopt(lsa.optname);
- break;
- case IPPROTO_IP:
- name = linux_to_bsd_ip_sockopt(lsa.optname);
- break;
- case IPPROTO_TCP:
- name = linux_to_bsd_tcp_sockopt(lsa.optname);
- break;
- case IPPROTO_UDP:
- name = linux_to_bsd_udp_sockopt(lsa.optname);
- break;
- default:
- error = EINVAL;
- goto bad;
- }
- if (name == -1) {
- error = EINVAL;
- goto bad;
- }
- if (lsa.optlen > MLEN) {
- error = EINVAL;
- goto bad;
- }
- if (lsa.optval != NULL) {
- m = m_get(M_WAIT, MT_SOOPTS);
- error = copyin(lsa.optval, mtod(m, caddr_t), lsa.optlen);
- if (error)
- goto bad;
- m->m_len = lsa.optlen;
- }
- so = (struct socket *)fp->f_data;
- if (so->so_proto && level == IPPROTO_TCP && name == TCP_NODELAY &&
- so->so_proto->pr_domain->dom_family == AF_LOCAL &&
- so->so_proto->pr_protocol == PF_LOCAL) {
- /* ignore it */
- error = 0;
- goto bad;
- }
- error = sosetopt(so, level, name, m);
- m = NULL;
-bad:
- if (m)
- m_free(m);
- FRELE(fp, p);
- return (error);
-}
-
-/*
- * getsockopt(2) is very much the same as setsockopt(2) (see above)
- */
-int
-linux_getsockopt(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_getsockopt_args /* {
- syscallarg(int) s;
- syscallarg(int) level;
- syscallarg(int) optname;
- syscallarg(void *) optval;
- syscallarg(int) *optlen;
- } */ *uap = v;
- struct linux_getsockopt_args lga;
- struct sys_getsockopt_args bga;
- int error, name;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lga, sizeof lga)))
- return error;
-
- SCARG(&bga, s) = lga.s;
- SCARG(&bga, level) = linux_to_bsd_sopt_level(lga.level);
- SCARG(&bga, val) = lga.optval;
- SCARG(&bga, avalsize) = lga.optlen;
-
- switch (SCARG(&bga, level)) {
- case SOL_SOCKET:
- name = linux_to_bsd_so_sockopt(lga.optname);
- break;
- case IPPROTO_IP:
- name = linux_to_bsd_ip_sockopt(lga.optname);
- break;
- case IPPROTO_TCP:
- name = linux_to_bsd_tcp_sockopt(lga.optname);
- break;
- case IPPROTO_UDP:
- name = linux_to_bsd_udp_sockopt(lga.optname);
- break;
- default:
- return EINVAL;
- }
-
- if (name == -1)
- return EINVAL;
- SCARG(&bga, name) = name;
-
- return sys_getsockopt(p, &bga, retval);
-}
-
-int
-linux_recvmsg(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_recvmsg_args /* {
- syscallarg(int) s;
- syscallarg(caddr_t) msg;
- syscallarg(int) flags;
- } */ *uap = v;
- struct linux_recvmsg_args lla;
- struct sys_recvmsg_args bla;
- struct msghdr msg;
- int error;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lla, sizeof lla)))
- return error;
-
- SCARG(&bla, s) = lla.s;
- SCARG(&bla, msg) = (struct msghdr *)lla.msg;
- SCARG(&bla, flags) = linux_to_bsd_msg_flags(lla.flags);
-
- error = sys_recvmsg(p, &bla, retval);
- if (error)
- return (error);
-
- error = copyin(lla.msg, (caddr_t)&msg, sizeof(msg));
-
- if (!error && msg.msg_name && msg.msg_namelen > 2)
- error = linux_sa_put(msg.msg_name);
-
- return (error);
-}
-
-int
-linux_sendmsg(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sendmsg_args /* {
- syscallarg(int) s;
- syscallarg(struct msghdr *) msg;
- syscallarg(int) flags;
- } */ *uap = v;
- struct linux_sendmsg_args lla;
- struct sys_sendmsg_args bla;
- struct msghdr msg, *nmsg = NULL;
- int error;
- caddr_t control;
- int level = -1;
-
- if ((error = copyin((caddr_t) uap, (caddr_t) &lla, sizeof lla)))
- return error;
-
- if ((error = copyin(lla.msg, (caddr_t) &msg, sizeof(msg))))
- return (error);
-
- if (msg.msg_name) {
- struct sockaddr *sa;
- caddr_t sg = stackgap_init(p);
-
- nmsg = (struct msghdr *)stackgap_alloc(&sg,
- sizeof(struct msghdr));
- if (!nmsg)
- return (ENOMEM);
-
- error = linux_sa_get(p, &sg, &sa,
- (struct linux_sockaddr *)msg.msg_name, &msg.msg_namelen);
- if (error)
- return (error);
-
- msg.msg_name = sa;
- if ((error = copyout(&msg, nmsg, sizeof(struct msghdr))))
- return (error);
- lla.msg = nmsg;
- }
-
- SCARG(&bla, s) = lla.s;
- SCARG(&bla, msg) = lla.msg;
- SCARG(&bla, flags) = linux_to_bsd_msg_flags(lla.flags);
-
- error = copyin(lla.msg->msg_control, &control, sizeof(caddr_t));
- if (error)
- return error;
- if (control == NULL)
- goto done;
- error = copyin(&((struct cmsghdr *)control)->cmsg_level,
- &level, sizeof(int));
- if (error)
- return error;
- if (level == 1) {
- /*
- * Linux thinks that SOL_SOCKET is 1; we know that it's really
- * 0xffff, of course.
- */
- level = SOL_SOCKET;
- /*
- * XXX should use stack gap!
- * We don't because the control header is variable length
- * up to 2048 bytes, and there's only 512 bytes of gap.
- */
- error = copyout(&level, &((struct cmsghdr *)control)->
- cmsg_level, sizeof(int));
- if (error)
- return error;
- }
-done:
- error = sys_sendmsg(p, &bla, retval);
- /* replace level, just in case somebody cares. */
- if (level == SOL_SOCKET) {
- level = 1;
- /* don't worry about the error */
- copyout(&level, &((struct cmsghdr *)control)->cmsg_level,
- sizeof(int));
- }
- return (error);
-}
-
-/*
- * Copy the linux_sockaddr structure pointed to by osa to kernel, adjust
- * family and convert to sockaddr, allocate stackgap and put the
- * the converted structure there. Address on stackgap returned in sap.
- */
-int
-linux_sa_get(struct proc *p, caddr_t *sgp, struct sockaddr **sap,
- const struct linux_sockaddr *osa, int *osalen)
-{
- int error, bdom;
- struct sockaddr *sa, *usa;
- struct linux_sockaddr *kosa;
- int alloclen;
-#ifdef INET6
- int oldv6size;
- struct sockaddr_in6 *sin6;
-#endif
-
- if (*osalen < 2 || *osalen > UCHAR_MAX || !osa) {
- return (EINVAL);
- }
-
- if (osa->sa_family == AF_UNIX && *osalen > sizeof(struct sockaddr_un))
- alloclen = sizeof(struct sockaddr_un);
- else
- alloclen = *osalen;
-#ifdef INET6
- oldv6size = 0;
- /*
- * Check for old (pre-RFC2553) sockaddr_in6. We may accept it
- * if it's a v4-mapped address, so reserve the proper space
- * for it.
- */
- if (alloclen == sizeof (struct sockaddr_in6) - sizeof (u_int32_t)) {
- alloclen = sizeof (struct sockaddr_in6);
- oldv6size = 1;
- }
-#endif
-
- kosa = malloc(alloclen, M_TEMP, M_WAITOK);
-
- if ((error = copyin(osa, (caddr_t) kosa, *osalen))) {
- goto out;
- }
-
- bdom = linux_to_bsd_domain(kosa->sa_family);
- if (bdom == -1) {
- error = EINVAL;
- goto out;
- }
-
-#ifdef INET6
- /*
- * Older Linux IPv6 code uses obsolete RFC2133 struct sockaddr_in6,
- * which lacks the scope id compared with RFC2553 one. If we detect
- * the situation, reject the address.
- *
- * Still accept addresses for which the scope id is not used.
- */
- if (oldv6size && bdom == AF_INET6) {
- sin6 = (struct sockaddr_in6 *)kosa;
- if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr) ||
- (!IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) &&
- !IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) &&
- !IN6_IS_ADDR_V4COMPAT(&sin6->sin6_addr) &&
- !IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) &&
- !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) {
- sin6->sin6_scope_id = 0;
- } else {
- error = EINVAL;
- goto out;
- }
- } else
-#endif
- if (bdom == AF_INET) {
- alloclen = sizeof(struct sockaddr_in);
- }
-
- sa = (struct sockaddr *) kosa;
- sa->sa_family = bdom;
- sa->sa_len = alloclen;
-
- usa = (struct sockaddr *) stackgap_alloc(sgp, alloclen);
- if (!usa) {
- error = ENOMEM;
- goto out;
- }
-
- if ((error = copyout(sa, usa, alloclen))) {
- goto out;
- }
-
- *sap = usa;
-
- out:
- *osalen = alloclen;
- free(kosa, M_TEMP, 0);
- return (error);
-}
-
-int
-linux_sa_put(struct sockaddr *osa)
-{
- struct sockaddr sa;
- struct linux_sockaddr *kosa;
- int error, bdom, len;
-
- /*
- * Only read/write the sockaddr family and length part, the rest is
- * not changed.
- */
- len = sizeof(sa.sa_len) + sizeof(sa.sa_family);
-
- error = copyin((caddr_t) osa, (caddr_t) &sa, len);
- if (error)
- return (error);
-
- bdom = bsd_to_linux_domain(sa.sa_family);
- if (bdom == -1)
- return (EINVAL);
-
- /* Note: we convert from sockaddr to linux_sockaddr here, too */
- kosa = (struct linux_sockaddr *) &sa;
- kosa->sa_family = bdom;
- error = copyout(kosa, osa, len);
- if (error)
- return (error);
-
- return (0);
-}
-
-/*
- * Entry point to all Linux socket calls. Just check which call to
- * make and take appropriate action.
- */
-int
-linux_sys_socketcall(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_socketcall_args /* {
- syscallarg(int) what;
- syscallarg(void *) args;
- } */ *uap = v;
-
- switch (SCARG(uap, what)) {
- case LINUX_SYS_socket:
- return linux_socket(p, SCARG(uap, args), retval);
- case LINUX_SYS_bind:
- return linux_bind(p, SCARG(uap, args), retval);
- case LINUX_SYS_connect:
- return linux_connect(p, SCARG(uap, args), retval);
- case LINUX_SYS_listen:
- return linux_listen(p, SCARG(uap, args), retval);
- case LINUX_SYS_accept:
- return linux_accept(p, SCARG(uap, args), retval);
- case LINUX_SYS_getsockname:
- return linux_getsockname(p, SCARG(uap, args), retval);
- case LINUX_SYS_getpeername:
- return linux_getpeername(p, SCARG(uap, args), retval);
- case LINUX_SYS_socketpair:
- return linux_socketpair(p, SCARG(uap, args), retval);
- case LINUX_SYS_send:
- return linux_send(p, SCARG(uap, args), retval);
- case LINUX_SYS_recv:
- return linux_recv(p, SCARG(uap, args), retval);
- case LINUX_SYS_sendto:
- return linux_sendto(p, SCARG(uap, args), retval);
- case LINUX_SYS_recvfrom:
- return linux_recvfrom(p, SCARG(uap, args), retval);
- case LINUX_SYS_shutdown:
- return linux_shutdown(p, SCARG(uap, args), retval);
- case LINUX_SYS_setsockopt:
- return linux_setsockopt(p, SCARG(uap, args), retval);
- case LINUX_SYS_getsockopt:
- return linux_getsockopt(p, SCARG(uap, args), retval);
- case LINUX_SYS_sendmsg:
- return linux_sendmsg(p, SCARG(uap, args), retval);
- case LINUX_SYS_recvmsg:
- return linux_recvmsg(p, SCARG(uap, args), retval);
- default:
- return ENOSYS;
- }
-}
-
-int
-linux_ioctl_socket(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ioctl_args /* {
- syscallarg(int) fd;
- syscallarg(u_long) com;
- syscallarg(caddr_t) data;
- } */ *uap = v;
- u_long com;
- struct sys_ioctl_args ia;
- struct file *fp;
- struct filedesc *fdp;
- struct vnode *vp;
- int (*ioctlf)(struct file *, u_long, caddr_t, struct proc *);
- struct ioctl_pt pt;
- void *data = SCARG(uap, data);
- int error = 0, isdev = 0, dosys = 1;
-
- fdp = p->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
- return (EBADF);
- FREF(fp);
-
- if (fp->f_type == DTYPE_VNODE) {
- vp = (struct vnode *)fp->f_data;
- isdev = vp->v_type == VCHR;
- }
-
- /*
- * Don't try to interpret socket ioctl calls that are done
- * on a device file descriptor, just pass them through, to
- * emulate Linux behaviour. Use PTIOCLINUX so that the
- * device will only handle these if it's prepared to do
- * so, to avoid unexpected things from happening.
- */
- if (isdev) {
- dosys = 0;
- ioctlf = fp->f_ops->fo_ioctl;
- pt.com = SCARG(uap, com);
- pt.data = data;
- error = ioctlf(fp, PTIOCLINUX, (caddr_t)&pt, p);
- /*
- * XXX hack: if the function returns EJUSTRETURN,
- * it has stuffed a sysctl return value in pt.data.
- */
- if (error == EJUSTRETURN) {
- retval[0] = (register_t)pt.data;
- error = 0;
- }
- goto out;
- }
-
- com = SCARG(uap, com);
- retval[0] = 0;
-
- switch (com) {
- case LINUX_FIOSETOWN:
- SCARG(&ia, com) = FIOSETOWN;
- break;
- case LINUX_SIOCSPGRP:
- SCARG(&ia, com) = SIOCSPGRP;
- break;
- case LINUX_FIOGETOWN:
- SCARG(&ia, com) = FIOGETOWN;
- break;
- case LINUX_SIOCGPGRP:
- SCARG(&ia, com) = SIOCGPGRP;
- break;
- case LINUX_SIOCATMARK:
- SCARG(&ia, com) = SIOCATMARK;
- break;
-#if 0
- case LINUX_SIOCGSTAMP:
- SCARG(&ia, com) = SIOCGSTAMP;
- break;
-#endif
- case LINUX_SIOCGIFCONF:
- SCARG(&ia, com) = OSIOCGIFCONF;
- break;
- case LINUX_SIOCGIFFLAGS:
- SCARG(&ia, com) = SIOCGIFFLAGS;
- break;
- case LINUX_SIOCGIFADDR:
- SCARG(&ia, com) = SIOCGIFADDR;
- break;
- case LINUX_SIOCGIFDSTADDR:
- SCARG(&ia, com) = SIOCGIFDSTADDR;
- break;
- case LINUX_SIOCGIFBRDADDR:
- SCARG(&ia, com) = SIOCGIFBRDADDR;
- break;
- case LINUX_SIOCGIFNETMASK:
- SCARG(&ia, com) = SIOCGIFNETMASK;
- break;
- case LINUX_SIOCGIFMETRIC:
- SCARG(&ia, com) = SIOCGIFMETRIC;
- break;
- case LINUX_SIOCGIFMTU:
- SCARG(&ia, com) = SIOCGIFMTU;
- break;
- case LINUX_SIOCADDMULTI:
- SCARG(&ia, com) = SIOCADDMULTI;
- break;
- case LINUX_SIOCDELMULTI:
- SCARG(&ia, com) = SIOCDELMULTI;
- break;
- case LINUX_SIOCGIFHWADDR: {
- struct linux_ifreq *ifr = data;
- struct sockaddr_dl *sdl;
- struct ifnet *ifp;
-
- /*
- * Note that we don't actually respect the name in the ifreq
- * structure, as Linux interface names are all different.
- */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
- if (ifp->if_type != IFT_ETHER)
- continue;
- if ((sdl = ifp->if_sadl) &&
- (sdl->sdl_family == AF_LINK) &&
- (sdl->sdl_type == IFT_ETHER)) {
- error = copyout(LLADDR(sdl),
- &ifr->ifr_hwaddr.sa_data,
- LINUX_IFHWADDRLEN);
- dosys = 0;
- goto out;
- }
- }
- error = ENOENT;
- break;
- }
- default:
- error = EINVAL;
- }
-
-out:
- if (error == 0 && dosys) {
- SCARG(&ia, fd) = SCARG(uap, fd);
- SCARG(&ia, data) = data;
- error = sys_ioctl(p, &ia, retval);
-
- if (error == 0) {
- struct ifreq *ifr = data;
-
- switch (com) {
- case LINUX_SIOCGIFADDR:
- case LINUX_SIOCGIFDSTADDR:
- case LINUX_SIOCGIFBRDADDR:
- case LINUX_SIOCGIFNETMASK:
- error = linux_sa_put(&ifr->ifr_addr);
- break;
- }
- }
- }
-
- FRELE(fp, p);
- return (error);
-}
diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h
deleted file mode 100644
index cebd5096604..00000000000
--- a/sys/compat/linux/linux_socket.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $OpenBSD: linux_socket.h,v 1.12 2015/01/19 23:30:20 guenther Exp $ */
-/* $NetBSD: linux_socket.h,v 1.3 1995/05/28 10:16:34 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SOCKET_H_
-#define _LINUX_SOCKET_H_
-
-/*
- * Various Linux socket defines. Everything that is not re-defined here
- * is the same as in OpenBSD.
- *
- * Linux uses the old-style sockaddr, called linux_sockaddr here,
- * without sa_len member. linux_sa_{get,put}() handle mapping from/to that.
- */
-
-/*
- * Address families. There are fewer of them, and they're numbered
- * a bit different
- */
-
-#define LINUX_AF_UNSPEC 0
-#define LINUX_AF_UNIX 1
-#define LINUX_AF_INET 2
-#define LINUX_AF_AX25 3
-#define LINUX_AF_IPX 4
-#define LINUX_AF_APPLETALK 5
-#define LINUX_AF_INET6 10
-#define LINUX_AF_MAX 32
-
-/*
- * Option levels for [gs]etsockopt(2). Only SOL_SOCKET is different,
- * the rest matches IPPROTO_XXX
- */
-
-#define LINUX_SOL_SOCKET 1
-#define LINUX_SOL_IP 0
-#define LINUX_SOL_IPX 256
-#define LINUX_SOL_AX25 257
-#define LINUX_SOL_TCP 6
-#define LINUX_SOL_UDP 17
-
-/*
- * Options for [gs]etsockopt(2), socket level. For Linux, they
- * are not masks, but just increasing numbers.
- */
-
-#define LINUX_SO_DEBUG 1
-#define LINUX_SO_REUSEADDR 2
-#define LINUX_SO_TYPE 3
-#define LINUX_SO_ERROR 4
-#define LINUX_SO_DONTROUTE 5
-#define LINUX_SO_BROADCAST 6
-#define LINUX_SO_SNDBUF 7
-#define LINUX_SO_RCVBUF 8
-#define LINUX_SO_KEEPALIVE 9
-#define LINUX_SO_OOBINLINE 10
-#define LINUX_SO_NO_CHECK 11
-#define LINUX_SO_PRIORITY 12
-#define LINUX_SO_LINGER 13
-
-/*
- * Options for [gs]etsockopt(2), IP level.
- */
-
-#define LINUX_IP_TOS 1
-#define LINUX_IP_TTL 2
-#define LINUX_IP_HDRINCL 3
-#define LINUX_IP_MULTICAST_IF 32
-#define LINUX_IP_MULTICAST_TTL 33
-#define LINUX_IP_MULTICAST_LOOP 34
-#define LINUX_IP_ADD_MEMBERSHIP 35
-#define LINUX_IP_DROP_MEMBERSHIP 36
-
-/*
- * Options for [gs]etsockopt(2), TCP level.
- */
-
-#define LINUX_TCP_NODELAY 1
-#define LINUX_TCP_MAXSEG 2
-
-/*
- * Flags for recv(2) and send(2) family functions.
- * The first 3 match MSG_XXX.
- */
-
-#define LINUX_MSG_OOB 1
-#define LINUX_MSG_PEEK 2
-#define LINUX_MSG_DONTROUTE 4
-#define LINUX_MSG_DONTWAIT 0x40
-#define LINUX_MSG_WAITALL 0x100
-#define LINUX_MSG_NOSIGNAL 0x4000
-
-/* Mask out extra type-related options */
-#define LINUX_SOCKET_TYPE_MASK 0xf
-#define LINUX_SOCK_CLOEXEC 02000000
-#define LINUX_SOCK_NONBLOCK 00004000
-
-struct linux_sockaddr {
- unsigned short sa_family;
- char sa_data[14];
-};
-
-struct linux_ifmap {
- unsigned long mem_start;
- unsigned long mem_end;
- unsigned short base_addr;
- unsigned char irq;
- unsigned char dma;
- unsigned char port;
-};
-
-struct linux_ifreq {
-#define LINUX_IFHWADDRLEN 6
-#define LINUX_IFNAMSIZ 16
- union {
- char ifrn_name[LINUX_IFNAMSIZ]; /* if name, e.g. "en0" */
- } ifr_ifrn;
-
- union {
- struct linux_sockaddr ifru_addr;
- struct linux_sockaddr ifru_dstaddr;
- struct linux_sockaddr ifru_broadaddr;
- struct linux_sockaddr ifru_netmask;
- struct linux_sockaddr ifru_hwaddr;
- short ifru_flags;
- int ifru_metric;
- int ifru_mtu;
- struct linux_ifmap ifru_map;
- char ifru_slave[LINUX_IFNAMSIZ];
- caddr_t ifru_data;
- } ifr_ifru;
-};
-
-#define ifr_name ifr_ifrn.ifrn_name /* interface name */
-#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
-
-#endif /* _LINUX_SOCKET_H_ */
diff --git a/sys/compat/linux/linux_socketcall.h b/sys/compat/linux/linux_socketcall.h
deleted file mode 100644
index 144e6c29448..00000000000
--- a/sys/compat/linux/linux_socketcall.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $OpenBSD: linux_socketcall.h,v 1.6 2015/01/19 23:30:20 guenther Exp $ */
-/* $NetBSD: linux_socketcall.h,v 1.1 1995/02/28 23:26:05 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SOCKETCALL_H_
-#define _LINUX_SOCKETCALL_H_
-
-/*
- * Values passed to the Linux socketcall() syscall, determining the actual
- * action to take.
- */
-#define LINUX_SYS_socket 1
-#define LINUX_SYS_bind 2
-#define LINUX_SYS_connect 3
-#define LINUX_SYS_listen 4
-#define LINUX_SYS_accept 5
-#define LINUX_SYS_getsockname 6
-#define LINUX_SYS_getpeername 7
-#define LINUX_SYS_socketpair 8
-#define LINUX_SYS_send 9
-#define LINUX_SYS_recv 10
-#define LINUX_SYS_sendto 11
-#define LINUX_SYS_recvfrom 12
-#define LINUX_SYS_shutdown 13
-#define LINUX_SYS_setsockopt 14
-#define LINUX_SYS_getsockopt 15
-#define LINUX_SYS_sendmsg 16
-#define LINUX_SYS_recvmsg 17
-
-/*
- * Structures for the arguments of the different system calls. This looks
- * a little better than copyin() of all values one by one.
- */
-struct linux_socket_args {
- int domain;
- int type;
- int protocol;
-};
-
-struct linux_bind_args {
- int s;
- struct linux_sockaddr *name;
- int namelen;
-};
-
-struct linux_connect_args {
- int s;
- struct linux_sockaddr *name;
- int namelen;
-};
-
-struct linux_listen_args {
- int s;
- int backlog;
-};
-
-struct linux_accept_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_getsockname_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_getpeername_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_socketpair_args {
- int domain;
- int type;
- int protocol;
- int *rsv;
-};
-
-struct linux_send_args {
- int s;
- void *msg;
- int len;
- int flags;
-};
-
-struct linux_recv_args {
- int s;
- void *msg;
- int len;
- int flags;
-};
-
-struct linux_sendto_args {
- int s;
- void *msg;
- int len;
- int flags;
- struct linux_sockaddr *to;
- int tolen;
-};
-
-struct linux_recvfrom_args {
- int s;
- void *buf;
- int len;
- int flags;
- struct sockaddr *from;
- int *fromlen;
-};
-
-struct linux_shutdown_args {
- int s;
- int how;
-};
-
-struct linux_getsockopt_args {
- int s;
- int level;
- int optname;
- void *optval;
- int *optlen;
-};
-
-struct linux_setsockopt_args {
- int s;
- int level;
- int optname;
- void *optval;
- int optlen;
-};
-
-struct linux_sendmsg_args {
- int s;
- struct msghdr *msg;
- int flags;
-};
-
-struct linux_recvmsg_args {
- int s;
- struct msghdr *msg;
- int flags;
-};
-
-#endif /* _LINUX_SOCKETCALL_H_ */
diff --git a/sys/compat/linux/linux_sockio.h b/sys/compat/linux/linux_sockio.h
deleted file mode 100644
index e5f068c6290..00000000000
--- a/sys/compat/linux/linux_sockio.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: linux_sockio.h,v 1.9 2011/04/05 22:54:31 pirofti Exp $ */
-/* $NetBSD: linux_sockio.h,v 1.5 1996/03/08 04:56:07 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_SOCKIO_H_
-#define _LINUX_SOCKIO_H_
-
-#define LINUX_FIOSETOWN _LINUX_IO(0x89, 1)
-#define LINUX_SIOCSPGRP _LINUX_IO(0x89, 2)
-#define LINUX_FIOGETOWN _LINUX_IO(0x89, 3)
-#define LINUX_SIOCGPGRP _LINUX_IO(0x89, 4)
-#define LINUX_SIOCATMARK _LINUX_IO(0x89, 5)
-#define LINUX_SIOCGSTAMP _LINUX_IO(0x89, 6)
-#define LINUX_SIOCGIFCONF _LINUX_IO(0x89, 18)
-#define LINUX_SIOCGIFFLAGS _LINUX_IO(0x89, 19)
-#define LINUX_SIOCSIFFLAGS _LINUX_IO(0x89, 20)
-#define LINUX_SIOCGIFADDR _LINUX_IO(0x89, 21)
-#define LINUX_SIOCSIFADDR _LINUX_IO(0x89, 22)
-#define LINUX_SIOCGIFDSTADDR _LINUX_IO(0x89, 23)
-#define LINUX_SIOCGIFBRDADDR _LINUX_IO(0x89, 25)
-#define LINUX_SIOCGIFNETMASK _LINUX_IO(0x89, 27)
-#define LINUX_SIOCGIFMETRIC _LINUX_IO(0x89, 29)
-#define LINUX_SIOCGIFMTU _LINUX_IO(0x89, 33)
-#define LINUX_SIOCGIFHWADDR _LINUX_IO(0x89, 39)
-#define LINUX_SIOCADDMULTI _LINUX_IO(0x89, 49)
-#define LINUX_SIOCDELMULTI _LINUX_IO(0x89, 50)
-#define LINUX_SIOCGIFBR _LINUX_IO(0x89, 64)
-#define LINUX_SIOCDEVPRIVATE _LINUX_IO(0x89, 0xf0)
-
-#endif /* _LINUX_SOCKIO_H_ */
diff --git a/sys/compat/linux/linux_syscall.h b/sys/compat/linux/linux_syscall.h
deleted file mode 100644
index b694bed0114..00000000000
--- a/sys/compat/linux/linux_syscall.h
+++ /dev/null
@@ -1,778 +0,0 @@
-/* $OpenBSD: linux_syscall.h,v 1.79 2014/09/01 05:13:21 doug Exp $ */
-
-/*
- * System call numbers.
- *
- * DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.76 2014/09/01 05:09:53 doug Exp
- */
-
-/* syscall: "syscall" ret: "int" args: */
-#define LINUX_SYS_syscall 0
-
-/* syscall: "exit" ret: "int" args: "int" */
-#define LINUX_SYS_exit 1
-
-/* syscall: "fork" ret: "int" args: */
-#define LINUX_SYS_fork 2
-
-/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */
-#define LINUX_SYS_read 3
-
-/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */
-#define LINUX_SYS_write 4
-
-/* syscall: "open" ret: "int" args: "char *" "int" "int" */
-#define LINUX_SYS_open 5
-
-/* syscall: "close" ret: "int" args: "int" */
-#define LINUX_SYS_close 6
-
-/* syscall: "waitpid" ret: "int" args: "int" "int *" "int" */
-#define LINUX_SYS_waitpid 7
-
-/* syscall: "creat" ret: "int" args: "char *" "int" */
-#define LINUX_SYS_creat 8
-
-/* syscall: "link" ret: "int" args: "char *" "char *" */
-#define LINUX_SYS_link 9
-
-/* syscall: "unlink" ret: "int" args: "char *" */
-#define LINUX_SYS_unlink 10
-
-/* syscall: "execve" ret: "int" args: "char *" "char **" "char **" */
-#define LINUX_SYS_execve 11
-
-/* syscall: "chdir" ret: "int" args: "char *" */
-#define LINUX_SYS_chdir 12
-
-/* syscall: "time" ret: "int" args: "linux_time_t *" */
-#define LINUX_SYS_time 13
-
-/* syscall: "mknod" ret: "int" args: "char *" "int" "int" */
-#define LINUX_SYS_mknod 14
-
-/* syscall: "chmod" ret: "int" args: "char *" "int" */
-#define LINUX_SYS_chmod 15
-
-/* syscall: "lchown16" ret: "int" args: "char *" "int" "int" */
-#define LINUX_SYS_lchown16 16
-
-/* syscall: "break" ret: "int" args: "char *" */
-#define LINUX_SYS_break 17
-
-/* syscall: "ostat" ret: "int" args: */
-#define LINUX_SYS_ostat 18
-
-/* syscall: "lseek" ret: "long" args: "int" "long" "int" */
-#define LINUX_SYS_lseek 19
-
-/* syscall: "getpid" ret: "pid_t" args: */
-#define LINUX_SYS_getpid 20
-
-/* syscall: "mount" ret: "int" args: "char *" "char *" "char *" "long" "void *" */
-#define LINUX_SYS_mount 21
-
-/* syscall: "umount" ret: "int" args: "char *" */
-#define LINUX_SYS_umount 22
-
-/* syscall: "linux_setuid16" ret: "int" args: "uid_t" */
-#define LINUX_SYS_linux_setuid16 23
-
-/* syscall: "linux_getuid16" ret: "uid_t" args: */
-#define LINUX_SYS_linux_getuid16 24
-
-/* syscall: "ptrace" ret: "int" args: */
-#define LINUX_SYS_ptrace 26
-
-/* syscall: "alarm" ret: "int" args: "unsigned int" */
-#define LINUX_SYS_alarm 27
-
-/* syscall: "ofstat" ret: "int" args: */
-#define LINUX_SYS_ofstat 28
-
-/* syscall: "pause" ret: "int" args: */
-#define LINUX_SYS_pause 29
-
-/* syscall: "utime" ret: "int" args: "char *" "struct linux_utimbuf *" */
-#define LINUX_SYS_utime 30
-
-/* syscall: "stty" ret: "int" args: */
-#define LINUX_SYS_stty 31
-
-/* syscall: "gtty" ret: "int" args: */
-#define LINUX_SYS_gtty 32
-
-/* syscall: "access" ret: "int" args: "char *" "int" */
-#define LINUX_SYS_access 33
-
-/* syscall: "nice" ret: "int" args: "int" */
-#define LINUX_SYS_nice 34
-
-/* syscall: "ftime" ret: "int" args: */
-#define LINUX_SYS_ftime 35
-
-/* syscall: "sync" ret: "int" args: */
-#define LINUX_SYS_sync 36
-
-/* syscall: "kill" ret: "int" args: "int" "int" */
-#define LINUX_SYS_kill 37
-
-/* syscall: "rename" ret: "int" args: "char *" "char *" */
-#define LINUX_SYS_rename 38
-
-/* syscall: "mkdir" ret: "int" args: "char *" "int" */
-#define LINUX_SYS_mkdir 39
-
-/* syscall: "rmdir" ret: "int" args: "char *" */
-#define LINUX_SYS_rmdir 40
-
-/* syscall: "dup" ret: "int" args: "u_int" */
-#define LINUX_SYS_dup 41
-
-/* syscall: "pipe" ret: "int" args: "int *" */
-#define LINUX_SYS_pipe 42
-
-/* syscall: "times" ret: "int" args: "struct linux_tms *" */
-#define LINUX_SYS_times 43
-
-/* syscall: "prof" ret: "int" args: */
-#define LINUX_SYS_prof 44
-
-/* syscall: "brk" ret: "int" args: "char *" */
-#define LINUX_SYS_brk 45
-
-/* syscall: "linux_setgid16" ret: "int" args: "gid_t" */
-#define LINUX_SYS_linux_setgid16 46
-
-/* syscall: "linux_getgid16" ret: "gid_t" args: */
-#define LINUX_SYS_linux_getgid16 47
-
-/* syscall: "signal" ret: "int" args: "int" "linux_handler_t" */
-#define LINUX_SYS_signal 48
-
-/* syscall: "linux_geteuid16" ret: "uid_t" args: */
-#define LINUX_SYS_linux_geteuid16 49
-
-/* syscall: "linux_getegid16" ret: "gid_t" args: */
-#define LINUX_SYS_linux_getegid16 50
-
-/* syscall: "acct" ret: "int" args: "char *" */
-#define LINUX_SYS_acct 51
-
-/* syscall: "phys" ret: "int" args: */
-#define LINUX_SYS_phys 52
-
-/* syscall: "lock" ret: "int" args: */
-#define LINUX_SYS_lock 53
-
-/* syscall: "ioctl" ret: "int" args: "int" "u_long" "caddr_t" */
-#define LINUX_SYS_ioctl 54
-
-/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */
-#define LINUX_SYS_fcntl 55
-
-/* syscall: "mpx" ret: "int" args: */
-#define LINUX_SYS_mpx 56
-
-/* syscall: "setpgid" ret: "int" args: "int" "int" */
-#define LINUX_SYS_setpgid 57
-
-/* syscall: "ulimit" ret: "int" args: */
-#define LINUX_SYS_ulimit 58
-
-/* syscall: "oldolduname" ret: "int" args: "struct linux_oldold_utsname *" */
-#define LINUX_SYS_oldolduname 59
-
-/* syscall: "umask" ret: "int" args: "int" */
-#define LINUX_SYS_umask 60
-
-/* syscall: "chroot" ret: "int" args: "char *" */
-#define LINUX_SYS_chroot 61
-
-/* syscall: "ustat" ret: "int" args: */
-#define LINUX_SYS_ustat 62
-
-/* syscall: "dup2" ret: "int" args: "u_int" "u_int" */
-#define LINUX_SYS_dup2 63
-
-/* syscall: "getppid" ret: "pid_t" args: */
-#define LINUX_SYS_getppid 64
-
-/* syscall: "getpgrp" ret: "int" args: */
-#define LINUX_SYS_getpgrp 65
-
-/* syscall: "setsid" ret: "int" args: */
-#define LINUX_SYS_setsid 66
-
-/* syscall: "sigaction" ret: "int" args: "int" "struct linux_old_sigaction *" "struct linux_old_sigaction *" */
-#define LINUX_SYS_sigaction 67
-
-/* syscall: "siggetmask" ret: "int" args: */
-#define LINUX_SYS_siggetmask 68
-
-/* syscall: "sigsetmask" ret: "int" args: "linux_old_sigset_t" */
-#define LINUX_SYS_sigsetmask 69
-
-/* syscall: "setreuid16" ret: "int" args: "int" "int" */
-#define LINUX_SYS_setreuid16 70
-
-/* syscall: "setregid16" ret: "int" args: "int" "int" */
-#define LINUX_SYS_setregid16 71
-
-/* syscall: "sigsuspend" ret: "int" args: "caddr_t" "int" "int" */
-#define LINUX_SYS_sigsuspend 72
-
-/* syscall: "sigpending" ret: "int" args: "linux_old_sigset_t *" */
-#define LINUX_SYS_sigpending 73
-
-/* syscall: "sethostname" ret: "int" args: "char *" "u_int" */
-#define LINUX_SYS_sethostname 74
-
-/* syscall: "setrlimit" ret: "int" args: "u_int" "struct linux_rlimit *" */
-#define LINUX_SYS_setrlimit 75
-
-/* syscall: "getrlimit" ret: "int" args: "u_int" "struct linux_rlimit *" */
-#define LINUX_SYS_getrlimit 76
-
-/* syscall: "getrusage" ret: "int" args: "int" "struct linux_rusage *" */
-#define LINUX_SYS_getrusage 77
-
-/* syscall: "gettimeofday" ret: "int" args: "struct linux_timeval *" "struct timezone *" */
-#define LINUX_SYS_gettimeofday 78
-
-/* syscall: "linux_getgroups" ret: "int" args: "u_int" "gid_t *" */
-#define LINUX_SYS_linux_getgroups 80
-
-/* syscall: "linux_setgroups" ret: "int" args: "u_int" "gid_t *" */
-#define LINUX_SYS_linux_setgroups 81
-
-/* syscall: "oldselect" ret: "int" args: "struct linux_select *" */
-#define LINUX_SYS_oldselect 82
-
-/* syscall: "symlink" ret: "int" args: "char *" "char *" */
-#define LINUX_SYS_symlink 83
-
-/* syscall: "olstat" ret: "int" args: "char *" "struct linux_stat *" */
-#define LINUX_SYS_olstat 84
-
-/* syscall: "readlink" ret: "ssize_t" args: "char *" "char *" "int" */
-#define LINUX_SYS_readlink 85
-
-/* syscall: "swapon" ret: "int" args: "char *" */
-#define LINUX_SYS_swapon 87
-
-/* syscall: "reboot" ret: "int" args: "int" */
-#define LINUX_SYS_reboot 88
-
-/* syscall: "readdir" ret: "int" args: "int" "caddr_t" "unsigned int" */
-#define LINUX_SYS_readdir 89
-
-/* syscall: "mmap" ret: "int" args: "struct linux_mmap *" */
-#define LINUX_SYS_mmap 90
-
-/* syscall: "munmap" ret: "int" args: "caddr_t" "int" */
-#define LINUX_SYS_munmap 91
-
-/* syscall: "truncate" ret: "int" args: "char *" "long" */
-#define LINUX_SYS_truncate 92
-
-/* syscall: "ftruncate" ret: "int" args: "int" "long" */
-#define LINUX_SYS_ftruncate 93
-
-/* syscall: "fchmod" ret: "int" args: "int" "int" */
-#define LINUX_SYS_fchmod 94
-
-/* syscall: "fchown16" ret: "int" args: "int" "int" "int" */
-#define LINUX_SYS_fchown16 95
-
-/* syscall: "getpriority" ret: "int" args: "int" "int" */
-#define LINUX_SYS_getpriority 96
-
-/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */
-#define LINUX_SYS_setpriority 97
-
-/* syscall: "profil" ret: "int" args: "caddr_t" "u_int" "u_int" "u_int" */
-#define LINUX_SYS_profil 98
-
-/* syscall: "statfs" ret: "int" args: "char *" "struct linux_statfs *" */
-#define LINUX_SYS_statfs 99
-
-/* syscall: "fstatfs" ret: "int" args: "int" "struct linux_statfs *" */
-#define LINUX_SYS_fstatfs 100
-
-/* syscall: "ioperm" ret: "int" args: "unsigned int" "unsigned int" "int" */
-#define LINUX_SYS_ioperm 101
-
-/* syscall: "ioperm" ret: "int" args: */
-#define LINUX_SYS_ioperm 101
-
-/* syscall: "socketcall" ret: "int" args: "int" "void *" */
-#define LINUX_SYS_socketcall 102
-
-/* syscall: "klog" ret: "int" args: */
-#define LINUX_SYS_klog 103
-
-/* syscall: "setitimer" ret: "int" args: "u_int" "struct linux_itimerval *" "struct linux_itimerval *" */
-#define LINUX_SYS_setitimer 104
-
-/* syscall: "getitimer" ret: "int" args: "u_int" "struct linux_itimerval *" */
-#define LINUX_SYS_getitimer 105
-
-/* syscall: "stat" ret: "int" args: "char *" "struct linux_stat *" */
-#define LINUX_SYS_stat 106
-
-/* syscall: "lstat" ret: "int" args: "char *" "struct linux_stat *" */
-#define LINUX_SYS_lstat 107
-
-/* syscall: "fstat" ret: "int" args: "int" "struct linux_stat *" */
-#define LINUX_SYS_fstat 108
-
-/* syscall: "olduname" ret: "int" args: "struct linux_old_utsname *" */
-#define LINUX_SYS_olduname 109
-
-/* syscall: "iopl" ret: "int" args: "int" */
-#define LINUX_SYS_iopl 110
-
-/* syscall: "iopl" ret: "int" args: */
-#define LINUX_SYS_iopl 110
-
-/* syscall: "vhangup" ret: "int" args: */
-#define LINUX_SYS_vhangup 111
-
-/* syscall: "idle" ret: "int" args: */
-#define LINUX_SYS_idle 112
-
-/* syscall: "vm86old" ret: "int" args: */
-#define LINUX_SYS_vm86old 113
-
-/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct linux_rusage *" */
-#define LINUX_SYS_wait4 114
-
-/* syscall: "swapoff" ret: "int" args: */
-#define LINUX_SYS_swapoff 115
-
-/* syscall: "sysinfo" ret: "int" args: "struct linux_sysinfo *" */
-#define LINUX_SYS_sysinfo 116
-
-/* syscall: "ipc" ret: "int" args: "int" "int" "int" "int" "caddr_t" */
-#define LINUX_SYS_ipc 117
-
-/* syscall: "fsync" ret: "int" args: "int" */
-#define LINUX_SYS_fsync 118
-
-/* syscall: "sigreturn" ret: "int" args: "struct linux_sigcontext *" */
-#define LINUX_SYS_sigreturn 119
-
-/* syscall: "clone" ret: "int" args: "int" "void *" "void *" "void *" "void *" */
-#define LINUX_SYS_clone 120
-
-/* syscall: "setdomainname" ret: "int" args: "char *" "int" */
-#define LINUX_SYS_setdomainname 121
-
-/* syscall: "uname" ret: "int" args: "struct linux_utsname *" */
-#define LINUX_SYS_uname 122
-
-/* syscall: "modify_ldt" ret: "int" args: "int" "void *" "size_t" */
-#define LINUX_SYS_modify_ldt 123
-
-/* syscall: "modify_ldt" ret: "int" args: */
-#define LINUX_SYS_modify_ldt 123
-
-/* syscall: "adjtimex" ret: "int" args: */
-#define LINUX_SYS_adjtimex 124
-
-/* syscall: "mprotect" ret: "int" args: "caddr_t" "int" "int" */
-#define LINUX_SYS_mprotect 125
-
-/* syscall: "sigprocmask" ret: "int" args: "int" "linux_old_sigset_t *" "linux_old_sigset_t *" */
-#define LINUX_SYS_sigprocmask 126
-
-/* syscall: "create_module" ret: "int" args: */
-#define LINUX_SYS_create_module 127
-
-/* syscall: "init_module" ret: "int" args: */
-#define LINUX_SYS_init_module 128
-
-/* syscall: "delete_module" ret: "int" args: */
-#define LINUX_SYS_delete_module 129
-
-/* syscall: "get_kernel_syms" ret: "int" args: */
-#define LINUX_SYS_get_kernel_syms 130
-
-/* syscall: "quotactl" ret: "int" args: */
-#define LINUX_SYS_quotactl 131
-
-/* syscall: "getpgid" ret: "int" args: "int" */
-#define LINUX_SYS_getpgid 132
-
-/* syscall: "fchdir" ret: "int" args: "int" */
-#define LINUX_SYS_fchdir 133
-
-/* syscall: "bdflush" ret: "int" args: */
-#define LINUX_SYS_bdflush 134
-
-/* syscall: "sysfs" ret: "int" args: */
-#define LINUX_SYS_sysfs 135
-
-/* syscall: "personality" ret: "int" args: "int" */
-#define LINUX_SYS_personality 136
-
-/* syscall: "afs_syscall" ret: "int" args: */
-#define LINUX_SYS_afs_syscall 137
-
-/* syscall: "linux_setfsuid16" ret: "int" args: "uid_t" */
-#define LINUX_SYS_linux_setfsuid16 138
-
-/* syscall: "linux_getfsuid16" ret: "int" args: */
-#define LINUX_SYS_linux_getfsuid16 139
-
-/* syscall: "llseek" ret: "int" args: "int" "u_int32_t" "u_int32_t" "caddr_t" "int" */
-#define LINUX_SYS_llseek 140
-
-/* syscall: "getdents" ret: "int" args: "int" "void *" "unsigned" */
-#define LINUX_SYS_getdents 141
-
-/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct linux_timeval *" */
-#define LINUX_SYS_select 142
-
-/* syscall: "flock" ret: "int" args: "int" "int" */
-#define LINUX_SYS_flock 143
-
-/* syscall: "msync" ret: "int" args: "void *" "int" "int" */
-#define LINUX_SYS_msync 144
-
-/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */
-#define LINUX_SYS_readv 145
-
-/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */
-#define LINUX_SYS_writev 146
-
-/* syscall: "getsid" ret: "int" args: "pid_t" */
-#define LINUX_SYS_getsid 147
-
-/* syscall: "fdatasync" ret: "int" args: "int" */
-#define LINUX_SYS_fdatasync 148
-
-/* syscall: "__sysctl" ret: "int" args: "struct linux___sysctl *" */
-#define LINUX_SYS___sysctl 149
-
-/* syscall: "mlock" ret: "int" args: "caddr_t" "size_t" */
-#define LINUX_SYS_mlock 150
-
-/* syscall: "munlock" ret: "int" args: "caddr_t" "size_t" */
-#define LINUX_SYS_munlock 151
-
-/* syscall: "mlockall" ret: "int" args: */
-#define LINUX_SYS_mlockall 152
-
-/* syscall: "munlockall" ret: "int" args: */
-#define LINUX_SYS_munlockall 153
-
-/* syscall: "sched_setparam" ret: "int" args: "linux_pid_t" "const struct linux_sched_param *" */
-#define LINUX_SYS_sched_setparam 154
-
-/* syscall: "sched_getparam" ret: "int" args: "linux_pid_t" "struct linux_sched_param *" */
-#define LINUX_SYS_sched_getparam 155
-
-/* syscall: "sched_setscheduler" ret: "int" args: "linux_pid_t" "int" "const struct linux_sched_param *" */
-#define LINUX_SYS_sched_setscheduler 156
-
-/* syscall: "sched_getscheduler" ret: "int" args: "linux_pid_t" */
-#define LINUX_SYS_sched_getscheduler 157
-
-/* syscall: "sched_yield" ret: "int" args: */
-#define LINUX_SYS_sched_yield 158
-
-/* syscall: "sched_get_priority_max" ret: "int" args: "int" */
-#define LINUX_SYS_sched_get_priority_max 159
-
-/* syscall: "sched_get_priority_min" ret: "int" args: "int" */
-#define LINUX_SYS_sched_get_priority_min 160
-
-/* syscall: "sched_rr_get_interval" ret: "int" args: */
-#define LINUX_SYS_sched_rr_get_interval 161
-
-/* syscall: "nanosleep" ret: "int" args: "const struct linux_timespec *" "struct linux_timespec *" */
-#define LINUX_SYS_nanosleep 162
-
-/* syscall: "mremap" ret: "int" args: "void *" "size_t" "size_t" "long" */
-#define LINUX_SYS_mremap 163
-
-/* syscall: "setresuid16" ret: "int" args: "u_int16_t" "u_int16_t" "u_int16_t" */
-#define LINUX_SYS_setresuid16 164
-
-/* syscall: "getresuid16" ret: "int" args: "u_int16_t *" "u_int16_t *" "u_int16_t *" */
-#define LINUX_SYS_getresuid16 165
-
-/* syscall: "vm86" ret: "int" args: */
-#define LINUX_SYS_vm86 166
-
-/* syscall: "query_module" ret: "int" args: */
-#define LINUX_SYS_query_module 167
-
-/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */
-#define LINUX_SYS_poll 168
-
-/* syscall: "nfsservctl" ret: "int" args: */
-#define LINUX_SYS_nfsservctl 169
-
-/* syscall: "setresgid16" ret: "int" args: "u_int16_t" "u_int16_t" "u_int16_t" */
-#define LINUX_SYS_setresgid16 170
-
-/* syscall: "getresgid16" ret: "int" args: "u_int16_t *" "u_int16_t *" "u_int16_t *" */
-#define LINUX_SYS_getresgid16 171
-
-/* syscall: "prctl" ret: "int" args: "int" "unsigned long" "unsigned long" "unsigned long" "unsigned long" */
-#define LINUX_SYS_prctl 172
-
-/* syscall: "rt_sigreturn" ret: "int" args: "struct linux_rt_sigframe *" */
-#define LINUX_SYS_rt_sigreturn 173
-
-/* syscall: "rt_sigaction" ret: "int" args: "int" "struct linux_sigaction *" "struct linux_sigaction *" "size_t" */
-#define LINUX_SYS_rt_sigaction 174
-
-/* syscall: "rt_sigprocmask" ret: "int" args: "int" "const linux_sigset_t *" "linux_sigset_t *" "size_t" */
-#define LINUX_SYS_rt_sigprocmask 175
-
-/* syscall: "rt_sigpending" ret: "int" args: "linux_sigset_t *" "size_t" */
-#define LINUX_SYS_rt_sigpending 176
-
-/* syscall: "rt_sigtimedwait" ret: "int" args: */
-#define LINUX_SYS_rt_sigtimedwait 177
-
-/* syscall: "rt_queueinfo" ret: "int" args: */
-#define LINUX_SYS_rt_queueinfo 178
-
-/* syscall: "rt_sigsuspend" ret: "int" args: "linux_sigset_t *" "size_t" */
-#define LINUX_SYS_rt_sigsuspend 179
-
-/* syscall: "pread" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */
-#define LINUX_SYS_pread 180
-
-/* syscall: "pwrite" ret: "int" args: "int" "char *" "size_t" "linux_off_t" */
-#define LINUX_SYS_pwrite 181
-
-/* syscall: "chown16" ret: "int" args: "char *" "int" "int" */
-#define LINUX_SYS_chown16 182
-
-/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */
-#define LINUX_SYS___getcwd 183
-
-/* syscall: "capget" ret: "int" args: */
-#define LINUX_SYS_capget 184
-
-/* syscall: "capset" ret: "int" args: */
-#define LINUX_SYS_capset 185
-
-/* syscall: "sigaltstack" ret: "int" args: "const struct linux_sigaltstack *" "struct linux_sigaltstack *" */
-#define LINUX_SYS_sigaltstack 186
-
-/* syscall: "sendfile" ret: "int" args: */
-#define LINUX_SYS_sendfile 187
-
-/* syscall: "getpmsg" ret: "int" args: */
-#define LINUX_SYS_getpmsg 188
-
-/* syscall: "putpmsg" ret: "int" args: */
-#define LINUX_SYS_putpmsg 189
-
-/* syscall: "vfork" ret: "int" args: */
-#define LINUX_SYS_vfork 190
-
-/* syscall: "ugetrlimit" ret: "int" args: "u_int" "struct linux_rlimit *" */
-#define LINUX_SYS_ugetrlimit 191
-
-/* syscall: "mmap2" ret: "linux_off_t" args: "unsigned long" "size_t" "int" "int" "int" "linux_off_t" */
-#define LINUX_SYS_mmap2 192
-
-/* syscall: "truncate64" ret: "int" args: "char *" "off_t" */
-#define LINUX_SYS_truncate64 193
-
-/* syscall: "ftruncate64" ret: "int" args: "int" "off_t" */
-#define LINUX_SYS_ftruncate64 194
-
-/* syscall: "stat64" ret: "int" args: "char *" "struct linux_stat64 *" */
-#define LINUX_SYS_stat64 195
-
-/* syscall: "lstat64" ret: "int" args: "char *" "struct linux_stat64 *" */
-#define LINUX_SYS_lstat64 196
-
-/* syscall: "fstat64" ret: "int" args: "int" "struct linux_stat64 *" */
-#define LINUX_SYS_fstat64 197
-
-/* syscall: "lchown" ret: "int" args: */
-#define LINUX_SYS_lchown 198
-
-/* syscall: "getuid" ret: "uid_t" args: */
-#define LINUX_SYS_getuid 199
-
-/* syscall: "getgid" ret: "gid_t" args: */
-#define LINUX_SYS_getgid 200
-
-/* syscall: "geteuid" ret: "uid_t" args: */
-#define LINUX_SYS_geteuid 201
-
-/* syscall: "getegid" ret: "gid_t" args: */
-#define LINUX_SYS_getegid 202
-
-/* syscall: "setreuid" ret: "int" args: "int" "int" */
-#define LINUX_SYS_setreuid 203
-
-/* syscall: "setregid" ret: "int" args: "int" "int" */
-#define LINUX_SYS_setregid 204
-
-/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */
-#define LINUX_SYS_getgroups 205
-
-/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */
-#define LINUX_SYS_setgroups 206
-
-/* syscall: "fchown" ret: "int" args: */
-#define LINUX_SYS_fchown 207
-
-/* syscall: "setresuid" ret: "int" args: "uid_t" "uid_t" "uid_t" */
-#define LINUX_SYS_setresuid 208
-
-/* syscall: "getresuid" ret: "int" args: "uid_t *" "uid_t *" "uid_t *" */
-#define LINUX_SYS_getresuid 209
-
-/* syscall: "setresgid" ret: "int" args: "gid_t" "gid_t" "gid_t" */
-#define LINUX_SYS_setresgid 210
-
-/* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */
-#define LINUX_SYS_getresgid 211
-
-/* syscall: "chown" ret: "int" args: "char *" "uid_t" "gid_t" */
-#define LINUX_SYS_chown 212
-
-/* syscall: "setuid" ret: "int" args: "uid_t" */
-#define LINUX_SYS_setuid 213
-
-/* syscall: "setgid" ret: "int" args: "gid_t" */
-#define LINUX_SYS_setgid 214
-
-/* syscall: "setfsuid" ret: "int" args: "uid_t" */
-#define LINUX_SYS_setfsuid 215
-
-/* syscall: "setfsgid" ret: "int" args: */
-#define LINUX_SYS_setfsgid 216
-
-/* syscall: "pivot_root" ret: "int" args: */
-#define LINUX_SYS_pivot_root 217
-
-/* syscall: "mincore" ret: "int" args: */
-#define LINUX_SYS_mincore 218
-
-/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */
-#define LINUX_SYS_madvise 219
-
-/* syscall: "getdents64" ret: "int" args: "int" "void *" "unsigned" */
-#define LINUX_SYS_getdents64 220
-
-/* syscall: "fcntl64" ret: "int" args: "u_int" "u_int" "void *" */
-#define LINUX_SYS_fcntl64 221
-
-/* syscall: "gettid" ret: "linux_pid_t" args: */
-#define LINUX_SYS_gettid 224
-
-/* syscall: "setxattr" ret: "int" args: */
-#define LINUX_SYS_setxattr 226
-
-/* syscall: "lsetxattr" ret: "int" args: */
-#define LINUX_SYS_lsetxattr 227
-
-/* syscall: "fsetxattr" ret: "int" args: */
-#define LINUX_SYS_fsetxattr 228
-
-/* syscall: "getxattr" ret: "int" args: */
-#define LINUX_SYS_getxattr 229
-
-/* syscall: "lgetxattr" ret: "int" args: */
-#define LINUX_SYS_lgetxattr 230
-
-/* syscall: "fgetxattr" ret: "int" args: */
-#define LINUX_SYS_fgetxattr 231
-
-/* syscall: "listxattr" ret: "int" args: */
-#define LINUX_SYS_listxattr 232
-
-/* syscall: "llistxattr" ret: "int" args: */
-#define LINUX_SYS_llistxattr 233
-
-/* syscall: "flistxattr" ret: "int" args: */
-#define LINUX_SYS_flistxattr 234
-
-/* syscall: "removexattr" ret: "int" args: */
-#define LINUX_SYS_removexattr 235
-
-/* syscall: "lremovexattr" ret: "int" args: */
-#define LINUX_SYS_lremovexattr 236
-
-/* syscall: "fremovexattr" ret: "int" args: */
-#define LINUX_SYS_fremovexattr 237
-
-/* syscall: "futex" ret: "int" args: "int *" "int" "int" "const struct linux_timespec *" "int *" "int" */
-#define LINUX_SYS_futex 240
-
-/* syscall: "set_thread_area" ret: "int" args: "struct l_segment_descriptor *" */
-#define LINUX_SYS_set_thread_area 243
-
-/* syscall: "get_thread_area" ret: "int" args: "struct l_segment_descriptor *" */
-#define LINUX_SYS_get_thread_area 244
-
-/* syscall: "fadvise64" ret: "int" args: */
-#define LINUX_SYS_fadvise64 250
-
-/* syscall: "linux_exit_group" ret: "int" args: "int" */
-#define LINUX_SYS_linux_exit_group 252
-
-/* syscall: "epoll_create" ret: "int" args: */
-#define LINUX_SYS_epoll_create 254
-
-/* syscall: "epoll_ctl" ret: "int" args: */
-#define LINUX_SYS_epoll_ctl 255
-
-/* syscall: "epoll_wait" ret: "int" args: */
-#define LINUX_SYS_epoll_wait 256
-
-/* syscall: "set_tid_address" ret: "int" args: "void *" */
-#define LINUX_SYS_set_tid_address 258
-
-/* syscall: "clock_gettime" ret: "int" args: "clockid_t" "struct linux_timespec *" */
-#define LINUX_SYS_clock_gettime 265
-
-/* syscall: "clock_getres" ret: "int" args: "clockid_t" "struct linux_timespec *" */
-#define LINUX_SYS_clock_getres 266
-
-/* syscall: "statfs64" ret: "int" args: "char *" "struct linux_statfs64 *" */
-#define LINUX_SYS_statfs64 268
-
-/* syscall: "fstatfs64" ret: "int" args: "int" "struct linux_statfs64 *" */
-#define LINUX_SYS_fstatfs64 269
-
-/* syscall: "tgkill" ret: "int" args: "int" "int" "int" */
-#define LINUX_SYS_tgkill 270
-
-/* syscall: "set_robust_list" ret: "int" args: "struct linux_robust_list_head *" "size_t" */
-#define LINUX_SYS_set_robust_list 311
-
-/* syscall: "get_robust_list" ret: "int" args: "int" "struct linux_robust_list_head **" "size_t *" */
-#define LINUX_SYS_get_robust_list 312
-
-/* syscall: "epoll_pwait" ret: "int" args: */
-#define LINUX_SYS_epoll_pwait 319
-
-/* syscall: "eventfd" ret: "int" args: */
-#define LINUX_SYS_eventfd 323
-
-/* syscall: "eventfd2" ret: "int" args: */
-#define LINUX_SYS_eventfd2 328
-
-/* syscall: "epoll_create1" ret: "int" args: */
-#define LINUX_SYS_epoll_create1 329
-
-/* syscall: "pipe2" ret: "int" args: "int *" "int" */
-#define LINUX_SYS_pipe2 331
-
-#define LINUX_SYS_MAXSYSCALL 338
diff --git a/sys/compat/linux/linux_syscallargs.h b/sys/compat/linux/linux_syscallargs.h
deleted file mode 100644
index a17307adb22..00000000000
--- a/sys/compat/linux/linux_syscallargs.h
+++ /dev/null
@@ -1,940 +0,0 @@
-/* $OpenBSD: linux_syscallargs.h,v 1.81 2014/09/01 05:13:21 doug Exp $ */
-
-/*
- * System call argument lists.
- *
- * DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.76 2014/09/01 05:09:53 doug Exp
- */
-
-#ifdef syscallarg
-#undef syscallarg
-#endif
-
-#define syscallarg(x) \
- union { \
- register_t pad; \
- struct { x datum; } le; \
- struct { \
- int8_t pad[ (sizeof (register_t) < sizeof (x)) \
- ? 0 \
- : sizeof (register_t) - sizeof (x)]; \
- x datum; \
- } be; \
- }
-
-struct linux_sys_open_args {
- syscallarg(char *) path;
- syscallarg(int) flags;
- syscallarg(int) mode;
-};
-
-struct linux_sys_waitpid_args {
- syscallarg(int) pid;
- syscallarg(int *) status;
- syscallarg(int) options;
-};
-
-struct linux_sys_creat_args {
- syscallarg(char *) path;
- syscallarg(int) mode;
-};
-
-struct linux_sys_unlink_args {
- syscallarg(char *) path;
-};
-
-struct linux_sys_execve_args {
- syscallarg(char *) path;
- syscallarg(char **) argp;
- syscallarg(char **) envp;
-};
-
-struct linux_sys_chdir_args {
- syscallarg(char *) path;
-};
-
-struct linux_sys_time_args {
- syscallarg(linux_time_t *) t;
-};
-
-struct linux_sys_mknod_args {
- syscallarg(char *) path;
- syscallarg(int) mode;
- syscallarg(int) dev;
-};
-
-struct linux_sys_chmod_args {
- syscallarg(char *) path;
- syscallarg(int) mode;
-};
-
-struct linux_sys_lchown16_args {
- syscallarg(char *) path;
- syscallarg(int) uid;
- syscallarg(int) gid;
-};
-
-struct linux_sys_break_args {
- syscallarg(char *) nsize;
-};
-
-struct linux_sys_lseek_args {
- syscallarg(int) fd;
- syscallarg(long) offset;
- syscallarg(int) whence;
-};
-
-struct linux_sys_mount_args {
- syscallarg(char *) specialfile;
- syscallarg(char *) dir;
- syscallarg(char *) filesystemtype;
- syscallarg(long) rwflag;
- syscallarg(void *) data;
-};
-
-struct linux_sys_umount_args {
- syscallarg(char *) specialfile;
-};
-
-struct linux_sys_alarm_args {
- syscallarg(unsigned int) secs;
-};
-
-struct linux_sys_utime_args {
- syscallarg(char *) path;
- syscallarg(struct linux_utimbuf *) times;
-};
-
-struct linux_sys_access_args {
- syscallarg(char *) path;
- syscallarg(int) flags;
-};
-
-struct linux_sys_nice_args {
- syscallarg(int) incr;
-};
-
-struct linux_sys_kill_args {
- syscallarg(int) pid;
- syscallarg(int) signum;
-};
-
-struct linux_sys_rename_args {
- syscallarg(char *) from;
- syscallarg(char *) to;
-};
-
-struct linux_sys_mkdir_args {
- syscallarg(char *) path;
- syscallarg(int) mode;
-};
-
-struct linux_sys_rmdir_args {
- syscallarg(char *) path;
-};
-
-struct linux_sys_times_args {
- syscallarg(struct linux_tms *) tms;
-};
-
-struct linux_sys_brk_args {
- syscallarg(char *) nsize;
-};
-
-struct linux_sys_signal_args {
- syscallarg(int) sig;
- syscallarg(linux_handler_t) handler;
-};
-
-struct linux_sys_ioctl_args {
- syscallarg(int) fd;
- syscallarg(u_long) com;
- syscallarg(caddr_t) data;
-};
-
-struct linux_sys_fcntl_args {
- syscallarg(int) fd;
- syscallarg(int) cmd;
- syscallarg(void *) arg;
-};
-
-struct linux_sys_oldolduname_args {
- syscallarg(struct linux_oldold_utsname *) up;
-};
-
-struct linux_sys_sigaction_args {
- syscallarg(int) signum;
- syscallarg(struct linux_old_sigaction *) nsa;
- syscallarg(struct linux_old_sigaction *) osa;
-};
-
-struct linux_sys_sigsetmask_args {
- syscallarg(linux_old_sigset_t) mask;
-};
-
-struct linux_sys_setreuid16_args {
- syscallarg(int) ruid;
- syscallarg(int) euid;
-};
-
-struct linux_sys_setregid16_args {
- syscallarg(int) rgid;
- syscallarg(int) egid;
-};
-
-struct linux_sys_sigsuspend_args {
- syscallarg(caddr_t) restart;
- syscallarg(int) oldmask;
- syscallarg(int) mask;
-};
-
-struct linux_sys_sigpending_args {
- syscallarg(linux_old_sigset_t *) mask;
-};
-
-struct linux_sys_sethostname_args {
- syscallarg(char *) hostname;
- syscallarg(u_int) len;
-};
-
-struct linux_sys_setrlimit_args {
- syscallarg(u_int) which;
- syscallarg(struct linux_rlimit *) rlp;
-};
-
-struct linux_sys_getrlimit_args {
- syscallarg(u_int) which;
- syscallarg(struct linux_rlimit *) rlp;
-};
-
-struct linux_sys_getrusage_args {
- syscallarg(int) who;
- syscallarg(struct linux_rusage *) rusage;
-};
-
-struct linux_sys_gettimeofday_args {
- syscallarg(struct linux_timeval *) tp;
- syscallarg(struct timezone *) tzp;
-};
-
-struct linux_sys_oldselect_args {
- syscallarg(struct linux_select *) lsp;
-};
-
-struct linux_sys_symlink_args {
- syscallarg(char *) path;
- syscallarg(char *) to;
-};
-
-struct linux_sys_readlink_args {
- syscallarg(char *) name;
- syscallarg(char *) buf;
- syscallarg(int) count;
-};
-
-struct linux_sys_swapon_args {
- syscallarg(char *) name;
-};
-
-struct linux_sys_readdir_args {
- syscallarg(int) fd;
- syscallarg(caddr_t) dent;
- syscallarg(unsigned int) count;
-};
-
-struct linux_sys_mmap_args {
- syscallarg(struct linux_mmap *) lmp;
-};
-
-struct linux_sys_truncate_args {
- syscallarg(char *) path;
- syscallarg(long) length;
-};
-
-struct linux_sys_ftruncate_args {
- syscallarg(int) fd;
- syscallarg(long) length;
-};
-
-struct linux_sys_fchown16_args {
- syscallarg(int) fd;
- syscallarg(int) uid;
- syscallarg(int) gid;
-};
-
-struct linux_sys_statfs_args {
- syscallarg(char *) path;
- syscallarg(struct linux_statfs *) sp;
-};
-
-struct linux_sys_fstatfs_args {
- syscallarg(int) fd;
- syscallarg(struct linux_statfs *) sp;
-};
-
-struct linux_sys_ioperm_args {
- syscallarg(unsigned int) lo;
- syscallarg(unsigned int) hi;
- syscallarg(int) val;
-};
-
-struct linux_sys_socketcall_args {
- syscallarg(int) what;
- syscallarg(void *) args;
-};
-
-struct linux_sys_setitimer_args {
- syscallarg(u_int) which;
- syscallarg(struct linux_itimerval *) itv;
- syscallarg(struct linux_itimerval *) oitv;
-};
-
-struct linux_sys_getitimer_args {
- syscallarg(u_int) which;
- syscallarg(struct linux_itimerval *) itv;
-};
-
-struct linux_sys_stat_args {
- syscallarg(char *) path;
- syscallarg(struct linux_stat *) sp;
-};
-
-struct linux_sys_lstat_args {
- syscallarg(char *) path;
- syscallarg(struct linux_stat *) sp;
-};
-
-struct linux_sys_fstat_args {
- syscallarg(int) fd;
- syscallarg(struct linux_stat *) sp;
-};
-
-struct linux_sys_olduname_args {
- syscallarg(struct linux_old_utsname *) up;
-};
-
-struct linux_sys_iopl_args {
- syscallarg(int) level;
-};
-
-struct linux_sys_wait4_args {
- syscallarg(int) pid;
- syscallarg(int *) status;
- syscallarg(int) options;
- syscallarg(struct linux_rusage *) rusage;
-};
-
-struct linux_sys_sysinfo_args {
- syscallarg(struct linux_sysinfo *) sysinfo;
-};
-
-struct linux_sys_ipc_args {
- syscallarg(int) what;
- syscallarg(int) a1;
- syscallarg(int) a2;
- syscallarg(int) a3;
- syscallarg(caddr_t) ptr;
-};
-
-struct linux_sys_sigreturn_args {
- syscallarg(struct linux_sigcontext *) scp;
-};
-
-struct linux_sys_clone_args {
- syscallarg(int) flags;
- syscallarg(void *) stack;
- syscallarg(void *) parent_tidptr;
- syscallarg(void *) tls;
- syscallarg(void *) child_tidptr;
-};
-
-struct linux_sys_setdomainname_args {
- syscallarg(char *) name;
- syscallarg(int) len;
-};
-
-struct linux_sys_uname_args {
- syscallarg(struct linux_utsname *) up;
-};
-
-struct linux_sys_modify_ldt_args {
- syscallarg(int) func;
- syscallarg(void *) ptr;
- syscallarg(size_t) bytecount;
-};
-
-struct linux_sys_mprotect_args {
- syscallarg(caddr_t) addr;
- syscallarg(int) len;
- syscallarg(int) prot;
-};
-
-struct linux_sys_sigprocmask_args {
- syscallarg(int) how;
- syscallarg(linux_old_sigset_t *) set;
- syscallarg(linux_old_sigset_t *) oset;
-};
-
-struct linux_sys_getpgid_args {
- syscallarg(int) pid;
-};
-
-struct linux_sys_personality_args {
- syscallarg(int) per;
-};
-
-struct linux_sys_llseek_args {
- syscallarg(int) fd;
- syscallarg(u_int32_t) ohigh;
- syscallarg(u_int32_t) olow;
- syscallarg(caddr_t) res;
- syscallarg(int) whence;
-};
-
-struct linux_sys_getdents_args {
- syscallarg(int) fd;
- syscallarg(void *) dirent;
- syscallarg(unsigned) count;
-};
-
-struct linux_sys_select_args {
- syscallarg(int) nfds;
- syscallarg(fd_set *) readfds;
- syscallarg(fd_set *) writefds;
- syscallarg(fd_set *) exceptfds;
- syscallarg(struct linux_timeval *) timeout;
-};
-
-struct linux_sys_fdatasync_args {
- syscallarg(int) fd;
-};
-
-struct linux_sys___sysctl_args {
- syscallarg(struct linux___sysctl *) lsp;
-};
-
-struct linux_sys_sched_setparam_args {
- syscallarg(linux_pid_t) pid;
- syscallarg(const struct linux_sched_param *) sp;
-};
-
-struct linux_sys_sched_getparam_args {
- syscallarg(linux_pid_t) pid;
- syscallarg(struct linux_sched_param *) sp;
-};
-
-struct linux_sys_sched_setscheduler_args {
- syscallarg(linux_pid_t) pid;
- syscallarg(int) policy;
- syscallarg(const struct linux_sched_param *) sp;
-};
-
-struct linux_sys_sched_getscheduler_args {
- syscallarg(linux_pid_t) pid;
-};
-
-struct linux_sys_sched_get_priority_max_args {
- syscallarg(int) policy;
-};
-
-struct linux_sys_sched_get_priority_min_args {
- syscallarg(int) policy;
-};
-
-struct linux_sys_nanosleep_args {
- syscallarg(const struct linux_timespec *) rqtp;
- syscallarg(struct linux_timespec *) rmtp;
-};
-
-struct linux_sys_mremap_args {
- syscallarg(void *) old_address;
- syscallarg(size_t) old_size;
- syscallarg(size_t) new_size;
- syscallarg(long) flags;
-};
-
-struct linux_sys_setresuid16_args {
- syscallarg(u_int16_t) ruid;
- syscallarg(u_int16_t) euid;
- syscallarg(u_int16_t) suid;
-};
-
-struct linux_sys_getresuid16_args {
- syscallarg(u_int16_t *) ruid;
- syscallarg(u_int16_t *) euid;
- syscallarg(u_int16_t *) suid;
-};
-
-struct linux_sys_setresgid16_args {
- syscallarg(u_int16_t) rgid;
- syscallarg(u_int16_t) egid;
- syscallarg(u_int16_t) sgid;
-};
-
-struct linux_sys_getresgid16_args {
- syscallarg(u_int16_t *) rgid;
- syscallarg(u_int16_t *) egid;
- syscallarg(u_int16_t *) sgid;
-};
-
-struct linux_sys_prctl_args {
- syscallarg(int) option;
- syscallarg(unsigned long) arg2;
- syscallarg(unsigned long) arg3;
- syscallarg(unsigned long) arg4;
- syscallarg(unsigned long) arg5;
-};
-
-struct linux_sys_rt_sigreturn_args {
- syscallarg(struct linux_rt_sigframe *) sfp;
-};
-
-struct linux_sys_rt_sigaction_args {
- syscallarg(int) signum;
- syscallarg(struct linux_sigaction *) nsa;
- syscallarg(struct linux_sigaction *) osa;
- syscallarg(size_t) sigsetsize;
-};
-
-struct linux_sys_rt_sigprocmask_args {
- syscallarg(int) how;
- syscallarg(const linux_sigset_t *) set;
- syscallarg(linux_sigset_t *) oset;
- syscallarg(size_t) sigsetsize;
-};
-
-struct linux_sys_rt_sigpending_args {
- syscallarg(linux_sigset_t *) set;
- syscallarg(size_t) sigsetsize;
-};
-
-struct linux_sys_rt_sigsuspend_args {
- syscallarg(linux_sigset_t *) unewset;
- syscallarg(size_t) sigsetsize;
-};
-
-struct linux_sys_pread_args {
- syscallarg(int) fd;
- syscallarg(char *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(linux_off_t) offset;
-};
-
-struct linux_sys_pwrite_args {
- syscallarg(int) fd;
- syscallarg(char *) buf;
- syscallarg(size_t) nbyte;
- syscallarg(linux_off_t) offset;
-};
-
-struct linux_sys_chown16_args {
- syscallarg(char *) path;
- syscallarg(int) uid;
- syscallarg(int) gid;
-};
-
-struct linux_sys_sigaltstack_args {
- syscallarg(const struct linux_sigaltstack *) nss;
- syscallarg(struct linux_sigaltstack *) oss;
-};
-
-struct linux_sys_ugetrlimit_args {
- syscallarg(u_int) which;
- syscallarg(struct linux_rlimit *) rlp;
-};
-
-struct linux_sys_mmap2_args {
- syscallarg(unsigned long) addr;
- syscallarg(size_t) len;
- syscallarg(int) prot;
- syscallarg(int) flags;
- syscallarg(int) fd;
- syscallarg(linux_off_t) offset;
-};
-
-struct linux_sys_truncate64_args {
- syscallarg(char *) path;
- syscallarg(off_t) length;
-};
-
-struct linux_sys_ftruncate64_args {
- syscallarg(int) fd;
- syscallarg(off_t) length;
-};
-
-struct linux_sys_stat64_args {
- syscallarg(char *) path;
- syscallarg(struct linux_stat64 *) sp;
-};
-
-struct linux_sys_lstat64_args {
- syscallarg(char *) path;
- syscallarg(struct linux_stat64 *) sp;
-};
-
-struct linux_sys_fstat64_args {
- syscallarg(int) fd;
- syscallarg(struct linux_stat64 *) sp;
-};
-
-struct linux_sys_chown_args {
- syscallarg(char *) path;
- syscallarg(uid_t) uid;
- syscallarg(gid_t) gid;
-};
-
-struct linux_sys_setfsuid_args {
- syscallarg(uid_t) uid;
-};
-
-struct linux_sys_getdents64_args {
- syscallarg(int) fd;
- syscallarg(void *) dirent;
- syscallarg(unsigned) count;
-};
-
-struct linux_sys_fcntl64_args {
- syscallarg(u_int) fd;
- syscallarg(u_int) cmd;
- syscallarg(void *) arg;
-};
-
-struct linux_sys_futex_args {
- syscallarg(int *) uaddr;
- syscallarg(int) op;
- syscallarg(int) val;
- syscallarg(const struct linux_timespec *) timeout;
- syscallarg(int *) uaddr2;
- syscallarg(int) val3;
-};
-
-struct linux_sys_set_thread_area_args {
- syscallarg(struct l_segment_descriptor *) desc;
-};
-
-struct linux_sys_get_thread_area_args {
- syscallarg(struct l_segment_descriptor *) desc;
-};
-
-struct linux_sys_set_tid_address_args {
- syscallarg(void *) tidptr;
-};
-
-struct linux_sys_clock_gettime_args {
- syscallarg(clockid_t) which;
- syscallarg(struct linux_timespec *) tp;
-};
-
-struct linux_sys_clock_getres_args {
- syscallarg(clockid_t) which;
- syscallarg(struct linux_timespec *) tp;
-};
-
-struct linux_sys_statfs64_args {
- syscallarg(char *) path;
- syscallarg(struct linux_statfs64 *) sp;
-};
-
-struct linux_sys_fstatfs64_args {
- syscallarg(int) fd;
- syscallarg(struct linux_statfs64 *) sp;
-};
-
-struct linux_sys_tgkill_args {
- syscallarg(int) tgid;
- syscallarg(int) tid;
- syscallarg(int) sig;
-};
-
-struct linux_sys_set_robust_list_args {
- syscallarg(struct linux_robust_list_head *) head;
- syscallarg(size_t) len;
-};
-
-struct linux_sys_get_robust_list_args {
- syscallarg(int) pid;
- syscallarg(struct linux_robust_list_head **) head;
- syscallarg(size_t *) len;
-};
-
-struct linux_sys_pipe2_args {
- syscallarg(int *) fdp;
- syscallarg(int) flags;
-};
-
-/*
- * System call prototypes.
- */
-
-int sys_nosys(struct proc *, void *, register_t *);
-int sys_exit(struct proc *, void *, register_t *);
-int sys_fork(struct proc *, void *, register_t *);
-int sys_read(struct proc *, void *, register_t *);
-int sys_write(struct proc *, void *, register_t *);
-int linux_sys_open(struct proc *, void *, register_t *);
-int sys_close(struct proc *, void *, register_t *);
-int linux_sys_waitpid(struct proc *, void *, register_t *);
-int linux_sys_creat(struct proc *, void *, register_t *);
-int sys_link(struct proc *, void *, register_t *);
-int linux_sys_unlink(struct proc *, void *, register_t *);
-int linux_sys_execve(struct proc *, void *, register_t *);
-int linux_sys_chdir(struct proc *, void *, register_t *);
-int linux_sys_time(struct proc *, void *, register_t *);
-int linux_sys_mknod(struct proc *, void *, register_t *);
-int linux_sys_chmod(struct proc *, void *, register_t *);
-int linux_sys_lchown16(struct proc *, void *, register_t *);
-int linux_sys_break(struct proc *, void *, register_t *);
-int linux_sys_ostat(struct proc *, void *, register_t *);
-int linux_sys_lseek(struct proc *, void *, register_t *);
-int linux_sys_getpid(struct proc *, void *, register_t *);
-int linux_sys_mount(struct proc *, void *, register_t *);
-int linux_sys_umount(struct proc *, void *, register_t *);
-int sys_setuid(struct proc *, void *, register_t *);
-int linux_sys_getuid(struct proc *, void *, register_t *);
-#ifdef PTRACE
-int linux_sys_ptrace(struct proc *, void *, register_t *);
-#else
-#endif
-int linux_sys_alarm(struct proc *, void *, register_t *);
-int linux_sys_ofstat(struct proc *, void *, register_t *);
-int linux_sys_pause(struct proc *, void *, register_t *);
-int linux_sys_utime(struct proc *, void *, register_t *);
-int linux_sys_stty(struct proc *, void *, register_t *);
-int linux_sys_gtty(struct proc *, void *, register_t *);
-int linux_sys_access(struct proc *, void *, register_t *);
-int linux_sys_nice(struct proc *, void *, register_t *);
-int linux_sys_ftime(struct proc *, void *, register_t *);
-int sys_sync(struct proc *, void *, register_t *);
-int linux_sys_kill(struct proc *, void *, register_t *);
-int linux_sys_rename(struct proc *, void *, register_t *);
-int linux_sys_mkdir(struct proc *, void *, register_t *);
-int linux_sys_rmdir(struct proc *, void *, register_t *);
-int sys_dup(struct proc *, void *, register_t *);
-int sys_pipe(struct proc *, void *, register_t *);
-int linux_sys_times(struct proc *, void *, register_t *);
-int linux_sys_prof(struct proc *, void *, register_t *);
-int linux_sys_brk(struct proc *, void *, register_t *);
-int sys_setgid(struct proc *, void *, register_t *);
-int linux_sys_getgid(struct proc *, void *, register_t *);
-int linux_sys_signal(struct proc *, void *, register_t *);
-int sys_geteuid(struct proc *, void *, register_t *);
-int sys_getegid(struct proc *, void *, register_t *);
-#ifdef ACCOUNTING
-int sys_acct(struct proc *, void *, register_t *);
-#else
-#endif
-int linux_sys_phys(struct proc *, void *, register_t *);
-int linux_sys_lock(struct proc *, void *, register_t *);
-int linux_sys_ioctl(struct proc *, void *, register_t *);
-int linux_sys_fcntl(struct proc *, void *, register_t *);
-int linux_sys_mpx(struct proc *, void *, register_t *);
-int sys_setpgid(struct proc *, void *, register_t *);
-int linux_sys_ulimit(struct proc *, void *, register_t *);
-int linux_sys_oldolduname(struct proc *, void *, register_t *);
-int sys_umask(struct proc *, void *, register_t *);
-int sys_chroot(struct proc *, void *, register_t *);
-int linux_sys_ustat(struct proc *, void *, register_t *);
-int sys_dup2(struct proc *, void *, register_t *);
-int sys_getppid(struct proc *, void *, register_t *);
-int sys_getpgrp(struct proc *, void *, register_t *);
-int sys_setsid(struct proc *, void *, register_t *);
-int linux_sys_sigaction(struct proc *, void *, register_t *);
-int linux_sys_siggetmask(struct proc *, void *, register_t *);
-int linux_sys_sigsetmask(struct proc *, void *, register_t *);
-int linux_sys_setreuid16(struct proc *, void *, register_t *);
-int linux_sys_setregid16(struct proc *, void *, register_t *);
-int linux_sys_sigsuspend(struct proc *, void *, register_t *);
-int linux_sys_sigpending(struct proc *, void *, register_t *);
-int linux_sys_sethostname(struct proc *, void *, register_t *);
-int linux_sys_setrlimit(struct proc *, void *, register_t *);
-int linux_sys_getrlimit(struct proc *, void *, register_t *);
-int linux_sys_getrusage(struct proc *, void *, register_t *);
-int linux_sys_gettimeofday(struct proc *, void *, register_t *);
-int sys_getgroups(struct proc *, void *, register_t *);
-int sys_setgroups(struct proc *, void *, register_t *);
-int linux_sys_oldselect(struct proc *, void *, register_t *);
-int linux_sys_symlink(struct proc *, void *, register_t *);
-int linux_sys_lstat(struct proc *, void *, register_t *);
-int linux_sys_readlink(struct proc *, void *, register_t *);
-int linux_sys_swapon(struct proc *, void *, register_t *);
-int sys_reboot(struct proc *, void *, register_t *);
-int linux_sys_readdir(struct proc *, void *, register_t *);
-int linux_sys_mmap(struct proc *, void *, register_t *);
-int sys_munmap(struct proc *, void *, register_t *);
-int linux_sys_truncate(struct proc *, void *, register_t *);
-int linux_sys_ftruncate(struct proc *, void *, register_t *);
-int sys_fchmod(struct proc *, void *, register_t *);
-int linux_sys_fchown16(struct proc *, void *, register_t *);
-int sys_getpriority(struct proc *, void *, register_t *);
-int sys_setpriority(struct proc *, void *, register_t *);
-int sys_profil(struct proc *, void *, register_t *);
-int linux_sys_statfs(struct proc *, void *, register_t *);
-int linux_sys_fstatfs(struct proc *, void *, register_t *);
-#ifdef __i386__
-int linux_sys_ioperm(struct proc *, void *, register_t *);
-#else
-int linux_sys_ioperm(struct proc *, void *, register_t *);
-#endif
-int linux_sys_socketcall(struct proc *, void *, register_t *);
-int linux_sys_klog(struct proc *, void *, register_t *);
-int linux_sys_setitimer(struct proc *, void *, register_t *);
-int linux_sys_getitimer(struct proc *, void *, register_t *);
-int linux_sys_stat(struct proc *, void *, register_t *);
-int linux_sys_lstat(struct proc *, void *, register_t *);
-int linux_sys_fstat(struct proc *, void *, register_t *);
-int linux_sys_olduname(struct proc *, void *, register_t *);
-#ifdef __i386__
-int linux_sys_iopl(struct proc *, void *, register_t *);
-#else
-int linux_sys_iopl(struct proc *, void *, register_t *);
-#endif
-int linux_sys_vhangup(struct proc *, void *, register_t *);
-int linux_sys_idle(struct proc *, void *, register_t *);
-int linux_sys_vm86old(struct proc *, void *, register_t *);
-int linux_sys_wait4(struct proc *, void *, register_t *);
-int linux_sys_swapoff(struct proc *, void *, register_t *);
-int linux_sys_sysinfo(struct proc *, void *, register_t *);
-int linux_sys_ipc(struct proc *, void *, register_t *);
-int sys_fsync(struct proc *, void *, register_t *);
-int linux_sys_sigreturn(struct proc *, void *, register_t *);
-int linux_sys_clone(struct proc *, void *, register_t *);
-int linux_sys_setdomainname(struct proc *, void *, register_t *);
-int linux_sys_uname(struct proc *, void *, register_t *);
-#ifdef __i386__
-int linux_sys_modify_ldt(struct proc *, void *, register_t *);
-#else
-int linux_sys_modify_ldt(struct proc *, void *, register_t *);
-#endif
-int linux_sys_adjtimex(struct proc *, void *, register_t *);
-int linux_sys_mprotect(struct proc *, void *, register_t *);
-int linux_sys_sigprocmask(struct proc *, void *, register_t *);
-int linux_sys_create_module(struct proc *, void *, register_t *);
-int linux_sys_init_module(struct proc *, void *, register_t *);
-int linux_sys_delete_module(struct proc *, void *, register_t *);
-int linux_sys_get_kernel_syms(struct proc *, void *, register_t *);
-int linux_sys_quotactl(struct proc *, void *, register_t *);
-int linux_sys_getpgid(struct proc *, void *, register_t *);
-int sys_fchdir(struct proc *, void *, register_t *);
-int linux_sys_bdflush(struct proc *, void *, register_t *);
-int linux_sys_sysfs(struct proc *, void *, register_t *);
-int linux_sys_personality(struct proc *, void *, register_t *);
-int linux_sys_afs_syscall(struct proc *, void *, register_t *);
-int linux_sys_setfsuid(struct proc *, void *, register_t *);
-int linux_sys_getfsuid(struct proc *, void *, register_t *);
-int linux_sys_llseek(struct proc *, void *, register_t *);
-int linux_sys_getdents(struct proc *, void *, register_t *);
-int linux_sys_select(struct proc *, void *, register_t *);
-int sys_flock(struct proc *, void *, register_t *);
-int sys_msync(struct proc *, void *, register_t *);
-int sys_readv(struct proc *, void *, register_t *);
-int sys_writev(struct proc *, void *, register_t *);
-int sys_getsid(struct proc *, void *, register_t *);
-int linux_sys_fdatasync(struct proc *, void *, register_t *);
-int linux_sys___sysctl(struct proc *, void *, register_t *);
-int sys_mlock(struct proc *, void *, register_t *);
-int sys_munlock(struct proc *, void *, register_t *);
-int linux_sys_mlockall(struct proc *, void *, register_t *);
-int linux_sys_munlockall(struct proc *, void *, register_t *);
-int linux_sys_sched_setparam(struct proc *, void *, register_t *);
-int linux_sys_sched_getparam(struct proc *, void *, register_t *);
-int linux_sys_sched_setscheduler(struct proc *, void *, register_t *);
-int linux_sys_sched_getscheduler(struct proc *, void *, register_t *);
-int linux_sys_sched_yield(struct proc *, void *, register_t *);
-int linux_sys_sched_get_priority_max(struct proc *, void *, register_t *);
-int linux_sys_sched_get_priority_min(struct proc *, void *, register_t *);
-int linux_sys_sched_rr_get_interval(struct proc *, void *, register_t *);
-int linux_sys_nanosleep(struct proc *, void *, register_t *);
-int linux_sys_mremap(struct proc *, void *, register_t *);
-int linux_sys_setresuid16(struct proc *, void *, register_t *);
-int linux_sys_getresuid16(struct proc *, void *, register_t *);
-int linux_sys_vm86(struct proc *, void *, register_t *);
-int linux_sys_query_module(struct proc *, void *, register_t *);
-int sys_poll(struct proc *, void *, register_t *);
-int linux_sys_nfsservctl(struct proc *, void *, register_t *);
-int linux_sys_setresgid16(struct proc *, void *, register_t *);
-int linux_sys_getresgid16(struct proc *, void *, register_t *);
-int linux_sys_prctl(struct proc *, void *, register_t *);
-int linux_sys_rt_sigreturn(struct proc *, void *, register_t *);
-int linux_sys_rt_sigaction(struct proc *, void *, register_t *);
-int linux_sys_rt_sigprocmask(struct proc *, void *, register_t *);
-int linux_sys_rt_sigpending(struct proc *, void *, register_t *);
-int linux_sys_rt_sigtimedwait(struct proc *, void *, register_t *);
-int linux_sys_rt_queueinfo(struct proc *, void *, register_t *);
-int linux_sys_rt_sigsuspend(struct proc *, void *, register_t *);
-int linux_sys_pread(struct proc *, void *, register_t *);
-int linux_sys_pwrite(struct proc *, void *, register_t *);
-int linux_sys_chown16(struct proc *, void *, register_t *);
-int sys___getcwd(struct proc *, void *, register_t *);
-int linux_sys_capget(struct proc *, void *, register_t *);
-int linux_sys_capset(struct proc *, void *, register_t *);
-int linux_sys_sigaltstack(struct proc *, void *, register_t *);
-int linux_sys_sendfile(struct proc *, void *, register_t *);
-int linux_sys_getpmsg(struct proc *, void *, register_t *);
-int linux_sys_putpmsg(struct proc *, void *, register_t *);
-int sys_vfork(struct proc *, void *, register_t *);
-int linux_sys_ugetrlimit(struct proc *, void *, register_t *);
-int linux_sys_mmap2(struct proc *, void *, register_t *);
-int linux_sys_truncate64(struct proc *, void *, register_t *);
-int linux_sys_ftruncate64(struct proc *, void *, register_t *);
-int linux_sys_stat64(struct proc *, void *, register_t *);
-int linux_sys_lstat64(struct proc *, void *, register_t *);
-int linux_sys_fstat64(struct proc *, void *, register_t *);
-int linux_sys_lchown(struct proc *, void *, register_t *);
-int linux_sys_getuid(struct proc *, void *, register_t *);
-int linux_sys_getgid(struct proc *, void *, register_t *);
-int sys_geteuid(struct proc *, void *, register_t *);
-int sys_getegid(struct proc *, void *, register_t *);
-int sys_setreuid(struct proc *, void *, register_t *);
-int sys_setregid(struct proc *, void *, register_t *);
-int sys_getgroups(struct proc *, void *, register_t *);
-int sys_setgroups(struct proc *, void *, register_t *);
-int linux_sys_fchown(struct proc *, void *, register_t *);
-int sys_setresuid(struct proc *, void *, register_t *);
-int sys_getresuid(struct proc *, void *, register_t *);
-int sys_setresgid(struct proc *, void *, register_t *);
-int sys_getresgid(struct proc *, void *, register_t *);
-int linux_sys_chown(struct proc *, void *, register_t *);
-int sys_setuid(struct proc *, void *, register_t *);
-int sys_setgid(struct proc *, void *, register_t *);
-int linux_sys_setfsuid(struct proc *, void *, register_t *);
-int linux_sys_setfsgid(struct proc *, void *, register_t *);
-int linux_sys_pivot_root(struct proc *, void *, register_t *);
-int linux_sys_mincore(struct proc *, void *, register_t *);
-int sys_madvise(struct proc *, void *, register_t *);
-int linux_sys_getdents64(struct proc *, void *, register_t *);
-int linux_sys_fcntl64(struct proc *, void *, register_t *);
-int linux_sys_gettid(struct proc *, void *, register_t *);
-int linux_sys_setxattr(struct proc *, void *, register_t *);
-int linux_sys_lsetxattr(struct proc *, void *, register_t *);
-int linux_sys_fsetxattr(struct proc *, void *, register_t *);
-int linux_sys_getxattr(struct proc *, void *, register_t *);
-int linux_sys_lgetxattr(struct proc *, void *, register_t *);
-int linux_sys_fgetxattr(struct proc *, void *, register_t *);
-int linux_sys_listxattr(struct proc *, void *, register_t *);
-int linux_sys_llistxattr(struct proc *, void *, register_t *);
-int linux_sys_flistxattr(struct proc *, void *, register_t *);
-int linux_sys_removexattr(struct proc *, void *, register_t *);
-int linux_sys_lremovexattr(struct proc *, void *, register_t *);
-int linux_sys_fremovexattr(struct proc *, void *, register_t *);
-int linux_sys_futex(struct proc *, void *, register_t *);
-int linux_sys_set_thread_area(struct proc *, void *, register_t *);
-int linux_sys_get_thread_area(struct proc *, void *, register_t *);
-int linux_sys_fadvise64(struct proc *, void *, register_t *);
-int sys_exit(struct proc *, void *, register_t *);
-int linux_sys_epoll_create(struct proc *, void *, register_t *);
-int linux_sys_epoll_ctl(struct proc *, void *, register_t *);
-int linux_sys_epoll_wait(struct proc *, void *, register_t *);
-int linux_sys_set_tid_address(struct proc *, void *, register_t *);
-int linux_sys_clock_gettime(struct proc *, void *, register_t *);
-int linux_sys_clock_getres(struct proc *, void *, register_t *);
-int linux_sys_statfs64(struct proc *, void *, register_t *);
-int linux_sys_fstatfs64(struct proc *, void *, register_t *);
-int linux_sys_tgkill(struct proc *, void *, register_t *);
-int linux_sys_set_robust_list(struct proc *, void *, register_t *);
-int linux_sys_get_robust_list(struct proc *, void *, register_t *);
-int linux_sys_epoll_pwait(struct proc *, void *, register_t *);
-int linux_sys_eventfd(struct proc *, void *, register_t *);
-int linux_sys_eventfd2(struct proc *, void *, register_t *);
-int linux_sys_epoll_create1(struct proc *, void *, register_t *);
-int linux_sys_pipe2(struct proc *, void *, register_t *);
diff --git a/sys/compat/linux/linux_syscalls.c b/sys/compat/linux/linux_syscalls.c
deleted file mode 100644
index c4cac725fe7..00000000000
--- a/sys/compat/linux/linux_syscalls.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/* $OpenBSD: linux_syscalls.c,v 1.79 2014/09/01 05:13:21 doug Exp $ */
-
-/*
- * System call names.
- *
- * DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.76 2014/09/01 05:09:53 doug Exp
- */
-
-char *linux_syscallnames[] = {
- "syscall", /* 0 = syscall */
- "exit", /* 1 = exit */
- "fork", /* 2 = fork */
- "read", /* 3 = read */
- "write", /* 4 = write */
- "open", /* 5 = open */
- "close", /* 6 = close */
- "waitpid", /* 7 = waitpid */
- "creat", /* 8 = creat */
- "link", /* 9 = link */
- "unlink", /* 10 = unlink */
- "execve", /* 11 = execve */
- "chdir", /* 12 = chdir */
- "time", /* 13 = time */
- "mknod", /* 14 = mknod */
- "chmod", /* 15 = chmod */
- "lchown16", /* 16 = lchown16 */
- "break", /* 17 = break */
- "ostat", /* 18 = ostat */
- "lseek", /* 19 = lseek */
- "getpid", /* 20 = getpid */
- "mount", /* 21 = mount */
- "umount", /* 22 = umount */
- "linux_setuid16", /* 23 = linux_setuid16 */
- "linux_getuid16", /* 24 = linux_getuid16 */
- "#25 (unimplemented stime)", /* 25 = unimplemented stime */
-#ifdef PTRACE
- "ptrace", /* 26 = ptrace */
-#else
- "#26 (unimplemented ptrace)", /* 26 = unimplemented ptrace */
-#endif
- "alarm", /* 27 = alarm */
- "ofstat", /* 28 = ofstat */
- "pause", /* 29 = pause */
- "utime", /* 30 = utime */
- "stty", /* 31 = stty */
- "gtty", /* 32 = gtty */
- "access", /* 33 = access */
- "nice", /* 34 = nice */
- "ftime", /* 35 = ftime */
- "sync", /* 36 = sync */
- "kill", /* 37 = kill */
- "rename", /* 38 = rename */
- "mkdir", /* 39 = mkdir */
- "rmdir", /* 40 = rmdir */
- "dup", /* 41 = dup */
- "pipe", /* 42 = pipe */
- "times", /* 43 = times */
- "prof", /* 44 = prof */
- "brk", /* 45 = brk */
- "linux_setgid16", /* 46 = linux_setgid16 */
- "linux_getgid16", /* 47 = linux_getgid16 */
- "signal", /* 48 = signal */
- "linux_geteuid16", /* 49 = linux_geteuid16 */
- "linux_getegid16", /* 50 = linux_getegid16 */
-#ifdef ACCOUNTING
- "acct", /* 51 = acct */
-#else
- "#51 (unimplemented acct)", /* 51 = unimplemented acct */
-#endif
- "phys", /* 52 = phys */
- "lock", /* 53 = lock */
- "ioctl", /* 54 = ioctl */
- "fcntl", /* 55 = fcntl */
- "mpx", /* 56 = mpx */
- "setpgid", /* 57 = setpgid */
- "ulimit", /* 58 = ulimit */
- "oldolduname", /* 59 = oldolduname */
- "umask", /* 60 = umask */
- "chroot", /* 61 = chroot */
- "ustat", /* 62 = ustat */
- "dup2", /* 63 = dup2 */
- "getppid", /* 64 = getppid */
- "getpgrp", /* 65 = getpgrp */
- "setsid", /* 66 = setsid */
- "sigaction", /* 67 = sigaction */
- "siggetmask", /* 68 = siggetmask */
- "sigsetmask", /* 69 = sigsetmask */
- "setreuid16", /* 70 = setreuid16 */
- "setregid16", /* 71 = setregid16 */
- "sigsuspend", /* 72 = sigsuspend */
- "sigpending", /* 73 = sigpending */
- "sethostname", /* 74 = sethostname */
- "setrlimit", /* 75 = setrlimit */
- "getrlimit", /* 76 = getrlimit */
- "getrusage", /* 77 = getrusage */
- "gettimeofday", /* 78 = gettimeofday */
- "#79 (unimplemented settimeofday)", /* 79 = unimplemented settimeofday */
- "linux_getgroups", /* 80 = linux_getgroups */
- "linux_setgroups", /* 81 = linux_setgroups */
- "oldselect", /* 82 = oldselect */
- "symlink", /* 83 = symlink */
- "olstat", /* 84 = olstat */
- "readlink", /* 85 = readlink */
- "#86 (unimplemented linux_sys_uselib)", /* 86 = unimplemented linux_sys_uselib */
- "swapon", /* 87 = swapon */
- "reboot", /* 88 = reboot */
- "readdir", /* 89 = readdir */
- "mmap", /* 90 = mmap */
- "munmap", /* 91 = munmap */
- "truncate", /* 92 = truncate */
- "ftruncate", /* 93 = ftruncate */
- "fchmod", /* 94 = fchmod */
- "fchown16", /* 95 = fchown16 */
- "getpriority", /* 96 = getpriority */
- "setpriority", /* 97 = setpriority */
- "profil", /* 98 = profil */
- "statfs", /* 99 = statfs */
- "fstatfs", /* 100 = fstatfs */
-#ifdef __i386__
- "ioperm", /* 101 = ioperm */
-#else
- "ioperm", /* 101 = ioperm */
-#endif
- "socketcall", /* 102 = socketcall */
- "klog", /* 103 = klog */
- "setitimer", /* 104 = setitimer */
- "getitimer", /* 105 = getitimer */
- "stat", /* 106 = stat */
- "lstat", /* 107 = lstat */
- "fstat", /* 108 = fstat */
- "olduname", /* 109 = olduname */
-#ifdef __i386__
- "iopl", /* 110 = iopl */
-#else
- "iopl", /* 110 = iopl */
-#endif
- "vhangup", /* 111 = vhangup */
- "idle", /* 112 = idle */
- "vm86old", /* 113 = vm86old */
- "wait4", /* 114 = wait4 */
- "swapoff", /* 115 = swapoff */
- "sysinfo", /* 116 = sysinfo */
- "ipc", /* 117 = ipc */
- "fsync", /* 118 = fsync */
- "sigreturn", /* 119 = sigreturn */
- "clone", /* 120 = clone */
- "setdomainname", /* 121 = setdomainname */
- "uname", /* 122 = uname */
-#ifdef __i386__
- "modify_ldt", /* 123 = modify_ldt */
-#else
- "modify_ldt", /* 123 = modify_ldt */
-#endif
- "adjtimex", /* 124 = adjtimex */
- "mprotect", /* 125 = mprotect */
- "sigprocmask", /* 126 = sigprocmask */
- "create_module", /* 127 = create_module */
- "init_module", /* 128 = init_module */
- "delete_module", /* 129 = delete_module */
- "get_kernel_syms", /* 130 = get_kernel_syms */
- "quotactl", /* 131 = quotactl */
- "getpgid", /* 132 = getpgid */
- "fchdir", /* 133 = fchdir */
- "bdflush", /* 134 = bdflush */
- "sysfs", /* 135 = sysfs */
- "personality", /* 136 = personality */
- "afs_syscall", /* 137 = afs_syscall */
- "linux_setfsuid16", /* 138 = linux_setfsuid16 */
- "linux_getfsuid16", /* 139 = linux_getfsuid16 */
- "llseek", /* 140 = llseek */
- "getdents", /* 141 = getdents */
- "select", /* 142 = select */
- "flock", /* 143 = flock */
- "msync", /* 144 = msync */
- "readv", /* 145 = readv */
- "writev", /* 146 = writev */
- "getsid", /* 147 = getsid */
- "fdatasync", /* 148 = fdatasync */
- "__sysctl", /* 149 = __sysctl */
- "mlock", /* 150 = mlock */
- "munlock", /* 151 = munlock */
- "mlockall", /* 152 = mlockall */
- "munlockall", /* 153 = munlockall */
- "sched_setparam", /* 154 = sched_setparam */
- "sched_getparam", /* 155 = sched_getparam */
- "sched_setscheduler", /* 156 = sched_setscheduler */
- "sched_getscheduler", /* 157 = sched_getscheduler */
- "sched_yield", /* 158 = sched_yield */
- "sched_get_priority_max", /* 159 = sched_get_priority_max */
- "sched_get_priority_min", /* 160 = sched_get_priority_min */
- "sched_rr_get_interval", /* 161 = sched_rr_get_interval */
- "nanosleep", /* 162 = nanosleep */
- "mremap", /* 163 = mremap */
- "setresuid16", /* 164 = setresuid16 */
- "getresuid16", /* 165 = getresuid16 */
- "vm86", /* 166 = vm86 */
- "query_module", /* 167 = query_module */
- "poll", /* 168 = poll */
- "nfsservctl", /* 169 = nfsservctl */
- "setresgid16", /* 170 = setresgid16 */
- "getresgid16", /* 171 = getresgid16 */
- "prctl", /* 172 = prctl */
- "rt_sigreturn", /* 173 = rt_sigreturn */
- "rt_sigaction", /* 174 = rt_sigaction */
- "rt_sigprocmask", /* 175 = rt_sigprocmask */
- "rt_sigpending", /* 176 = rt_sigpending */
- "rt_sigtimedwait", /* 177 = rt_sigtimedwait */
- "rt_queueinfo", /* 178 = rt_queueinfo */
- "rt_sigsuspend", /* 179 = rt_sigsuspend */
- "pread", /* 180 = pread */
- "pwrite", /* 181 = pwrite */
- "chown16", /* 182 = chown16 */
- "__getcwd", /* 183 = __getcwd */
- "capget", /* 184 = capget */
- "capset", /* 185 = capset */
- "sigaltstack", /* 186 = sigaltstack */
- "sendfile", /* 187 = sendfile */
- "getpmsg", /* 188 = getpmsg */
- "putpmsg", /* 189 = putpmsg */
- "vfork", /* 190 = vfork */
- "ugetrlimit", /* 191 = ugetrlimit */
- "mmap2", /* 192 = mmap2 */
- "truncate64", /* 193 = truncate64 */
- "ftruncate64", /* 194 = ftruncate64 */
- "stat64", /* 195 = stat64 */
- "lstat64", /* 196 = lstat64 */
- "fstat64", /* 197 = fstat64 */
- "lchown", /* 198 = lchown */
- "getuid", /* 199 = getuid */
- "getgid", /* 200 = getgid */
- "geteuid", /* 201 = geteuid */
- "getegid", /* 202 = getegid */
- "setreuid", /* 203 = setreuid */
- "setregid", /* 204 = setregid */
- "getgroups", /* 205 = getgroups */
- "setgroups", /* 206 = setgroups */
- "fchown", /* 207 = fchown */
- "setresuid", /* 208 = setresuid */
- "getresuid", /* 209 = getresuid */
- "setresgid", /* 210 = setresgid */
- "getresgid", /* 211 = getresgid */
- "chown", /* 212 = chown */
- "setuid", /* 213 = setuid */
- "setgid", /* 214 = setgid */
- "setfsuid", /* 215 = setfsuid */
- "setfsgid", /* 216 = setfsgid */
- "pivot_root", /* 217 = pivot_root */
- "mincore", /* 218 = mincore */
- "madvise", /* 219 = madvise */
- "getdents64", /* 220 = getdents64 */
- "fcntl64", /* 221 = fcntl64 */
- "#222 (unimplemented)", /* 222 = unimplemented */
- "#223 (unimplemented)", /* 223 = unimplemented */
- "gettid", /* 224 = gettid */
- "#225 (unimplemented linux_sys_readahead)", /* 225 = unimplemented linux_sys_readahead */
- "setxattr", /* 226 = setxattr */
- "lsetxattr", /* 227 = lsetxattr */
- "fsetxattr", /* 228 = fsetxattr */
- "getxattr", /* 229 = getxattr */
- "lgetxattr", /* 230 = lgetxattr */
- "fgetxattr", /* 231 = fgetxattr */
- "listxattr", /* 232 = listxattr */
- "llistxattr", /* 233 = llistxattr */
- "flistxattr", /* 234 = flistxattr */
- "removexattr", /* 235 = removexattr */
- "lremovexattr", /* 236 = lremovexattr */
- "fremovexattr", /* 237 = fremovexattr */
- "#238 (unimplemented linux_sys_tkill)", /* 238 = unimplemented linux_sys_tkill */
- "#239 (unimplemented linux_sys_sendfile64)", /* 239 = unimplemented linux_sys_sendfile64 */
- "futex", /* 240 = futex */
- "#241 (unimplemented linux_sys_sched_setaffinity)", /* 241 = unimplemented linux_sys_sched_setaffinity */
- "#242 (unimplemented linux_sys_sched_getaffinity)", /* 242 = unimplemented linux_sys_sched_getaffinity */
- "set_thread_area", /* 243 = set_thread_area */
- "get_thread_area", /* 244 = get_thread_area */
- "#245 (unimplemented linux_sys_io_setup)", /* 245 = unimplemented linux_sys_io_setup */
- "#246 (unimplemented linux_sys_io_destroy)", /* 246 = unimplemented linux_sys_io_destroy */
- "#247 (unimplemented linux_sys_io_getevents)", /* 247 = unimplemented linux_sys_io_getevents */
- "#248 (unimplemented linux_sys_io_submit)", /* 248 = unimplemented linux_sys_io_submit */
- "#249 (unimplemented linux_sys_io_cancel)", /* 249 = unimplemented linux_sys_io_cancel */
- "fadvise64", /* 250 = fadvise64 */
- "#251 (unimplemented)", /* 251 = unimplemented */
- "linux_exit_group", /* 252 = linux_exit_group */
- "#253 (unimplemented linux_sys_lookup_dcookie)", /* 253 = unimplemented linux_sys_lookup_dcookie */
- "epoll_create", /* 254 = epoll_create */
- "epoll_ctl", /* 255 = epoll_ctl */
- "epoll_wait", /* 256 = epoll_wait */
- "#257 (unimplemented linux_sys_remap_file_pages)", /* 257 = unimplemented linux_sys_remap_file_pages */
- "set_tid_address", /* 258 = set_tid_address */
- "#259 (unimplemented linux_sys_timer_create)", /* 259 = unimplemented linux_sys_timer_create */
- "#260 (unimplemented linux_sys_timer_settime)", /* 260 = unimplemented linux_sys_timer_settime */
- "#261 (unimplemented linux_sys_timer_gettime)", /* 261 = unimplemented linux_sys_timer_gettime */
- "#262 (unimplemented linux_sys_timer_getoverrun)", /* 262 = unimplemented linux_sys_timer_getoverrun */
- "#263 (unimplemented linux_sys_timer_delete)", /* 263 = unimplemented linux_sys_timer_delete */
- "#264 (unimplemented linux_sys_clock_settime)", /* 264 = unimplemented linux_sys_clock_settime */
- "clock_gettime", /* 265 = clock_gettime */
- "clock_getres", /* 266 = clock_getres */
- "#267 (unimplemented linux_sys_clock_nanosleep)", /* 267 = unimplemented linux_sys_clock_nanosleep */
- "statfs64", /* 268 = statfs64 */
- "fstatfs64", /* 269 = fstatfs64 */
- "tgkill", /* 270 = tgkill */
- "#271 (unimplemented linux_sys_utimes)", /* 271 = unimplemented linux_sys_utimes */
- "#272 (unimplemented linux_sys_fadvise64_64)", /* 272 = unimplemented linux_sys_fadvise64_64 */
- "#273 (unimplemented linux_sys_vserver)", /* 273 = unimplemented linux_sys_vserver */
- "#274 (unimplemented linux_sys_mbind)", /* 274 = unimplemented linux_sys_mbind */
- "#275 (unimplemented linux_sys_get_mempolicy)", /* 275 = unimplemented linux_sys_get_mempolicy */
- "#276 (unimplemented linux_sys_set_mempolicy)", /* 276 = unimplemented linux_sys_set_mempolicy */
- "#277 (unimplemented linux_sys_mq_open)", /* 277 = unimplemented linux_sys_mq_open */
- "#278 (unimplemented linux_sys_mq_unlink)", /* 278 = unimplemented linux_sys_mq_unlink */
- "#279 (unimplemented linux_sys_mq_timedsend)", /* 279 = unimplemented linux_sys_mq_timedsend */
- "#280 (unimplemented linux_sys_mq_timedreceive)", /* 280 = unimplemented linux_sys_mq_timedreceive */
- "#281 (unimplemented linux_sys_mq_notify)", /* 281 = unimplemented linux_sys_mq_notify */
- "#282 (unimplemented linux_sys_mq_getsetattr)", /* 282 = unimplemented linux_sys_mq_getsetattr */
- "#283 (unimplemented linux_sys_sys_kexec_load)", /* 283 = unimplemented linux_sys_sys_kexec_load */
- "#284 (unimplemented linux_sys_waitid)", /* 284 = unimplemented linux_sys_waitid */
- "#285 (unimplemented / * unused * /)", /* 285 = unimplemented / * unused * / */
- "#286 (unimplemented linux_sys_add_key)", /* 286 = unimplemented linux_sys_add_key */
- "#287 (unimplemented linux_sys_request_key)", /* 287 = unimplemented linux_sys_request_key */
- "#288 (unimplemented linux_sys_keyctl)", /* 288 = unimplemented linux_sys_keyctl */
- "#289 (unimplemented linux_sys_ioprio_set)", /* 289 = unimplemented linux_sys_ioprio_set */
- "#290 (unimplemented linux_sys_ioprio_get)", /* 290 = unimplemented linux_sys_ioprio_get */
- "#291 (unimplemented linux_sys_inotify_init)", /* 291 = unimplemented linux_sys_inotify_init */
- "#292 (unimplemented linux_sys_inotify_add_watch)", /* 292 = unimplemented linux_sys_inotify_add_watch */
- "#293 (unimplemented linux_sys_inotify_rm_watch)", /* 293 = unimplemented linux_sys_inotify_rm_watch */
- "#294 (unimplemented linux_sys_migrate_pages)", /* 294 = unimplemented linux_sys_migrate_pages */
- "#295 (unimplemented linux_sys_openalinux_sys_t)", /* 295 = unimplemented linux_sys_openalinux_sys_t */
- "#296 (unimplemented linux_sys_mkdirat)", /* 296 = unimplemented linux_sys_mkdirat */
- "#297 (unimplemented linux_sys_mknodat)", /* 297 = unimplemented linux_sys_mknodat */
- "#298 (unimplemented linux_sys_fchownat)", /* 298 = unimplemented linux_sys_fchownat */
- "#299 (unimplemented linux_sys_futimesat)", /* 299 = unimplemented linux_sys_futimesat */
- "#300 (unimplemented linux_sys_fstatat64)", /* 300 = unimplemented linux_sys_fstatat64 */
- "#301 (unimplemented linux_sys_unlinkat)", /* 301 = unimplemented linux_sys_unlinkat */
- "#302 (unimplemented linux_sys_renameat)", /* 302 = unimplemented linux_sys_renameat */
- "#303 (unimplemented linux_sys_linkat)", /* 303 = unimplemented linux_sys_linkat */
- "#304 (unimplemented linux_sys_symlinkat)", /* 304 = unimplemented linux_sys_symlinkat */
- "#305 (unimplemented linux_sys_readlinkat)", /* 305 = unimplemented linux_sys_readlinkat */
- "#306 (unimplemented linux_sys_fchmodat)", /* 306 = unimplemented linux_sys_fchmodat */
- "#307 (unimplemented linux_sys_faccessat)", /* 307 = unimplemented linux_sys_faccessat */
- "#308 (unimplemented linux_sys_pselect6)", /* 308 = unimplemented linux_sys_pselect6 */
- "#309 (unimplemented linux_sys_ppoll)", /* 309 = unimplemented linux_sys_ppoll */
- "#310 (unimplemented linux_sys_unshare)", /* 310 = unimplemented linux_sys_unshare */
- "set_robust_list", /* 311 = set_robust_list */
- "get_robust_list", /* 312 = get_robust_list */
- "#313 (unimplemented splice)", /* 313 = unimplemented splice */
- "#314 (unimplemented sync_file_range)", /* 314 = unimplemented sync_file_range */
- "#315 (unimplemented tee)", /* 315 = unimplemented tee */
- "#316 (unimplemented vmsplice)", /* 316 = unimplemented vmsplice */
- "#317 (unimplemented move_pages)", /* 317 = unimplemented move_pages */
- "#318 (unimplemented getcpu)", /* 318 = unimplemented getcpu */
- "epoll_pwait", /* 319 = epoll_pwait */
- "#320 (unimplemented utimensat)", /* 320 = unimplemented utimensat */
- "#321 (unimplemented signalfd)", /* 321 = unimplemented signalfd */
- "#322 (unimplemented timerfd_create)", /* 322 = unimplemented timerfd_create */
- "eventfd", /* 323 = eventfd */
- "#324 (unimplemented fallocate)", /* 324 = unimplemented fallocate */
- "#325 (unimplemented timerfd_settime)", /* 325 = unimplemented timerfd_settime */
- "#326 (unimplemented timerfd_gettime)", /* 326 = unimplemented timerfd_gettime */
- "#327 (unimplemented signalfd4)", /* 327 = unimplemented signalfd4 */
- "eventfd2", /* 328 = eventfd2 */
- "epoll_create1", /* 329 = epoll_create1 */
- "#330 (unimplemented dup3)", /* 330 = unimplemented dup3 */
- "pipe2", /* 331 = pipe2 */
- "#332 (unimplemented inotify_init1)", /* 332 = unimplemented inotify_init1 */
- "#333 (unimplemented preadv)", /* 333 = unimplemented preadv */
- "#334 (unimplemented pwritev)", /* 334 = unimplemented pwritev */
- "#335 (unimplemented rt_tgsigqueueinfo)", /* 335 = unimplemented rt_tgsigqueueinfo */
- "#336 (unimplemented perf_counter_open)", /* 336 = unimplemented perf_counter_open */
- "#337 (unimplemented recvmmsg)", /* 337 = unimplemented recvmmsg */
-};
diff --git a/sys/compat/linux/linux_sysent.c b/sys/compat/linux/linux_sysent.c
deleted file mode 100644
index 8bc18a288c1..00000000000
--- a/sys/compat/linux/linux_sysent.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/* $OpenBSD: linux_sysent.c,v 1.80 2014/09/01 05:13:21 doug Exp $ */
-
-/*
- * System call switch table.
- *
- * DO NOT EDIT-- this file is automatically generated.
- * created from OpenBSD: syscalls.master,v 1.76 2014/09/01 05:09:53 doug Exp
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signal.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_misc.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <machine/linux_machdep.h>
-
-#define s(type) sizeof(type)
-
-struct sysent linux_sysent[] = {
- { 0, 0, 0,
- sys_nosys }, /* 0 = syscall */
- { 1, s(struct sys_exit_args), 0,
- sys_exit }, /* 1 = exit */
- { 0, 0, 0,
- sys_fork }, /* 2 = fork */
- { 3, s(struct sys_read_args), 0,
- sys_read }, /* 3 = read */
- { 3, s(struct sys_write_args), 0,
- sys_write }, /* 4 = write */
- { 3, s(struct linux_sys_open_args), 0,
- linux_sys_open }, /* 5 = open */
- { 1, s(struct sys_close_args), 0,
- sys_close }, /* 6 = close */
- { 3, s(struct linux_sys_waitpid_args), 0,
- linux_sys_waitpid }, /* 7 = waitpid */
- { 2, s(struct linux_sys_creat_args), 0,
- linux_sys_creat }, /* 8 = creat */
- { 2, s(struct sys_link_args), 0,
- sys_link }, /* 9 = link */
- { 1, s(struct linux_sys_unlink_args), 0,
- linux_sys_unlink }, /* 10 = unlink */
- { 3, s(struct linux_sys_execve_args), 0,
- linux_sys_execve }, /* 11 = execve */
- { 1, s(struct linux_sys_chdir_args), 0,
- linux_sys_chdir }, /* 12 = chdir */
- { 1, s(struct linux_sys_time_args), 0,
- linux_sys_time }, /* 13 = time */
- { 3, s(struct linux_sys_mknod_args), 0,
- linux_sys_mknod }, /* 14 = mknod */
- { 2, s(struct linux_sys_chmod_args), 0,
- linux_sys_chmod }, /* 15 = chmod */
- { 3, s(struct linux_sys_lchown16_args), 0,
- linux_sys_lchown16 }, /* 16 = lchown16 */
- { 1, s(struct linux_sys_break_args), 0,
- linux_sys_break }, /* 17 = break */
- { 0, 0, 0,
- linux_sys_ostat }, /* 18 = ostat */
- { 3, s(struct linux_sys_lseek_args), 0,
- linux_sys_lseek }, /* 19 = lseek */
- { 0, 0, 0,
- linux_sys_getpid }, /* 20 = getpid */
- { 5, s(struct linux_sys_mount_args), 0,
- linux_sys_mount }, /* 21 = mount */
- { 1, s(struct linux_sys_umount_args), 0,
- linux_sys_umount }, /* 22 = umount */
- { 1, s(struct sys_setuid_args), 0,
- sys_setuid }, /* 23 = linux_setuid16 */
- { 0, 0, 0,
- linux_sys_getuid }, /* 24 = linux_getuid16 */
- { 0, 0, 0,
- sys_nosys }, /* 25 = unimplemented stime */
-#ifdef PTRACE
- { 0, 0, 0,
- linux_sys_ptrace }, /* 26 = ptrace */
-#else
- { 0, 0, 0,
- sys_nosys }, /* 26 = unimplemented ptrace */
-#endif
- { 1, s(struct linux_sys_alarm_args), 0,
- linux_sys_alarm }, /* 27 = alarm */
- { 0, 0, 0,
- linux_sys_ofstat }, /* 28 = ofstat */
- { 0, 0, 0,
- linux_sys_pause }, /* 29 = pause */
- { 2, s(struct linux_sys_utime_args), 0,
- linux_sys_utime }, /* 30 = utime */
- { 0, 0, 0,
- linux_sys_stty }, /* 31 = stty */
- { 0, 0, 0,
- linux_sys_gtty }, /* 32 = gtty */
- { 2, s(struct linux_sys_access_args), 0,
- linux_sys_access }, /* 33 = access */
- { 1, s(struct linux_sys_nice_args), 0,
- linux_sys_nice }, /* 34 = nice */
- { 0, 0, 0,
- linux_sys_ftime }, /* 35 = ftime */
- { 0, 0, 0,
- sys_sync }, /* 36 = sync */
- { 2, s(struct linux_sys_kill_args), 0,
- linux_sys_kill }, /* 37 = kill */
- { 2, s(struct linux_sys_rename_args), 0,
- linux_sys_rename }, /* 38 = rename */
- { 2, s(struct linux_sys_mkdir_args), 0,
- linux_sys_mkdir }, /* 39 = mkdir */
- { 1, s(struct linux_sys_rmdir_args), 0,
- linux_sys_rmdir }, /* 40 = rmdir */
- { 1, s(struct sys_dup_args), 0,
- sys_dup }, /* 41 = dup */
- { 1, s(struct sys_pipe_args), 0,
- sys_pipe }, /* 42 = pipe */
- { 1, s(struct linux_sys_times_args), 0,
- linux_sys_times }, /* 43 = times */
- { 0, 0, 0,
- linux_sys_prof }, /* 44 = prof */
- { 1, s(struct linux_sys_brk_args), 0,
- linux_sys_brk }, /* 45 = brk */
- { 1, s(struct sys_setgid_args), 0,
- sys_setgid }, /* 46 = linux_setgid16 */
- { 0, 0, 0,
- linux_sys_getgid }, /* 47 = linux_getgid16 */
- { 2, s(struct linux_sys_signal_args), 0,
- linux_sys_signal }, /* 48 = signal */
- { 0, 0, 0,
- sys_geteuid }, /* 49 = linux_geteuid16 */
- { 0, 0, 0,
- sys_getegid }, /* 50 = linux_getegid16 */
-#ifdef ACCOUNTING
- { 1, s(struct sys_acct_args), 0,
- sys_acct }, /* 51 = acct */
-#else
- { 0, 0, 0,
- sys_nosys }, /* 51 = unimplemented acct */
-#endif
- { 0, 0, 0,
- linux_sys_phys }, /* 52 = phys */
- { 0, 0, 0,
- linux_sys_lock }, /* 53 = lock */
- { 3, s(struct linux_sys_ioctl_args), 0,
- linux_sys_ioctl }, /* 54 = ioctl */
- { 3, s(struct linux_sys_fcntl_args), 0,
- linux_sys_fcntl }, /* 55 = fcntl */
- { 0, 0, 0,
- linux_sys_mpx }, /* 56 = mpx */
- { 2, s(struct sys_setpgid_args), 0,
- sys_setpgid }, /* 57 = setpgid */
- { 0, 0, 0,
- linux_sys_ulimit }, /* 58 = ulimit */
- { 1, s(struct linux_sys_oldolduname_args), 0,
- linux_sys_oldolduname }, /* 59 = oldolduname */
- { 1, s(struct sys_umask_args), 0,
- sys_umask }, /* 60 = umask */
- { 1, s(struct sys_chroot_args), 0,
- sys_chroot }, /* 61 = chroot */
- { 0, 0, 0,
- linux_sys_ustat }, /* 62 = ustat */
- { 2, s(struct sys_dup2_args), 0,
- sys_dup2 }, /* 63 = dup2 */
- { 0, 0, 0,
- sys_getppid }, /* 64 = getppid */
- { 0, 0, 0,
- sys_getpgrp }, /* 65 = getpgrp */
- { 0, 0, 0,
- sys_setsid }, /* 66 = setsid */
- { 3, s(struct linux_sys_sigaction_args), 0,
- linux_sys_sigaction }, /* 67 = sigaction */
- { 0, 0, 0,
- linux_sys_siggetmask }, /* 68 = siggetmask */
- { 1, s(struct linux_sys_sigsetmask_args), 0,
- linux_sys_sigsetmask }, /* 69 = sigsetmask */
- { 2, s(struct linux_sys_setreuid16_args), 0,
- linux_sys_setreuid16 }, /* 70 = setreuid16 */
- { 2, s(struct linux_sys_setregid16_args), 0,
- linux_sys_setregid16 }, /* 71 = setregid16 */
- { 3, s(struct linux_sys_sigsuspend_args), 0,
- linux_sys_sigsuspend }, /* 72 = sigsuspend */
- { 1, s(struct linux_sys_sigpending_args), 0,
- linux_sys_sigpending }, /* 73 = sigpending */
- { 2, s(struct linux_sys_sethostname_args), 0,
- linux_sys_sethostname }, /* 74 = sethostname */
- { 2, s(struct linux_sys_setrlimit_args), 0,
- linux_sys_setrlimit }, /* 75 = setrlimit */
- { 2, s(struct linux_sys_getrlimit_args), 0,
- linux_sys_getrlimit }, /* 76 = getrlimit */
- { 2, s(struct linux_sys_getrusage_args), 0,
- linux_sys_getrusage }, /* 77 = getrusage */
- { 2, s(struct linux_sys_gettimeofday_args), 0,
- linux_sys_gettimeofday }, /* 78 = gettimeofday */
- { 0, 0, 0,
- sys_nosys }, /* 79 = unimplemented settimeofday */
- { 2, s(struct sys_getgroups_args), 0,
- sys_getgroups }, /* 80 = linux_getgroups */
- { 2, s(struct sys_setgroups_args), 0,
- sys_setgroups }, /* 81 = linux_setgroups */
- { 1, s(struct linux_sys_oldselect_args), 0,
- linux_sys_oldselect }, /* 82 = oldselect */
- { 2, s(struct linux_sys_symlink_args), 0,
- linux_sys_symlink }, /* 83 = symlink */
- { 2, s(struct linux_sys_lstat_args), 0,
- linux_sys_lstat }, /* 84 = olstat */
- { 3, s(struct linux_sys_readlink_args), 0,
- linux_sys_readlink }, /* 85 = readlink */
- { 0, 0, 0,
- sys_nosys }, /* 86 = unimplemented linux_sys_uselib */
- { 1, s(struct linux_sys_swapon_args), 0,
- linux_sys_swapon }, /* 87 = swapon */
- { 1, s(struct sys_reboot_args), 0,
- sys_reboot }, /* 88 = reboot */
- { 3, s(struct linux_sys_readdir_args), 0,
- linux_sys_readdir }, /* 89 = readdir */
- { 1, s(struct linux_sys_mmap_args), 0,
- linux_sys_mmap }, /* 90 = mmap */
- { 2, s(struct sys_munmap_args), 0,
- sys_munmap }, /* 91 = munmap */
- { 2, s(struct linux_sys_truncate_args), 0,
- linux_sys_truncate }, /* 92 = truncate */
- { 2, s(struct linux_sys_ftruncate_args), 0,
- linux_sys_ftruncate }, /* 93 = ftruncate */
- { 2, s(struct sys_fchmod_args), 0,
- sys_fchmod }, /* 94 = fchmod */
- { 3, s(struct linux_sys_fchown16_args), 0,
- linux_sys_fchown16 }, /* 95 = fchown16 */
- { 2, s(struct sys_getpriority_args), 0,
- sys_getpriority }, /* 96 = getpriority */
- { 3, s(struct sys_setpriority_args), 0,
- sys_setpriority }, /* 97 = setpriority */
- { 4, s(struct sys_profil_args), 0,
- sys_profil }, /* 98 = profil */
- { 2, s(struct linux_sys_statfs_args), 0,
- linux_sys_statfs }, /* 99 = statfs */
- { 2, s(struct linux_sys_fstatfs_args), 0,
- linux_sys_fstatfs }, /* 100 = fstatfs */
-#ifdef __i386__
- { 3, s(struct linux_sys_ioperm_args), 0,
- linux_sys_ioperm }, /* 101 = ioperm */
-#else
- { 0, 0, 0,
- linux_sys_ioperm }, /* 101 = ioperm */
-#endif
- { 2, s(struct linux_sys_socketcall_args), 0,
- linux_sys_socketcall }, /* 102 = socketcall */
- { 0, 0, 0,
- linux_sys_klog }, /* 103 = klog */
- { 3, s(struct linux_sys_setitimer_args), 0,
- linux_sys_setitimer }, /* 104 = setitimer */
- { 2, s(struct linux_sys_getitimer_args), 0,
- linux_sys_getitimer }, /* 105 = getitimer */
- { 2, s(struct linux_sys_stat_args), 0,
- linux_sys_stat }, /* 106 = stat */
- { 2, s(struct linux_sys_lstat_args), 0,
- linux_sys_lstat }, /* 107 = lstat */
- { 2, s(struct linux_sys_fstat_args), 0,
- linux_sys_fstat }, /* 108 = fstat */
- { 1, s(struct linux_sys_olduname_args), 0,
- linux_sys_olduname }, /* 109 = olduname */
-#ifdef __i386__
- { 1, s(struct linux_sys_iopl_args), 0,
- linux_sys_iopl }, /* 110 = iopl */
-#else
- { 0, 0, 0,
- linux_sys_iopl }, /* 110 = iopl */
-#endif
- { 0, 0, 0,
- linux_sys_vhangup }, /* 111 = vhangup */
- { 0, 0, 0,
- linux_sys_idle }, /* 112 = idle */
- { 0, 0, 0,
- linux_sys_vm86old }, /* 113 = vm86old */
- { 4, s(struct linux_sys_wait4_args), 0,
- linux_sys_wait4 }, /* 114 = wait4 */
- { 0, 0, 0,
- linux_sys_swapoff }, /* 115 = swapoff */
- { 1, s(struct linux_sys_sysinfo_args), 0,
- linux_sys_sysinfo }, /* 116 = sysinfo */
- { 5, s(struct linux_sys_ipc_args), 0,
- linux_sys_ipc }, /* 117 = ipc */
- { 1, s(struct sys_fsync_args), 0,
- sys_fsync }, /* 118 = fsync */
- { 1, s(struct linux_sys_sigreturn_args), 0,
- linux_sys_sigreturn }, /* 119 = sigreturn */
- { 5, s(struct linux_sys_clone_args), 0,
- linux_sys_clone }, /* 120 = clone */
- { 2, s(struct linux_sys_setdomainname_args), 0,
- linux_sys_setdomainname }, /* 121 = setdomainname */
- { 1, s(struct linux_sys_uname_args), 0,
- linux_sys_uname }, /* 122 = uname */
-#ifdef __i386__
- { 3, s(struct linux_sys_modify_ldt_args), 0,
- linux_sys_modify_ldt }, /* 123 = modify_ldt */
-#else
- { 0, 0, 0,
- linux_sys_modify_ldt }, /* 123 = modify_ldt */
-#endif
- { 0, 0, 0,
- linux_sys_adjtimex }, /* 124 = adjtimex */
- { 3, s(struct linux_sys_mprotect_args), 0,
- linux_sys_mprotect }, /* 125 = mprotect */
- { 3, s(struct linux_sys_sigprocmask_args), 0,
- linux_sys_sigprocmask }, /* 126 = sigprocmask */
- { 0, 0, 0,
- linux_sys_create_module }, /* 127 = create_module */
- { 0, 0, 0,
- linux_sys_init_module }, /* 128 = init_module */
- { 0, 0, 0,
- linux_sys_delete_module }, /* 129 = delete_module */
- { 0, 0, 0,
- linux_sys_get_kernel_syms }, /* 130 = get_kernel_syms */
- { 0, 0, 0,
- linux_sys_quotactl }, /* 131 = quotactl */
- { 1, s(struct linux_sys_getpgid_args), 0,
- linux_sys_getpgid }, /* 132 = getpgid */
- { 1, s(struct sys_fchdir_args), 0,
- sys_fchdir }, /* 133 = fchdir */
- { 0, 0, 0,
- linux_sys_bdflush }, /* 134 = bdflush */
- { 0, 0, 0,
- linux_sys_sysfs }, /* 135 = sysfs */
- { 1, s(struct linux_sys_personality_args), 0,
- linux_sys_personality }, /* 136 = personality */
- { 0, 0, 0,
- linux_sys_afs_syscall }, /* 137 = afs_syscall */
- { 1, s(struct linux_sys_setfsuid_args), 0,
- linux_sys_setfsuid }, /* 138 = linux_setfsuid16 */
- { 0, 0, 0,
- linux_sys_getfsuid }, /* 139 = linux_getfsuid16 */
- { 5, s(struct linux_sys_llseek_args), 0,
- linux_sys_llseek }, /* 140 = llseek */
- { 3, s(struct linux_sys_getdents_args), 0,
- linux_sys_getdents }, /* 141 = getdents */
- { 5, s(struct linux_sys_select_args), 0,
- linux_sys_select }, /* 142 = select */
- { 2, s(struct sys_flock_args), 0,
- sys_flock }, /* 143 = flock */
- { 3, s(struct sys_msync_args), 0,
- sys_msync }, /* 144 = msync */
- { 3, s(struct sys_readv_args), 0,
- sys_readv }, /* 145 = readv */
- { 3, s(struct sys_writev_args), 0,
- sys_writev }, /* 146 = writev */
- { 1, s(struct sys_getsid_args), 0,
- sys_getsid }, /* 147 = getsid */
- { 1, s(struct linux_sys_fdatasync_args), 0,
- linux_sys_fdatasync }, /* 148 = fdatasync */
- { 1, s(struct linux_sys___sysctl_args), 0,
- linux_sys___sysctl }, /* 149 = __sysctl */
- { 2, s(struct sys_mlock_args), 0,
- sys_mlock }, /* 150 = mlock */
- { 2, s(struct sys_munlock_args), 0,
- sys_munlock }, /* 151 = munlock */
- { 0, 0, 0,
- linux_sys_mlockall }, /* 152 = mlockall */
- { 0, 0, 0,
- linux_sys_munlockall }, /* 153 = munlockall */
- { 2, s(struct linux_sys_sched_setparam_args), 0,
- linux_sys_sched_setparam }, /* 154 = sched_setparam */
- { 2, s(struct linux_sys_sched_getparam_args), 0,
- linux_sys_sched_getparam }, /* 155 = sched_getparam */
- { 3, s(struct linux_sys_sched_setscheduler_args), 0,
- linux_sys_sched_setscheduler }, /* 156 = sched_setscheduler */
- { 1, s(struct linux_sys_sched_getscheduler_args), 0,
- linux_sys_sched_getscheduler }, /* 157 = sched_getscheduler */
- { 0, 0, 0,
- linux_sys_sched_yield }, /* 158 = sched_yield */
- { 1, s(struct linux_sys_sched_get_priority_max_args), 0,
- linux_sys_sched_get_priority_max }, /* 159 = sched_get_priority_max */
- { 1, s(struct linux_sys_sched_get_priority_min_args), 0,
- linux_sys_sched_get_priority_min }, /* 160 = sched_get_priority_min */
- { 0, 0, 0,
- linux_sys_sched_rr_get_interval }, /* 161 = sched_rr_get_interval */
- { 2, s(struct linux_sys_nanosleep_args), 0,
- linux_sys_nanosleep }, /* 162 = nanosleep */
- { 4, s(struct linux_sys_mremap_args), 0,
- linux_sys_mremap }, /* 163 = mremap */
- { 3, s(struct linux_sys_setresuid16_args), 0,
- linux_sys_setresuid16 }, /* 164 = setresuid16 */
- { 3, s(struct linux_sys_getresuid16_args), 0,
- linux_sys_getresuid16 }, /* 165 = getresuid16 */
- { 0, 0, 0,
- linux_sys_vm86 }, /* 166 = vm86 */
- { 0, 0, 0,
- linux_sys_query_module }, /* 167 = query_module */
- { 3, s(struct sys_poll_args), 0,
- sys_poll }, /* 168 = poll */
- { 0, 0, 0,
- linux_sys_nfsservctl }, /* 169 = nfsservctl */
- { 3, s(struct linux_sys_setresgid16_args), 0,
- linux_sys_setresgid16 }, /* 170 = setresgid16 */
- { 3, s(struct linux_sys_getresgid16_args), 0,
- linux_sys_getresgid16 }, /* 171 = getresgid16 */
- { 5, s(struct linux_sys_prctl_args), 0,
- linux_sys_prctl }, /* 172 = prctl */
- { 1, s(struct linux_sys_rt_sigreturn_args), 0,
- linux_sys_rt_sigreturn }, /* 173 = rt_sigreturn */
- { 4, s(struct linux_sys_rt_sigaction_args), 0,
- linux_sys_rt_sigaction }, /* 174 = rt_sigaction */
- { 4, s(struct linux_sys_rt_sigprocmask_args), 0,
- linux_sys_rt_sigprocmask }, /* 175 = rt_sigprocmask */
- { 2, s(struct linux_sys_rt_sigpending_args), 0,
- linux_sys_rt_sigpending }, /* 176 = rt_sigpending */
- { 0, 0, 0,
- linux_sys_rt_sigtimedwait }, /* 177 = rt_sigtimedwait */
- { 0, 0, 0,
- linux_sys_rt_queueinfo }, /* 178 = rt_queueinfo */
- { 2, s(struct linux_sys_rt_sigsuspend_args), 0,
- linux_sys_rt_sigsuspend }, /* 179 = rt_sigsuspend */
- { 4, s(struct linux_sys_pread_args), 0,
- linux_sys_pread }, /* 180 = pread */
- { 4, s(struct linux_sys_pwrite_args), 0,
- linux_sys_pwrite }, /* 181 = pwrite */
- { 3, s(struct linux_sys_chown16_args), 0,
- linux_sys_chown16 }, /* 182 = chown16 */
- { 2, s(struct sys___getcwd_args), 0,
- sys___getcwd }, /* 183 = __getcwd */
- { 0, 0, 0,
- linux_sys_capget }, /* 184 = capget */
- { 0, 0, 0,
- linux_sys_capset }, /* 185 = capset */
- { 2, s(struct linux_sys_sigaltstack_args), 0,
- linux_sys_sigaltstack }, /* 186 = sigaltstack */
- { 0, 0, 0,
- linux_sys_sendfile }, /* 187 = sendfile */
- { 0, 0, 0,
- linux_sys_getpmsg }, /* 188 = getpmsg */
- { 0, 0, 0,
- linux_sys_putpmsg }, /* 189 = putpmsg */
- { 0, 0, 0,
- sys_vfork }, /* 190 = vfork */
- { 2, s(struct linux_sys_ugetrlimit_args), 0,
- linux_sys_ugetrlimit }, /* 191 = ugetrlimit */
- { 6, s(struct linux_sys_mmap2_args), 0,
- linux_sys_mmap2 }, /* 192 = mmap2 */
- { 2, s(struct linux_sys_truncate64_args), 0,
- linux_sys_truncate64 }, /* 193 = truncate64 */
- { 2, s(struct linux_sys_ftruncate64_args), 0,
- linux_sys_ftruncate64 }, /* 194 = ftruncate64 */
- { 2, s(struct linux_sys_stat64_args), 0,
- linux_sys_stat64 }, /* 195 = stat64 */
- { 2, s(struct linux_sys_lstat64_args), 0,
- linux_sys_lstat64 }, /* 196 = lstat64 */
- { 2, s(struct linux_sys_fstat64_args), 0,
- linux_sys_fstat64 }, /* 197 = fstat64 */
- { 0, 0, 0,
- linux_sys_lchown }, /* 198 = lchown */
- { 0, 0, 0,
- linux_sys_getuid }, /* 199 = getuid */
- { 0, 0, 0,
- linux_sys_getgid }, /* 200 = getgid */
- { 0, 0, 0,
- sys_geteuid }, /* 201 = geteuid */
- { 0, 0, 0,
- sys_getegid }, /* 202 = getegid */
- { 2, s(struct sys_setreuid_args), 0,
- sys_setreuid }, /* 203 = setreuid */
- { 2, s(struct sys_setregid_args), 0,
- sys_setregid }, /* 204 = setregid */
- { 2, s(struct sys_getgroups_args), 0,
- sys_getgroups }, /* 205 = getgroups */
- { 2, s(struct sys_setgroups_args), 0,
- sys_setgroups }, /* 206 = setgroups */
- { 0, 0, 0,
- linux_sys_fchown }, /* 207 = fchown */
- { 3, s(struct sys_setresuid_args), 0,
- sys_setresuid }, /* 208 = setresuid */
- { 3, s(struct sys_getresuid_args), 0,
- sys_getresuid }, /* 209 = getresuid */
- { 3, s(struct sys_setresgid_args), 0,
- sys_setresgid }, /* 210 = setresgid */
- { 3, s(struct sys_getresgid_args), 0,
- sys_getresgid }, /* 211 = getresgid */
- { 3, s(struct linux_sys_chown_args), 0,
- linux_sys_chown }, /* 212 = chown */
- { 1, s(struct sys_setuid_args), 0,
- sys_setuid }, /* 213 = setuid */
- { 1, s(struct sys_setgid_args), 0,
- sys_setgid }, /* 214 = setgid */
- { 1, s(struct linux_sys_setfsuid_args), 0,
- linux_sys_setfsuid }, /* 215 = setfsuid */
- { 0, 0, 0,
- linux_sys_setfsgid }, /* 216 = setfsgid */
- { 0, 0, 0,
- linux_sys_pivot_root }, /* 217 = pivot_root */
- { 0, 0, 0,
- linux_sys_mincore }, /* 218 = mincore */
- { 3, s(struct sys_madvise_args), 0,
- sys_madvise }, /* 219 = madvise */
- { 3, s(struct linux_sys_getdents64_args), 0,
- linux_sys_getdents64 }, /* 220 = getdents64 */
- { 3, s(struct linux_sys_fcntl64_args), 0,
- linux_sys_fcntl64 }, /* 221 = fcntl64 */
- { 0, 0, 0,
- sys_nosys }, /* 222 = unimplemented */
- { 0, 0, 0,
- sys_nosys }, /* 223 = unimplemented */
- { 0, 0, 0,
- linux_sys_gettid }, /* 224 = gettid */
- { 0, 0, 0,
- sys_nosys }, /* 225 = unimplemented linux_sys_readahead */
- { 0, 0, 0,
- linux_sys_setxattr }, /* 226 = setxattr */
- { 0, 0, 0,
- linux_sys_lsetxattr }, /* 227 = lsetxattr */
- { 0, 0, 0,
- linux_sys_fsetxattr }, /* 228 = fsetxattr */
- { 0, 0, 0,
- linux_sys_getxattr }, /* 229 = getxattr */
- { 0, 0, 0,
- linux_sys_lgetxattr }, /* 230 = lgetxattr */
- { 0, 0, 0,
- linux_sys_fgetxattr }, /* 231 = fgetxattr */
- { 0, 0, 0,
- linux_sys_listxattr }, /* 232 = listxattr */
- { 0, 0, 0,
- linux_sys_llistxattr }, /* 233 = llistxattr */
- { 0, 0, 0,
- linux_sys_flistxattr }, /* 234 = flistxattr */
- { 0, 0, 0,
- linux_sys_removexattr }, /* 235 = removexattr */
- { 0, 0, 0,
- linux_sys_lremovexattr }, /* 236 = lremovexattr */
- { 0, 0, 0,
- linux_sys_fremovexattr }, /* 237 = fremovexattr */
- { 0, 0, 0,
- sys_nosys }, /* 238 = unimplemented linux_sys_tkill */
- { 0, 0, 0,
- sys_nosys }, /* 239 = unimplemented linux_sys_sendfile64 */
- { 6, s(struct linux_sys_futex_args), 0,
- linux_sys_futex }, /* 240 = futex */
- { 0, 0, 0,
- sys_nosys }, /* 241 = unimplemented linux_sys_sched_setaffinity */
- { 0, 0, 0,
- sys_nosys }, /* 242 = unimplemented linux_sys_sched_getaffinity */
- { 1, s(struct linux_sys_set_thread_area_args), 0,
- linux_sys_set_thread_area }, /* 243 = set_thread_area */
- { 1, s(struct linux_sys_get_thread_area_args), 0,
- linux_sys_get_thread_area }, /* 244 = get_thread_area */
- { 0, 0, 0,
- sys_nosys }, /* 245 = unimplemented linux_sys_io_setup */
- { 0, 0, 0,
- sys_nosys }, /* 246 = unimplemented linux_sys_io_destroy */
- { 0, 0, 0,
- sys_nosys }, /* 247 = unimplemented linux_sys_io_getevents */
- { 0, 0, 0,
- sys_nosys }, /* 248 = unimplemented linux_sys_io_submit */
- { 0, 0, 0,
- sys_nosys }, /* 249 = unimplemented linux_sys_io_cancel */
- { 0, 0, 0,
- linux_sys_fadvise64 }, /* 250 = fadvise64 */
- { 0, 0, 0,
- sys_nosys }, /* 251 = unimplemented */
- { 1, s(struct sys_exit_args), 0,
- sys_exit }, /* 252 = linux_exit_group */
- { 0, 0, 0,
- sys_nosys }, /* 253 = unimplemented linux_sys_lookup_dcookie */
- { 0, 0, 0,
- linux_sys_epoll_create }, /* 254 = epoll_create */
- { 0, 0, 0,
- linux_sys_epoll_ctl }, /* 255 = epoll_ctl */
- { 0, 0, 0,
- linux_sys_epoll_wait }, /* 256 = epoll_wait */
- { 0, 0, 0,
- sys_nosys }, /* 257 = unimplemented linux_sys_remap_file_pages */
- { 1, s(struct linux_sys_set_tid_address_args), 0,
- linux_sys_set_tid_address }, /* 258 = set_tid_address */
- { 0, 0, 0,
- sys_nosys }, /* 259 = unimplemented linux_sys_timer_create */
- { 0, 0, 0,
- sys_nosys }, /* 260 = unimplemented linux_sys_timer_settime */
- { 0, 0, 0,
- sys_nosys }, /* 261 = unimplemented linux_sys_timer_gettime */
- { 0, 0, 0,
- sys_nosys }, /* 262 = unimplemented linux_sys_timer_getoverrun */
- { 0, 0, 0,
- sys_nosys }, /* 263 = unimplemented linux_sys_timer_delete */
- { 0, 0, 0,
- sys_nosys }, /* 264 = unimplemented linux_sys_clock_settime */
- { 2, s(struct linux_sys_clock_gettime_args), 0,
- linux_sys_clock_gettime }, /* 265 = clock_gettime */
- { 2, s(struct linux_sys_clock_getres_args), 0,
- linux_sys_clock_getres }, /* 266 = clock_getres */
- { 0, 0, 0,
- sys_nosys }, /* 267 = unimplemented linux_sys_clock_nanosleep */
- { 2, s(struct linux_sys_statfs64_args), 0,
- linux_sys_statfs64 }, /* 268 = statfs64 */
- { 2, s(struct linux_sys_fstatfs64_args), 0,
- linux_sys_fstatfs64 }, /* 269 = fstatfs64 */
- { 3, s(struct linux_sys_tgkill_args), 0,
- linux_sys_tgkill }, /* 270 = tgkill */
- { 0, 0, 0,
- sys_nosys }, /* 271 = unimplemented linux_sys_utimes */
- { 0, 0, 0,
- sys_nosys }, /* 272 = unimplemented linux_sys_fadvise64_64 */
- { 0, 0, 0,
- sys_nosys }, /* 273 = unimplemented linux_sys_vserver */
- { 0, 0, 0,
- sys_nosys }, /* 274 = unimplemented linux_sys_mbind */
- { 0, 0, 0,
- sys_nosys }, /* 275 = unimplemented linux_sys_get_mempolicy */
- { 0, 0, 0,
- sys_nosys }, /* 276 = unimplemented linux_sys_set_mempolicy */
- { 0, 0, 0,
- sys_nosys }, /* 277 = unimplemented linux_sys_mq_open */
- { 0, 0, 0,
- sys_nosys }, /* 278 = unimplemented linux_sys_mq_unlink */
- { 0, 0, 0,
- sys_nosys }, /* 279 = unimplemented linux_sys_mq_timedsend */
- { 0, 0, 0,
- sys_nosys }, /* 280 = unimplemented linux_sys_mq_timedreceive */
- { 0, 0, 0,
- sys_nosys }, /* 281 = unimplemented linux_sys_mq_notify */
- { 0, 0, 0,
- sys_nosys }, /* 282 = unimplemented linux_sys_mq_getsetattr */
- { 0, 0, 0,
- sys_nosys }, /* 283 = unimplemented linux_sys_sys_kexec_load */
- { 0, 0, 0,
- sys_nosys }, /* 284 = unimplemented linux_sys_waitid */
- { 0, 0, 0,
- sys_nosys }, /* 285 = unimplemented / * unused * / */
- { 0, 0, 0,
- sys_nosys }, /* 286 = unimplemented linux_sys_add_key */
- { 0, 0, 0,
- sys_nosys }, /* 287 = unimplemented linux_sys_request_key */
- { 0, 0, 0,
- sys_nosys }, /* 288 = unimplemented linux_sys_keyctl */
- { 0, 0, 0,
- sys_nosys }, /* 289 = unimplemented linux_sys_ioprio_set */
- { 0, 0, 0,
- sys_nosys }, /* 290 = unimplemented linux_sys_ioprio_get */
- { 0, 0, 0,
- sys_nosys }, /* 291 = unimplemented linux_sys_inotify_init */
- { 0, 0, 0,
- sys_nosys }, /* 292 = unimplemented linux_sys_inotify_add_watch */
- { 0, 0, 0,
- sys_nosys }, /* 293 = unimplemented linux_sys_inotify_rm_watch */
- { 0, 0, 0,
- sys_nosys }, /* 294 = unimplemented linux_sys_migrate_pages */
- { 0, 0, 0,
- sys_nosys }, /* 295 = unimplemented linux_sys_openalinux_sys_t */
- { 0, 0, 0,
- sys_nosys }, /* 296 = unimplemented linux_sys_mkdirat */
- { 0, 0, 0,
- sys_nosys }, /* 297 = unimplemented linux_sys_mknodat */
- { 0, 0, 0,
- sys_nosys }, /* 298 = unimplemented linux_sys_fchownat */
- { 0, 0, 0,
- sys_nosys }, /* 299 = unimplemented linux_sys_futimesat */
- { 0, 0, 0,
- sys_nosys }, /* 300 = unimplemented linux_sys_fstatat64 */
- { 0, 0, 0,
- sys_nosys }, /* 301 = unimplemented linux_sys_unlinkat */
- { 0, 0, 0,
- sys_nosys }, /* 302 = unimplemented linux_sys_renameat */
- { 0, 0, 0,
- sys_nosys }, /* 303 = unimplemented linux_sys_linkat */
- { 0, 0, 0,
- sys_nosys }, /* 304 = unimplemented linux_sys_symlinkat */
- { 0, 0, 0,
- sys_nosys }, /* 305 = unimplemented linux_sys_readlinkat */
- { 0, 0, 0,
- sys_nosys }, /* 306 = unimplemented linux_sys_fchmodat */
- { 0, 0, 0,
- sys_nosys }, /* 307 = unimplemented linux_sys_faccessat */
- { 0, 0, 0,
- sys_nosys }, /* 308 = unimplemented linux_sys_pselect6 */
- { 0, 0, 0,
- sys_nosys }, /* 309 = unimplemented linux_sys_ppoll */
- { 0, 0, 0,
- sys_nosys }, /* 310 = unimplemented linux_sys_unshare */
- { 2, s(struct linux_sys_set_robust_list_args), 0,
- linux_sys_set_robust_list }, /* 311 = set_robust_list */
- { 3, s(struct linux_sys_get_robust_list_args), 0,
- linux_sys_get_robust_list }, /* 312 = get_robust_list */
- { 0, 0, 0,
- sys_nosys }, /* 313 = unimplemented splice */
- { 0, 0, 0,
- sys_nosys }, /* 314 = unimplemented sync_file_range */
- { 0, 0, 0,
- sys_nosys }, /* 315 = unimplemented tee */
- { 0, 0, 0,
- sys_nosys }, /* 316 = unimplemented vmsplice */
- { 0, 0, 0,
- sys_nosys }, /* 317 = unimplemented move_pages */
- { 0, 0, 0,
- sys_nosys }, /* 318 = unimplemented getcpu */
- { 0, 0, 0,
- linux_sys_epoll_pwait }, /* 319 = epoll_pwait */
- { 0, 0, 0,
- sys_nosys }, /* 320 = unimplemented utimensat */
- { 0, 0, 0,
- sys_nosys }, /* 321 = unimplemented signalfd */
- { 0, 0, 0,
- sys_nosys }, /* 322 = unimplemented timerfd_create */
- { 0, 0, 0,
- linux_sys_eventfd }, /* 323 = eventfd */
- { 0, 0, 0,
- sys_nosys }, /* 324 = unimplemented fallocate */
- { 0, 0, 0,
- sys_nosys }, /* 325 = unimplemented timerfd_settime */
- { 0, 0, 0,
- sys_nosys }, /* 326 = unimplemented timerfd_gettime */
- { 0, 0, 0,
- sys_nosys }, /* 327 = unimplemented signalfd4 */
- { 0, 0, 0,
- linux_sys_eventfd2 }, /* 328 = eventfd2 */
- { 0, 0, 0,
- linux_sys_epoll_create1 }, /* 329 = epoll_create1 */
- { 0, 0, 0,
- sys_nosys }, /* 330 = unimplemented dup3 */
- { 2, s(struct linux_sys_pipe2_args), 0,
- linux_sys_pipe2 }, /* 331 = pipe2 */
- { 0, 0, 0,
- sys_nosys }, /* 332 = unimplemented inotify_init1 */
- { 0, 0, 0,
- sys_nosys }, /* 333 = unimplemented preadv */
- { 0, 0, 0,
- sys_nosys }, /* 334 = unimplemented pwritev */
- { 0, 0, 0,
- sys_nosys }, /* 335 = unimplemented rt_tgsigqueueinfo */
- { 0, 0, 0,
- sys_nosys }, /* 336 = unimplemented perf_counter_open */
- { 0, 0, 0,
- sys_nosys }, /* 337 = unimplemented recvmmsg */
-};
-
diff --git a/sys/compat/linux/linux_termios.c b/sys/compat/linux/linux_termios.c
deleted file mode 100644
index 9b555947c6b..00000000000
--- a/sys/compat/linux/linux_termios.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/* $OpenBSD: linux_termios.c,v 1.18 2015/04/30 09:20:51 mpi Exp $ */
-/* $NetBSD: linux_termios.c,v 1.3 1996/04/05 00:01:54 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/termios.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_ioctl.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_termios.h>
-
-static speed_t linux_speeds[] = {
- 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
- 9600, 19200, 38400, 57600, 115200, 230400
-};
-
-static const int linux_spmasks[] = {
- LINUX_B0, LINUX_B50, LINUX_B75, LINUX_B110, LINUX_B134, LINUX_B150,
- LINUX_B200, LINUX_B300, LINUX_B600, LINUX_B1200, LINUX_B1800,
- LINUX_B2400, LINUX_B4800, LINUX_B9600, LINUX_B19200, LINUX_B38400,
- LINUX_B57600, LINUX_B115200, LINUX_B230400
-};
-
-static void linux_termio_to_bsd_termios(struct linux_termio *,
- struct termios *);
-static void bsd_termios_to_linux_termio(struct termios *,
- struct linux_termio *);
-static void linux_termios_to_bsd_termios(struct linux_termios *,
- struct termios *);
-static void bsd_termios_to_linux_termios(struct termios *,
- struct linux_termios *);
-
-/*
- * Deal with termio ioctl cruft. This doesn't look very good..
- * XXX too much code duplication, obviously..
- *
- * The conversion routines between Linux and BSD structures assume
- * that the fields are already filled with the current values,
- * so that fields present in BSD but not in Linux keep their current
- * values.
- */
-
-static void
-linux_termio_to_bsd_termios(lt, bts)
- struct linux_termio *lt;
- struct termios *bts;
-{
- int index;
-
- bts->c_iflag = 0;
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNBRK, IGNBRK);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_BRKINT, BRKINT);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNPAR, IGNPAR);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_INPCK, INPCK);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_ISTRIP, ISTRIP);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_INLCR, INLCR);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNCR, IGNCR);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_ICRNL, ICRNL);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXON, IXON);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXANY, IXANY);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXOFF, IXOFF);
- bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IMAXBEL, IMAXBEL);
-
- bts->c_oflag = 0;
- bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_OPOST, OPOST);
- bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_ONLCR, ONLCR);
- bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_XTABS, OXTABS);
-
- /*
- * This could have been:
- * bts->c_cflag = (lt->c_flag & LINUX_CSIZE) << 4
- * But who knows, those values might perhaps change one day.
- */
- switch (lt->c_cflag & LINUX_CSIZE) {
- case LINUX_CS5:
- bts->c_cflag = CS5;
- break;
- case LINUX_CS6:
- bts->c_cflag = CS6;
- break;
- case LINUX_CS7:
- bts->c_cflag = CS7;
- break;
- case LINUX_CS8:
- bts->c_cflag = CS8;
- break;
- }
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CSTOPB, CSTOPB);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CREAD, CREAD);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_PARENB, PARENB);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_PARODD, PARODD);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_HUPCL, HUPCL);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CLOCAL, CLOCAL);
- bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CRTSCTS, CRTSCTS);
-
- bts->c_lflag = 0;
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ISIG, ISIG);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ICANON, ICANON);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHO, ECHO);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOE, ECHOE);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOK, ECHOK);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHONL, ECHONL);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_NOFLSH, NOFLSH);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_TOSTOP, TOSTOP);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOCTL, ECHOCTL);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOPRT, ECHOPRT);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOKE, ECHOKE);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_FLUSHO, FLUSHO);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_PENDIN, PENDIN);
- bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_IEXTEN, IEXTEN);
-
- index = lt->c_cflag & LINUX_CBAUD;
- if (index & LINUX_CBAUDEX)
- index = (index & ~LINUX_CBAUDEX) + LINUX_NSPEEDS - 1;
- bts->c_ispeed = bts->c_ospeed = linux_speeds[index];
-
- bts->c_cc[VINTR] = lt->c_cc[LINUX_VINTR];
- bts->c_cc[VQUIT] = lt->c_cc[LINUX_VQUIT];
- bts->c_cc[VERASE] = lt->c_cc[LINUX_VERASE];
- bts->c_cc[VKILL] = lt->c_cc[LINUX_VKILL];
- bts->c_cc[VEOF] = lt->c_cc[LINUX_VEOF];
- bts->c_cc[VTIME] = lt->c_cc[LINUX_VTIME];
- bts->c_cc[VMIN] = lt->c_cc[LINUX_VMIN];
-}
-
-static void
-bsd_termios_to_linux_termio(bts, lt)
- struct termios *bts;
- struct linux_termio *lt;
-{
- int i, mask;
-
- lt->c_iflag = 0;
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNBRK, LINUX_IGNBRK);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, BRKINT, LINUX_BRKINT);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNPAR, LINUX_IGNPAR);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, INPCK, LINUX_INPCK);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, ISTRIP, LINUX_ISTRIP);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, INLCR, LINUX_INLCR);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNCR, LINUX_IGNCR);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, ICRNL, LINUX_ICRNL);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXON, LINUX_IXON);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXANY, LINUX_IXANY);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXOFF, LINUX_IXOFF);
- lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IMAXBEL, LINUX_IMAXBEL);
-
- lt->c_oflag = 0;
- lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, OPOST, LINUX_OPOST);
- lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, ONLCR, LINUX_ONLCR);
- lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, OXTABS, LINUX_XTABS);
-
- switch (bts->c_cflag & CSIZE) {
- case CS5:
- lt->c_cflag = LINUX_CS5;
- break;
- case CS6:
- lt->c_cflag = LINUX_CS6;
- break;
- case CS7:
- lt->c_cflag = LINUX_CS7;
- break;
- case CS8:
- lt->c_cflag = LINUX_CS8;
- break;
- }
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CSTOPB, LINUX_CSTOPB);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CREAD, LINUX_CREAD);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARENB, LINUX_PARENB);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARODD, LINUX_PARODD);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, HUPCL, LINUX_HUPCL);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CLOCAL, LINUX_CLOCAL);
- lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CRTSCTS, LINUX_CRTSCTS);
-
- lt->c_lflag = 0;
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ISIG, LINUX_ISIG);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ICANON, LINUX_ICANON);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHO, LINUX_ECHO);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOE, LINUX_ECHOE);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOK, LINUX_ECHOK);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHONL, LINUX_ECHONL);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, NOFLSH, LINUX_NOFLSH);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, TOSTOP, LINUX_TOSTOP);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOCTL, LINUX_ECHOCTL);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOPRT, LINUX_ECHOPRT);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOKE, LINUX_ECHOKE);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, FLUSHO, LINUX_FLUSHO);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, PENDIN, LINUX_PENDIN);
- lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, IEXTEN, LINUX_IEXTEN);
-
- mask = LINUX_B9600; /* XXX default value should this be 0? */
- for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) {
- if (bts->c_ospeed == linux_speeds[i]) {
- mask = linux_spmasks[i];
- break;
- }
- }
- lt->c_cflag |= mask;
-
- lt->c_cc[LINUX_VINTR] = bts->c_cc[VINTR];
- lt->c_cc[LINUX_VQUIT] = bts->c_cc[VQUIT];
- lt->c_cc[LINUX_VERASE] = bts->c_cc[VERASE];
- lt->c_cc[LINUX_VKILL] = bts->c_cc[VKILL];
- lt->c_cc[LINUX_VEOF] = bts->c_cc[VEOF];
- lt->c_cc[LINUX_VTIME] = bts->c_cc[VTIME];
- lt->c_cc[LINUX_VMIN] = bts->c_cc[VMIN];
- lt->c_cc[LINUX_VSWTC] = 0;
-
- /* XXX should be fixed someday */
- lt->c_line = 0;
-}
-
-static void
-linux_termios_to_bsd_termios(lts, bts)
- struct linux_termios *lts;
- struct termios *bts;
-{
- int index;
-
- bts->c_iflag = 0;
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNBRK, IGNBRK);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_BRKINT, BRKINT);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNPAR, IGNPAR);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_INPCK, INPCK);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_ISTRIP, ISTRIP);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_INLCR, INLCR);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNCR, IGNCR);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_ICRNL, ICRNL);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXON, IXON);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXANY, IXANY);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXOFF, IXOFF);
- bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IMAXBEL, IMAXBEL);
-
- bts->c_oflag = 0;
- bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_OPOST, OPOST);
- bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_ONLCR, ONLCR);
- bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_XTABS, OXTABS);
-
- bts->c_cflag = 0;
- switch (lts->c_cflag & LINUX_CSIZE) {
- case LINUX_CS5:
- bts->c_cflag = CS5;
- break;
- case LINUX_CS6:
- bts->c_cflag = CS6;
- break;
- case LINUX_CS7:
- bts->c_cflag = CS7;
- break;
- case LINUX_CS8:
- bts->c_cflag = CS8;
- break;
- }
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CSTOPB, CSTOPB);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CREAD, CREAD);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_PARENB, PARENB);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_PARODD, PARODD);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_HUPCL, HUPCL);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CLOCAL, CLOCAL);
- bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CRTSCTS, CRTSCTS);
-
- bts->c_lflag = 0;
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ISIG, ISIG);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ICANON, ICANON);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHO, ECHO);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOE, ECHOE);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOK, ECHOK);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHONL, ECHONL);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_NOFLSH, NOFLSH);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_TOSTOP, TOSTOP);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOCTL, ECHOCTL);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOPRT, ECHOPRT);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOKE, ECHOKE);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_FLUSHO, FLUSHO);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_PENDIN, PENDIN);
- bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_IEXTEN, IEXTEN);
-
- index = lts->c_cflag & LINUX_CBAUD;
- if (index & LINUX_CBAUDEX)
- index = (index & ~LINUX_CBAUDEX) + LINUX_NSPEEDS - 1;
- bts->c_ispeed = bts->c_ospeed = linux_speeds[index];
-
- bts->c_cc[VINTR] = lts->c_cc[LINUX_VINTR];
- bts->c_cc[VQUIT] = lts->c_cc[LINUX_VQUIT];
- bts->c_cc[VERASE] = lts->c_cc[LINUX_VERASE];
- bts->c_cc[VKILL] = lts->c_cc[LINUX_VKILL];
- bts->c_cc[VEOF] = lts->c_cc[LINUX_VEOF];
- bts->c_cc[VTIME] = lts->c_cc[LINUX_VTIME];
- bts->c_cc[VMIN] = lts->c_cc[LINUX_VMIN];
- bts->c_cc[VEOL] = lts->c_cc[LINUX_VEOL];
- bts->c_cc[VEOL2] = lts->c_cc[LINUX_VEOL2];
- bts->c_cc[VWERASE] = lts->c_cc[LINUX_VWERASE];
- bts->c_cc[VSUSP] = lts->c_cc[LINUX_VSUSP];
- bts->c_cc[VSTART] = lts->c_cc[LINUX_VSTART];
- bts->c_cc[VSTOP] = lts->c_cc[LINUX_VSTOP];
- bts->c_cc[VLNEXT] = lts->c_cc[LINUX_VLNEXT];
- bts->c_cc[VDISCARD] = lts->c_cc[LINUX_VDISCARD];
- bts->c_cc[VREPRINT] = lts->c_cc[LINUX_VREPRINT];
-}
-
-static void
-bsd_termios_to_linux_termios(bts, lts)
- struct termios *bts;
- struct linux_termios *lts;
-{
- int i, mask;
-
- lts->c_iflag = 0;
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNBRK, LINUX_IGNBRK);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, BRKINT, LINUX_BRKINT);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNPAR, LINUX_IGNPAR);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, INPCK, LINUX_INPCK);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, ISTRIP, LINUX_ISTRIP);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, INLCR, LINUX_INLCR);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNCR, LINUX_IGNCR);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, ICRNL, LINUX_ICRNL);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXON, LINUX_IXON);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXANY, LINUX_IXANY);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXOFF, LINUX_IXOFF);
- lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IMAXBEL, LINUX_IMAXBEL);
-
- lts->c_oflag = 0;
- lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, OPOST, LINUX_OPOST);
- lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, ONLCR, LINUX_ONLCR);
- lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, OXTABS, LINUX_XTABS);
-
- switch (bts->c_cflag & CSIZE) {
- case CS5:
- lts->c_cflag = LINUX_CS5;
- break;
- case CS6:
- lts->c_cflag = LINUX_CS6;
- break;
- case CS7:
- lts->c_cflag = LINUX_CS7;
- break;
- case CS8:
- lts->c_cflag = LINUX_CS8;
- break;
- }
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS5, LINUX_CS5);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS6, LINUX_CS6);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS7, LINUX_CS7);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS8, LINUX_CS8);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CSTOPB, LINUX_CSTOPB);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CREAD, LINUX_CREAD);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARENB, LINUX_PARENB);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARODD, LINUX_PARODD);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, HUPCL, LINUX_HUPCL);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CLOCAL, LINUX_CLOCAL);
- lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CRTSCTS, LINUX_CRTSCTS);
-
- lts->c_lflag = 0;
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ISIG, LINUX_ISIG);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ICANON, LINUX_ICANON);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHO, LINUX_ECHO);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOE, LINUX_ECHOE);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOK, LINUX_ECHOK);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHONL, LINUX_ECHONL);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, NOFLSH, LINUX_NOFLSH);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, TOSTOP, LINUX_TOSTOP);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOCTL, LINUX_ECHOCTL);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOPRT, LINUX_ECHOPRT);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOKE, LINUX_ECHOKE);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, FLUSHO, LINUX_FLUSHO);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, PENDIN, LINUX_PENDIN);
- lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, IEXTEN, LINUX_IEXTEN);
-
- mask = LINUX_B9600; /* XXX default value */
- for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) {
- if (bts->c_ospeed == linux_speeds[i]) {
- mask = linux_spmasks[i];
- break;
- }
- }
- lts->c_cflag |= mask;
-
- lts->c_cc[LINUX_VINTR] = bts->c_cc[VINTR];
- lts->c_cc[LINUX_VQUIT] = bts->c_cc[VQUIT];
- lts->c_cc[LINUX_VERASE] = bts->c_cc[VERASE];
- lts->c_cc[LINUX_VKILL] = bts->c_cc[VKILL];
- lts->c_cc[LINUX_VEOF] = bts->c_cc[VEOF];
- lts->c_cc[LINUX_VTIME] = bts->c_cc[VTIME];
- lts->c_cc[LINUX_VMIN] = bts->c_cc[VMIN];
- lts->c_cc[LINUX_VEOL] = bts->c_cc[VEOL];
- lts->c_cc[LINUX_VEOL2] = bts->c_cc[VEOL2];
- lts->c_cc[LINUX_VWERASE] = bts->c_cc[VWERASE];
- lts->c_cc[LINUX_VSUSP] = bts->c_cc[VSUSP];
- lts->c_cc[LINUX_VSTART] = bts->c_cc[VSTART];
- lts->c_cc[LINUX_VSTOP] = bts->c_cc[VSTOP];
- lts->c_cc[LINUX_VLNEXT] = bts->c_cc[VLNEXT];
- lts->c_cc[LINUX_VDISCARD] = bts->c_cc[VDISCARD];
- lts->c_cc[LINUX_VREPRINT] = bts->c_cc[VREPRINT];
- lts->c_cc[LINUX_VSWTC] = 0;
-
- /* XXX should be fixed someday */
- lts->c_line = 0;
-}
-
-int
-linux_ioctl_termios(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct linux_sys_ioctl_args /* {
- syscallarg(int) fd;
- syscallarg(u_long) com;
- syscallarg(caddr_t) data;
- } */ *uap = v;
- struct file *fp;
- struct filedesc *fdp;
- u_long com;
- struct linux_termio tmplt;
- struct linux_termios tmplts;
- struct termios tmpbts;
- caddr_t sg;
- int idat;
- struct sys_ioctl_args ia;
- char tioclinux;
- int error = 0;
-
- fdp = p->p_fd;
- if ((fp = fd_getfile_mode(fdp, SCARG(uap, fd), FREAD|FWRITE)) == NULL)
- return (EBADF);
- FREF(fp);
-
- com = SCARG(uap, com);
- retval[0] = 0;
-
- switch (com) {
- case LINUX_TCGETS:
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA, (caddr_t)&tmpbts,
- p);
- if (error)
- goto out;
- bsd_termios_to_linux_termios(&tmpbts, &tmplts);
- error = copyout(&tmplts, SCARG(uap, data), sizeof tmplts);
- goto out;
- case LINUX_TCSETS:
- case LINUX_TCSETSW:
- case LINUX_TCSETSF:
- /*
- * First fill in all fields, so that we keep the current
- * values for fields that Linux doesn't know about.
- */
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA, (caddr_t)&tmpbts,
- p);
- if (error)
- goto out;
- error = copyin(SCARG(uap, data), &tmplts, sizeof tmplts);
- if (error)
- goto out;
- linux_termios_to_bsd_termios(&tmplts, &tmpbts);
- switch (com) {
- case LINUX_TCSETS:
- com = TIOCSETA;
- break;
- case LINUX_TCSETSW:
- com = TIOCSETAW;
- break;
- case LINUX_TCSETSF:
- com = TIOCSETAF;
- break;
- }
- error = (*fp->f_ops->fo_ioctl)(fp, com, (caddr_t)&tmpbts, p);
- goto out;
- case LINUX_TCGETA:
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA, (caddr_t)&tmpbts,
- p);
- if (error)
- goto out;
- bsd_termios_to_linux_termio(&tmpbts, &tmplt);
- error = copyout(&tmplt, SCARG(uap, data), sizeof tmplt);
- goto out;
- case LINUX_TCSETA:
- case LINUX_TCSETAW:
- case LINUX_TCSETAF:
- /*
- * First fill in all fields, so that we keep the current
- * values for fields that Linux doesn't know about.
- */
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA, (caddr_t)&tmpbts,
- p);
- if (error)
- goto out;
- error = copyin(SCARG(uap, data), &tmplt, sizeof tmplt);
- if (error)
- goto out;
- linux_termio_to_bsd_termios(&tmplt, &tmpbts);
- switch (com) {
- case LINUX_TCSETA:
- com = TIOCSETA;
- break;
- case LINUX_TCSETAW:
- com = TIOCSETAW;
- break;
- case LINUX_TCSETAF:
- com = TIOCSETAF;
- break;
- }
- error = (*fp->f_ops->fo_ioctl)(fp, com, (caddr_t)&tmpbts, p);
- goto out;
- case LINUX_TIOCGETD:
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETD, (caddr_t)&idat, p);
- if (error)
- goto out;
- switch (idat) {
- case TTYDISC:
- idat = LINUX_N_TTY;
- break;
- case SLIPDISC:
- idat = LINUX_N_SLIP;
- break;
- case PPPDISC:
- idat = LINUX_N_PPP;
- break;
- /*
- * Linux does not have the tablet line discipline.
- */
- case TABLDISC:
- default:
- idat = -1; /* XXX What should this be? */
- break;
- }
- error = copyout(&idat, SCARG(uap, data), sizeof idat);
- goto out;
- case LINUX_TIOCSETD:
- error = copyin(SCARG(uap, data), &idat, sizeof idat);
- if (error)
- goto out;
- switch (idat) {
- case LINUX_N_TTY:
- idat = TTYDISC;
- break;
- case LINUX_N_SLIP:
- idat = SLIPDISC;
- break;
- case LINUX_N_PPP:
- idat = PPPDISC;
- break;
- /*
- * We can't handle the mouse line discipline Linux has.
- */
- case LINUX_N_MOUSE:
- default:
- error = EINVAL;
- goto out;
- }
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCSETD, (caddr_t)&idat, p);
- goto out;
- case LINUX_TIOCLINUX:
- error = copyin(SCARG(uap, data), &tioclinux, sizeof tioclinux);
- if (error != 0)
- goto out;
- switch (tioclinux) {
- case LINUX_TIOCLINUX_KERNMSG:
- /*
- * XXX needed to not fail for some things. Could
- * try to use TIOCCONS, but the char argument
- * specifies the VT #, not an fd.
- */
- goto out;
- case LINUX_TIOCLINUX_COPY:
- case LINUX_TIOCLINUX_PASTE:
- case LINUX_TIOCLINUX_UNBLANK:
- case LINUX_TIOCLINUX_LOADLUT:
- case LINUX_TIOCLINUX_READSHIFT:
- case LINUX_TIOCLINUX_READMOUSE:
- case LINUX_TIOCLINUX_VESABLANK:
- case LINUX_TIOCLINUX_CURCONS: /* could use VT_GETACTIVE */
- error = EINVAL;
- goto out;
- }
- break;
- case LINUX_TIOCGWINSZ:
- SCARG(&ia, com) = TIOCGWINSZ;
- break;
- case LINUX_TIOCSWINSZ:
- SCARG(&ia, com) = TIOCSWINSZ;
- break;
- case LINUX_TIOCMGET:
- SCARG(&ia, com) = TIOCMGET;
- break;
- case LINUX_TIOCMBIS:
- SCARG(&ia, com) = TIOCMBIS;
- break;
- case LINUX_TIOCMBIC:
- SCARG(&ia, com) = TIOCMBIC;
- break;
- case LINUX_TIOCMSET:
- SCARG(&ia, com) = TIOCMSET;
- break;
- case LINUX_TIOCGPGRP:
- SCARG(&ia, com) = TIOCGPGRP;
- break;
- case LINUX_TIOCSPGRP:
- SCARG(&ia, com) = TIOCSPGRP;
- break;
- case LINUX_FIONREAD:
- SCARG(&ia, com) = FIONREAD;
- break;
- case LINUX_FIONBIO:
- SCARG(&ia, com) = FIONBIO;
- break;
- case LINUX_FIOASYNC:
- SCARG(&ia, com) = FIOASYNC;
- break;
- case LINUX_TIOCEXCL:
- SCARG(&ia, com) = TIOCEXCL;
- break;
- case LINUX_TIOCNXCL:
- SCARG(&ia, com) = TIOCNXCL;
- break;
- case LINUX_TIOCSCTTY:
- SCARG(&ia, com) = TIOCSCTTY;
- break;
- case LINUX_TIOCCONS:
- SCARG(&ia, com) = TIOCCONS;
- break;
- case LINUX_TIOCNOTTY:
- SCARG(&ia, com) = TIOCNOTTY;
- break;
- case LINUX_TCSBRK:
- SCARG(&ia, com) = SCARG(uap, data) ? TIOCDRAIN : TIOCSBRK;
- break;
- case LINUX_TCXONC:
- switch ((int)SCARG(uap, data)) {
- case LINUX_TCOOFF:
- SCARG(&ia, com) = TIOCSTOP;
- break;
- case LINUX_TCOON:
- SCARG(&ia, com) = TIOCSTART;
- break;
- case LINUX_TCIOFF:
- case LINUX_TCION: {
- u_char c, *cp;
- struct sys_write_args wa;
-
- error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA,
- (caddr_t)&tmpbts, p);
- if (error)
- goto out;
- if ((int)SCARG(uap, data) == LINUX_TCIOFF)
- c = tmpbts.c_cc[VSTOP];
- else
- c = tmpbts.c_cc[VSTART];
- if (c == _POSIX_VDISABLE)
- goto out;
-
- sg = stackgap_init(p);
- cp = (char *) stackgap_alloc(&sg, 1);
- if ((error = copyout(&c, cp, 1)))
- goto out;
-
- SCARG(&wa, fd) = SCARG(uap, fd);
- SCARG(&wa, buf) = cp;
- SCARG(&wa, nbyte) = 1;
- error = sys_write(p, &wa, retval);
- goto out;
- }
- default:
- error = EINVAL;
- goto out;
- }
- SCARG(uap, data) = 0;
- break;
- default:
- error = EINVAL;
- goto out;
- }
-
- SCARG(&ia, fd) = SCARG(uap, fd);
- SCARG(&ia, data) = SCARG(uap, data);
- error = sys_ioctl(p, &ia, retval);
-
-out:
- FRELE(fp, p);
- return (error);
-}
diff --git a/sys/compat/linux/linux_termios.h b/sys/compat/linux/linux_termios.h
deleted file mode 100644
index b1a11e812eb..00000000000
--- a/sys/compat/linux/linux_termios.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $OpenBSD: linux_termios.h,v 1.4 2002/05/07 20:23:42 jasoni Exp $ */
-
-#define LINUX_TCGETS _LINUX_IO('T', 1)
-#define LINUX_TCSETS _LINUX_IO('T', 2)
-#define LINUX_TCSETSW _LINUX_IO('T', 3)
-#define LINUX_TCSETSF _LINUX_IO('T', 4)
-#define LINUX_TCGETA _LINUX_IO('T', 5)
-#define LINUX_TCSETA _LINUX_IO('T', 6)
-#define LINUX_TCSETAW _LINUX_IO('T', 7)
-#define LINUX_TCSETAF _LINUX_IO('T', 8)
-#define LINUX_TCSBRK _LINUX_IO('T', 9)
-#define LINUX_TCXONC _LINUX_IO('T', 10)
-#define LINUX_TCFLSH _LINUX_IO('T', 11)
-#define LINUX_TIOCEXCL _LINUX_IO('T', 12)
-#define LINUX_TIOCNXCL _LINUX_IO('T', 13)
-#define LINUX_TIOCSCTTY _LINUX_IO('T', 14)
-#define LINUX_TIOCGPGRP _LINUX_IO('T', 15)
-#define LINUX_TIOCSPGRP _LINUX_IO('T', 16)
-#define LINUX_TIOCOUTQ _LINUX_IO('T', 17)
-#define LINUX_TIOCSTI _LINUX_IO('T', 18)
-#define LINUX_TIOCGWINSZ _LINUX_IO('T', 19)
-#define LINUX_TIOCSWINSZ _LINUX_IO('T', 20)
-#define LINUX_TIOCMGET _LINUX_IO('T', 21)
-#define LINUX_TIOCMBIS _LINUX_IO('T', 22)
-#define LINUX_TIOCMBIC _LINUX_IO('T', 23)
-#define LINUX_TIOCMSET _LINUX_IO('T', 24)
-#define LINUX_TIOCGSOFTCAR _LINUX_IO('T', 25)
-#define LINUX_TIOCSSOFTCAR _LINUX_IO('T', 26)
-#define LINUX_FIONREAD _LINUX_IO('T', 27)
-#define LINUX_TIOCINQ LINUX_FIONREAD
-#define LINUX_TIOCLINUX _LINUX_IO('T', 28)
-#define LINUX_TIOCCONS _LINUX_IO('T', 29)
-#define LINUX_TIOCGSERIAL _LINUX_IO('T', 30)
-#define LINUX_TIOCSSERIAL _LINUX_IO('T', 31)
-#define LINUX_TIOCPKT _LINUX_IO('T', 32)
-#define LINUX_FIONBIO _LINUX_IO('T', 33)
-#define LINUX_TIOCNOTTY _LINUX_IO('T', 34)
-#define LINUX_TIOCSETD _LINUX_IO('T', 35)
-#define LINUX_TIOCGETD _LINUX_IO('T', 36)
-#define LINUX_TCSBRKP _LINUX_IO('T', 37)
-#define LINUX_TIOCTTYGSTRUCT _LINUX_IO('T', 38)
-
-#define LINUX_FIONCLEX _LINUX_IO('T', 80)
-#define LINUX_FIOCLEX _LINUX_IO('T', 81)
-#define LINUX_FIOASYNC _LINUX_IO('T', 82)
-#define LINUX_TIOCSERCONFIG _LINUX_IO('T', 83)
-#define LINUX_TIOCSERGWILD _LINUX_IO('T', 84)
-#define LINUX_TIOCSERSWILD _LINUX_IO('T', 85)
-#define LINUX_TIOCGLCKTRMIOS _LINUX_IO('T', 86)
-#define LINUX_TIOCSLCKTRMIOS _LINUX_IO('T', 87)
-#define LINUX_TIOCSERGSTRUCT _LINUX_IO('T', 88)
-#define LINUX_TIOCSERGETLSR _LINUX_IO('T', 89)
-
-
-#define LINUX_NCC 8
-struct linux_termio {
- unsigned short c_iflag;
- unsigned short c_oflag;
- unsigned short c_cflag;
- unsigned short c_lflag;
- unsigned char c_line;
- unsigned char c_cc[LINUX_NCC];
-};
-
-typedef unsigned char linux_cc_t;
-typedef unsigned long linux_tcflag_t;
-
-#define LINUX_NCCS 19
-struct linux_termios {
- linux_tcflag_t c_iflag;
- linux_tcflag_t c_oflag;
- linux_tcflag_t c_cflag;
- linux_tcflag_t c_lflag;
- linux_cc_t c_line;
- linux_cc_t c_cc[LINUX_NCCS];
-};
-
-/* Just in old style linux_termio struct */
-#define LINUX_VINTR 0
-#define LINUX_VQUIT 1
-#define LINUX_VERASE 2
-#define LINUX_VKILL 3
-#define LINUX_VEOF 4
-#define LINUX_VTIME 5
-#define LINUX_VMIN 6
-#define LINUX_VSWTC 7
-
-/* In the termios struct too */
-#define LINUX_VSTART 8
-#define LINUX_VSTOP 9
-#define LINUX_VSUSP 10
-#define LINUX_VEOL 11
-#define LINUX_VREPRINT 12
-#define LINUX_VDISCARD 13
-#define LINUX_VWERASE 14
-#define LINUX_VLNEXT 15
-#define LINUX_VEOL2 16
-
-/* Linux c_iflag masks */
-#define LINUX_IGNBRK 0x0000001
-#define LINUX_BRKINT 0x0000002
-#define LINUX_IGNPAR 0x0000004
-#define LINUX_PARMRK 0x0000008
-#define LINUX_INPCK 0x0000010
-#define LINUX_ISTRIP 0x0000020
-#define LINUX_INLCR 0x0000040
-#define LINUX_IGNCR 0x0000080
-#define LINUX_ICRNL 0x0000100
-#define LINUX_IUCLC 0x0000200
-#define LINUX_IXON 0x0000400
-#define LINUX_IXANY 0x0000800
-#define LINUX_IXOFF 0x0001000
-#define LINUX_IMAXBEL 0x0002000
-
-/* Linux c_oflag masks */
-#define LINUX_OPOST 0x0000001
-#define LINUX_OLCUC 0x0000002
-#define LINUX_ONLCR 0x0000004
-#define LINUX_OCRNL 0x0000008
-#define LINUX_ONOCR 0x0000010
-#define LINUX_ONLRET 0x0000020
-#define LINUX_OFILL 0x0000040
-#define LINUX_OFDEL 0x0000080
-#define LINUX_NLDLY 0x0000100
-
-#define LINUX_NL0 0x0000000
-#define LINUX_NL1 0x0000100
-#define LINUX_CRDLY 0x0000600
-#define LINUX_CR0 0x0000000
-#define LINUX_CR1 0x0000200
-#define LINUX_CR2 0x0000400
-#define LINUX_CR3 0x0000600
-#define LINUX_TABDLY 0x0001800
-#define LINUX_TAB0 0x0000000
-#define LINUX_TAB1 0x0000800
-#define LINUX_TAB2 0x0001000
-#define LINUX_TAB3 0x0001800
-#define LINUX_XTABS 0x0001800
-#define LINUX_BSDLY 0x0002000
-#define LINUX_BS0 0x0000000
-#define LINUX_BS1 0x0002000
-#define LINUX_VTDLY 0x0004000
-#define LINUX_VT0 0x0000000
-#define LINUX_VT1 0x0004000
-#define LINUX_FFDLY 0x0008000
-#define LINUX_FF0 0x0000000
-#define LINUX_FF1 0x0008000
-
-/* Linux c_cflag bit masks */
-
-#define LINUX_NSPEEDS 16
-#define LINUX_NXSPEEDS 2
-
-#define LINUX_CBAUD 0x0000100f
-
-#define LINUX_B0 0x00000000
-#define LINUX_B50 0x00000001
-#define LINUX_B75 0x00000002
-#define LINUX_B110 0x00000003
-#define LINUX_B134 0x00000004
-#define LINUX_B150 0x00000005
-#define LINUX_B200 0x00000006
-#define LINUX_B300 0x00000007
-#define LINUX_B600 0x00000008
-#define LINUX_B1200 0x00000009
-#define LINUX_B1800 0x0000000a
-#define LINUX_B2400 0x0000000b
-#define LINUX_B4800 0x0000000c
-#define LINUX_B9600 0x0000000d
-#define LINUX_B19200 0x0000000e
-#define LINUX_B38400 0x0000000f
-#define LINUX_EXTA LINUX_B19200
-#define LINUX_EXTB LINUX_B38400
-#define LINUX_CBAUDEX 0x00001000
-#define LINUX_B57600 0x00001001
-#define LINUX_B115200 0x00001002
-#define LINUX_B230400 0x00001003
-
-#define LINUX_CSIZE 0x00000030
-#define LINUX_CS5 0x00000000
-#define LINUX_CS6 0x00000010
-#define LINUX_CS7 0x00000020
-#define LINUX_CS8 0x00000030
-#define LINUX_CSTOPB 0x00000040
-#define LINUX_CREAD 0x00000080
-#define LINUX_PARENB 0x00000100
-#define LINUX_PARODD 0x00000200
-#define LINUX_HUPCL 0x00000400
-#define LINUX_CLOCAL 0x00000800
-
-#define LINUX_CRTSCTS 0x80000000
-
-/* Linux c_lflag masks */
-#define LINUX_ISIG 0x00000001
-#define LINUX_ICANON 0x00000002
-#define LINUX_XCASE 0x00000004
-#define LINUX_ECHO 0x00000008
-#define LINUX_ECHOE 0x00000010
-#define LINUX_ECHOK 0x00000020
-#define LINUX_ECHONL 0x00000040
-#define LINUX_NOFLSH 0x00000080
-#define LINUX_TOSTOP 0x00000100
-#define LINUX_ECHOCTL 0x00000200
-#define LINUX_ECHOPRT 0x00000400
-#define LINUX_ECHOKE 0x00000800
-#define LINUX_FLUSHO 0x00001000
-#define LINUX_PENDIN 0x00002000
-#define LINUX_IEXTEN 0x00008000
-
-/* Linux modem line defines.. not sure if they'll be used */
-#define LINUX_TIOCM_LE 0x0001
-#define LINUX_TIOCM_DTR 0x0002
-#define LINUX_TIOCM_RTS 0x0004
-#define LINUX_TIOCM_ST 0x0008
-#define LINUX_TIOCM_SR 0x0010
-#define LINUX_TIOCM_CTS 0x0020
-#define LINUX_TIOCM_CAR 0x0040
-#define LINUX_TIOCM_RNG 0x0080
-#define LINUX_TIOCM_DSR 0x0100
-#define LINUX_TIOCM_CD LINUX_TIOCM_CAR
-#define LINUX_TIOCM_RI LINUX_TIOCM_RNG
-
-#define LINUX_TCIFLUSH 0
-#define LINUX_TCOFLUSH 1
-#define LINUX_TCIOFLUSH 2
-
-#define LINUX_TCOOFF 0
-#define LINUX_TCOON 1
-#define LINUX_TCIOFF 2
-#define LINUX_TCION 3
-
-#define LINUX_TCSANOW 0
-#define LINUX_TCSADRAIN 1
-#define LINUX_TCSAFLUSH 2
-
-/* Linux line disciplines */
-#define LINUX_N_TTY 0
-#define LINUX_N_SLIP 1
-#define LINUX_N_MOUSE 2
-#define LINUX_N_PPP 3
-
-/* values passed to TIOCLINUX ioctl */
-#define LINUX_TIOCLINUX_COPY 2
-#define LINUX_TIOCLINUX_PASTE 3
-#define LINUX_TIOCLINUX_UNBLANK 4
-#define LINUX_TIOCLINUX_LOADLUT 5
-#define LINUX_TIOCLINUX_READSHIFT 6
-#define LINUX_TIOCLINUX_READMOUSE 7
-#define LINUX_TIOCLINUX_VESABLANK 10
-#define LINUX_TIOCLINUX_KERNMSG 11
-#define LINUX_TIOCLINUX_CURCONS 12
diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c
deleted file mode 100644
index f60a2ff6926..00000000000
--- a/sys/compat/linux/linux_time.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* $OpenBSD: linux_time.c,v 1.5 2013/10/25 04:51:39 guenther Exp $ */
-/*
- * Copyright (c) 2010, 2011 Paul Irofti <pirofti@openbsd.org>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/mount.h>
-#include <sys/signal.h>
-#include <sys/stdint.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_fcntl.h>
-#include <compat/linux/linux_misc.h>
-#include <compat/linux/linux_mmap.h>
-#include <compat/linux/linux_sched.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_syscallargs.h>
-#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_dirent.h>
-#include <compat/linux/linux_emuldata.h>
-
-#include <compat/linux/linux_time.h>
-
-#define LINUX_CLOCK_REALTIME 0
-#define LINUX_CLOCK_MONOTONIC 1
-#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2
-#define LINUX_CLOCK_THREAD_CPUTIME_ID 3
-
-
-int
-bsd_to_linux_timespec(struct linux_timespec *ltp, const struct timespec *ntp)
-{
- if (ntp->tv_sec > LINUX_TIME_MAX)
- return EOVERFLOW;
- ltp->tv_sec = ntp->tv_sec;
- ltp->tv_nsec = ntp->tv_nsec;
- return 0;
-}
-
-void
-linux_to_bsd_timespec(struct timespec *ntp, const struct linux_timespec *ltp)
-{
- ntp->tv_sec = ltp->tv_sec;
- ntp->tv_nsec = ltp->tv_nsec;
-}
-
-int
-bsd_to_linux_itimerval(struct linux_itimerval *ltp,
- const struct itimerval *ntp)
-{
- int error;
-
- error = bsd_to_linux_timeval(&ltp->it_interval, &ntp->it_interval);
- if (error)
- return (error);
- return (bsd_to_linux_timeval(&ltp->it_value, &ntp->it_value));
-}
-
-void
-linux_to_bsd_itimerval(struct itimerval *ntp,
- const struct linux_itimerval *ltp)
-{
- linux_to_bsd_timeval(&ntp->it_interval, &ltp->it_interval);
- linux_to_bsd_timeval(&ntp->it_value, &ltp->it_value);
-}
-
-int
-linux_to_bsd_clockid(clockid_t *n, clockid_t l)
-{
- switch (l) {
- case LINUX_CLOCK_REALTIME:
- *n = CLOCK_REALTIME;
- break;
- case LINUX_CLOCK_MONOTONIC:
- *n = CLOCK_MONOTONIC;
- break;
- case LINUX_CLOCK_PROCESS_CPUTIME_ID:
- *n = CLOCK_PROCESS_CPUTIME_ID;
- break;
- case LINUX_CLOCK_THREAD_CPUTIME_ID:
- *n = CLOCK_THREAD_CPUTIME_ID;
- break;
- default:
- return (EINVAL);
- break;
- }
-
- return (0);
-}
-
-int
-linux_sys_clock_getres(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_clock_getres_args *uap = v;
- struct linux_timespec ltp;
- clockid_t clockid;
- int error;
-
- if (SCARG(uap, tp) == NULL)
- return 0;
-
- error = linux_to_bsd_clockid(&clockid, SCARG(uap, which));
- if (error != 0)
- return error;
-
- /* ahhh, just give a good guess */
- ltp.tv_sec = 0;
- ltp.tv_nsec = 1000000000 / hz;
-
- return (copyout(&ltp, SCARG(uap, tp), sizeof ltp));
-}
-
-int
-linux_sys_clock_gettime(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_clock_gettime_args *uap = v;
- struct timespec tp;
- struct linux_timespec ltp;
- clockid_t clockid;
- int error;
-
- error = linux_to_bsd_clockid(&clockid, SCARG(uap, which));
- if (error != 0)
- return error;
-
- error = clock_gettime(p, clockid, &tp);
- if (error != 0)
- return error;
-
- error = bsd_to_linux_timespec(&ltp, &tp);
- if (error != 0)
- return error;
-
- return (copyout(&ltp, SCARG(uap, tp), sizeof ltp));
-}
-
-int
-linux_sys_nanosleep(struct proc *p, void *v, register_t *retval)
-{
- static int nanowait;
- struct linux_sys_nanosleep_args /* {
- syscallarg(const struct linux_timespec *) rqtp;
- syscallarg(struct linux_timespec *) rmtp;
- } */ *uap = v;
- struct linux_timespec lts;
- struct timespec rqt, rmt;
- struct timespec sts, ets;
- struct linux_timespec *rmtp;
- struct timeval tv;
- int error, error1;
-
- rmtp = SCARG(uap, rmtp);
- error = copyin(SCARG(uap, rqtp), &lts, sizeof(lts));
- if (error)
- return (error);
- linux_to_bsd_timespec(&rqt, &lts);
-
- TIMESPEC_TO_TIMEVAL(&tv, &rqt);
- if (itimerfix(&tv))
- return (EINVAL);
-
- if (rmtp)
- getnanouptime(&sts);
-
- error = tsleep(&nanowait, PWAIT | PCATCH, "nanosleep",
- MAX(1, tvtohz(&tv)));
- if (error == ERESTART)
- error = EINTR;
- if (error == EWOULDBLOCK)
- error = 0;
-
- if (rmtp) {
- getnanouptime(&ets);
-
- timespecsub(&ets, &sts, &sts);
- timespecsub(&rqt, &sts, &rmt);
-
- if (rmt.tv_sec < 0)
- timespecclear(&rmt);
-
- if ((error1 = bsd_to_linux_timespec(&lts, &rmt)) ||
- (error1 = copyout(&lts, rmtp, sizeof(lts))))
- error = error1;
- }
-
- return error;
-}
-
-int
-linux_sys_gettimeofday(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_gettimeofday_args /* {
- syscallarg(struct linux_timeval *) tp;
- syscallarg(struct timezone *) tzp;
- } */ *uap = v;
- struct timeval atv;
- struct linux_timeval latv;
- struct linux_timeval *tp;
- struct timezone *tzp;
- int error = 0;
-
- tp = SCARG(uap, tp);
- tzp = SCARG(uap, tzp);
-
- if (tp) {
- microtime(&atv);
- if ((error = bsd_to_linux_timeval(&latv, &atv)) ||
- (error = copyout(&latv, tp, sizeof (latv))))
- return (error);
- }
- if (tzp)
- error = copyout(&tz, tzp, sizeof (tz));
- return (error);
-}
-
-int
-linux_sys_getitimer(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_getitimer_args /* {
- syscallarg(int) which;
- syscallarg(struct linux_itimerval *) itv;
- } */ *uap = v;
- struct itimerval aitv;
- struct linux_itimerval laitv;
- int s, which, error;
-
- which = SCARG(uap, which);
-
- if (which < ITIMER_REAL || which > ITIMER_PROF)
- return (EINVAL);
- s = splclock();
- aitv = p->p_p->ps_timer[which];
-
- if (which == ITIMER_REAL) {
- struct timeval now;
-
- getmicrouptime(&now);
- /*
- * Convert from absolute to relative time in .it_value
- * part of real time timer. If time for real time timer
- * has passed return 0, else return difference between
- * current time and time for the timer to go off.
- */
- if (timerisset(&aitv.it_value)) {
- if (timercmp(&aitv.it_value, &now, <))
- timerclear(&aitv.it_value);
- else
- timersub(&aitv.it_value, &now,
- &aitv.it_value);
- }
- }
- splx(s);
- if ((error = bsd_to_linux_itimerval(&laitv, &aitv)))
- return error;
- return (copyout(&laitv, SCARG(uap, itv), sizeof(laitv)));
-}
-
-int
-linux_sys_setitimer(struct proc *p, void *v, register_t *retval)
-{
- struct linux_sys_setitimer_args /* {
- syscallarg(int) which;
- syscallarg(const struct linux_itimerval *) itv;
- syscallarg(struct linux_itimerval *) oitv;
- } */ *uap = v;
- struct linux_sys_getitimer_args getargs;
- struct itimerval aitv;
- struct linux_itimerval laitv;
- const struct linux_itimerval *itvp;
- struct linux_itimerval *oitv;
- struct process *pr = p->p_p;
- int error;
- int timo;
- int which;
-
- which = SCARG(uap, which);
- itvp = SCARG(uap, itv);
- oitv = SCARG(uap, oitv);
-
- if (which < ITIMER_REAL || which > ITIMER_PROF)
- return (EINVAL);
- if (itvp && (error = copyin(itvp, &laitv, sizeof(laitv))))
- return (error);
- if (oitv != NULL) {
- SCARG(&getargs, which) = which;
- SCARG(&getargs, itv) = oitv;
- if ((error = linux_sys_getitimer(p, &getargs, retval)))
- return (error);
- }
- if (itvp == 0)
- return (0);
- linux_to_bsd_itimerval(&aitv, &laitv);
- if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval))
- return (EINVAL);
- if (which == ITIMER_REAL) {
- struct timeval ctv;
-
- timeout_del(&pr->ps_realit_to);
- getmicrouptime(&ctv);
- if (timerisset(&aitv.it_value)) {
- timo = tvtohz(&aitv.it_value);
- timeout_add(&pr->ps_realit_to, timo);
- timeradd(&aitv.it_value, &ctv, &aitv.it_value);
- }
- pr->ps_timer[ITIMER_REAL] = aitv;
- } else {
- int s;
-
- itimerround(&aitv.it_interval);
- s = splclock();
- pr->ps_timer[which] = aitv;
- splx(s);
- }
-
- return (0);
-}
diff --git a/sys/compat/linux/linux_time.h b/sys/compat/linux/linux_time.h
deleted file mode 100644
index 875d3b1adf9..00000000000
--- a/sys/compat/linux/linux_time.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: linux_time.h,v 1.4 2013/10/25 04:51:39 guenther Exp $ */
-/*
- * Copyright (c) 2011 Paul Irofti <pirofti@openbsd.org>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _LINUX_TIME_H_
-#define _LINUX_TIME_H_
-
-/* BSD to linux can fail with EOVERFLOW */
-int bsd_to_linux_timespec(struct linux_timespec *,
- const struct timespec *);
-int bsd_to_linux_itimerval(struct linux_itimerval *,
- const struct itimerval *);
-
-/* linux to BSD can't fail for time_t-based stuff, but can for clockid_t */
-void linux_to_bsd_timespec(struct timespec *,
- const struct linux_timespec *);
-void linux_to_bsd_itimerval(struct itimerval *,
- const struct linux_itimerval *);
-int linux_to_bsd_clockid(clockid_t *, clockid_t);
-
-
-/* the timespec conversion functions also handle timeval */
-static inline int
-bsd_to_linux_timeval(struct linux_timeval *ltp, const struct timeval *ntp)
-{
- return (bsd_to_linux_timespec((void *)ltp, (const void *)ntp));
-}
-static inline void
-linux_to_bsd_timeval(struct timeval *ntp, const struct linux_timeval *ltp)
-{
- linux_to_bsd_timespec((void *)ntp, (const void *)ltp);
-}
-
-
-#endif
diff --git a/sys/compat/linux/linux_types.h b/sys/compat/linux/linux_types.h
deleted file mode 100644
index b8e6798b390..00000000000
--- a/sys/compat/linux/linux_types.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/* $OpenBSD: linux_types.h,v 1.14 2014/09/08 01:47:06 guenther Exp $ */
-/* $NetBSD: linux_types.h,v 1.5 1996/05/20 01:59:28 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#ifndef _LINUX_TYPES_H_
-#define _LINUX_TYPES_H_
-
-typedef struct {
- long val[2];
-} linux_fsid_t;
-
-typedef unsigned short linux_uid_t;
-typedef unsigned short linux_gid_t;
-typedef unsigned short linux_dev_t;
-typedef unsigned long long linux_ino64_t;
-typedef unsigned long linux_ino_t;
-typedef unsigned short linux_mode_t;
-typedef unsigned short linux_nlink_t;
-typedef long linux_time_t;
-typedef long linux_clock_t;
-typedef long long linux_off64_t;
-typedef long linux_off_t;
-typedef u_int64_t linux_loff_t;
-typedef int linux_pid_t;
-
-#define LINUX_TIME_MAX LONG_MAX
-#define LINUX_INO_MAX ULONG_MAX
-#define LINUX_INO64_MAX ULLONG_MAX
-
-#define LINUX_FSTYPE_FFS 0x11954
-#define LINUX_FSTYPE_NFS 0x6969
-#define LINUX_FSTYPE_MSDOS 0x4d44
-#define LINUX_FSTYPE_EXT2FS 0xef53
-#define LINUX_FSTYPE_CD9660 0x9660
-#define LINUX_FSTYPE_NCPFS 0x6969
-#define LINUX_FSTYPE_NTFS 0x5346544e /* "NTFS" */
-#define LINUX_FSTYPE_UDF 0x15013346
-#define LINUX_FSTYPE_AFS 0x5346414f
-
-/*
- * Linux version of time-based structures, passed to many system calls
- */
-struct linux_timespec {
- linux_time_t tv_sec;
- long tv_nsec;
-};
-
-struct linux_timeval {
- linux_time_t tv_sec;
- long tv_usec;
-};
-
-struct linux_itimerval {
- struct linux_timeval it_interval;
- struct linux_timeval it_value;
-};
-
-/*
- * Passed to the statfs(2) system call family
- */
-struct linux_statfs {
- long l_ftype;
- long l_fbsize;
- long l_fblocks;
- long l_fbfree;
- long l_fbavail;
- long l_ffiles;
- long l_fffree;
- linux_fsid_t l_ffsid;
- long l_fnamelen;
- long l_fspare[6];
-};
-
-struct linux_statfs64 {
- int l_ftype;
- int l_fbsize;
- uint64_t l_fblocks;
- uint64_t l_fbfree;
- uint64_t l_fbavail;
- uint64_t l_ffiles;
- uint64_t l_fffree;
- linux_fsid_t l_ffsid;
- int l_fnamelen;
- int l_fspare[6];
-};
-
-/*
- * Passed to the uname(2) system call
- */
-struct linux_utsname {
- char l_sysname[65];
- char l_nodename[65];
- char l_release[65];
- char l_version[65];
- char l_machine[65];
- char l_domainname[65];
-};
-
-struct linux_oldutsname {
- char l_sysname[65];
- char l_nodename[65];
- char l_release[65];
- char l_version[65];
- char l_machine[65];
-};
-
-struct linux_oldoldutsname {
- char l_sysname[9];
- char l_nodename[9];
- char l_release[9];
- char l_version[9];
- char l_machine[9];
-};
-
-/*
- * Passed to the mmap() system call
- */
-struct linux_mmap {
- caddr_t lm_addr;
- int lm_len;
- int lm_prot;
- int lm_flags;
- int lm_fd;
- int lm_pos;
-};
-
-/*
- * Passed to the select() system call
- */
-struct linux_select {
- int nfds;
- fd_set *readfds;
- fd_set *writefds;
- fd_set *exceptfds;
- struct linux_timeval *timeout;
-};
-
-struct linux_stat {
- linux_dev_t lst_dev;
- unsigned short pad1;
- linux_ino_t lst_ino;
- linux_mode_t lst_mode;
- linux_nlink_t lst_nlink;
- linux_uid_t lst_uid;
- linux_gid_t lst_gid;
- linux_dev_t lst_rdev;
- unsigned short pad2;
- linux_off_t lst_size;
- unsigned long lst_blksize;
- unsigned long lst_blocks;
- linux_time_t lst_atime;
- unsigned long unused1;
- linux_time_t lst_mtime;
- unsigned long unused2;
- linux_time_t lst_ctime;
- unsigned long unused3;
- unsigned long unused4;
- unsigned long unused5;
-};
-
-struct linux_tms {
- linux_clock_t ltms_utime;
- linux_clock_t ltms_stime;
- linux_clock_t ltms_cutime;
- linux_clock_t ltms_cstime;
-};
-
-struct linux_utimbuf {
- linux_time_t l_actime;
- linux_time_t l_modtime;
-};
-
-struct linux___sysctl {
- int *name;
- int namelen;
- void *old;
- size_t *oldlenp;
- void *new;
- size_t newlen;
- unsigned long __unused0[4];
-};
-
-/* This matches struct stat64 in glibc2.1, hence the absolutely
- * insane amounts of padding around dev_t's.
- */
-struct linux_stat64 {
- unsigned long long lst_dev;
- unsigned int __pad1;
-
-#define LINUX_STAT64_HAS_BROKEN_ST_INO 1
- linux_ino_t __lst_ino;
- unsigned int lst_mode;
- unsigned int lst_nlink;
-
- unsigned int lst_uid;
- unsigned int lst_gid;
-
- unsigned long long lst_rdev;
- unsigned int __pad2;
-
- long long lst_size;
- unsigned int lst_blksize;
-
- unsigned long long lst_blocks; /* Number 512-byte blocks allocated. */
-
- unsigned int lst_atime;
- unsigned int __unused1;
-
- unsigned int lst_mtime;
- unsigned int __unused2;
-
- unsigned int lst_ctime;
- unsigned int __unused3; /* will be high 32 bits of ctime someday */
-
- linux_ino64_t lst_ino;
-};
-
-#endif /* !_LINUX_TYPES_H_ */
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
deleted file mode 100644
index a0652749a85..00000000000
--- a/sys/compat/linux/linux_util.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $OpenBSD: linux_util.h,v 1.2 1996/04/17 05:24:11 mickey Exp $ */
-/* $NetBSD: linux_util.h,v 1.5 1995/06/24 20:20:42 christos Exp $ */
-
-/*
- * Copyright (c) 1994 Christos Zoulas
- * Copyright (c) 1995 Frank van der Linden
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#ifndef _LINUX_UTIL_H_
-#define _LINUX_UTIL_H_
-
-#include <compat/common/compat_util.h>
-
-#define cvtto_linux_mask(flags,bmask,lmask) (((flags) & bmask) ? lmask : 0)
-#define cvtto_bsd_mask(flags,lmask,bmask) (((flags) & lmask) ? bmask : 0)
-
-extern const char linux_emul_path[];
-
-#define LINUX_CHECK_ALT_EXIST(p, sgp, path) \
- CHECK_ALT_EXIST(p, sgp, linux_emul_path, path)
-
-#define LINUX_CHECK_ALT_CREAT(p, sgp, path) \
- CHECK_ALT_CREAT(p, sgp, linux_emul_path, path)
-
-#endif /* !_LINUX_UTIL_H_ */
diff --git a/sys/compat/linux/syscalls.conf b/sys/compat/linux/syscalls.conf
deleted file mode 100644
index a0974e142cb..00000000000
--- a/sys/compat/linux/syscalls.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: syscalls.conf,v 1.2 1996/04/17 05:24:12 mickey Exp $
-# $NetBSD: syscalls.conf,v 1.1 1995/02/28 23:26:24 fvdl Exp $
-
-sysnames="linux_syscalls.c"
-sysnumhdr="linux_syscall.h"
-syssw="linux_sysent.c"
-sysarghdr="linux_syscallargs.h"
-compatopts=""
-libcompatopts=""
-
-switchname="linux_sysent"
-namesname="linux_syscallnames"
-constprefix="LINUX_SYS_"
diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master
deleted file mode 100644
index a93e2493146..00000000000
--- a/sys/compat/linux/syscalls.master
+++ /dev/null
@@ -1,495 +0,0 @@
- $OpenBSD: syscalls.master,v 1.76 2014/09/01 05:09:53 doug Exp $
-; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $
-
-; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
-
-; OpenBSD COMPAT_LINUX system call name/number "master" file.
-; (See syscalls.conf to see what it is processed into.)
-;
-; Fields: number type [type-dependent ...]
-; number system call number, must be in order
-; type one of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of
-; the compatibility options defined in syscalls.conf.
-;
-; types:
-; STD always included
-; OBSOL obsolete, not included in system
-; UNIMPL unimplemented, not included in system
-; NODEF included, but don't define the syscall number
-; NOARGS included, but don't define the syscall args structure
-;
-; The compat options are defined in the syscalls.conf file, and the
-; compat option name is prefixed to the syscall name. Other than
-; that, they're like NODEF (for 'compat' options), or STD (for
-; 'libcompat' options).
-;
-; The type-dependent arguments are as follows:
-; For STD, NODEF, NOARGS, and compat syscalls:
-; { pseudo-proto } [alias]
-; For other syscalls:
-; [comment]
-;
-; #ifdef's, etc. may be included, and are copied to the output files.
-; #include's are copied to the syscall switch definition file only.
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signal.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_misc.h>
-#include <compat/linux/linux_syscallargs.h>
-
-#include <machine/linux_machdep.h>
-
-0 NOARGS { int sys_nosys(void); } syscall
-1 NOARGS { int sys_exit(int rval); }
-2 NOARGS { int sys_fork(void); }
-3 NOARGS { int sys_read(int fd, char *buf, u_int nbyte); }
-4 NOARGS { int sys_write(int fd, char *buf, u_int nbyte); }
-5 STD { int linux_sys_open(char *path, int flags, int mode); }
-6 NOARGS { int sys_close(int fd); }
-7 STD { int linux_sys_waitpid(int pid, int *status, \
- int options);}
-8 STD { int linux_sys_creat(char *path, int mode); }
-9 NOARGS { int sys_link(char *path, char *link); }
-10 STD { int linux_sys_unlink(char *path); }
-11 STD { int linux_sys_execve(char *path, char **argp, \
- char **envp); }
-12 STD { int linux_sys_chdir(char *path); }
-13 STD { int linux_sys_time(linux_time_t *t); }
-14 STD { int linux_sys_mknod(char *path, int mode, int dev); }
-15 STD { int linux_sys_chmod(char *path, int mode); }
-16 STD { int linux_sys_lchown16(char *path, int uid, \
- int gid); }
-17 STD { int linux_sys_break(char *nsize); }
-18 STD { int linux_sys_ostat(void); }
-19 STD { long linux_sys_lseek(int fd, long offset, \
- int whence); }
-20 STD { pid_t linux_sys_getpid(void); }
-21 STD { int linux_sys_mount(char *specialfile, char *dir, \
- char *filesystemtype, long rwflag, void *data); }
-22 STD { int linux_sys_umount(char *specialfile); }
-23 NOARGS linux_setuid16 { int sys_setuid(uid_t uid); }
-24 STD linux_getuid16 { uid_t linux_sys_getuid(void); }
-25 UNIMPL stime
-#ifdef PTRACE
-26 STD { int linux_sys_ptrace(void); }
-#else
-26 UNIMPL ptrace
-#endif
-27 STD { int linux_sys_alarm(unsigned int secs); }
-28 STD { int linux_sys_ofstat(void); }
-29 STD { int linux_sys_pause(void); }
-30 STD { int linux_sys_utime(char *path, \
- struct linux_utimbuf *times); }
-31 STD { int linux_sys_stty(void); }
-32 STD { int linux_sys_gtty(void); }
-33 STD { int linux_sys_access(char *path, int flags); }
-34 STD { int linux_sys_nice(int incr); }
-35 STD { int linux_sys_ftime(void); }
-36 NOARGS { int sys_sync(void); }
-37 STD { int linux_sys_kill(int pid, int signum); }
-38 STD { int linux_sys_rename(char *from, char *to); }
-39 STD { int linux_sys_mkdir(char *path, int mode); }
-40 STD { int linux_sys_rmdir(char *path); }
-41 NOARGS { int sys_dup(u_int fd); }
-42 NOARGS { int sys_pipe(int *fdp); }
-43 STD { int linux_sys_times(struct linux_tms *tms); }
-44 STD { int linux_sys_prof(void); }
-45 STD { int linux_sys_brk(char *nsize); }
-46 NOARGS linux_setgid16 { int sys_setgid(gid_t gid); }
-47 STD linux_getgid16 { gid_t linux_sys_getgid(void); }
-48 STD { int linux_sys_signal(int sig, \
- linux_handler_t handler); }
-49 NOARGS linux_geteuid16 { uid_t sys_geteuid(void); }
-50 NOARGS linux_getegid16 { gid_t sys_getegid(void); }
-#ifdef ACCOUNTING
-51 NOARGS { int sys_acct(char *path); }
-#else
-51 UNIMPL acct
-#endif
-52 STD { int linux_sys_phys(void); }
-53 STD { int linux_sys_lock(void); }
-54 STD { int linux_sys_ioctl(int fd, u_long com, \
- caddr_t data); }
-55 STD { int linux_sys_fcntl(int fd, int cmd, void *arg); }
-56 STD { int linux_sys_mpx(void); }
-57 NOARGS { int sys_setpgid(int pid, int pgid); }
-58 STD { int linux_sys_ulimit(void); }
-59 STD { int linux_sys_oldolduname(struct linux_oldold_utsname *up); }
-60 NOARGS { int sys_umask(int newmask); }
-61 NOARGS { int sys_chroot(char *path); }
-62 STD { int linux_sys_ustat(void); }
-63 NOARGS { int sys_dup2(u_int from, u_int to); }
-64 NOARGS { pid_t sys_getppid(void); }
-65 NOARGS { int sys_getpgrp(void); }
-66 NOARGS { int sys_setsid(void); }
-67 STD { int linux_sys_sigaction(int signum, \
- struct linux_old_sigaction *nsa, \
- struct linux_old_sigaction *osa); }
-68 STD { int linux_sys_siggetmask(void); }
-69 STD { int linux_sys_sigsetmask(linux_old_sigset_t mask); }
-70 STD { int linux_sys_setreuid16(int ruid, int euid); }
-71 STD { int linux_sys_setregid16(int rgid, int egid); }
-72 STD { int linux_sys_sigsuspend(caddr_t restart, \
- int oldmask, int mask); }
-73 STD { int linux_sys_sigpending(linux_old_sigset_t *mask); }
-74 STD { int linux_sys_sethostname(char *hostname, u_int len);}
-75 STD { int linux_sys_setrlimit(u_int which, \
- struct linux_rlimit *rlp); }
-76 STD { int linux_sys_getrlimit(u_int which, \
- struct linux_rlimit *rlp); }
-77 STD { int linux_sys_getrusage(int who, \
- struct linux_rusage *rusage); }
-78 STD { int linux_sys_gettimeofday(struct linux_timeval *tp, \
- struct timezone *tzp); }
-79 UNIMPL settimeofday
-80 NOARGS linux_getgroups { int sys_getgroups(u_int gidsetsize, \
- gid_t *gidset); }
-81 NOARGS linux_setgroups { int sys_setgroups(u_int gidsetsize, \
- gid_t *gidset); }
-82 STD { int linux_sys_oldselect(struct linux_select *lsp); }
-83 STD { int linux_sys_symlink(char *path, char *to); }
-84 NOARGS { int linux_sys_lstat(char *path, \
- struct linux_stat *up); } olstat
-85 STD { ssize_t linux_sys_readlink(char *name, \
- char *buf, int count); }
-86 UNIMPL linux_sys_uselib
-87 STD { int linux_sys_swapon(char *name); }
-88 NOARGS { int sys_reboot(int opt); }
-89 STD { int linux_sys_readdir(int fd, caddr_t dent, \
- unsigned int count); }
-90 STD { int linux_sys_mmap(struct linux_mmap *lmp); }
-91 NOARGS { int sys_munmap(caddr_t addr, int len); }
-92 STD { int linux_sys_truncate(char *path, long length); }
-93 STD { int linux_sys_ftruncate(int fd, long length); }
-94 NOARGS { int sys_fchmod(int fd, int mode); }
-95 STD { int linux_sys_fchown16(int fd, int uid, int gid); }
-96 NOARGS { int sys_getpriority(int which, int who); }
-97 NOARGS { int sys_setpriority(int which, int who, int prio); }
-98 NOARGS { int sys_profil(caddr_t samples, u_int size, \
- u_int offset, u_int scale); }
-99 STD { int linux_sys_statfs(char *path, \
- struct linux_statfs *sp); }
-100 STD { int linux_sys_fstatfs(int fd, \
- struct linux_statfs *sp); }
-#ifdef __i386__
-101 STD { int linux_sys_ioperm(unsigned int lo, \
- unsigned int hi, int val); }
-#else
-101 STD { int linux_sys_ioperm(void); }
-#endif
-102 STD { int linux_sys_socketcall(int what, void *args); }
-103 STD { int linux_sys_klog(void); }
-104 STD { int linux_sys_setitimer(u_int which, \
- struct linux_itimerval *itv, \
- struct linux_itimerval *oitv); }
-105 STD { int linux_sys_getitimer(u_int which, \
- struct linux_itimerval *itv); }
-106 STD { int linux_sys_stat(char *path, \
- struct linux_stat *sp); }
-107 STD { int linux_sys_lstat(char *path, \
- struct linux_stat *sp); }
-108 STD { int linux_sys_fstat(int fd, struct linux_stat *sp); }
-109 STD { int linux_sys_olduname(struct linux_old_utsname *up); }
-#ifdef __i386__
-110 STD { int linux_sys_iopl(int level); }
-#else
-110 STD { int linux_sys_iopl(void); }
-#endif
-111 STD { int linux_sys_vhangup(void); }
-112 STD { int linux_sys_idle(void); }
-113 STD { int linux_sys_vm86old(void); }
-114 STD { int linux_sys_wait4(int pid, int *status, \
- int options, struct linux_rusage *rusage); }
-115 STD { int linux_sys_swapoff(void); }
-116 STD { int linux_sys_sysinfo(struct linux_sysinfo *sysinfo); }
-117 STD { int linux_sys_ipc(int what, int a1, int a2, int a3, \
- caddr_t ptr); }
-118 NOARGS { int sys_fsync(int fd); }
-119 STD { int linux_sys_sigreturn(struct linux_sigcontext *scp); }
-120 STD { int linux_sys_clone(int flags, void *stack, \
- void *parent_tidptr, void *tls, void *child_tidptr); }
-121 STD { int linux_sys_setdomainname(char *name, int len); }
-122 STD { int linux_sys_uname(struct linux_utsname *up); }
-#ifdef __i386__
-123 STD { int linux_sys_modify_ldt(int func, void *ptr, \
- size_t bytecount); }
-#else
-123 STD { int linux_sys_modify_ldt(void); }
-#endif
-124 STD { int linux_sys_adjtimex(void); }
-125 STD { int linux_sys_mprotect(caddr_t addr, int len, int prot); }
-126 STD { int linux_sys_sigprocmask(int how, \
- linux_old_sigset_t *set, linux_old_sigset_t *oset); }
-127 STD { int linux_sys_create_module(void); }
-128 STD { int linux_sys_init_module(void); }
-129 STD { int linux_sys_delete_module(void); }
-130 STD { int linux_sys_get_kernel_syms(void); }
-131 STD { int linux_sys_quotactl(void); }
-132 STD { int linux_sys_getpgid(int pid); }
-133 NOARGS { int sys_fchdir(int fd); }
-134 STD { int linux_sys_bdflush(void); }
-135 STD { int linux_sys_sysfs(void); }
-136 STD { int linux_sys_personality(int per); }
-137 STD { int linux_sys_afs_syscall(void); }
-138 NOARGS linux_setfsuid16 { int linux_sys_setfsuid(uid_t uid); }
-139 NOARGS linux_getfsuid16 { int linux_sys_getfsuid(void); }
-140 STD { int linux_sys_llseek(int fd, u_int32_t ohigh, \
- u_int32_t olow, caddr_t res, int whence); }
-141 STD { int linux_sys_getdents(int fd, void *dirent, \
- unsigned count); }
-142 STD { int linux_sys_select(int nfds, fd_set *readfds, \
- fd_set *writefds, fd_set *exceptfds, \
- struct linux_timeval *timeout); }
-143 NOARGS { int sys_flock(int fd, int how); }
-144 NOARGS { int sys_msync(void *addr, int len, int fl); }
-145 NOARGS { int sys_readv(int fd, struct iovec *iovp, \
- u_int iovcnt); }
-146 NOARGS { int sys_writev(int fd, struct iovec *iovp, \
- u_int iovcnt); }
-147 NOARGS { int sys_getsid(pid_t pid); }
-148 STD { int linux_sys_fdatasync(int fd); }
-149 STD { int linux_sys___sysctl(struct linux___sysctl *lsp); }
-150 NOARGS { int sys_mlock(caddr_t addr, size_t len); }
-151 NOARGS { int sys_munlock(caddr_t addr, size_t len); }
-152 STD { int linux_sys_mlockall(void); }
-153 STD { int linux_sys_munlockall(void); }
-154 STD { int linux_sys_sched_setparam(linux_pid_t pid, \
- const struct linux_sched_param *sp); }
-155 STD { int linux_sys_sched_getparam(linux_pid_t pid, \
- struct linux_sched_param *sp); }
-156 STD { int linux_sys_sched_setscheduler(linux_pid_t pid, \
- int policy, const struct linux_sched_param *sp); }
-157 STD { int linux_sys_sched_getscheduler(linux_pid_t pid); }
-158 STD { int linux_sys_sched_yield(void); }
-159 STD { int linux_sys_sched_get_priority_max(int policy); }
-160 STD { int linux_sys_sched_get_priority_min(int policy); }
-161 STD { int linux_sys_sched_rr_get_interval(void); }
-162 STD { int linux_sys_nanosleep( \
- const struct linux_timespec *rqtp, \
- struct linux_timespec *rmtp); }
-163 STD { int linux_sys_mremap(void *old_address, \
- size_t old_size, size_t new_size, long flags); }
-164 STD { int linux_sys_setresuid16(u_int16_t ruid, \
- u_int16_t euid, u_int16_t suid); }
-165 STD { int linux_sys_getresuid16(u_int16_t *ruid, \
- u_int16_t *euid, u_int16_t *suid); }
-166 STD { int linux_sys_vm86(void); }
-167 STD { int linux_sys_query_module(void); }
-168 NOARGS { int sys_poll(struct pollfd *fds, u_int nfds, \
- int timeout); }
-169 STD { int linux_sys_nfsservctl(void); }
-170 STD { int linux_sys_setresgid16(u_int16_t rgid, \
- u_int16_t egid, u_int16_t sgid); }
-171 STD { int linux_sys_getresgid16(u_int16_t *rgid, \
- u_int16_t *egid, u_int16_t *sgid); }
-172 STD { int linux_sys_prctl(int option, unsigned long arg2, \
- unsigned long arg3, unsigned long arg4, \
- unsigned long arg5); }
-173 STD { int linux_sys_rt_sigreturn( \
- struct linux_rt_sigframe *sfp); }
-174 STD { int linux_sys_rt_sigaction(int signum, \
- struct linux_sigaction *nsa, \
- struct linux_sigaction *osa, \
- size_t sigsetsize); }
-175 STD { int linux_sys_rt_sigprocmask(int how, \
- const linux_sigset_t *set, \
- linux_sigset_t *oset, size_t sigsetsize); }
-176 STD { int linux_sys_rt_sigpending(linux_sigset_t *set, \
- size_t sigsetsize); }
-177 STD { int linux_sys_rt_sigtimedwait(void); }
-178 STD { int linux_sys_rt_queueinfo(void); }
-179 STD { int linux_sys_rt_sigsuspend(linux_sigset_t *unewset, \
- size_t sigsetsize); }
-180 STD { int linux_sys_pread(int fd, char *buf, \
- size_t nbyte, linux_off_t offset); }
-181 STD { int linux_sys_pwrite(int fd, char *buf, \
- size_t nbyte, linux_off_t offset); }
-182 STD { int linux_sys_chown16(char *path, int uid, \
- int gid); }
-183 NOARGS { int sys___getcwd(char *bufp, size_t length); }
-184 STD { int linux_sys_capget(void); }
-185 STD { int linux_sys_capset(void); }
-186 STD { int linux_sys_sigaltstack( \
- const struct linux_sigaltstack *nss, \
- struct linux_sigaltstack *oss); }
-187 STD { int linux_sys_sendfile(void); }
-188 STD { int linux_sys_getpmsg(void); }
-189 STD { int linux_sys_putpmsg(void); }
-190 STD { int sys_vfork(void); }
-191 STD { int linux_sys_ugetrlimit(u_int which, \
- struct linux_rlimit *rlp); }
-192 STD { linux_off_t linux_sys_mmap2(unsigned long addr, \
- size_t len, int prot, int flags, int fd, \
- linux_off_t offset); }
-193 STD { int linux_sys_truncate64(char *path, off_t length); }
-194 STD { int linux_sys_ftruncate64(int fd, off_t length); }
-195 STD { int linux_sys_stat64(char *path, \
- struct linux_stat64 *sp); }
-196 STD { int linux_sys_lstat64(char *path, \
- struct linux_stat64 *sp); }
-197 STD { int linux_sys_fstat64(int fd, \
- struct linux_stat64 *sp); }
-198 NOARGS { int linux_sys_lchown(void); }
-199 STD { uid_t linux_sys_getuid(void); }
-200 STD { gid_t linux_sys_getgid(void); }
-201 NOARGS { uid_t sys_geteuid(void); }
-202 NOARGS { gid_t sys_getegid(void); }
-203 NOARGS { int sys_setreuid(int ruid, int euid); }
-204 NOARGS { int sys_setregid(int rgid, int egid); }
-205 NOARGS { int sys_getgroups(u_int gidsetsize, gid_t *gidset); }
-206 NOARGS { int sys_setgroups(u_int gidsetsize, gid_t *gidset); }
-207 NOARGS { int linux_sys_fchown(void); }
-208 NOARGS { int sys_setresuid(uid_t ruid, uid_t euid, \
- uid_t suid); }
-209 NOARGS { int sys_getresuid(uid_t *ruid, uid_t *euid, \
- uid_t *suid); }
-210 NOARGS { int sys_setresgid(gid_t rgid, gid_t egid, \
- gid_t sgid); }
-211 NOARGS { int sys_getresgid(gid_t *rgid, gid_t *egid, \
- gid_t *sgid); }
-212 STD { int linux_sys_chown(char *path, uid_t uid, \
- gid_t gid); }
-213 NOARGS { int sys_setuid(uid_t uid); }
-214 NOARGS { int sys_setgid(gid_t gid); }
-215 STD { int linux_sys_setfsuid(uid_t uid); }
-216 NOARGS { int linux_sys_setfsgid(void); }
-217 NOARGS { int linux_sys_pivot_root(void); }
-218 NOARGS { int linux_sys_mincore(void); }
-219 NOARGS { int sys_madvise(void *addr, size_t len, int behav); }
-220 STD { int linux_sys_getdents64(int fd, void *dirent, \
- unsigned count); }
-221 STD { int linux_sys_fcntl64(u_int fd, u_int cmd, \
- void *arg); }
-222 UNIMPL
-223 UNIMPL
-224 STD { linux_pid_t linux_sys_gettid(void); }
-225 UNIMPL linux_sys_readahead
-226 NOARGS { int linux_sys_setxattr(void); }
-227 NOARGS { int linux_sys_lsetxattr(void); }
-228 NOARGS { int linux_sys_fsetxattr(void); }
-229 NOARGS { int linux_sys_getxattr(void); }
-230 NOARGS { int linux_sys_lgetxattr(void); }
-231 NOARGS { int linux_sys_fgetxattr(void); }
-232 NOARGS { int linux_sys_listxattr(void); }
-233 NOARGS { int linux_sys_llistxattr(void); }
-234 NOARGS { int linux_sys_flistxattr(void); }
-235 NOARGS { int linux_sys_removexattr(void); }
-236 NOARGS { int linux_sys_lremovexattr(void); }
-237 NOARGS { int linux_sys_fremovexattr(void); }
-238 UNIMPL linux_sys_tkill
-239 UNIMPL linux_sys_sendfile64
-240 STD { int linux_sys_futex(int *uaddr, int op, int val, \
- const struct linux_timespec *timeout, \
- int *uaddr2, int val3); }
-241 UNIMPL linux_sys_sched_setaffinity
-242 UNIMPL linux_sys_sched_getaffinity
-243 STD { int linux_sys_set_thread_area( \
- struct l_segment_descriptor *desc); }
-244 STD { int linux_sys_get_thread_area( \
- struct l_segment_descriptor *desc); }
-245 UNIMPL linux_sys_io_setup
-246 UNIMPL linux_sys_io_destroy
-247 UNIMPL linux_sys_io_getevents
-248 UNIMPL linux_sys_io_submit
-249 UNIMPL linux_sys_io_cancel
-250 NOARGS { int linux_sys_fadvise64(void); }
-251 UNIMPL
-252 NOARGS linux_exit_group { int sys_exit(int rval); }
-253 UNIMPL linux_sys_lookup_dcookie
-254 NOARGS { int linux_sys_epoll_create(void); }
-255 NOARGS { int linux_sys_epoll_ctl(void); }
-256 NOARGS { int linux_sys_epoll_wait(void); }
-257 UNIMPL linux_sys_remap_file_pages
-258 STD { int linux_sys_set_tid_address(void *tidptr); }
-259 UNIMPL linux_sys_timer_create
-260 UNIMPL linux_sys_timer_settime
-261 UNIMPL linux_sys_timer_gettime
-262 UNIMPL linux_sys_timer_getoverrun
-263 UNIMPL linux_sys_timer_delete
-264 UNIMPL linux_sys_clock_settime
-265 STD { int linux_sys_clock_gettime(clockid_t which, \
- struct linux_timespec *tp); }
-266 STD { int linux_sys_clock_getres(clockid_t which, \
- struct linux_timespec *tp); }
-267 UNIMPL linux_sys_clock_nanosleep
-268 STD { int linux_sys_statfs64(char *path, \
- struct linux_statfs64 *sp); }
-269 STD { int linux_sys_fstatfs64(int fd, \
- struct linux_statfs64 *sp); }
-270 STD { int linux_sys_tgkill(int tgid, int tid, int sig); }
-271 UNIMPL linux_sys_utimes
-272 UNIMPL linux_sys_fadvise64_64
-273 UNIMPL linux_sys_vserver
-274 UNIMPL linux_sys_mbind
-275 UNIMPL linux_sys_get_mempolicy
-276 UNIMPL linux_sys_set_mempolicy
-277 UNIMPL linux_sys_mq_open
-278 UNIMPL linux_sys_mq_unlink
-279 UNIMPL linux_sys_mq_timedsend
-280 UNIMPL linux_sys_mq_timedreceive
-281 UNIMPL linux_sys_mq_notify
-282 UNIMPL linux_sys_mq_getsetattr
-283 UNIMPL linux_sys_sys_kexec_load
-284 UNIMPL linux_sys_waitid
-285 UNIMPL /* unused */
-286 UNIMPL linux_sys_add_key
-287 UNIMPL linux_sys_request_key
-288 UNIMPL linux_sys_keyctl
-289 UNIMPL linux_sys_ioprio_set
-290 UNIMPL linux_sys_ioprio_get
-291 UNIMPL linux_sys_inotify_init
-292 UNIMPL linux_sys_inotify_add_watch
-293 UNIMPL linux_sys_inotify_rm_watch
-294 UNIMPL linux_sys_migrate_pages
-295 UNIMPL linux_sys_openalinux_sys_t
-296 UNIMPL linux_sys_mkdirat
-297 UNIMPL linux_sys_mknodat
-298 UNIMPL linux_sys_fchownat
-299 UNIMPL linux_sys_futimesat
-300 UNIMPL linux_sys_fstatat64
-301 UNIMPL linux_sys_unlinkat
-302 UNIMPL linux_sys_renameat
-303 UNIMPL linux_sys_linkat
-304 UNIMPL linux_sys_symlinkat
-305 UNIMPL linux_sys_readlinkat
-306 UNIMPL linux_sys_fchmodat
-307 UNIMPL linux_sys_faccessat
-308 UNIMPL linux_sys_pselect6
-309 UNIMPL linux_sys_ppoll
-310 UNIMPL linux_sys_unshare
-311 STD { int linux_sys_set_robust_list( \
- struct linux_robust_list_head *head, size_t len); }
-312 STD { int linux_sys_get_robust_list(int pid, \
- struct linux_robust_list_head **head, \
- size_t *len); }
-313 UNIMPL splice
-314 UNIMPL sync_file_range
-315 UNIMPL tee
-316 UNIMPL vmsplice
-317 UNIMPL move_pages
-318 UNIMPL getcpu
-319 NOARGS { int linux_sys_epoll_pwait(void); }
-320 UNIMPL utimensat
-321 UNIMPL signalfd
-322 UNIMPL timerfd_create
-323 NOARGS { int linux_sys_eventfd(void); }
-324 UNIMPL fallocate
-325 UNIMPL timerfd_settime
-326 UNIMPL timerfd_gettime
-327 UNIMPL signalfd4
-328 NOARGS { int linux_sys_eventfd2(void); }
-329 NOARGS { int linux_sys_epoll_create1(void); }
-330 UNIMPL dup3
-331 STD { int linux_sys_pipe2(int *fdp, int flags); }
-332 UNIMPL inotify_init1
-333 UNIMPL preadv
-334 UNIMPL pwritev
-335 UNIMPL rt_tgsigqueueinfo
-336 UNIMPL perf_counter_open
-337 UNIMPL recvmmsg