Module Name: src Committed By: pgoyette Date: Thu Dec 3 10:38:21 UTC 2015
Modified Files: src/distrib/sets/lists/modules: ad.arm ad.mips md.amd64 src/sys/compat/netbsd32: netbsd32_compat_10.c netbsd32_compat_14.c netbsd32_compat_50.c netbsd32_ipc.c syscalls.master src/sys/modules: Makefile src/sys/modules/compat_netbsd32: Makefile Added Files: src/sys/compat/netbsd32: netbsd32_compat_50_sysv.c src/sys/modules/compat_netbsd32_sysvipc: Makefile Log Message: Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc module. Adjust dependencies as needed. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/modules/ad.arm \ src/distrib/sets/lists/modules/ad.mips cvs rdiff -u -r1.65 -r1.66 src/distrib/sets/lists/modules/md.amd64 cvs rdiff -u -r1.24 -r1.25 src/sys/compat/netbsd32/netbsd32_compat_10.c cvs rdiff -u -r1.21 -r1.22 src/sys/compat/netbsd32/netbsd32_compat_14.c cvs rdiff -u -r1.31 -r1.32 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_compat_50_sysv.c cvs rdiff -u -r1.17 -r1.18 src/sys/compat/netbsd32/netbsd32_ipc.c cvs rdiff -u -r1.111 -r1.112 src/sys/compat/netbsd32/syscalls.master cvs rdiff -u -r1.161 -r1.162 src/sys/modules/Makefile cvs rdiff -u -r1.17 -r1.18 src/sys/modules/compat_netbsd32/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/compat_netbsd32_sysvipc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/modules/ad.arm diff -u src/distrib/sets/lists/modules/ad.arm:1.7 src/distrib/sets/lists/modules/ad.arm:1.8 --- src/distrib/sets/lists/modules/ad.arm:1.7 Tue Dec 1 23:59:16 2015 +++ src/distrib/sets/lists/modules/ad.arm Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -# $NetBSD: ad.arm,v 1.7 2015/12/01 23:59:16 pgoyette Exp $ +# $NetBSD: ad.arm,v 1.8 2015/12/03 10:38:21 pgoyette Exp $ ./@MODULEDIR@/compat_netbsd32 base-kernel-modules kmod ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod base-kernel-modules kmod @@ -6,5 +6,7 @@ ./@MODULEDIR@/compat_netbsd32_mqueue/compat_netbsd32_mqueue.kmod base-kernel-modules kmod ./@MODULEDIR@/compat_netbsd32_nfssrv base-kernel-modules kmod ./@MODULEDIR@/compat_netbsd32_nfssrv/compat_netbsd32_nfssrv.kmod base-kernel-modules kmod +./@MODULEDIR@/compat_netbsd32_sysvipc base-kernel-modules kmod +./@MODULEDIR@/compat_netbsd32_sysvipc/compat_netbsd32_sysvipc.kmod base-kernel-modules kmod ./@MODULEDIR@/exec_elf32 base-kernel-modules kmod ./@MODULEDIR@/exec_elf32/exec_elf32.kmod base-kernel-modules kmod Index: src/distrib/sets/lists/modules/ad.mips diff -u src/distrib/sets/lists/modules/ad.mips:1.7 src/distrib/sets/lists/modules/ad.mips:1.8 --- src/distrib/sets/lists/modules/ad.mips:1.7 Tue Dec 1 23:59:16 2015 +++ src/distrib/sets/lists/modules/ad.mips Thu Dec 3 10:38:21 2015 @@ -1,9 +1,11 @@ -# $NetBSD: ad.mips,v 1.7 2015/12/01 23:59:16 pgoyette Exp $ +# $NetBSD: ad.mips,v 1.8 2015/12/03 10:38:21 pgoyette Exp $ ./@MODULEDIR@/compat_netbsd32 base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/compat_netbsd32_mqueue base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/compat_netbsd32_mqueue/compat_netbsd32_mqueue.kmod base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/compat_netbsd32_nfssrv base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/compat_netbsd32_nfssrv/compat_netbsd32_nfssrv.kmod base-kernel-modules kmod,arch64,nocompatmodules +./@MODULEDIR@/compat_netbsd32_sysvipc base-kernel-modules kmod,arch64,nocompatmodules +./@MODULEDIR@/compat_netbsd32_sysvipc/compat_netbsd32_sysvipc.kmod base-kernel-modules kmod,arch64,nocompatmodules ./@MODULEDIR@/exec_elf32 base-kernel-modules kmod ./@MODULEDIR@/exec_elf32/exec_elf32.kmod base-kernel-modules kmod Index: src/distrib/sets/lists/modules/md.amd64 diff -u src/distrib/sets/lists/modules/md.amd64:1.65 src/distrib/sets/lists/modules/md.amd64:1.66 --- src/distrib/sets/lists/modules/md.amd64:1.65 Tue Dec 1 23:59:16 2015 +++ src/distrib/sets/lists/modules/md.amd64 Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -# $NetBSD: md.amd64,v 1.65 2015/12/01 23:59:16 pgoyette Exp $ +# $NetBSD: md.amd64,v 1.66 2015/12/03 10:38:21 pgoyette Exp $ # # NOTE that there are two sets of files here: # @MODULEDIR@ and amd64-xen @@ -55,6 +55,8 @@ ./@MODULEDIR@/compat_netbsd32_mqueue/compat_netbsd32_mqueue.kmod base-kernel-modules kmod ./@MODULEDIR@/compat_netbsd32_nfssrv base-kernel-modules kmod ./@MODULEDIR@/compat_netbsd32_nfssrv/compat_netbsd32_nfssrv.kmod base-kernel-modules kmod +./@MODULEDIR@/compat_netbsd32_sysvipc base-kernel-modules kmod +./@MODULEDIR@/compat_netbsd32_sysvipc/compat_netbsd32_sysvipc.kmod base-kernel-modules kmod ./@MODULEDIR@/coram base-kernel-modules kmod ./@MODULEDIR@/coram/coram.kmod base-kernel-modules kmod ./@MODULEDIR@/coretemp base-kernel-modules kmod Index: src/sys/compat/netbsd32/netbsd32_compat_10.c diff -u src/sys/compat/netbsd32/netbsd32_compat_10.c:1.24 src/sys/compat/netbsd32/netbsd32_compat_10.c:1.25 --- src/sys/compat/netbsd32/netbsd32_compat_10.c:1.24 Fri Apr 23 15:19:20 2010 +++ src/sys/compat/netbsd32/netbsd32_compat_10.c Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_10.c,v 1.24 2010/04/23 15:19:20 rmind Exp $ */ +/* $NetBSD: netbsd32_compat_10.c,v 1.25 2015/12/03 10:38:21 pgoyette Exp $ */ /* * Copyright (c) 1994 Adam Glass and Charles M. Hannum. All rights reserved. @@ -31,10 +31,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10.c,v 1.24 2010/04/23 15:19:20 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10.c,v 1.25 2015/12/03 10:38:21 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_sysv.h" +#include "opt_compat_netbsd.h" #endif #include <sys/param.h> @@ -50,7 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com #include <compat/netbsd32/netbsd32_syscallargs.h> #include <compat/sys/shm.h> -#if defined(SYSVSEM) || !defined(_KERNEL_OPT) +#if defined(COMPAT_10) +#if defined(SYSVSEM) int compat_10_netbsd32_semsys(struct lwp *l, const struct compat_10_netbsd32_semsys_args *uap, register_t *retval) { @@ -112,7 +114,7 @@ compat_10_netbsd32_semsys(struct lwp *l, } #endif -#if defined(SYSVSHM) || !defined(_KERNEL_OPT) +#if defined(SYSVSHM) int compat_10_netbsd32_shmsys(struct lwp *l, const struct compat_10_netbsd32_shmsys_args *uap, register_t *retval) { @@ -170,7 +172,7 @@ compat_10_netbsd32_shmsys(struct lwp *l, } #endif -#if defined(SYSVMSG) || !defined(_KERNEL) +#if defined(SYSVMSG) int compat_10_netbsd32_msgsys(struct lwp *l, const struct compat_10_netbsd32_msgsys_args *uap, register_t *retval) { @@ -237,3 +239,4 @@ compat_10_netbsd32_msgsys(struct lwp *l, } } #endif +#endif /* COMPAT_10 */ Index: src/sys/compat/netbsd32/netbsd32_compat_14.c diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.22 --- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 Thu Dec 20 23:03:01 2007 +++ src/sys/compat/netbsd32/netbsd32_compat_14.c Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $ */ +/* $NetBSD: netbsd32_compat_14.c,v 1.22 2015/12/03 10:38:21 pgoyette Exp $ */ /* * Copyright (c) 1999 Eduardo E. Horvath @@ -29,7 +29,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.22 2015/12/03 10:38:21 pgoyette Exp $"); + +#ifdef _KERNEL_OPT +#include "opt_sysv.h" +#include "opt_compat_netbsd.h" +#endif #include <sys/param.h> #include <sys/ipc.h> @@ -41,21 +46,13 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com #include <sys/sem.h> #include <sys/shm.h> -#ifndef SYSVMSG -#define SYSVMSG -#endif -#ifndef SYSVSEM -#define SYSVSEM -#endif -#ifndef SYSVSHM -#define SYSVSHM -#endif - #include <sys/syscallargs.h> #include <compat/netbsd32/netbsd32.h> #include <compat/netbsd32/netbsd32_syscallargs.h> #include <compat/sys/shm.h> +#if defined(COMPAT_14) + static inline void netbsd32_ipc_perm14_to_native(struct netbsd32_ipc_perm14 *, struct ipc_perm *); static inline void @@ -207,6 +204,7 @@ native_to_netbsd32_shmid_ds14(struct shm /* * the compat_14 system calls */ +#if defined(SYSVMSG) int compat_14_netbsd32_msgctl(struct lwp *l, const struct compat_14_netbsd32_msgctl_args *uap, register_t *retval) { @@ -240,7 +238,9 @@ compat_14_netbsd32_msgctl(struct lwp *l, return (error); } +#endif +#if defined(SYSVSEM) int compat_14_netbsd32___semctl(struct lwp *l, const struct compat_14_netbsd32___semctl_args *uap, register_t *retval) { @@ -294,7 +294,9 @@ compat_14_netbsd32___semctl(struct lwp * return (error); } +#endif +#if defined(SYSVSHM) int compat_14_netbsd32_shmctl(struct lwp *l, const struct compat_14_netbsd32_shmctl_args *uap, register_t *retval) { @@ -326,3 +328,5 @@ compat_14_netbsd32_shmctl(struct lwp *l, return (error); } +#endif +#endif /* COMPAT_14 */ Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.31 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.32 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.31 Tue Dec 1 23:56:43 2015 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_50.c,v 1.31 2015/12/01 23:56:43 pgoyette Exp $ */ +/* $NetBSD: netbsd32_compat_50.c,v 1.32 2015/12/03 10:38:21 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,10 +36,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.31 2015/12/01 23:56:43 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32 2015/12/03 10:38:21 pgoyette Exp $"); #if defined(_KERNEL_OPT) -#include "opt_sysv.h" +#include "opt_compat_netbsd.h" #endif #include <sys/param.h> @@ -63,10 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com #include <sys/dirent.h> #include <sys/kauth.h> #include <sys/vfs_syscalls.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <sys/sem.h> -#include <sys/shm.h> #include <compat/netbsd32/netbsd32.h> #include <compat/netbsd32/netbsd32_syscallargs.h> @@ -74,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com #include <compat/sys/mount.h> #include <compat/sys/time.h> +#if defined(COMPAT_50) /* * Common routine to set access and modification times given a vnode. @@ -909,158 +906,6 @@ compat_50_netbsd32_getitimer(struct lwp return copyout(&s32it, SCARG_P32(uap, itv), sizeof(s32it)); } -#if defined(SYSVSEM) - -int -compat_50_netbsd32___semctl14(struct lwp *l, const struct compat_50_netbsd32___semctl14_args *uap, register_t *retval) -{ - return do_netbsd32___semctl14(l, uap, retval, NULL); -} - -int -do_netbsd32___semctl14(struct lwp *l, const struct compat_50_netbsd32___semctl14_args *uap, register_t *retval, void *vkarg) -{ - /* { - syscallarg(int) semid; - syscallarg(int) semnum; - syscallarg(int) cmd; - syscallarg(netbsd32_semun50p_t) arg; - } */ - struct semid_ds sembuf; - struct netbsd32_semid_ds50 sembuf32; - int cmd, error; - void *pass_arg; - union __semun karg; - union netbsd32_semun50 karg32; - - cmd = SCARG(uap, cmd); - - switch (cmd) { - case IPC_SET: - case IPC_STAT: - pass_arg = &sembuf; - break; - - case GETALL: - case SETVAL: - case SETALL: - pass_arg = &karg; - break; - default: - pass_arg = NULL; - break; - } - - if (pass_arg) { - if (vkarg != NULL) - karg32 = *(union netbsd32_semun50 *)vkarg; - else { - error = copyin(SCARG_P32(uap, arg), &karg32, - sizeof(karg32)); - if (error) - return error; - } - if (pass_arg == &karg) { - switch (cmd) { - case GETALL: - case SETALL: - karg.array = NETBSD32PTR64(karg32.array); - break; - case SETVAL: - karg.val = karg32.val; - break; - } - } - if (cmd == IPC_SET) { - error = copyin(NETBSD32PTR64(karg32.buf), &sembuf32, - sizeof(sembuf32)); - if (error) - return (error); - netbsd32_to_semid_ds50(&sembuf32, &sembuf); - } - } - - error = semctl1(l, SCARG(uap, semid), SCARG(uap, semnum), cmd, - pass_arg, retval); - - if (error == 0 && cmd == IPC_STAT) { - netbsd32_from_semid_ds50(&sembuf, &sembuf32); - error = copyout(&sembuf32, NETBSD32PTR64(karg32.buf), - sizeof(sembuf32)); - } - - return (error); -} -#endif - -#if defined(SYSVMSG) - -int -compat_50_netbsd32___msgctl13(struct lwp *l, const struct compat_50_netbsd32___msgctl13_args *uap, register_t *retval) -{ - /* { - syscallarg(int) msqid; - syscallarg(int) cmd; - syscallarg(netbsd32_msqid_ds50p_t) buf; - } */ - struct msqid_ds ds; - struct netbsd32_msqid_ds50 ds32; - int error, cmd; - - cmd = SCARG(uap, cmd); - if (cmd == IPC_SET) { - error = copyin(SCARG_P32(uap, buf), &ds32, sizeof(ds32)); - if (error) - return error; - netbsd32_to_msqid_ds50(&ds32, &ds); - } - - error = msgctl1(l, SCARG(uap, msqid), cmd, - (cmd == IPC_SET || cmd == IPC_STAT) ? &ds : NULL); - - if (error == 0 && cmd == IPC_STAT) { - netbsd32_from_msqid_ds50(&ds, &ds32); - error = copyout(&ds32, SCARG_P32(uap, buf), sizeof(ds32)); - } - - return error; -} -#endif - -#if defined(SYSVSHM) - -int -compat_50_netbsd32___shmctl13(struct lwp *l, const struct compat_50_netbsd32___shmctl13_args *uap, register_t *retval) -{ - /* { - syscallarg(int) shmid; - syscallarg(int) cmd; - syscallarg(netbsd32_shmid_ds50p_t) buf; - } */ - struct shmid_ds ds; - struct netbsd32_shmid_ds50 ds32; - int error, cmd; - - cmd = SCARG(uap, cmd); - if (cmd == IPC_SET) { - error = copyin(SCARG_P32(uap, buf), &ds32, sizeof(ds32)); - if (error) - return error; - netbsd32_to_shmid_ds50(&ds32, &ds); - } - - error = shmctl1(l, SCARG(uap, shmid), cmd, - (cmd == IPC_SET || cmd == IPC_STAT) ? &ds : NULL); - - if (error == 0 && cmd == IPC_STAT) { - netbsd32_from_shmid_ds50(&ds, &ds32); - error = copyout(&ds32, SCARG_P32(uap, buf), sizeof(ds32)); - } - - return error; -} -#endif - int compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval) { @@ -1079,3 +924,4 @@ compat_50_netbsd32_quotactl(struct lwp * return (compat_50_sys_quotactl(l, &ua, retval)); } +#endif /* COMPAT_50 */ Index: src/sys/compat/netbsd32/netbsd32_ipc.c diff -u src/sys/compat/netbsd32/netbsd32_ipc.c:1.17 src/sys/compat/netbsd32/netbsd32_ipc.c:1.18 --- src/sys/compat/netbsd32/netbsd32_ipc.c:1.17 Sat Dec 12 10:30:09 2009 +++ src/sys/compat/netbsd32/netbsd32_ipc.c Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ipc.c,v 1.17 2009/12/12 10:30:09 njoly Exp $ */ +/* $NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.17 2009/12/12 10:30:09 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc.c,v 1.18 2015/12/03 10:38:21 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -40,15 +40,101 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ipc #include <sys/sem.h> #include <sys/shm.h> #include <sys/mount.h> +#include <sys/module.h> #include <sys/dirent.h> +#include <sys/syscallvar.h> #include <sys/syscallargs.h> #include <sys/proc.h> #include <compat/netbsd32/netbsd32.h> +#include <compat/netbsd32/netbsd32_syscall.h> #include <compat/netbsd32/netbsd32_syscallargs.h> #include <compat/netbsd32/netbsd32_conv.h> +extern struct emul emul_netbsd32; + +#define _PKG_ENTRY(name) \ + { NETBSD32_SYS_ ## name, 0, (sy_call_t *)name } + +#define _PKG_ENTRY2(code, name) \ + { NETBSD32_SYS_ ## code, 0, (sy_call_t *)name } + +static const struct syscall_package compat_sysvipc_syscalls[] = { +#if defined(SYSVSEM) + _PKG_ENTRY(netbsd32_____semctl50), + _PKG_ENTRY(netbsd32_semget), + _PKG_ENTRY(netbsd32_semop), + _PKG_ENTRY(netbsd32_semconfig), +#if defined(COMPAT_10) + _PKG_ENTRY2(compat_10_osemsys, compat_10_netbsd32_semsys), +#endif +#if defined(COMPAT_14) + _PKG_ENTRY(compat_14_netbsd32___semctl), +#endif +#if defined(COMPAT_50) + _PKG_ENTRY(compat_50_netbsd32___semctl14), +#endif +#endif /* SYSVSEM */ + +#if defined(SYSVSHM) + _PKG_ENTRY(netbsd32_shmat), + _PKG_ENTRY(netbsd32___shmctl50), + _PKG_ENTRY(netbsd32_shmdt), + _PKG_ENTRY(netbsd32_shmget), +#if defined(COMPAT_10) + _PKG_ENTRY2(compat_10_oshmsys, compat_10_netbsd32_shmsys), +#endif +#if defined(COMPAT_14) + _PKG_ENTRY(compat_14_netbsd32_shmctl), +#endif +#if defined(COMPAT_50) + _PKG_ENTRY(compat_50_netbsd32___shmctl13), +#endif +#endif /* SYSVSHM */ + +#if defined(SYSVMSG) + _PKG_ENTRY(netbsd32___msgctl50), + _PKG_ENTRY(netbsd32_msgget), + _PKG_ENTRY(netbsd32_msgsnd), + _PKG_ENTRY(netbsd32_msgrcv), +#if defined(COMPAT_10) + _PKG_ENTRY2(compat_10_omsgsys, compat_10_netbsd32_msgsys), +#endif +#if defined(COMPAT_14) + _PKG_ENTRY(compat_14_netbsd32_msgctl), +#endif +#if defined(COMPAT_50) + _PKG_ENTRY(compat_50_netbsd32___msgctl13), +#endif +#endif /* SYSVMSG */ + { 0, 0, NULL } +}; + +MODULE(MODULE_CLASS_EXEC, compat_netbsd32_sysvipc, "sysv_ipc,compat_netbsd32"); + +static int +compat_netbsd32_sysvipc_modcmd(modcmd_t cmd, void *arg) +{ + int error; + + switch (cmd) { + case MODULE_CMD_INIT: + error = syscall_establish(&emul_netbsd32, + compat_sysvipc_syscalls); + break; + case MODULE_CMD_FINI: + error = syscall_disestablish(&emul_netbsd32, + compat_sysvipc_syscalls); + break; + default: + error = ENOTTY; + break; + } + return error; +} + + #if defined(SYSVSEM) int Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.111 src/sys/compat/netbsd32/syscalls.master:1.112 --- src/sys/compat/netbsd32/syscalls.master:1.111 Tue Dec 1 23:56:43 2015 +++ src/sys/compat/netbsd32/syscalls.master Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.111 2015/12/01 23:56:43 pgoyette Exp $ + $NetBSD: syscalls.master,v 1.112 2015/12/03 10:38:21 pgoyette Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -39,7 +39,6 @@ #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" #include "opt_ntp.h" -#include "opt_sysv.h" #include "opt_compat_43.h" #endif @@ -339,24 +338,15 @@ 166 UNIMPL 167 UNIMPL 168 UNIMPL -#if defined(SYSVSEM) || !defined(_KERNEL_OPT) -169 COMPAT_10 { int|netbsd32||semsys(int which, int a2, int a3, \ +169 COMPAT_10 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||semsys(int which, int a2, int a3, \ int a4, int a5); } osemsys -#else -169 EXCL netbsd32_semsys -#endif -#if defined(SYSVMSG) || !defined(_KERNEL_OPT) -170 COMPAT_10 { int|netbsd32||msgsys(int which, int a2, int a3, \ +170 COMPAT_10 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||msgsys(int which, int a2, int a3, \ int a4, int a5, int a6); } omsgsys -#else -170 EXCL netbsd32_msgsys -#endif -#if defined(SYSVSHM) || !defined(_KERNEL_OPT) -171 COMPAT_10 { int|netbsd32||shmsys(int which, int a2, int a3, \ +171 COMPAT_10 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||shmsys(int which, int a2, int a3, \ int a4); } oshmsys -#else -171 EXCL netbsd32_shmsys -#endif 172 UNIMPL 173 STD { netbsd32_ssize_t|netbsd32||pread(int fd, \ netbsd32_voidp buf, netbsd32_size_t nbyte, \ @@ -440,49 +430,40 @@ 218 UNIMPL 219 UNIMPL ; System calls 220-300 are reserved for use by NetBSD -#if defined(SYSVSEM) || !defined(_KERNEL_OPT) -220 COMPAT_14 { int|netbsd32||__semctl(int semid, int semnum, \ +220 COMPAT_14 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||__semctl(int semid, int semnum, \ int cmd, netbsd32_semunu_t arg); } -221 STD { int|netbsd32||semget(netbsd32_key_t key, int nsems, \ +221 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||semget(netbsd32_key_t key, int nsems, \ int semflg); } -222 STD { int|netbsd32||semop(int semid, \ +222 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||semop(int semid, \ netbsd32_sembufp_t sops, netbsd32_size_t nsops); } -223 STD { int|netbsd32||semconfig(int flag); } -#else -220 EXCL compat_14_netbsd32_semctl -221 EXCL netbsd32_semget -222 EXCL netbsd32_semop -223 EXCL netbsd32_semconfig -#endif -#if defined(SYSVMSG) || !defined(_KERNEL_OPT) -224 COMPAT_14 { int|netbsd32||msgctl(int msqid, int cmd, \ +223 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||semconfig(int flag); } +224 COMPAT_14 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||msgctl(int msqid, int cmd, \ netbsd32_msqid_ds14p_t buf); } -225 STD { int|netbsd32||msgget(netbsd32_key_t key, int msgflg); } -226 STD { int|netbsd32||msgsnd(int msqid, netbsd32_voidp msgp, \ +225 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||msgget(netbsd32_key_t key, int msgflg); } +226 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||msgsnd(int msqid, netbsd32_voidp msgp, \ netbsd32_size_t msgsz, int msgflg); } -227 STD { netbsd32_ssize_t|netbsd32||msgrcv(int msqid, \ +227 STD MODULAR compat_netbsd32_sysvipc \ + { netbsd32_ssize_t|netbsd32||msgrcv(int msqid, \ netbsd32_voidp msgp, netbsd32_size_t msgsz, \ netbsd32_long msgtyp, int msgflg); } -#else -224 EXCL compat_14_netbsd32_msgctl -225 EXCL netbsd32_msgget -226 EXCL netbsd32_msgsnd -227 EXCL netbsd32_msgrcv -#endif -#if defined(SYSVSHM) || !defined(_KERNEL_OPT) -228 STD { netbsd32_voidp|netbsd32||shmat(int shmid, \ +228 STD MODULAR compat_netbsd32_sysvipc \ + { netbsd32_voidp|netbsd32||shmat(int shmid, \ netbsd32_voidp shmaddr, int shmflg); } -229 COMPAT_14 { int|netbsd32||shmctl(int shmid, int cmd, \ +229 COMPAT_14 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||shmctl(int shmid, int cmd, \ netbsd32_shmid_dsp_t buf); } -230 STD { int|netbsd32||shmdt(netbsd32_voidp shmaddr); } -231 STD { int|netbsd32||shmget(netbsd32_key_t key, \ +230 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||shmdt(netbsd32_voidp shmaddr); } +231 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32||shmget(netbsd32_key_t key, \ netbsd32_size_t size, int shmflg); } -#else -228 EXCL netbsd32_shmat -229 EXCL compat_14_netbsd32_shmctl -230 EXCL netbsd32_shmdt -231 EXCL netbsd32_shmget -#endif 232 COMPAT_50 { int|netbsd32||clock_gettime( \ netbsd32_clockid_t clock_id, \ netbsd32_timespec50p_t tp); } @@ -637,24 +618,15 @@ netbsd32_stat13p_t sb); } 300 COMPAT_20 { int|netbsd32||fhstatfs(netbsd32_fhandlep_t fhp, \ netbsd32_stat50p_t buf); } -#if defined(SYSVSEM) || !defined(_KERNEL_OPT) -301 COMPAT_50 { int|netbsd32|14|semctl(int semid, int semnum, \ +301 COMPAT_50 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|14|semctl(int semid, int semnum, \ int cmd, ... netbsd32_semun50p_t arg); } -#else -301 EXCL __semctl14 -#endif -#if defined(SYSVMSG) || !defined(_KERNEL_OPT) -302 COMPAT_50 { int|netbsd32|13|msgctl(int msqid, int cmd, \ +302 COMPAT_50 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|13|msgctl(int msqid, int cmd, \ netbsd32_msqid_ds50p_t buf); } -#else -302 EXCL __msgctl13 -#endif -#if defined(SYSVSHM) || !defined(_KERNEL_OPT) -303 COMPAT_50 { int|netbsd32|13|shmctl(int shmid, int cmd, \ +303 COMPAT_50 MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|13|shmctl(int shmid, int cmd, \ netbsd32_shmid_ds50p_t buf); } -#else -303 EXCL __shmctl13 -#endif 304 STD { int|netbsd32||lchflags(netbsd32_charp path, \ netbsd32_u_long flags); } 305 NOARGS { int|sys||issetugid(void); } @@ -957,24 +929,15 @@ 440 STD { int|netbsd32|50|fstat(int fd, netbsd32_statp_t sb); } 441 STD { int|netbsd32|50|lstat(const netbsd32_charp path, \ netbsd32_statp_t ub); } -#if defined(SYSVSEM) || !defined(_KERNEL_OPT) -442 STD { int|netbsd32|50|__semctl(int semid, int semnum, \ +442 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|50|__semctl(int semid, int semnum, \ int cmd, ... netbsd32_semunp_t arg); } -#else -442 EXCL ____semctl50 -#endif -#if defined(SYSVSHM) || !defined(_KERNEL_OPT) -443 STD { int|netbsd32|50|shmctl(int shmid, int cmd, \ +443 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|50|shmctl(int shmid, int cmd, \ netbsd32_shmid_dsp_t buf); } -#else -443 EXCL ____shmctl50 -#endif -#if defined(SYSVMSG) || !defined(_KERNEL_OPT) -444 STD { int|netbsd32|50|msgctl(int msqid, int cmd, \ +444 STD MODULAR compat_netbsd32_sysvipc \ + { int|netbsd32|50|msgctl(int msqid, int cmd, \ netbsd32_msqid_dsp_t buf); } -#else -444 EXCL ____msgctl50 -#endif 445 STD { int|netbsd32|50|getrusage(int who, \ netbsd32_rusagep_t rusage); } 446 STD { int|netbsd32|50|timer_settime(timer_t timerid, \ Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.161 src/sys/modules/Makefile:1.162 --- src/sys/modules/Makefile:1.161 Thu Dec 3 02:51:01 2015 +++ src/sys/modules/Makefile Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.161 2015/12/03 02:51:01 pgoyette Exp $ +# $NetBSD: Makefile,v 1.162 2015/12/03 10:38:21 pgoyette Exp $ .include <bsd.own.mk> @@ -211,6 +211,7 @@ SUBDIR+= wmimsi SUBDIR+= compat_netbsd32 SUBDIR+= compat_netbsd32_nfssrv SUBDIR+= compat_netbsd32_mqueue +SUBDIR+= compat_netbsd32_sysvipc .endif .if ${MACHINE_ARCH} == "x86_64" @@ -218,6 +219,7 @@ SUBDIR+= compat_linux32 SUBDIR+= compat_netbsd32 SUBDIR+= compat_netbsd32_nfssrv SUBDIR+= compat_netbsd32_mqueue +SUBDIR+= compat_netbsd32_sysvipc .endif .if ${MACHINE_ARCH} == "i386" Index: src/sys/modules/compat_netbsd32/Makefile diff -u src/sys/modules/compat_netbsd32/Makefile:1.17 src/sys/modules/compat_netbsd32/Makefile:1.18 --- src/sys/modules/compat_netbsd32/Makefile:1.17 Tue Dec 1 23:58:19 2015 +++ src/sys/modules/compat_netbsd32/Makefile Thu Dec 3 10:38:21 2015 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2015/12/01 23:58:19 pgoyette Exp $ +# $NetBSD: Makefile,v 1.18 2015/12/03 10:38:21 pgoyette Exp $ .include "../Makefile.inc" .include "../Makefile.assym" @@ -18,7 +18,7 @@ CPPFLAGS+= -DCOMPAT_20 CPPFLAGS+= -DCOMPAT_30 -DCOMPAT_40 -DCOMPAT_50 CPPFLAGS+= -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80 CPPFLAGS+= -DCOMPAT_43 -CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG -DCOMPAT_NETBSD32 +CPPFLAGS+= -DCOMPAT_NETBSD32 CPPFLAGS+= -DEXEC_ELF32 -DEXEC_ELF64 CPPFLAGS+= -DCOREDUMP -DNTP -DVMSWAP CPPFLAGS+= -DNTP @@ -32,7 +32,7 @@ SRCS+= netbsd32_compat_50.c netbsd32_com SRCS+= netbsd32_core.c netbsd32_event.c SRCS+= netbsd32_exec_elf32.c SRCS+= netbsd32_execve.c netbsd32_fs.c -SRCS+= netbsd32_ioctl.c netbsd32_ipc.c +SRCS+= netbsd32_ioctl.c SRCS+= netbsd32_lwp.c netbsd32_netbsd.c SRCS+= netbsd32_select.c SRCS+= netbsd32_sem.c netbsd32_signal.c Added files: Index: src/sys/compat/netbsd32/netbsd32_compat_50_sysv.c diff -u /dev/null src/sys/compat/netbsd32/netbsd32_compat_50_sysv.c:1.1 --- /dev/null Thu Dec 3 10:38:21 2015 +++ src/sys/compat/netbsd32/netbsd32_compat_50_sysv.c Thu Dec 3 10:38:21 2015 @@ -0,0 +1,210 @@ +/* $NetBSD: netbsd32_compat_50_sysv.c,v 1.1 2015/12/03 10:38:21 pgoyette Exp $ */ + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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 the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE 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/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50_sysv.c,v 1.1 2015/12/03 10:38:21 pgoyette Exp $"); + +#if defined(_KERNEL_OPT) +#include "opt_sysv.h" +#include "opt_compat_netbsd.h" +#endif + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/msg.h> +#include <sys/sem.h> +#include <sys/shm.h> + +#include <compat/netbsd32/netbsd32.h> +#include <compat/netbsd32/netbsd32_syscallargs.h> +#include <compat/netbsd32/netbsd32_conv.h> + +#if defined(COMPAT_50) + +#if defined(SYSVSEM) + +int +compat_50_netbsd32___semctl14(struct lwp *l, const struct compat_50_netbsd32___semctl14_args *uap, register_t *retval) +{ + return do_netbsd32___semctl14(l, uap, retval, NULL); +} + +int +do_netbsd32___semctl14(struct lwp *l, const struct compat_50_netbsd32___semctl14_args *uap, register_t *retval, void *vkarg) +{ + /* { + syscallarg(int) semid; + syscallarg(int) semnum; + syscallarg(int) cmd; + syscallarg(netbsd32_semun50p_t) arg; + } */ + struct semid_ds sembuf; + struct netbsd32_semid_ds50 sembuf32; + int cmd, error; + void *pass_arg; + union __semun karg; + union netbsd32_semun50 karg32; + + cmd = SCARG(uap, cmd); + + switch (cmd) { + case IPC_SET: + case IPC_STAT: + pass_arg = &sembuf; + break; + + case GETALL: + case SETVAL: + case SETALL: + pass_arg = &karg; + break; + default: + pass_arg = NULL; + break; + } + + if (pass_arg) { + if (vkarg != NULL) + karg32 = *(union netbsd32_semun50 *)vkarg; + else { + error = copyin(SCARG_P32(uap, arg), &karg32, + sizeof(karg32)); + if (error) + return error; + } + if (pass_arg == &karg) { + switch (cmd) { + case GETALL: + case SETALL: + karg.array = NETBSD32PTR64(karg32.array); + break; + case SETVAL: + karg.val = karg32.val; + break; + } + } + if (cmd == IPC_SET) { + error = copyin(NETBSD32PTR64(karg32.buf), &sembuf32, + sizeof(sembuf32)); + if (error) + return (error); + netbsd32_to_semid_ds50(&sembuf32, &sembuf); + } + } + + error = semctl1(l, SCARG(uap, semid), SCARG(uap, semnum), cmd, + pass_arg, retval); + + if (error == 0 && cmd == IPC_STAT) { + netbsd32_from_semid_ds50(&sembuf, &sembuf32); + error = copyout(&sembuf32, NETBSD32PTR64(karg32.buf), + sizeof(sembuf32)); + } + + return (error); +} +#endif + +#if defined(SYSVMSG) + +int +compat_50_netbsd32___msgctl13(struct lwp *l, const struct compat_50_netbsd32___msgctl13_args *uap, register_t *retval) +{ + /* { + syscallarg(int) msqid; + syscallarg(int) cmd; + syscallarg(netbsd32_msqid_ds50p_t) buf; + } */ + struct msqid_ds ds; + struct netbsd32_msqid_ds50 ds32; + int error, cmd; + + cmd = SCARG(uap, cmd); + if (cmd == IPC_SET) { + error = copyin(SCARG_P32(uap, buf), &ds32, sizeof(ds32)); + if (error) + return error; + netbsd32_to_msqid_ds50(&ds32, &ds); + } + + error = msgctl1(l, SCARG(uap, msqid), cmd, + (cmd == IPC_SET || cmd == IPC_STAT) ? &ds : NULL); + + if (error == 0 && cmd == IPC_STAT) { + netbsd32_from_msqid_ds50(&ds, &ds32); + error = copyout(&ds32, SCARG_P32(uap, buf), sizeof(ds32)); + } + + return error; +} +#endif + +#if defined(SYSVSHM) + +int +compat_50_netbsd32___shmctl13(struct lwp *l, const struct compat_50_netbsd32___shmctl13_args *uap, register_t *retval) +{ + /* { + syscallarg(int) shmid; + syscallarg(int) cmd; + syscallarg(netbsd32_shmid_ds50p_t) buf; + } */ + struct shmid_ds ds; + struct netbsd32_shmid_ds50 ds32; + int error, cmd; + + cmd = SCARG(uap, cmd); + if (cmd == IPC_SET) { + error = copyin(SCARG_P32(uap, buf), &ds32, sizeof(ds32)); + if (error) + return error; + netbsd32_to_shmid_ds50(&ds32, &ds); + } + + error = shmctl1(l, SCARG(uap, shmid), cmd, + (cmd == IPC_SET || cmd == IPC_STAT) ? &ds : NULL); + + if (error == 0 && cmd == IPC_STAT) { + netbsd32_from_shmid_ds50(&ds, &ds32); + error = copyout(&ds32, SCARG_P32(uap, buf), sizeof(ds32)); + } + + return error; +} +#endif + +#endif /* COMPAT_50 */ Index: src/sys/modules/compat_netbsd32_sysvipc/Makefile diff -u /dev/null src/sys/modules/compat_netbsd32_sysvipc/Makefile:1.1 --- /dev/null Thu Dec 3 10:38:21 2015 +++ src/sys/modules/compat_netbsd32_sysvipc/Makefile Thu Dec 3 10:38:21 2015 @@ -0,0 +1,19 @@ +# $NetBSD: Makefile,v 1.1 2015/12/03 10:38:21 pgoyette Exp $ + +.include "../Makefile.inc" +.include "../Makefile.assym" + +KMOD= compat_netbsd32_sysvipc + +CPPFLAGS+= -DCOMPAT_NETBSD32 +CPPFLAGS+= -DCOMPAT_10 -DCOMPAT_13 -DCOMPAT_14 -DCOMPAT_50 +CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG + +.PATH: ${S}/compat/netbsd32 + +SRCS+= netbsd32_ipc.c +SRCS+= netbsd32_compat_10.c +SRCS+= netbsd32_compat_14.c +SRCS+= netbsd32_compat_50_sysv.c + +.include <bsd.kmodule.mk>