From 381b1356d06b80c02bcf1fce3a8053bd593afe58 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 19 May 2024 22:25:47 +0000 Subject: [PATCH] version dup3 --- include/unistd.h | 6 +- lib/libc/compat/include/unistd.h | 10 ++- lib/libc/compat/sys/Makefile.inc | 4 +- lib/libc/compat/sys/compat_dup3.c | 62 ++++++++++++++++ lib/libc/sys/Makefile.inc | 4 +- sys/compat/common/compat_110_mod.c | 79 ++++++++++++++++++++ sys/compat/common/compat_mod.h | 11 ++- sys/compat/common/files.common | 7 +- sys/compat/common/sys_decrip_110.c | 74 +++++++++++++++++++ sys/compat/netbsd32/files.netbsd32 | 3 +- sys/compat/netbsd32/netbsd32_compat_110.c | 88 +++++++++++++++++++++++ sys/compat/netbsd32/netbsd32_netbsd.c | 10 +-- sys/compat/netbsd32/syscalls.conf | 4 +- sys/compat/netbsd32/syscalls.master | 7 +- sys/conf/compat_netbsd110.config | 9 +++ sys/conf/files | 5 +- sys/kern/sys_descrip.c | 6 +- sys/kern/syscalls.conf | 4 +- sys/kern/syscalls.master | 6 +- sys/modules/Makefile | 4 +- sys/modules/compat_110/Makefile | 13 ++++ sys/modules/compat_netbsd32_110/Makefile | 14 ++++ sys/rump/Makefile.rump | 4 +- 23 files changed, 398 insertions(+), 36 deletions(-) create mode 100644 lib/libc/compat/sys/compat_dup3.c create mode 100644 sys/compat/common/compat_110_mod.c create mode 100644 sys/compat/common/sys_decrip_110.c create mode 100644 sys/compat/netbsd32/netbsd32_compat_110.c create mode 100644 sys/conf/compat_netbsd110.config create mode 100644 sys/modules/compat_110/Makefile create mode 100644 sys/modules/compat_netbsd32_110/Makefile diff --git a/include/unistd.h b/include/unistd.h index 3c6c16386c37..1bfe0aa9102a 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.164 2024/01/19 18:40:35 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.165 2024/05/19 22:25:47 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -329,7 +329,9 @@ int acct(const char *); int closefrom(int); int des_cipher(const char *, char *, long, int); int des_setkey(const char *); -int dup3(int, int, int); +#ifndef __LIBC12_SOURCE__ +int dup3(int, int, int) __RENAME(__dup3110); +#endif void endusershell(void); int exect(const char *, char * const *, char * const *); int execvpe(const char *, char * const *, char * const *); diff --git a/lib/libc/compat/include/unistd.h b/lib/libc/compat/include/unistd.h index 43cd188e4ddd..bf269b58d7eb 100644 --- a/lib/libc/compat/include/unistd.h +++ b/lib/libc/compat/include/unistd.h @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.3 2024/01/20 14:52:46 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.4 2024/05/19 22:25:47 christos Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -64,8 +64,12 @@ #define _COMPAT_UNISTD_H_ __BEGIN_DECLS -pid_t vfork(void) __returns_twice; -pid_t __vfork14(void) __returns_twice; + +pid_t vfork(void) __returns_twice; +pid_t __vfork14(void) __returns_twice; +int dup3(int, int, int); +int __dup3110(int, int, int); + __END_DECLS #endif /* !_COMPAT_UNISTD_H_ */ diff --git a/lib/libc/compat/sys/Makefile.inc b/lib/libc/compat/sys/Makefile.inc index 83452169b77d..268a5d42da8a 100644 --- a/lib/libc/compat/sys/Makefile.inc +++ b/lib/libc/compat/sys/Makefile.inc @@ -1,8 +1,8 @@ -# $NetBSD: Makefile.inc,v 1.11 2021/11/01 05:53:45 thorpej Exp $ +# $NetBSD: Makefile.inc,v 1.12 2024/05/19 22:25:47 christos Exp $ .PATH: ${COMPATDIR}/sys SRCS+= compat_getdents.c compat_getdirentries.c compat_msync.c \ - compat_ntp_gettime.c compat_sched.c \ + compat_ntp_gettime.c compat_sched.c compat_dup3.c \ compat_semctl.c compat_sigaltstack.c compat_stat.c compat___stat13.c \ compat_statfs.c compat_statvfs.c compat_socket.c compat_getfh.c \ compat_fhopen.c compat___fhstat30.c compat_fhstatvfs.c compat_fhstatvfs1.c \ diff --git a/lib/libc/compat/sys/compat_dup3.c b/lib/libc/compat/sys/compat_dup3.c new file mode 100644 index 000000000000..ce6b2cfb0dc1 --- /dev/null +++ b/lib/libc/compat/sys/compat_dup3.c @@ -0,0 +1,62 @@ +/* $NetBSD: compat_dup3.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */ + +/*- + * Copyright (c) 2024 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. + * + * 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 +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: compat_dup3.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#include "namespace.h" +#define __LIBC12_SOURCE__ +#include +#include + +__warn_references(dup3, + "warning: reference to compatibility dup3(); include to generate correct reference") + +int +dup3(int oldfd, int newfd, int flags) +{ + if (oldfd != newfd) { + return __dup3110(oldfd, newfd, flags); + } + if (flags & (O_NONBLOCK|O_NOSIGPIPE)) { + int e = fcntl(newfd, F_GETFL, 0); + if (e == -1) + return -1; + e |= flags & (O_NONBLOCK|O_NOSIGPIPE); + e = fcntl(newfd, F_SETFL, e); + if (e == -1) + return -1; + } + if (flags & O_CLOEXEC) + return fcntl(newfd, F_SETFD, FD_CLOEXEC); + return 0; +} diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 8eb8163600ef..1abf57f11360 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.253 2023/08/03 12:24:46 nia Exp $ +# $NetBSD: Makefile.inc,v 1.254 2024/05/19 22:25:48 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 dup3.S \ + dup.S dup2.S __dup3110.S \ eventfd.S \ extattrctl.S \ extattr_delete_fd.S extattr_delete_file.S \ diff --git a/sys/compat/common/compat_110_mod.c b/sys/compat/common/compat_110_mod.c new file mode 100644 index 000000000000..9e2d6a2e105e --- /dev/null +++ b/sys/compat/common/compat_110_mod.c @@ -0,0 +1,79 @@ +/* $NetBSD: compat_110_mod.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */ + +/*- + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software developed for The NetBSD Foundation + * by Paul Goyette + * + * 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. + */ + +/* + * Linkage for the compat module: spaghetti. + */ + +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#endif + +#include +__KERNEL_RCSID(0, "$NetBSD: compat_110_mod.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); + +#include +#include + +#include +#include + +int +compat_110_init(void) +{ + + return sys_descrip_110_init(); +} + +int +compat_110_fini(void) +{ + + return sys_descrip_110_fini(); +} + +MODULE(MODULE_CLASS_EXEC, compat_110, NULL); + +static int +compat_110_modcmd(modcmd_t cmd, void *arg) +{ + + switch (cmd) { + case MODULE_CMD_INIT: + return compat_110_init(); + + case MODULE_CMD_FINI: + return compat_110_fini(); + + default: + return ENOTTY; + } +} diff --git a/sys/compat/common/compat_mod.h b/sys/compat/common/compat_mod.h index 4f5a80d48893..276bd4d6accb 100644 --- a/sys/compat/common/compat_mod.h +++ b/sys/compat/common/compat_mod.h @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.h,v 1.10 2023/12/09 15:21:01 pgoyette Exp $ */ +/* $NetBSD: compat_mod.h,v 1.11 2024/05/19 22:25:48 christos Exp $ */ /*- * Copyright (c) 2013, 2019 The NetBSD Foundation, Inc. @@ -32,13 +32,18 @@ #ifndef _COMPAT_MOD_H #define _COMPAT_MOD_H +#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 int compat_100_init(void); int compat_100_fini(void); int kern_event_100_init(void); int kern_event_100_fini(void); -void usb_100_init(void); -void usb_100_fini(void); #endif #ifdef COMPAT_90 diff --git a/sys/compat/common/files.common b/sys/compat/common/files.common index a11b0abc3fd0..d63d9a5dc331 100644 --- a/sys/compat/common/files.common +++ b/sys/compat/common/files.common @@ -1,4 +1,4 @@ -# $NetBSD: files.common,v 1.11 2023/12/09 15:21:01 pgoyette Exp $ +# $NetBSD: files.common,v 1.12 2024/05/19 22:25:48 christos Exp $ # # Generic utility files, used by various compat options. @@ -114,7 +114,10 @@ file compat/common/net_inet6_nd_90.c compat_90 # 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/usb_subr_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. diff --git a/sys/compat/common/sys_decrip_110.c b/sys/compat/common/sys_decrip_110.c new file mode 100644 index 000000000000..4ba16696dc18 --- /dev/null +++ b/sys/compat/common/sys_decrip_110.c @@ -0,0 +1,74 @@ +/* $NetBSD: sys_decrip_110.c,v 1.1 2024/05/19 22:25:48 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 +__KERNEL_RCSID(0, "$NetBSD: sys_decrip_110.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); + +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#endif + +#include +#include +#include +#include +#include + +#include + +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); +} diff --git a/sys/compat/netbsd32/files.netbsd32 b/sys/compat/netbsd32/files.netbsd32 index 2dc43912bc7c..e011958b50e9 100644 --- a/sys/compat/netbsd32/files.netbsd32 +++ b/sys/compat/netbsd32/files.netbsd32 @@ -1,4 +1,4 @@ -# $NetBSD: files.netbsd32,v 1.55 2023/07/30 06:52:20 rin Exp $ +# $NetBSD: files.netbsd32,v 1.56 2024/05/19 22:25:48 christos Exp $ # # config file description for machine-independent netbsd32 compat code. # included by ports that need it. @@ -66,3 +66,4 @@ file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60 file compat/netbsd32/netbsd32_compat_80.c compat_netbsd32 & compat_80 file compat/netbsd32/netbsd32_compat_90.c compat_netbsd32 & compat_90 file compat/netbsd32/netbsd32_compat_100.c compat_netbsd32 & compat_100 +file compat/netbsd32/netbsd32_compat_110.c compat_netbsd32 & compat_110 diff --git a/sys/compat/netbsd32/netbsd32_compat_110.c b/sys/compat/netbsd32/netbsd32_compat_110.c new file mode 100644 index 000000000000..5413e9e24b76 --- /dev/null +++ b/sys/compat/netbsd32/netbsd32_compat_110.c @@ -0,0 +1,88 @@ +/* $NetBSD: netbsd32_compat_110.c,v 1.1 2024/05/19 22:25:48 christos Exp $ */ + +/*- + * Copyright (c) 2024 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software developed for 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. + * + * 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 +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_110.c,v 1.1 2024/05/19 22:25:48 christos Exp $"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +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 }, +}; + +MODULE(MODULE_CLASS_EXEC, compat_netbsd32_110, "compat_netbsd32,compat_110"); + +static int +compat_netbsd32_110_modcmd(modcmd_t cmd, void *arg) +{ + + switch (cmd) { + case MODULE_CMD_INIT: + return syscall_establish(&emul_netbsd32, + compat_netbsd32_110_syscalls); + + case MODULE_CMD_FINI: + return syscall_disestablish(&emul_netbsd32, + compat_netbsd32_110_syscalls); + + default: + return ENOTTY; + } +} diff --git a/sys/compat/netbsd32/netbsd32_netbsd.c b/sys/compat/netbsd32/netbsd32_netbsd.c index 742b61a5c34a..4133d2ac98b8 100644 --- a/sys/compat/netbsd32/netbsd32_netbsd.c +++ b/sys/compat/netbsd32/netbsd32_netbsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $ */ +/* $NetBSD: netbsd32_netbsd.c,v 1.236 2024/05/19 22:25:48 christos Exp $ */ /* * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.236 2024/05/19 22:25:48 christos Exp $"); /* * below are all the standard NetBSD system calls, in the 32bit @@ -2462,7 +2462,7 @@ netbsd32__sched_protect(struct lwp *l, } int -netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap, +netbsd32___dup3110(struct lwp *l, const struct netbsd32___dup3110_args *uap, register_t *retval) { /* { @@ -2470,13 +2470,13 @@ netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap, syscallarg(int) to; syscallarg(int) flags; } */ - struct sys_dup3_args ua; + struct sys___dup3110_args ua; NETBSD32TO64_UAP(from); NETBSD32TO64_UAP(to); NETBSD32TO64_UAP(flags); - return sys_dup3(l, &ua, retval); + return sys___dup3110(l, &ua, retval); } int diff --git a/sys/compat/netbsd32/syscalls.conf b/sys/compat/netbsd32/syscalls.conf index afe172c0a459..bf377bfe0411 100644 --- a/sys/compat/netbsd32/syscalls.conf +++ b/sys/compat/netbsd32/syscalls.conf @@ -1,4 +1,4 @@ -# $NetBSD: syscalls.conf,v 1.18 2022/12/19 23:19:51 pgoyette Exp $ +# $NetBSD: syscalls.conf,v 1.19 2024/05/19 22:25:48 christos Exp $ sysnames="netbsd32_syscalls.c" sysnumhdr="netbsd32_syscall.h" @@ -6,7 +6,7 @@ syssw="netbsd32_sysent.c" sysarghdr="netbsd32_syscallargs.h" systrace="netbsd32_systrace_args.c" sysautoload="netbsd32_syscalls_autoload.c" -compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90 compat_100" +compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90 compat_100 compat_110" libcompatopts="" switchname="netbsd32_sysent" diff --git a/sys/compat/netbsd32/syscalls.master b/sys/compat/netbsd32/syscalls.master index 8244289aa1a8..481579647da9 100644 --- a/sys/compat/netbsd32/syscalls.master +++ b/sys/compat/netbsd32/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.144 2023/07/30 06:52:20 rin Exp $ + $NetBSD: syscalls.master,v 1.145 2024/05/19 22:25:48 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,8 @@ 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 STD { int|netbsd32||dup3(int from, int to, int flags); } +454 COMPAT_110 MODULAR compat_netbsd32_110 \ + { int|netbsd32||dup3(int from, int to, int flags); } 455 STD { int|netbsd32||kqueue1(int flags); } 456 STD { int|netbsd32||paccept(int s, \ netbsd32_sockaddrp_t name, \ @@ -1229,3 +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, \ + int flags); } diff --git a/sys/conf/compat_netbsd110.config b/sys/conf/compat_netbsd110.config new file mode 100644 index 000000000000..0e909c3f6faf --- /dev/null +++ b/sys/conf/compat_netbsd110.config @@ -0,0 +1,9 @@ +# $NetBSD: compat_netbsd110.config,v 1.1 2024/05/19 22:25:48 christos Exp $ + +# Common fragment for all NetBSD targets wanting NetBSD 10.0 and newer +# compatibility support. +# +# Note that COMPAT_110 implies all newer COMPAT_XX options. + +include "conf/compat_netbsd.config" +options COMPAT_110 # NetBSD 11.0 and beyond. diff --git a/sys/conf/files b/sys/conf/files index e021fb6d19db..30f7089fca94 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1312 2024/04/02 22:30:03 charlotte Exp $ +# $NetBSD: files,v 1.1313 2024/05/19 22:25:48 christos Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -151,7 +151,8 @@ defflag opt_efi.h EFI_RUNTIME # compatibility options # defflag opt_compat_netbsd.h COMPAT_NETBSD -defflag opt_compat_netbsd.h COMPAT_100: COMPAT_NETBSD +defflag opt_compat_netbsd.h COMPAT_110: COMPAT_NETBSD +defflag opt_compat_netbsd.h COMPAT_100: COMPAT_110, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_90: COMPAT_100, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_80: COMPAT_90, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_70: COMPAT_80, COMPAT_NETBSD diff --git a/sys/kern/sys_descrip.c b/sys/kern/sys_descrip.c index 6f3c8294e5b9..59b9ccc8f5a6 100644 --- a/sys/kern/sys_descrip.c +++ b/sys/kern/sys_descrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_descrip.c,v 1.49 2024/05/19 15:56:55 christos Exp $ */ +/* $NetBSD: sys_descrip.c,v 1.50 2024/05/19 22:25:48 christos Exp $ */ /*- * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.49 2024/05/19 15:56:55 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.50 2024/05/19 22:25:48 christos Exp $"); #include #include @@ -149,7 +149,7 @@ dodup(struct lwp *l, int from, int to, int flags, register_t *retval) } int -sys_dup3(struct lwp *l, const struct sys_dup3_args *uap, register_t *retval) +sys___dup3110(struct lwp *l, const struct sys___dup3110_args *uap, register_t *retval) { /* { syscallarg(int) from; diff --git a/sys/kern/syscalls.conf b/sys/kern/syscalls.conf index 9ce2d33abf72..eceeb6861f54 100644 --- a/sys/kern/syscalls.conf +++ b/sys/kern/syscalls.conf @@ -1,4 +1,4 @@ -# $NetBSD: syscalls.conf,v 1.32 2023/07/28 18:19:01 christos Exp $ +# $NetBSD: syscalls.conf,v 1.33 2024/05/19 22:25:48 christos Exp $ sysnames="syscalls.c" sysnumhdr="../sys/syscall.h" @@ -11,7 +11,7 @@ sysalign=1 rumpcalls="../rump/librump/rumpkern/rump_syscalls.c" rumpcallshdr="../rump/include/rump/rump_syscalls.h" rumpsysmap="../rump/rump.sysmap" -compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90 compat_100" +compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90 compat_100 compat_110" libcompatopts="" switchname="sysent" diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index b93cc4716771..bed427e90f75 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.311 2023/07/28 18:19:01 christos Exp $ + $NetBSD: syscalls.master,v 1.312 2024/05/19 22:25:48 christos Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -954,7 +954,8 @@ ; 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 STD RUMP { int|sys||dup3(int from, int to, int flags); } +454 COMPAT_110 MODULAR compat_110 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, \ socklen_t *anamelen, const sigset_t *mask, \ @@ -1063,3 +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); } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 8c93ee1ca3df..ca129bccbe2e 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.286 2024/05/09 12:09:59 pho Exp $ +# $NetBSD: Makefile,v 1.287 2024/05/19 22:25:49 christos Exp $ .include @@ -12,6 +12,7 @@ SUBDIR+= compat_43 compat_sysctl_09_43 SUBDIR+= compat_09 compat_10 compat_12 compat_13 compat_14 SUBDIR+= compat_16 compat_20 compat_30 compat_40 compat_50 SUBDIR+= compat_60 compat_70 compat_80 compat_90 compat_100 +SUBDIR+= compat_110 SUBDIR+= compat_sysv_10 compat_sysv_14 compat_sysv_50 @@ -318,6 +319,7 @@ SUBDIR+= compat_netbsd32_20 compat_netbsd32_30 SUBDIR+= compat_netbsd32_40 compat_netbsd32_50 SUBDIR+= compat_netbsd32_60 compat_netbsd32_80 SUBDIR+= compat_netbsd32_90 compat_netbsd32_100 +SUBDIR+= compat_netbsd32_110 SUBDIR+= compat_netbsd32_43 SUBDIR+= compat_netbsd32_coredump SUBDIR+= compat_netbsd32_mqueue diff --git a/sys/modules/compat_110/Makefile b/sys/modules/compat_110/Makefile new file mode 100644 index 000000000000..9c97af9eb299 --- /dev/null +++ b/sys/modules/compat_110/Makefile @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.1 2024/05/19 22:25:49 christos Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/compat/common + +KMOD= compat_110 + +CPPFLAGS+= -DCOMPAT_110 + +SRCS+= compat_110_mod.c sys_decrip_110.c + +.include diff --git a/sys/modules/compat_netbsd32_110/Makefile b/sys/modules/compat_netbsd32_110/Makefile new file mode 100644 index 000000000000..acf489779cb2 --- /dev/null +++ b/sys/modules/compat_netbsd32_110/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2024/05/19 22:25:49 christos Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/compat/netbsd32 + +KMOD= compat_netbsd32_110 + +CPPFLAGS+= -DCOMPAT_NETBSD32 +CPPFLAGS+= -DCOMPAT_110 + +SRCS+= netbsd32_compat_110.c + +.include diff --git a/sys/rump/Makefile.rump b/sys/rump/Makefile.rump index 7f157e9f3fa7..06be93fb2fc6 100644 --- a/sys/rump/Makefile.rump +++ b/sys/rump/Makefile.rump @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rump,v 1.136 2024/02/04 18:52:36 andvar Exp $ +# $NetBSD: Makefile.rump,v 1.137 2024/05/19 22:25:49 christos Exp $ # .if !defined(_RUMP_MK) @@ -48,7 +48,7 @@ CPPFLAGS+= -DMIPS1=1 # which NetBSD compat to build RUMP_NBCOMPAT?=default .if ${RUMP_NBCOMPAT} == "all" || ${RUMP_NBCOMPAT} == "default" -RUMP_NBCOMPAT= 50 60 70 80 90 100 +RUMP_NBCOMPAT= 50 60 70 80 90 100 110 .endif .if ${RUMP_NBCOMPAT} == "none" RUMP_NBCOMPAT=