Mon Dec 24 21:27:06 2018 UTC ()
move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat.  mark old mount()
properly instead of manually #if'ing ito to ENOSYS.


(mrg)
diff -r1.40 -r1.41 src/sys/compat/netbsd32/files.netbsd32
diff -r0 -r1.2 src/sys/compat/netbsd32/netbsd32_compat_40.c
diff -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_fd.c
diff -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_vm.c
diff -r1.221 -r1.222 src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -r1.136 -r1.137 src/sys/compat/netbsd32/netbsd32_syscalls.c
diff -r1.16 -r1.17 src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
diff -r1.135 -r1.136 src/sys/compat/netbsd32/netbsd32_sysent.c
diff -r1.27 -r1.28 src/sys/compat/netbsd32/netbsd32_systrace_args.c
diff -r1.123 -r1.124 src/sys/compat/netbsd32/syscalls.master

cvs diff -r1.40 -r1.41 src/sys/compat/netbsd32/files.netbsd32 (expand / switch to unified diff)

--- src/sys/compat/netbsd32/files.netbsd32 2018/12/24 20:44:39 1.40
+++ src/sys/compat/netbsd32/files.netbsd32 2018/12/24 21:27:05 1.41
@@ -1,48 +1,51 @@ @@ -1,48 +1,51 @@
1# $NetBSD: files.netbsd32,v 1.40 2018/12/24 20:44:39 mrg Exp $ 1# $NetBSD: files.netbsd32,v 1.41 2018/12/24 21:27:05 mrg Exp $
2# 2#
3# config file description for machine-independent netbsd32 compat code. 3# config file description for machine-independent netbsd32 compat code.
4# included by ports that need it. 4# included by ports that need it.
5 5
6# ports should define any machine-specific files they need in their 6# ports should define any machine-specific files they need in their
7# own file lists. 7# own file lists.
8 8
9define compat_netbsd32 9define compat_netbsd32
10file compat/netbsd32/netbsd32_core.c compat_netbsd32 & coredump 10file compat/netbsd32/netbsd32_core.c compat_netbsd32 & coredump
11file compat/netbsd32/netbsd32_exec_elf32.c compat_netbsd32 & exec_elf32 11file compat/netbsd32/netbsd32_exec_elf32.c compat_netbsd32 & exec_elf32
12file compat/netbsd32/netbsd32_exec_aout.c compat_netbsd32 & exec_aout 12file compat/netbsd32/netbsd32_exec_aout.c compat_netbsd32 & exec_aout
13file compat/netbsd32/netbsd32_netbsd.c compat_netbsd32 13file compat/netbsd32/netbsd32_netbsd.c compat_netbsd32
14file compat/netbsd32/netbsd32_event.c compat_netbsd32 14file compat/netbsd32/netbsd32_event.c compat_netbsd32
15file compat/netbsd32/netbsd32_execve.c compat_netbsd32 15file compat/netbsd32/netbsd32_execve.c compat_netbsd32
 16file compat/netbsd32/netbsd32_fd.c compat_netbsd32
16file compat/netbsd32/netbsd32_fs.c compat_netbsd32 17file compat/netbsd32/netbsd32_fs.c compat_netbsd32
17file compat/netbsd32/netbsd32_ioctl.c compat_netbsd32 18file compat/netbsd32/netbsd32_ioctl.c compat_netbsd32
18file compat/netbsd32/netbsd32_ipc.c compat_netbsd32 19file compat/netbsd32/netbsd32_ipc.c compat_netbsd32
19file compat/netbsd32/netbsd32_lwp.c compat_netbsd32 20file compat/netbsd32/netbsd32_lwp.c compat_netbsd32
20file compat/netbsd32/netbsd32_module.c compat_netbsd32 21file compat/netbsd32/netbsd32_module.c compat_netbsd32
21file compat/netbsd32/netbsd32_mod.c compat_netbsd32 22file compat/netbsd32/netbsd32_mod.c compat_netbsd32
22file compat/netbsd32/netbsd32_mqueue.c compat_netbsd32 & mqueue 23file compat/netbsd32/netbsd32_mqueue.c compat_netbsd32 & mqueue
23file compat/netbsd32/netbsd32_nfssvc.c compat_netbsd32 & nfsserver 24file compat/netbsd32/netbsd32_nfssvc.c compat_netbsd32 & nfsserver
24file compat/netbsd32/netbsd32_ptrace.c compat_netbsd32 & ptrace 25file compat/netbsd32/netbsd32_ptrace.c compat_netbsd32 & ptrace
25file compat/netbsd32/netbsd32_rlimit.c compat_netbsd32 26file compat/netbsd32/netbsd32_rlimit.c compat_netbsd32
26file compat/netbsd32/netbsd32_quota.c compat_netbsd32 & quota 27file compat/netbsd32/netbsd32_quota.c compat_netbsd32 & quota
27file compat/netbsd32/netbsd32_select.c compat_netbsd32 28file compat/netbsd32/netbsd32_select.c compat_netbsd32
28file compat/netbsd32/netbsd32_sem.c compat_netbsd32 29file compat/netbsd32/netbsd32_sem.c compat_netbsd32
29file compat/netbsd32/netbsd32_signal.c compat_netbsd32 30file compat/netbsd32/netbsd32_signal.c compat_netbsd32
30file compat/netbsd32/netbsd32_socket.c compat_netbsd32 31file compat/netbsd32/netbsd32_socket.c compat_netbsd32
31file compat/netbsd32/netbsd32_sysctl.c compat_netbsd32 32file compat/netbsd32/netbsd32_sysctl.c compat_netbsd32
32file compat/netbsd32/netbsd32_time.c compat_netbsd32 33file compat/netbsd32/netbsd32_time.c compat_netbsd32
33file compat/netbsd32/netbsd32_wait.c compat_netbsd32 34file compat/netbsd32/netbsd32_wait.c compat_netbsd32
 35file compat/netbsd32/netbsd32_vm.c compat_netbsd32
34file compat/netbsd32/netbsd32_sysent.c compat_netbsd32 36file compat/netbsd32/netbsd32_sysent.c compat_netbsd32
35file compat/netbsd32/netbsd32_syscalls.c compat_netbsd32 & syscall_debug 37file compat/netbsd32/netbsd32_syscalls.c compat_netbsd32 & syscall_debug
36 38
37file compat/netbsd32/netbsd32_compat_09.c compat_netbsd32 & (compat_09 | compat_sunos) 39file compat/netbsd32/netbsd32_compat_09.c compat_netbsd32 & (compat_09 | compat_sunos)
38file compat/netbsd32/netbsd32_compat_10.c compat_netbsd32 & (compat_10 | compat_sunos) 40file compat/netbsd32/netbsd32_compat_10.c compat_netbsd32 & (compat_10 | compat_sunos)
39file compat/netbsd32/netbsd32_compat_12.c compat_netbsd32 & (compat_12 | compat_sunos) 41file compat/netbsd32/netbsd32_compat_12.c compat_netbsd32 & (compat_12 | compat_sunos)
40file compat/netbsd32/netbsd32_compat_13.c compat_netbsd32 & compat_13 42file compat/netbsd32/netbsd32_compat_13.c compat_netbsd32 & compat_13
41file compat/netbsd32/netbsd32_compat_14.c compat_netbsd32 & compat_14 43file compat/netbsd32/netbsd32_compat_14.c compat_netbsd32 & compat_14
42file compat/netbsd32/netbsd32_compat_20.c compat_netbsd32 & compat_20 44file compat/netbsd32/netbsd32_compat_20.c compat_netbsd32 & compat_20
43file compat/netbsd32/netbsd32_compat_30.c compat_netbsd32 & compat_30 45file compat/netbsd32/netbsd32_compat_30.c compat_netbsd32 & compat_30
44file compat/netbsd32/netbsd32_compat_43.c compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32) 46file compat/netbsd32/netbsd32_compat_43.c compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32)
 47file compat/netbsd32/netbsd32_compat_40.c compat_netbsd32 & compat_40
45file compat/netbsd32/netbsd32_compat_50.c compat_netbsd32 & compat_50 48file compat/netbsd32/netbsd32_compat_50.c compat_netbsd32 & compat_50
46file compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 & 49file compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 &
47 (sysvmsg | sysvsem | sysvshm) 50 (sysvmsg | sysvsem | sysvshm)
48file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60 51file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60

File Added: src/sys/compat/netbsd32/netbsd32_compat_40.c
/*	$NetBSD: netbsd32_compat_40.c,v 1.2 2018/12/24 21:27:05 mrg Exp $	*/

/*
 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
 * 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.
 *
 * from: NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_40.c,v 1.2 2018/12/24 21:27:05 mrg Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>

#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>

int
compat_40_netbsd32_mount(struct lwp *l,
			 const struct compat_40_netbsd32_mount_args *uap,
			 register_t *retval)
{
	/* {
		syscallarg(const netbsd32_charp) type;
		syscallarg(const netbsd32_charp) path;
		syscallarg(int) flags;
		syscallarg(netbsd32_voidp) data;
	} */
	struct compat_40_sys_mount_args ua;

	NETBSD32TOP_UAP(type, const char);
	NETBSD32TOP_UAP(path, const char);
	NETBSD32TO64_UAP(flags);
	NETBSD32TOP_UAP(data, void);

	return compat_40_sys_mount(l, &ua, retval);
}

File Added: src/sys/compat/netbsd32/netbsd32_fd.c
/*	$NetBSD: netbsd32_fd.c,v 1.1 2018/12/24 21:27:05 mrg Exp $	*/

/*
 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
 * 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.
 *
 * from: NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_fd.c,v 1.1 2018/12/24 21:27:05 mrg Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/filedesc.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/vfs_syscalls.h>
#include <sys/kauth.h>

#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>


int
netbsd32___getfh30(struct lwp *l, const struct netbsd32___getfh30_args *uap, register_t *retval)
{
	/* {
		syscallarg(const netbsd32_charp) fname;
		syscallarg(netbsd32_fhandlep_t) fhp;
		syscallarg(netbsd32_size_tp) fh_size;
	} */
	struct vnode *vp;
	fhandle_t *fh;
	int error;
	struct pathbuf *pb;
	struct nameidata nd;
	netbsd32_size_t usz32, sz32;
	size_t sz;

	/*
	 * Must be super user
	 */
	error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
	    0, NULL, NULL, NULL);
	if (error)
		return error;

	error = pathbuf_copyin(SCARG_P32(uap, fname), &pb);
	if (error) {
		return error;
	}

	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
	error = namei(&nd);
	if (error) {
		pathbuf_destroy(pb);
		return error;
	}
	vp = nd.ni_vp;
	pathbuf_destroy(pb);

	error = vfs_composefh_alloc(vp, &fh);
	vput(vp);
	if (error != 0) {
		return error;
	}
	error = copyin(SCARG_P32(uap, fh_size), &usz32, sizeof(usz32));
	if (error != 0) {
		goto out;
	}
	sz = FHANDLE_SIZE(fh);
	sz32 = sz;

	error = copyout(&sz32, SCARG_P32(uap, fh_size), sizeof(sz32));
	if (error != 0) {
		goto out;
	}
	if (usz32 >= sz32) {
		error = copyout(fh, SCARG_P32(uap, fhp), sz);
	} else {
		error = E2BIG;
	}
out:
	vfs_composefh_free(fh);
	return error;
}

int
netbsd32_pipe2(struct lwp *l, const struct netbsd32_pipe2_args *uap,
	       register_t *retval)
{
	/* {
		syscallarg(netbsd32_intp) fildes;
		syscallarg(int) flags;
	} */
	int fd[2], error;

	error = pipe1(l, fd, SCARG(uap, flags));
	if (error != 0)
		return error;

	error = copyout(fd, SCARG_P32(uap, fildes), sizeof(fd));
	if (error != 0)
		return error;

	retval[0] = 0;
	return 0;
}

File Added: src/sys/compat/netbsd32/netbsd32_vm.c
/*	$NetBSD: netbsd32_vm.c,v 1.1 2018/12/24 21:27:06 mrg Exp $	*/

/*
 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
 * 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.
 *
 * from: NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_vm.c,v 1.1 2018/12/24 21:27:06 mrg Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mman.h>
#include <sys/filedesc.h>
#include <sys/vfs_syscalls.h>

#include <compat/sys/mman.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>


int
netbsd32_mmap(struct lwp *l, const struct netbsd32_mmap_args *uap, register_t *retval)
{
	/* {
		syscallarg(netbsd32_voidp) addr;
		syscallarg(netbsd32_size_t) len;
		syscallarg(int) prot;
		syscallarg(int) flags;
		syscallarg(int) fd;
		syscallarg(netbsd32_long) PAD;
		syscallarg(netbsd32_off_t) pos;
	} */
	struct sys_mmap_args ua;
	int error;

	NETBSD32TOP_UAP(addr, void);
	NETBSD32TOX_UAP(len, size_t);
	NETBSD32TO64_UAP(prot);
	NETBSD32TO64_UAP(flags);
#ifdef __x86_64__
	/*
	 * Ancient kernel on x86 did not obey PROT_EXEC on i386 at least
	 * and ld.so did not turn it on!
	 */
	if (SCARG(&ua, flags) & COMPAT_MAP_COPY) {
		SCARG(&ua, flags) = MAP_PRIVATE
		    | (SCARG(&ua, flags) & ~COMPAT_MAP_COPY);
		SCARG(&ua, prot) |= PROT_EXEC;
	}
#endif
	NETBSD32TO64_UAP(fd);
	NETBSD32TOX_UAP(PAD, long);
	NETBSD32TOX_UAP(pos, off_t);
#ifdef DEBUG_MMAP
	printf("mmap(addr=0x%lx, len=0x%lx, prot=0x%lx, flags=0x%lx, "
	    "fd=%ld, pos=0x%lx);\n",
	    (long)SCARG(&ua, addr), (long)SCARG(&ua, len),
	    (long)SCARG(&ua, prot), (long)SCARG(&ua, flags),
	    (long)SCARG(&ua, fd), (long)SCARG(&ua, pos));
#endif

	error = sys_mmap(l, &ua, retval);
	if ((u_long)*retval > (u_long)UINT_MAX) {
		printf("netbsd32_mmap: retval out of range: 0x%lx\n",
		    (u_long)*retval);
		/* Should try to recover and return an error here. */
	}
	return error;
}

cvs diff -r1.221 -r1.222 src/sys/compat/netbsd32/netbsd32_netbsd.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_netbsd.c 2018/12/24 20:44:39 1.221
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c 2018/12/24 21:27:05 1.222
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $ */ 1/* $NetBSD: netbsd32_netbsd.c,v 1.222 2018/12/24 21:27:05 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green 4 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,35 +17,27 @@ @@ -17,35 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.222 2018/12/24 21:27:05 mrg Exp $");
31 
32/* 
33 * below are all the standard NetBSD system calls, in the 32bit 
34 * environment, with the necessary conversions to 64bit before calling 
35 * the real syscall. anything that needs special attention is handled 
36 * elsewhere - this file should only contain structure assignment and 
37 * calls to the original function. 
38 */ 
39 31
40/* 32/*
41 * below are all the standard NetBSD system calls, in the 32bit 33 * below are all the standard NetBSD system calls, in the 32bit
42 * environment, with the necessary conversions to 64bit before calling 34 * environment, with the necessary conversions to 64bit before calling
43 * the real syscall. anything that needs special attention is handled 35 * the real syscall. anything that needs special attention is handled
44 * elsewhere - this file should only contain structure assignment and 36 * elsewhere - this file should only contain structure assignment and
45 * calls to the original function. 37 * calls to the original function.
46 */ 38 */
47 39
48#if defined(_KERNEL_OPT) 40#if defined(_KERNEL_OPT)
49#include "opt_ddb.h" 41#include "opt_ddb.h"
50#include "opt_ntp.h" 42#include "opt_ntp.h"
51#include "opt_ktrace.h" 43#include "opt_ktrace.h"
@@ -63,33 +55,31 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_net @@ -63,33 +55,31 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_net
63#include <sys/sockio.h> 55#include <sys/sockio.h>
64#include <sys/socketvar.h> 56#include <sys/socketvar.h>
65#include <sys/mbuf.h> 57#include <sys/mbuf.h>
66#include <sys/mman.h> 58#include <sys/mman.h>
67#include <sys/stat.h> 59#include <sys/stat.h>
68#include <sys/swap.h> 60#include <sys/swap.h>
69#include <sys/time.h> 61#include <sys/time.h>
70#include <sys/signalvar.h> 62#include <sys/signalvar.h>
71#include <sys/ptrace.h> 63#include <sys/ptrace.h>
72#include <sys/ktrace.h> 64#include <sys/ktrace.h>
73#include <sys/trace.h> 65#include <sys/trace.h>
74#include <sys/resourcevar.h> 66#include <sys/resourcevar.h>
75#include <sys/pool.h> 67#include <sys/pool.h>
76#include <sys/vnode.h> 
77#include <sys/file.h> 68#include <sys/file.h>
78#include <sys/filedesc.h> 69#include <sys/filedesc.h>
79#include <sys/namei.h> 70#include <sys/namei.h>
80#include <sys/dirent.h> 71#include <sys/dirent.h>
81#include <sys/quotactl.h> 72#include <sys/quotactl.h>
82#include <sys/kauth.h> 
83#include <sys/vfs_syscalls.h> 73#include <sys/vfs_syscalls.h>
84 74
85#include <uvm/uvm_extern.h> 75#include <uvm/uvm_extern.h>
86#include <uvm/uvm_swap.h> 76#include <uvm/uvm_swap.h>
87 77
88#include <sys/syscallargs.h> 78#include <sys/syscallargs.h>
89#include <sys/proc.h> 79#include <sys/proc.h>
90#include <sys/acct.h> 80#include <sys/acct.h>
91#include <sys/exec.h> 81#include <sys/exec.h>
92 82
93#include <net/if.h> 83#include <net/if.h>
94 84
95#include <compat/netbsd32/netbsd32.h> 85#include <compat/netbsd32/netbsd32.h>
@@ -355,50 +345,26 @@ netbsd32_chown(struct lwp *l, const stru @@ -355,50 +345,26 @@ netbsd32_chown(struct lwp *l, const stru
355int 345int
356netbsd32_break(struct lwp *l, const struct netbsd32_break_args *uap, register_t *retval) 346netbsd32_break(struct lwp *l, const struct netbsd32_break_args *uap, register_t *retval)
357{ 347{
358 /* { 348 /* {
359 syscallarg(netbsd32_charp) nsize; 349 syscallarg(netbsd32_charp) nsize;
360 } */ 350 } */
361 struct sys_obreak_args ua; 351 struct sys_obreak_args ua;
362 352
363 NETBSD32TOP_UAP(nsize, char); 353 NETBSD32TOP_UAP(nsize, char);
364 354
365 return sys_obreak(l, &ua, retval); 355 return sys_obreak(l, &ua, retval);
366} 356}
367 357
368// XXX move into compat_40 
369int 
370netbsd32_mount(struct lwp *l, const struct netbsd32_mount_args *uap, register_t *retval) 
371{ 
372#ifdef COMPAT_40 
373 /* { 
374 syscallarg(const netbsd32_charp) type; 
375 syscallarg(const netbsd32_charp) path; 
376 syscallarg(int) flags; 
377 syscallarg(netbsd32_voidp) data; 
378 } */ 
379 struct compat_40_sys_mount_args ua; 
380 
381 NETBSD32TOP_UAP(type, const char); 
382 NETBSD32TOP_UAP(path, const char); 
383 NETBSD32TO64_UAP(flags); 
384 NETBSD32TOP_UAP(data, void); 
385 
386 return compat_40_sys_mount(l, &ua, retval); 
387#else 
388 return ENOSYS; 
389#endif 
390} 
391 
392int 358int
393netbsd32_unmount(struct lwp *l, const struct netbsd32_unmount_args *uap, register_t *retval) 359netbsd32_unmount(struct lwp *l, const struct netbsd32_unmount_args *uap, register_t *retval)
394{ 360{
395 /* { 361 /* {
396 syscallarg(const netbsd32_charp) path; 362 syscallarg(const netbsd32_charp) path;
397 syscallarg(int) flags; 363 syscallarg(int) flags;
398 } */ 364 } */
399 struct sys_unmount_args ua; 365 struct sys_unmount_args ua;
400 366
401 NETBSD32TOP_UAP(path, const char); 367 NETBSD32TOP_UAP(path, const char);
402 NETBSD32TO64_UAP(flags); 368 NETBSD32TO64_UAP(flags);
403 369
404 return sys_unmount(l, &ua, retval); 370 return sys_unmount(l, &ua, retval);
@@ -1204,91 +1170,26 @@ netbsd32_mkdir(struct lwp *l, const stru @@ -1204,91 +1170,26 @@ netbsd32_mkdir(struct lwp *l, const stru
1204int 1170int
1205netbsd32_rmdir(struct lwp *l, const struct netbsd32_rmdir_args *uap, register_t *retval) 1171netbsd32_rmdir(struct lwp *l, const struct netbsd32_rmdir_args *uap, register_t *retval)
1206{ 1172{
1207 /* { 1173 /* {
1208 syscallarg(const netbsd32_charp) path; 1174 syscallarg(const netbsd32_charp) path;
1209 } */ 1175 } */
1210 struct sys_rmdir_args ua; 1176 struct sys_rmdir_args ua;
1211 1177
1212 NETBSD32TOP_UAP(path, const char); 1178 NETBSD32TOP_UAP(path, const char);
1213 1179
1214 return sys_rmdir(l, &ua, retval); 1180 return sys_rmdir(l, &ua, retval);
1215} 1181}
1216 1182
1217// XXX new file 
1218int 
1219netbsd32___getfh30(struct lwp *l, const struct netbsd32___getfh30_args *uap, register_t *retval) 
1220{ 
1221 /* { 
1222 syscallarg(const netbsd32_charp) fname; 
1223 syscallarg(netbsd32_fhandlep_t) fhp; 
1224 syscallarg(netbsd32_size_tp) fh_size; 
1225 } */ 
1226 struct vnode *vp; 
1227 fhandle_t *fh; 
1228 int error; 
1229 struct pathbuf *pb; 
1230 struct nameidata nd; 
1231 netbsd32_size_t usz32, sz32; 
1232 size_t sz; 
1233 
1234 /* 
1235 * Must be super user 
1236 */ 
1237 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE, 
1238 0, NULL, NULL, NULL); 
1239 if (error) 
1240 return error; 
1241 
1242 error = pathbuf_copyin(SCARG_P32(uap, fname), &pb); 
1243 if (error) { 
1244 return error; 
1245 } 
1246 
1247 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb); 
1248 error = namei(&nd); 
1249 if (error) { 
1250 pathbuf_destroy(pb); 
1251 return error; 
1252 } 
1253 vp = nd.ni_vp; 
1254 pathbuf_destroy(pb); 
1255 
1256 error = vfs_composefh_alloc(vp, &fh); 
1257 vput(vp); 
1258 if (error != 0) { 
1259 return error; 
1260 } 
1261 error = copyin(SCARG_P32(uap, fh_size), &usz32, sizeof(usz32)); 
1262 if (error != 0) { 
1263 goto out; 
1264 } 
1265 sz = FHANDLE_SIZE(fh); 
1266 sz32 = sz; 
1267 
1268 error = copyout(&sz32, SCARG_P32(uap, fh_size), sizeof(sz32)); 
1269 if (error != 0) { 
1270 goto out; 
1271 } 
1272 if (usz32 >= sz32) { 
1273 error = copyout(fh, SCARG_P32(uap, fhp), sz); 
1274 } else { 
1275 error = E2BIG; 
1276 } 
1277out: 
1278 vfs_composefh_free(fh); 
1279 return error; 
1280} 
1281 
1282int 1183int
1283netbsd32_pread(struct lwp *l, const struct netbsd32_pread_args *uap, register_t *retval) 1184netbsd32_pread(struct lwp *l, const struct netbsd32_pread_args *uap, register_t *retval)
1284{ 1185{
1285 /* { 1186 /* {
1286 syscallarg(int) fd; 1187 syscallarg(int) fd;
1287 syscallarg(netbsd32_voidp) buf; 1188 syscallarg(netbsd32_voidp) buf;
1288 syscallarg(netbsd32_size_t) nbyte; 1189 syscallarg(netbsd32_size_t) nbyte;
1289 syscallarg(int) PAD; 1190 syscallarg(int) PAD;
1290 syscallarg(netbsd32_off_t) offset; 1191 syscallarg(netbsd32_off_t) offset;
1291 } */ 1192 } */
1292 struct sys_pread_args ua; 1193 struct sys_pread_args ua;
1293 1194
1294 NETBSD32TO64_UAP(fd); 1195 NETBSD32TO64_UAP(fd);
@@ -1380,77 +1281,26 @@ netbsd32_fpathconf(struct lwp *l, const  @@ -1380,77 +1281,26 @@ netbsd32_fpathconf(struct lwp *l, const
1380{ 1281{
1381 /* { 1282 /* {
1382 syscallarg(int) fd; 1283 syscallarg(int) fd;
1383 syscallarg(int) name; 1284 syscallarg(int) name;
1384 } */ 1285 } */
1385 struct sys_fpathconf_args ua; 1286 struct sys_fpathconf_args ua;
1386 1287
1387 NETBSD32TO64_UAP(fd); 1288 NETBSD32TO64_UAP(fd);
1388 NETBSD32TO64_UAP(name); 1289 NETBSD32TO64_UAP(name);
1389 1290
1390 return sys_fpathconf(l, &ua, retval); 1291 return sys_fpathconf(l, &ua, retval);
1391} 1292}
1392 1293
1393// XXX new file 
1394int 
1395netbsd32_mmap(struct lwp *l, const struct netbsd32_mmap_args *uap, register_t *retval) 
1396{ 
1397 /* { 
1398 syscallarg(netbsd32_voidp) addr; 
1399 syscallarg(netbsd32_size_t) len; 
1400 syscallarg(int) prot; 
1401 syscallarg(int) flags; 
1402 syscallarg(int) fd; 
1403 syscallarg(netbsd32_long) PAD; 
1404 syscallarg(netbsd32_off_t) pos; 
1405 } */ 
1406 struct sys_mmap_args ua; 
1407 int error; 
1408 
1409 NETBSD32TOP_UAP(addr, void); 
1410 NETBSD32TOX_UAP(len, size_t); 
1411 NETBSD32TO64_UAP(prot); 
1412 NETBSD32TO64_UAP(flags); 
1413#ifdef __x86_64__ 
1414 /* 
1415 * Ancient kernel on x86 did not obey PROT_EXEC on i386 at least 
1416 * and ld.so did not turn it on! 
1417 */ 
1418 if (SCARG(&ua, flags) & COMPAT_MAP_COPY) { 
1419 SCARG(&ua, flags) = MAP_PRIVATE 
1420 | (SCARG(&ua, flags) & ~COMPAT_MAP_COPY); 
1421 SCARG(&ua, prot) |= PROT_EXEC; 
1422 } 
1423#endif 
1424 NETBSD32TO64_UAP(fd); 
1425 NETBSD32TOX_UAP(PAD, long); 
1426 NETBSD32TOX_UAP(pos, off_t); 
1427#ifdef DEBUG_MMAP 
1428 printf("mmap(addr=0x%lx, len=0x%lx, prot=0x%lx, flags=0x%lx, " 
1429 "fd=%ld, pos=0x%lx);\n", 
1430 (long)SCARG(&ua, addr), (long)SCARG(&ua, len), 
1431 (long)SCARG(&ua, prot), (long)SCARG(&ua, flags), 
1432 (long)SCARG(&ua, fd), (long)SCARG(&ua, pos)); 
1433#endif 
1434 
1435 error = sys_mmap(l, &ua, retval); 
1436 if ((u_long)*retval > (u_long)UINT_MAX) { 
1437 printf("netbsd32_mmap: retval out of range: 0x%lx\n", 
1438 (u_long)*retval); 
1439 /* Should try to recover and return an error here. */ 
1440 } 
1441 return error; 
1442} 
1443 
1444int 1294int
1445netbsd32_mremap(struct lwp *l, const struct netbsd32_mremap_args *uap, register_t *retval) 1295netbsd32_mremap(struct lwp *l, const struct netbsd32_mremap_args *uap, register_t *retval)
1446{ 1296{
1447 /* { 1297 /* {
1448 syscallarg(void *) old_address; 1298 syscallarg(void *) old_address;
1449 syscallarg(size_t) old_size; 1299 syscallarg(size_t) old_size;
1450 syscallarg(void *) new_address; 1300 syscallarg(void *) new_address;
1451 syscallarg(size_t) new_size; 1301 syscallarg(size_t) new_size;
1452 syscallarg(int) flags; 1302 syscallarg(int) flags;
1453 } */ 1303 } */
1454 struct sys_mremap_args ua; 1304 struct sys_mremap_args ua;
1455 1305
1456 NETBSD32TOP_UAP(old_address, void); 1306 NETBSD32TOP_UAP(old_address, void);
@@ -2586,49 +2436,26 @@ netbsd32__sched_protect(struct lwp *l, @@ -2586,49 +2436,26 @@ netbsd32__sched_protect(struct lwp *l,
2586 const struct netbsd32__sched_protect_args *uap, 2436 const struct netbsd32__sched_protect_args *uap,
2587 register_t *retval) 2437 register_t *retval)
2588{ 2438{
2589 /* { 2439 /* {
2590 syscallarg(int) priority; 2440 syscallarg(int) priority;
2591 } */ 2441 } */
2592 struct sys__sched_protect_args ua; 2442 struct sys__sched_protect_args ua;
2593 2443
2594 NETBSD32TO64_UAP(priority); 2444 NETBSD32TO64_UAP(priority);
2595 2445
2596 return sys__sched_protect(l, &ua, retval); 2446 return sys__sched_protect(l, &ua, retval);
2597} 2447}
2598 2448
2599// XXX new file 
2600int 
2601netbsd32_pipe2(struct lwp *l, const struct netbsd32_pipe2_args *uap, 
2602 register_t *retval) 
2603{ 
2604 /* { 
2605 syscallarg(netbsd32_intp) fildes; 
2606 syscallarg(int) flags; 
2607 } */ 
2608 int fd[2], error; 
2609 
2610 error = pipe1(l, fd, SCARG(uap, flags)); 
2611 if (error != 0) 
2612 return error; 
2613 
2614 error = copyout(fd, SCARG_P32(uap, fildes), sizeof(fd)); 
2615 if (error != 0) 
2616 return error; 
2617 
2618 retval[0] = 0; 
2619 return 0; 
2620} 
2621 
2622int 2449int
2623netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap, 2450netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap,
2624 register_t *retval) 2451 register_t *retval)
2625{ 2452{
2626 /* { 2453 /* {
2627 syscallarg(int) from; 2454 syscallarg(int) from;
2628 syscallarg(int) to; 2455 syscallarg(int) to;
2629 syscallarg(int) flags; 2456 syscallarg(int) flags;
2630 } */ 2457 } */
2631 struct sys_dup3_args ua; 2458 struct sys_dup3_args ua;
2632 2459
2633 NETBSD32TO64_UAP(from); 2460 NETBSD32TO64_UAP(from);
2634 NETBSD32TO64_UAP(to); 2461 NETBSD32TO64_UAP(to);

cvs diff -r1.136 -r1.137 src/sys/compat/netbsd32/netbsd32_syscalls.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_syscalls.c 2018/08/10 21:47:15 1.136
+++ src/sys/compat/netbsd32/netbsd32_syscalls.c 2018/12/24 21:27:06 1.137
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1/* $NetBSD: netbsd32_syscalls.c,v 1.136 2018/08/10 21:47:15 pgoyette Exp $ */ 1/* $NetBSD: netbsd32_syscalls.c,v 1.137 2018/12/24 21:27:06 mrg Exp $ */
2 2
3/* 3/*
4 * System call names. 4 * System call names.
5 * 5 *
6 * DO NOT EDIT-- this file is automatically generated. 6 * DO NOT EDIT-- this file is automatically generated.
7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp 7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp
8 */ 8 */
9 9
10#include <sys/cdefs.h> 10#include <sys/cdefs.h>
11__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.136 2018/08/10 21:47:15 pgoyette Exp $"); 11__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.137 2018/12/24 21:27:06 mrg Exp $");
12 12
13#if defined(_KERNEL_OPT) 13#if defined(_KERNEL_OPT)
14#if defined(_KERNEL_OPT) 14#if defined(_KERNEL_OPT)
15#include "opt_compat_netbsd.h" 15#include "opt_compat_netbsd.h"
16#include "opt_ntp.h" 16#include "opt_ntp.h"
17#include "opt_compat_43.h" 17#include "opt_compat_43.h"
18#endif 18#endif
19#include <sys/param.h> 19#include <sys/param.h>
20#include <sys/systm.h> 20#include <sys/systm.h>
21#include <sys/signal.h> 21#include <sys/signal.h>
22#include <sys/mount.h> 22#include <sys/mount.h>
23#include <sys/syscallargs.h> 23#include <sys/syscallargs.h>
24#include <compat/netbsd32/netbsd32.h> 24#include <compat/netbsd32/netbsd32.h>
@@ -39,27 +39,27 @@ const char *const netbsd32_syscallnames[ @@ -39,27 +39,27 @@ const char *const netbsd32_syscallnames[
39 /* 8 */ "compat_43_netbsd32_ocreat", 39 /* 8 */ "compat_43_netbsd32_ocreat",
40 /* 9 */ "netbsd32_link", 40 /* 9 */ "netbsd32_link",
41 /* 10 */ "netbsd32_unlink", 41 /* 10 */ "netbsd32_unlink",
42 /* 11 */ "#11 (obsolete execv)", 42 /* 11 */ "#11 (obsolete execv)",
43 /* 12 */ "netbsd32_chdir", 43 /* 12 */ "netbsd32_chdir",
44 /* 13 */ "netbsd32_fchdir", 44 /* 13 */ "netbsd32_fchdir",
45 /* 14 */ "compat_50_netbsd32_mknod", 45 /* 14 */ "compat_50_netbsd32_mknod",
46 /* 15 */ "netbsd32_chmod", 46 /* 15 */ "netbsd32_chmod",
47 /* 16 */ "netbsd32_chown", 47 /* 16 */ "netbsd32_chown",
48 /* 17 */ "netbsd32_break", 48 /* 17 */ "netbsd32_break",
49 /* 18 */ "compat_20_netbsd32_getfsstat", 49 /* 18 */ "compat_20_netbsd32_getfsstat",
50 /* 19 */ "compat_43_netbsd32_olseek", 50 /* 19 */ "compat_43_netbsd32_olseek",
51 /* 20 */ "getpid", 51 /* 20 */ "getpid",
52 /* 21 */ "netbsd32_mount", 52 /* 21 */ "compat_40_netbsd32_mount",
53 /* 22 */ "netbsd32_unmount", 53 /* 22 */ "netbsd32_unmount",
54 /* 23 */ "netbsd32_setuid", 54 /* 23 */ "netbsd32_setuid",
55 /* 24 */ "getuid", 55 /* 24 */ "getuid",
56 /* 25 */ "geteuid", 56 /* 25 */ "geteuid",
57 /* 26 */ "netbsd32_ptrace", 57 /* 26 */ "netbsd32_ptrace",
58 /* 27 */ "netbsd32_recvmsg", 58 /* 27 */ "netbsd32_recvmsg",
59 /* 28 */ "netbsd32_sendmsg", 59 /* 28 */ "netbsd32_sendmsg",
60 /* 29 */ "netbsd32_recvfrom", 60 /* 29 */ "netbsd32_recvfrom",
61 /* 30 */ "netbsd32_accept", 61 /* 30 */ "netbsd32_accept",
62 /* 31 */ "netbsd32_getpeername", 62 /* 31 */ "netbsd32_getpeername",
63 /* 32 */ "netbsd32_getsockname", 63 /* 32 */ "netbsd32_getsockname",
64 /* 33 */ "netbsd32_access", 64 /* 33 */ "netbsd32_access",
65 /* 34 */ "netbsd32_chflags", 65 /* 34 */ "netbsd32_chflags",
@@ -569,27 +569,27 @@ const char *const altnetbsd32_syscallnam @@ -569,27 +569,27 @@ const char *const altnetbsd32_syscallnam
569 /* 8 */ NULL, /* compat_43_netbsd32_ocreat */ 569 /* 8 */ NULL, /* compat_43_netbsd32_ocreat */
570 /* 9 */ "link", 570 /* 9 */ "link",
571 /* 10 */ "unlink", 571 /* 10 */ "unlink",
572 /* 11 */ NULL, /* obsolete execv */ 572 /* 11 */ NULL, /* obsolete execv */
573 /* 12 */ "chdir", 573 /* 12 */ "chdir",
574 /* 13 */ "fchdir", 574 /* 13 */ "fchdir",
575 /* 14 */ NULL, /* compat_50_netbsd32_mknod */ 575 /* 14 */ NULL, /* compat_50_netbsd32_mknod */
576 /* 15 */ "chmod", 576 /* 15 */ "chmod",
577 /* 16 */ "chown", 577 /* 16 */ "chown",
578 /* 17 */ "break", 578 /* 17 */ "break",
579 /* 18 */ NULL, /* compat_20_netbsd32_getfsstat */ 579 /* 18 */ NULL, /* compat_20_netbsd32_getfsstat */
580 /* 19 */ NULL, /* compat_43_netbsd32_olseek */ 580 /* 19 */ NULL, /* compat_43_netbsd32_olseek */
581 /* 20 */ NULL, /* getpid */ 581 /* 20 */ NULL, /* getpid */
582 /* 21 */ "mount", 582 /* 21 */ NULL, /* compat_40_netbsd32_mount */
583 /* 22 */ "unmount", 583 /* 22 */ "unmount",
584 /* 23 */ "setuid", 584 /* 23 */ "setuid",
585 /* 24 */ NULL, /* getuid */ 585 /* 24 */ NULL, /* getuid */
586 /* 25 */ NULL, /* geteuid */ 586 /* 25 */ NULL, /* geteuid */
587 /* 26 */ "ptrace", 587 /* 26 */ "ptrace",
588 /* 27 */ "recvmsg", 588 /* 27 */ "recvmsg",
589 /* 28 */ "sendmsg", 589 /* 28 */ "sendmsg",
590 /* 29 */ "recvfrom", 590 /* 29 */ "recvfrom",
591 /* 30 */ "accept", 591 /* 30 */ "accept",
592 /* 31 */ "getpeername", 592 /* 31 */ "getpeername",
593 /* 32 */ "getsockname", 593 /* 32 */ "getsockname",
594 /* 33 */ "access", 594 /* 33 */ "access",
595 /* 34 */ "chflags", 595 /* 34 */ "chflags",

cvs diff -r1.16 -r1.17 src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c 2018/08/10 21:47:15 1.16
+++ src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c 2018/12/24 21:27:06 1.17
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.16 2018/08/10 21:47:15 pgoyette Exp $ */ 1/* $NetBSD: netbsd32_syscalls_autoload.c,v 1.17 2018/12/24 21:27:06 mrg Exp $ */
2 2
3/* 3/*
4 * System call autoload table. 4 * System call autoload table.
5 * 5 *
6 * DO NOT EDIT-- this file is automatically generated. 6 * DO NOT EDIT-- this file is automatically generated.
7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp 7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp
8 */ 8 */
9 9
10#include <sys/cdefs.h> 10#include <sys/cdefs.h>
11__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.16 2018/08/10 21:47:15 pgoyette Exp $"); 11__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls_autoload.c,v 1.17 2018/12/24 21:27:06 mrg Exp $");
12 12
13#include <sys/proc.h> 13#include <sys/proc.h>
14static struct sc_autoload netbsd32_syscalls_autoload[] = { 14static struct sc_autoload netbsd32_syscalls_autoload[] = {
15 { NETBSD32_SYS_netbsd32_ptrace, "compat_netbsd32_ptrace" }, 15 { NETBSD32_SYS_netbsd32_ptrace, "compat_netbsd32_ptrace" },
16 { NETBSD32_SYS_netbsd32_nfssvc, "compat_netbsd32_nfssrv" }, 16 { NETBSD32_SYS_netbsd32_nfssvc, "compat_netbsd32_nfssrv" },
17 { NETBSD32_SYS_compat_10_osemsys, "compat_netbsd32_sysvipc" }, 17 { NETBSD32_SYS_compat_10_osemsys, "compat_netbsd32_sysvipc" },
18 { NETBSD32_SYS_compat_10_omsgsys, "compat_netbsd32_sysvipc" }, 18 { NETBSD32_SYS_compat_10_omsgsys, "compat_netbsd32_sysvipc" },
19 { NETBSD32_SYS_compat_10_oshmsys, "compat_netbsd32_sysvipc" }, 19 { NETBSD32_SYS_compat_10_oshmsys, "compat_netbsd32_sysvipc" },
20 { NETBSD32_SYS_compat_14_netbsd32___semctl, "compat_netbsd32_sysvipc" }, 20 { NETBSD32_SYS_compat_14_netbsd32___semctl, "compat_netbsd32_sysvipc" },
21 { NETBSD32_SYS_netbsd32_semget, "compat_netbsd32_sysvipc" }, 21 { NETBSD32_SYS_netbsd32_semget, "compat_netbsd32_sysvipc" },
22 { NETBSD32_SYS_netbsd32_semop, "compat_netbsd32_sysvipc" }, 22 { NETBSD32_SYS_netbsd32_semop, "compat_netbsd32_sysvipc" },
23 { NETBSD32_SYS_netbsd32_semconfig, "compat_netbsd32_sysvipc" }, 23 { NETBSD32_SYS_netbsd32_semconfig, "compat_netbsd32_sysvipc" },
24 { NETBSD32_SYS_compat_14_netbsd32_msgctl, "compat_netbsd32_sysvipc" }, 24 { NETBSD32_SYS_compat_14_netbsd32_msgctl, "compat_netbsd32_sysvipc" },

cvs diff -r1.135 -r1.136 src/sys/compat/netbsd32/netbsd32_sysent.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_sysent.c 2018/08/10 21:47:15 1.135
+++ src/sys/compat/netbsd32/netbsd32_sysent.c 2018/12/24 21:27:06 1.136
@@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
1/* $NetBSD: netbsd32_sysent.c,v 1.135 2018/08/10 21:47:15 pgoyette Exp $ */ 1/* $NetBSD: netbsd32_sysent.c,v 1.136 2018/12/24 21:27:06 mrg Exp $ */
2 2
3/* 3/*
4 * System call switch table. 4 * System call switch table.
5 * 5 *
6 * DO NOT EDIT-- this file is automatically generated. 6 * DO NOT EDIT-- this file is automatically generated.
7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp 7 * created from NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp
8 */ 8 */
9 9
10#include <sys/cdefs.h> 10#include <sys/cdefs.h>
11__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.135 2018/08/10 21:47:15 pgoyette Exp $"); 11__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.136 2018/12/24 21:27:06 mrg Exp $");
12 12
13#if defined(_KERNEL_OPT) 13#if defined(_KERNEL_OPT)
14#include "opt_compat_netbsd.h" 14#include "opt_compat_netbsd.h"
15#include "opt_ntp.h" 15#include "opt_ntp.h"
16#include "opt_compat_43.h" 16#include "opt_compat_43.h"
17#endif 17#endif
18#include <sys/param.h> 18#include <sys/param.h>
19#include <sys/systm.h> 19#include <sys/systm.h>
20#include <sys/signal.h> 20#include <sys/signal.h>
21#include <sys/mount.h> 21#include <sys/mount.h>
22#include <sys/syscallargs.h> 22#include <sys/syscallargs.h>
23#include <compat/netbsd32/netbsd32.h> 23#include <compat/netbsd32/netbsd32.h>
24#include <compat/netbsd32/netbsd32_syscallargs.h> 24#include <compat/netbsd32/netbsd32_syscallargs.h>
@@ -191,29 +191,29 @@ struct sysent netbsd32_sysent[] = { @@ -191,29 +191,29 @@ struct sysent netbsd32_sysent[] = {
191 }, /* 17 = netbsd32_break */ 191 }, /* 17 = netbsd32_break */
192 { 192 {
193 ns(struct compat_20_netbsd32_getfsstat_args), 193 ns(struct compat_20_netbsd32_getfsstat_args),
194 .sy_call = (sy_call_t *)compat_20(netbsd32_getfsstat) 194 .sy_call = (sy_call_t *)compat_20(netbsd32_getfsstat)
195 }, /* 18 = compat_20_netbsd32_getfsstat */ 195 }, /* 18 = compat_20_netbsd32_getfsstat */
196 { 196 {
197 ns(struct compat_43_netbsd32_olseek_args), 197 ns(struct compat_43_netbsd32_olseek_args),
198 .sy_call = (sy_call_t *)compat_43(netbsd32_olseek) 198 .sy_call = (sy_call_t *)compat_43(netbsd32_olseek)
199 }, /* 19 = compat_43_netbsd32_olseek */ 199 }, /* 19 = compat_43_netbsd32_olseek */
200 { 200 {
201 .sy_call = (sy_call_t *)sys_getpid 201 .sy_call = (sy_call_t *)sys_getpid
202 }, /* 20 = getpid */ 202 }, /* 20 = getpid */
203 { 203 {
204 ns(struct netbsd32_mount_args), 204 ns(struct compat_40_netbsd32_mount_args),
205 .sy_call = (sy_call_t *)netbsd32_mount 205 .sy_call = (sy_call_t *)compat_40(netbsd32_mount)
206 }, /* 21 = netbsd32_mount */ 206 }, /* 21 = compat_40_netbsd32_mount */
207 { 207 {
208 ns(struct netbsd32_unmount_args), 208 ns(struct netbsd32_unmount_args),
209 .sy_call = (sy_call_t *)netbsd32_unmount 209 .sy_call = (sy_call_t *)netbsd32_unmount
210 }, /* 22 = netbsd32_unmount */ 210 }, /* 22 = netbsd32_unmount */
211 { 211 {
212 ns(struct netbsd32_setuid_args), 212 ns(struct netbsd32_setuid_args),
213 .sy_call = (sy_call_t *)netbsd32_setuid 213 .sy_call = (sy_call_t *)netbsd32_setuid
214 }, /* 23 = netbsd32_setuid */ 214 }, /* 23 = netbsd32_setuid */
215 { 215 {
216 .sy_call = (sy_call_t *)sys_getuid 216 .sy_call = (sy_call_t *)sys_getuid
217 }, /* 24 = getuid */ 217 }, /* 24 = getuid */
218 { 218 {
219 .sy_call = (sy_call_t *)sys_geteuid 219 .sy_call = (sy_call_t *)sys_geteuid

cvs diff -r1.27 -r1.28 src/sys/compat/netbsd32/netbsd32_systrace_args.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_systrace_args.c 2018/08/10 21:47:15 1.27
+++ src/sys/compat/netbsd32/netbsd32_systrace_args.c 2018/12/24 21:27:06 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_systrace_args.c,v 1.27 2018/08/10 21:47:15 pgoyette Exp $ */ 1/* $NetBSD: netbsd32_systrace_args.c,v 1.28 2018/12/24 21:27:06 mrg Exp $ */
2 2
3/* 3/*
4 * System call argument to DTrace register array converstion. 4 * System call argument to DTrace register array converstion.
5 * 5 *
6 * DO NOT EDIT-- this file is automatically generated. 6 * DO NOT EDIT-- this file is automatically generated.
7 * This file is part of the DTrace syscall provider. 7 * This file is part of the DTrace syscall provider.
8 */ 8 */
9 9
10static void 10static void
11systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_args) 11systrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_args)
12{ 12{
13 intptr_t *iarg = (intptr_t *)uarg; 13 intptr_t *iarg = (intptr_t *)uarg;
14 switch (sysnum) { 14 switch (sysnum) {
@@ -161,27 +161,27 @@ systrace_args(register_t sysnum, const v @@ -161,27 +161,27 @@ systrace_args(register_t sysnum, const v
161 iarg[0] = SCARG(p, fd); /* int */ 161 iarg[0] = SCARG(p, fd); /* int */
162 iarg[1] = SCARG(p, offset); /* netbsd32_long */ 162 iarg[1] = SCARG(p, offset); /* netbsd32_long */
163 iarg[2] = SCARG(p, whence); /* int */ 163 iarg[2] = SCARG(p, whence); /* int */
164 *n_args = 3; 164 *n_args = 3;
165 break; 165 break;
166 } 166 }
167 /* sys_getpid */ 167 /* sys_getpid */
168 case 20: { 168 case 20: {
169 *n_args = 0; 169 *n_args = 0;
170 break; 170 break;
171 } 171 }
172 /* netbsd32_mount */ 172 /* netbsd32_mount */
173 case 21: { 173 case 21: {
174 const struct netbsd32_mount_args *p = params; 174 const struct compat_40_netbsd32_mount_args *p = params;
175 uarg[0] = (intptr_t) SCARG(p, type).i32; /* netbsd32_charp */ 175 uarg[0] = (intptr_t) SCARG(p, type).i32; /* netbsd32_charp */
176 uarg[1] = (intptr_t) SCARG(p, path).i32; /* netbsd32_charp */ 176 uarg[1] = (intptr_t) SCARG(p, path).i32; /* netbsd32_charp */
177 iarg[2] = SCARG(p, flags); /* int */ 177 iarg[2] = SCARG(p, flags); /* int */
178 uarg[3] = (intptr_t) SCARG(p, data).i32; /* netbsd32_voidp */ 178 uarg[3] = (intptr_t) SCARG(p, data).i32; /* netbsd32_voidp */
179 *n_args = 4; 179 *n_args = 4;
180 break; 180 break;
181 } 181 }
182 /* netbsd32_unmount */ 182 /* netbsd32_unmount */
183 case 22: { 183 case 22: {
184 const struct netbsd32_unmount_args *p = params; 184 const struct netbsd32_unmount_args *p = params;
185 uarg[0] = (intptr_t) SCARG(p, path).i32; /* netbsd32_charp */ 185 uarg[0] = (intptr_t) SCARG(p, path).i32; /* netbsd32_charp */
186 iarg[1] = SCARG(p, flags); /* int */ 186 iarg[1] = SCARG(p, flags); /* int */
187 *n_args = 2; 187 *n_args = 2;

cvs diff -r1.123 -r1.124 src/sys/compat/netbsd32/syscalls.master (expand / switch to unified diff)

--- src/sys/compat/netbsd32/syscalls.master 2018/07/31 21:00:02 1.123
+++ src/sys/compat/netbsd32/syscalls.master 2018/12/24 21:27:06 1.124
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1 $NetBSD: syscalls.master,v 1.123 2018/07/31 21:00:02 rjs Exp $ 1 $NetBSD: syscalls.master,v 1.124 2018/12/24 21:27:06 mrg Exp $
2 2
3; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp 3; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
4; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 4; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
5 5
6; NetBSD system call name/number "master" file. 6; NetBSD system call name/number "master" file.
7; (See syscalls.conf to see what it is processed into.) 7; (See syscalls.conf to see what it is processed into.)
8; 8;
9; Fields: number type [type-dependent ...] 9; Fields: number type [type-dependent ...]
10; number system call number, must be in order 10; number system call number, must be in order
11; type one of STD, OBSOL, UNIMPL, IGNORED, NODEF, NOARGS, or one of 11; type one of STD, OBSOL, UNIMPL, IGNORED, NODEF, NOARGS, or one of
12; the compatibility options defined in syscalls.conf. 12; the compatibility options defined in syscalls.conf.
13; 13;
14; types: 14; types:
@@ -81,27 +81,27 @@ @@ -81,27 +81,27 @@
8112 STD { int|netbsd32||chdir(netbsd32_charp path); } 8112 STD { int|netbsd32||chdir(netbsd32_charp path); }
8213 STD { int|netbsd32||fchdir(int fd); } 8213 STD { int|netbsd32||fchdir(int fd); }
8314 COMPAT_50 { int|netbsd32||mknod(netbsd32_charp path, mode_t mode, \ 8314 COMPAT_50 { int|netbsd32||mknod(netbsd32_charp path, mode_t mode, \
84 uint32_t dev); } 84 uint32_t dev); }
8515 STD { int|netbsd32||chmod(netbsd32_charp path, mode_t mode); } 8515 STD { int|netbsd32||chmod(netbsd32_charp path, mode_t mode); }
8616 STD { int|netbsd32||chown(netbsd32_charp path, uid_t uid, \ 8616 STD { int|netbsd32||chown(netbsd32_charp path, uid_t uid, \
87 gid_t gid); } 87 gid_t gid); }
8817 STD { int|netbsd32||break(netbsd32_charp nsize); } 8817 STD { int|netbsd32||break(netbsd32_charp nsize); }
8918 COMPAT_20 { int|netbsd32||getfsstat(netbsd32_statfsp_t buf, \ 8918 COMPAT_20 { int|netbsd32||getfsstat(netbsd32_statfsp_t buf, \
90 netbsd32_long bufsize, int flags); } 90 netbsd32_long bufsize, int flags); }
9119 COMPAT_43 { netbsd32_long|netbsd32||olseek(int fd, \ 9119 COMPAT_43 { netbsd32_long|netbsd32||olseek(int fd, \
92 netbsd32_long offset, int whence); } 92 netbsd32_long offset, int whence); }
9320 NOARGS { pid_t|sys||getpid(void); } 9320 NOARGS { pid_t|sys||getpid(void); }
9421 STD { int|netbsd32||mount(netbsd32_charp type, \ 9421 COMPAT_40 { int|netbsd32||mount(netbsd32_charp type, \
95 netbsd32_charp path, int flags, \ 95 netbsd32_charp path, int flags, \
96 netbsd32_voidp data); } 96 netbsd32_voidp data); }
9722 STD { int|netbsd32||unmount(netbsd32_charp path, \ 9722 STD { int|netbsd32||unmount(netbsd32_charp path, \
98 int flags); } 98 int flags); }
9923 STD { int|netbsd32||setuid(uid_t uid); } 9923 STD { int|netbsd32||setuid(uid_t uid); }
10024 NOARGS { uid_t|sys||getuid(void); } 10024 NOARGS { uid_t|sys||getuid(void); }
10125 NOARGS { uid_t|sys||geteuid(void); } 10125 NOARGS { uid_t|sys||geteuid(void); }
10226 STD MODULAR compat_netbsd32_ptrace \ 10226 STD MODULAR compat_netbsd32_ptrace \
103 { int|netbsd32||ptrace(int req, pid_t pid, \ 103 { int|netbsd32||ptrace(int req, pid_t pid, \
104 netbsd32_voidp addr, int data); } 104 netbsd32_voidp addr, int data); }
10527 STD { netbsd32_ssize_t|netbsd32||recvmsg(int s, \ 10527 STD { netbsd32_ssize_t|netbsd32||recvmsg(int s, \
106 netbsd32_msghdrp_t msg, int flags); } 106 netbsd32_msghdrp_t msg, int flags); }
10728 STD { netbsd32_ssize_t|netbsd32||sendmsg(int s, \ 10728 STD { netbsd32_ssize_t|netbsd32||sendmsg(int s, \