Module Name: src Committed By: christos Date: Mon May 20 01:30:34 UTC 2024
Modified Files: src/include: unistd.h src/lib/libc/sys: Makefile.inc src/sys/compat/common: compat_100_mod.c compat_110_mod.c compat_mod.h files.common src/sys/compat/netbsd32: netbsd32_compat_100.c netbsd32_compat_110.c netbsd32_netbsd.c syscalls.master src/sys/kern: syscalls.master src/sys/modules/compat_110: Makefile Added Files: src/sys/compat/common: sys_descrip_100.c Removed Files: src/sys/compat/common: sys_decrip_110.c Log Message: Rename dup3110 to dup3100 to match historical practice for NetBSD-11, because we already have kevent100. Fix compat_dup3 to belong in compat_100 not compat_110. To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 src/include/unistd.h cvs rdiff -u -r1.254 -r1.255 src/lib/libc/sys/Makefile.inc cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/compat_100_mod.c cvs rdiff -u -r1.1 -r1.2 src/sys/compat/common/compat_110_mod.c cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/compat_mod.h cvs rdiff -u -r1.12 -r1.13 src/sys/compat/common/files.common cvs rdiff -u -r1.1 -r0 src/sys/compat/common/sys_decrip_110.c cvs rdiff -u -r0 -r1.1 src/sys/compat/common/sys_descrip_100.c cvs rdiff -u -r1.3 -r1.4 src/sys/compat/netbsd32/netbsd32_compat_100.c cvs rdiff -u -r1.1 -r1.2 src/sys/compat/netbsd32/netbsd32_compat_110.c cvs rdiff -u -r1.236 -r1.237 src/sys/compat/netbsd32/netbsd32_netbsd.c cvs rdiff -u -r1.145 -r1.146 src/sys/compat/netbsd32/syscalls.master cvs rdiff -u -r1.312 -r1.313 src/sys/kern/syscalls.master cvs rdiff -u -r1.1 -r1.2 src/sys/modules/compat_110/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/include/unistd.h diff -u src/include/unistd.h:1.165 src/include/unistd.h:1.166 --- src/include/unistd.h:1.165 Sun May 19 18:25:47 2024 +++ src/include/unistd.h Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.165 2024/05/19 22:25:47 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.166 2024/05/20 01:30:33 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -330,7 +330,7 @@ int closefrom(int); int des_cipher(const char *, char *, long, int); int des_setkey(const char *); #ifndef __LIBC12_SOURCE__ -int dup3(int, int, int) __RENAME(__dup3110); +int dup3(int, int, int) __RENAME(__dup3100); #endif void endusershell(void); int exect(const char *, char * const *, char * const *); Index: src/lib/libc/sys/Makefile.inc diff -u src/lib/libc/sys/Makefile.inc:1.254 src/lib/libc/sys/Makefile.inc:1.255 --- src/lib/libc/sys/Makefile.inc:1.254 Sun May 19 18:25:48 2024 +++ src/lib/libc/sys/Makefile.inc Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.254 2024/05/19 22:25:48 christos Exp $ +# $NetBSD: Makefile.inc,v 1.255 2024/05/20 01:30:33 christos Exp $ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 # sys sources @@ -102,7 +102,7 @@ ASM=\ chdir.S chflags.S chmod.S chown.S chroot.S \ clock_getcpuclockid2.S \ __clock_getres50.S __clock_gettime50.S \ - dup.S dup2.S __dup3110.S \ + dup.S dup2.S __dup3100.S \ eventfd.S \ extattrctl.S \ extattr_delete_fd.S extattr_delete_file.S \ Index: src/sys/compat/common/compat_100_mod.c diff -u src/sys/compat/common/compat_100_mod.c:1.2 src/sys/compat/common/compat_100_mod.c:1.3 --- src/sys/compat/common/compat_100_mod.c:1.2 Fri Jul 28 14:19:00 2023 +++ src/sys/compat/common/compat_100_mod.c Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_100_mod.c,v 1.2 2023/07/28 18:19:00 christos Exp $ */ +/* $NetBSD: compat_100_mod.c,v 1.3 2024/05/20 01:30:34 christos Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_100_mod.c,v 1.2 2023/07/28 18:19:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_100_mod.c,v 1.3 2024/05/20 01:30:34 christos Exp $"); #include <sys/systm.h> #include <sys/module.h> @@ -49,15 +49,23 @@ __KERNEL_RCSID(0, "$NetBSD: compat_100_m int compat_100_init(void) { + int error; - return kern_event_100_init(); + error = kern_event_100_init(); + if (error) + return error; + return sys_descrip_100_init(); } int compat_100_fini(void) { + int error; - return kern_event_100_fini(); + error = kern_event_100_fini(); + if (error) + return error; + return sys_descrip_100_fini(); } MODULE(MODULE_CLASS_EXEC, compat_100, NULL); Index: src/sys/compat/common/compat_110_mod.c diff -u src/sys/compat/common/compat_110_mod.c:1.1 src/sys/compat/common/compat_110_mod.c:1.2 --- src/sys/compat/common/compat_110_mod.c:1.1 Sun May 19 18:25:48 2024 +++ src/sys/compat/common/compat_110_mod.c Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_110_mod.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */ +/* $NetBSD: compat_110_mod.c,v 1.2 2024/05/20 01:30:34 christos Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_110_mod.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_110_mod.c,v 1.2 2024/05/20 01:30:34 christos Exp $"); #include <sys/systm.h> #include <sys/module.h> @@ -49,15 +49,13 @@ __KERNEL_RCSID(0, "$NetBSD: compat_110_m int compat_110_init(void) { - - return sys_descrip_110_init(); + return 0; } int compat_110_fini(void) { - - return sys_descrip_110_fini(); + return 0; } MODULE(MODULE_CLASS_EXEC, compat_110, NULL); Index: src/sys/compat/common/compat_mod.h diff -u src/sys/compat/common/compat_mod.h:1.11 src/sys/compat/common/compat_mod.h:1.12 --- src/sys/compat/common/compat_mod.h:1.11 Sun May 19 18:25:48 2024 +++ src/sys/compat/common/compat_mod.h Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.h,v 1.11 2024/05/19 22:25:48 christos Exp $ */ +/* $NetBSD: compat_mod.h,v 1.12 2024/05/20 01:30:34 christos Exp $ */ /*- * Copyright (c) 2013, 2019 The NetBSD Foundation, Inc. @@ -35,8 +35,6 @@ #ifdef COMPAT_110 int compat_110_init(void); int compat_110_fini(void); -int sys_descrip_110_init(void); -int sys_descrip_110_fini(void); #endif #ifdef COMPAT_100 @@ -44,6 +42,8 @@ int compat_100_init(void); int compat_100_fini(void); int kern_event_100_init(void); int kern_event_100_fini(void); +int sys_descrip_100_init(void); +int sys_descrip_100_fini(void); #endif #ifdef COMPAT_90 Index: src/sys/compat/common/files.common diff -u src/sys/compat/common/files.common:1.12 src/sys/compat/common/files.common:1.13 --- src/sys/compat/common/files.common:1.12 Sun May 19 18:25:48 2024 +++ src/sys/compat/common/files.common Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ -# $NetBSD: files.common,v 1.12 2024/05/19 22:25:48 christos Exp $ +# $NetBSD: files.common,v 1.13 2024/05/20 01:30:34 christos Exp $ # # Generic utility files, used by various compat options. @@ -114,10 +114,11 @@ file compat/common/net_inet6_nd_90.c co # Compatibility code for NetBSD 10.0 file compat/common/compat_100_mod.c compat_100 file compat/common/kern_event_100.c compat_100 +file compat/common/compat_100_mod.c compat_100 +file compat/common/sys_descrip_100.c compat_100 # Compatibility code for NetBSD 11.0 file compat/common/compat_110_mod.c compat_110 -file compat/common/sys_descrip_110.c compat_110 # # Sources for sysv ipc compatibility across the versions. Index: src/sys/compat/netbsd32/netbsd32_compat_100.c diff -u src/sys/compat/netbsd32/netbsd32_compat_100.c:1.3 src/sys/compat/netbsd32/netbsd32_compat_100.c:1.4 --- src/sys/compat/netbsd32/netbsd32_compat_100.c:1.3 Sat Jul 29 08:48:15 2023 +++ src/sys/compat/netbsd32/netbsd32_compat_100.c Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_100.c,v 1.3 2023/07/29 12:48:15 rin Exp $ */ +/* $NetBSD: netbsd32_compat_100.c,v 1.4 2024/05/20 01:30:33 christos Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,9 +30,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_100.c,v 1.3 2023/07/29 12:48:15 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_100.c,v 1.4 2024/05/20 01:30:33 christos Exp $"); #include <sys/types.h> +#include <sys/filedesc.h> #include <sys/event.h> #include <sys/eventvar.h> #include <sys/module.h> @@ -129,9 +130,29 @@ compat_100_netbsd32___kevent50(struct lw SCARG(uap, timeout), &netbsd32_kevent_ops); } +int +compat_100_netbsd32_dup3(struct lwp *l, + const struct compat_100_netbsd32_dup3_args *uap, register_t *retval) +{ + /* { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; + syscallarg(const netbsd32_kevent100p_t) changelist; + syscallarg(netbsd32_size_t) nchanges; + syscallarg(netbsd32_kevent100p_t) eventlist; + syscallarg(netbsd32_size_t) nevents; + syscallarg(netbsd32_timespecp_t) timeout; + } */ + return dodup(l, SCARG(uap, from), SCARG(uap, to), SCARG(uap, flags), + retval); +} + static struct syscall_package compat_netbsd32_100_syscalls[] = { { NETBSD32_SYS_compat_100_netbsd32___kevent50, 0, (sy_call_t *)compat_100_netbsd32___kevent50 }, + { NETBSD32_SYS_compat_100_netbsd32_dup3, 0, + (sy_call_t *)compat_100_netbsd32_dup3 }, { 0, 0, NULL }, }; Index: src/sys/compat/netbsd32/netbsd32_compat_110.c diff -u src/sys/compat/netbsd32/netbsd32_compat_110.c:1.1 src/sys/compat/netbsd32/netbsd32_compat_110.c:1.2 --- src/sys/compat/netbsd32/netbsd32_compat_110.c:1.1 Sun May 19 18:25:48 2024 +++ src/sys/compat/netbsd32/netbsd32_compat_110.c Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_110.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */ +/* $NetBSD: netbsd32_compat_110.c,v 1.2 2024/05/20 01:30:33 christos Exp $ */ /*- * Copyright (c) 2024 The NetBSD Foundation, Inc. @@ -30,10 +30,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_110.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_110.c,v 1.2 2024/05/20 01:30:33 christos Exp $"); #include <sys/types.h> -#include <sys/filedesc.h> #include <sys/module.h> #include <sys/syscallvar.h> #include <sys/syscallargs.h> @@ -43,27 +42,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com #include <compat/netbsd32/netbsd32_syscall.h> #include <compat/netbsd32/netbsd32_syscallargs.h> -int -compat_110_netbsd32_dup3(struct lwp *l, - const struct compat_110_netbsd32_dup3_args *uap, register_t *retval) -{ - /* { - syscallarg(int) from; - syscallarg(int) to; - syscallarg(int) flags; - syscallarg(const netbsd32_kevent100p_t) changelist; - syscallarg(netbsd32_size_t) nchanges; - syscallarg(netbsd32_kevent100p_t) eventlist; - syscallarg(netbsd32_size_t) nevents; - syscallarg(netbsd32_timespecp_t) timeout; - } */ - return dodup(l, SCARG(uap, from), SCARG(uap, to), SCARG(uap, flags), - retval); -} static struct syscall_package compat_netbsd32_110_syscalls[] = { - { NETBSD32_SYS_compat_110_netbsd32_dup3, 0, - (sy_call_t *)compat_110_netbsd32_dup3 }, { 0, 0, NULL }, }; Index: src/sys/compat/netbsd32/netbsd32_netbsd.c diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.236 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.237 --- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.236 Sun May 19 18:25:48 2024 +++ src/sys/compat/netbsd32/netbsd32_netbsd.c Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_netbsd.c,v 1.236 2024/05/19 22:25:48 christos Exp $ */ +/* $NetBSD: netbsd32_netbsd.c,v 1.237 2024/05/20 01:30:33 christos Exp $ */ /* * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.236 2024/05/19 22:25:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.237 2024/05/20 01:30:33 christos Exp $"); /* * below are all the standard NetBSD system calls, in the 32bit @@ -2462,21 +2462,21 @@ netbsd32__sched_protect(struct lwp *l, } int -netbsd32___dup3110(struct lwp *l, const struct netbsd32___dup3110_args *uap, - register_t *retval) +netbsd32___dup3100(struct lwp *l, const struct netbsd32___dup3100_args *uap, + register_t *retval) { /* { syscallarg(int) from; syscallarg(int) to; syscallarg(int) flags; } */ - struct sys___dup3110_args ua; + struct sys___dup3100_args ua; NETBSD32TO64_UAP(from); NETBSD32TO64_UAP(to); NETBSD32TO64_UAP(flags); - return sys___dup3110(l, &ua, retval); + return sys___dup3100(l, &ua, retval); } int Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.145 src/sys/compat/netbsd32/syscalls.master:1.146 --- src/sys/compat/netbsd32/syscalls.master:1.145 Sun May 19 18:25:48 2024 +++ src/sys/compat/netbsd32/syscalls.master Sun May 19 21:30:33 2024 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.145 2024/05/19 22:25:48 christos Exp $ + $NetBSD: syscalls.master,v 1.146 2024/05/20 01:30:33 christos Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -1069,7 +1069,7 @@ netbsd32_size_t fh_size, netbsd32_statp_t sb); } 452 OBSOL 5.99 quotactl 453 STD { int|netbsd32||pipe2(netbsd32_intp fildes, int flags); } -454 COMPAT_110 MODULAR compat_netbsd32_110 \ +454 COMPAT_100 MODULAR compat_netbsd32_100 \ { int|netbsd32||dup3(int from, int to, int flags); } 455 STD { int|netbsd32||kqueue1(int flags); } 456 STD { int|netbsd32||paccept(int s, \ @@ -1230,5 +1230,5 @@ netbsd32_epoll_eventp_t events, int maxevents, \ netbsd32_timespecp_t timeout, \ netbsd32_sigsetp_t sigmask); } -505 STD { int|netbsd32|110|dup3(int from, int to, \ +505 STD { int|netbsd32|100|dup3(int from, int to, \ int flags); } Index: src/sys/kern/syscalls.master diff -u src/sys/kern/syscalls.master:1.312 src/sys/kern/syscalls.master:1.313 --- src/sys/kern/syscalls.master:1.312 Sun May 19 18:25:48 2024 +++ src/sys/kern/syscalls.master Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.312 2024/05/19 22:25:48 christos Exp $ + $NetBSD: syscalls.master,v 1.313 2024/05/20 01:30:34 christos Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -954,7 +954,7 @@ ; 452 only ever appeared in 5.99.x and can be reused after netbsd-7 452 OBSOL 5.99 quotactl 453 STD RUMP { int|sys||pipe2(int *fildes, int flags); } -454 COMPAT_110 MODULAR compat_110 RUMP \ +454 COMPAT_100 MODULAR compat_100 RUMP \ { int|sys||dup3(int from, int to, int flags); } 455 STD RUMP { int|sys||kqueue1(int flags); } 456 STD RUMP { int|sys||paccept(int s, struct sockaddr *name, \ @@ -1064,4 +1064,4 @@ struct epoll_event *events, int maxevents, \ const struct timespec *timeout, \ const sigset_t *sigmask); } -505 STD RUMP { int|sys|110|dup3(int from, int to, int flags); } +505 STD RUMP { int|sys|100|dup3(int from, int to, int flags); } Index: src/sys/modules/compat_110/Makefile diff -u src/sys/modules/compat_110/Makefile:1.1 src/sys/modules/compat_110/Makefile:1.2 --- src/sys/modules/compat_110/Makefile:1.1 Sun May 19 18:25:49 2024 +++ src/sys/modules/compat_110/Makefile Sun May 19 21:30:34 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2024/05/19 22:25:49 christos Exp $ +# $NetBSD: Makefile,v 1.2 2024/05/20 01:30:34 christos Exp $ .include "../Makefile.inc" @@ -8,6 +8,6 @@ KMOD= compat_110 CPPFLAGS+= -DCOMPAT_110 -SRCS+= compat_110_mod.c sys_decrip_110.c +SRCS+= compat_110_mod.c .include <bsd.kmodule.mk> Added files: Index: src/sys/compat/common/sys_descrip_100.c diff -u /dev/null src/sys/compat/common/sys_descrip_100.c:1.1 --- /dev/null Sun May 19 21:30:34 2024 +++ src/sys/compat/common/sys_descrip_100.c Sun May 19 21:30:34 2024 @@ -0,0 +1,74 @@ +/* $NetBSD: sys_descrip_100.c,v 1.1 2024/05/20 01:30:34 christos Exp $ */ + +/*- + * Copyright (c) 2024 The NetBSD Foundation, Inc. + * 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 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: sys_descrip_100.c,v 1.1 2024/05/20 01:30:34 christos Exp $"); + +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#endif + +#include <sys/param.h> +#include <sys/filedesc.h> +#include <sys/syscall.h> +#include <sys/syscallvar.h> +#include <sys/syscallargs.h> + +#include <compat/common/compat_mod.h> + +static const struct syscall_package sys_descrip_110_syscalls[] = { + { SYS_compat_110_dup3, 0, + (sy_call_t *)compat_110_sys_dup3 }, + { 0, 0, NULL }, +}; + +int +sys_descrip_110_init(void) +{ + + return syscall_establish(NULL, sys_descrip_110_syscalls); +} + +int +sys_descrip_110_fini(void) +{ + + return syscall_disestablish(NULL, sys_descrip_110_syscalls); +} + +int +compat_110_sys_dup3(struct lwp *l, const struct compat_110_sys_dup3_args *uap, + register_t *retval) +{ + /* { + syscallarg(int) from; + syscallarg(int) to; + syscallarg(int) flags; + } */ + return dodup(l, SCARG(uap, from), SCARG(uap, to), SCARG(uap, flags), + retval); +}