Sun Jul 30 05:30:45 2023 UTC ()
COMPAT_NETBSD32: Add support for memfd_create(2).


(rin)
diff -r1.234 -r1.235 src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -r1.142 -r1.143 src/sys/compat/netbsd32/syscalls.master

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

--- src/sys/compat/netbsd32/netbsd32_netbsd.c 2023/07/30 05:10:47 1.234
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c 2023/07/30 05:30:45 1.235
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_netbsd.c,v 1.234 2023/07/30 05:10:47 rin Exp $ */ 1/* $NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin 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,27 +17,27 @@ @@ -17,27 +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.234 2023/07/30 05:10:47 rin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $");
31 31
32/* 32/*
33 * below are all the standard NetBSD system calls, in the 32bit 33 * below are all the standard NetBSD system calls, in the 32bit
34 * environment, with the necessary conversions to 64bit before calling 34 * environment, with the necessary conversions to 64bit before calling
35 * the real syscall. anything that needs special attention is handled 35 * the real syscall. anything that needs special attention is handled
36 * elsewhere - this file should only contain structure assignment and 36 * elsewhere - this file should only contain structure assignment and
37 * calls to the original function. 37 * calls to the original function.
38 */ 38 */
39 39
40/* 40/*
41 * below are all the standard NetBSD system calls, in the 32bit 41 * below are all the standard NetBSD system calls, in the 32bit
42 * environment, with the necessary conversions to 64bit before calling 42 * environment, with the necessary conversions to 64bit before calling
43 * the real syscall. anything that needs special attention is handled 43 * the real syscall. anything that needs special attention is handled
@@ -2638,26 +2638,41 @@ netbsd32_eventfd(struct lwp *l, @@ -2638,26 +2638,41 @@ netbsd32_eventfd(struct lwp *l,
2638 const struct netbsd32_eventfd_args *uap, register_t *retval) 2638 const struct netbsd32_eventfd_args *uap, register_t *retval)
2639{ 2639{
2640 /* { 2640 /* {
2641 syscallarg(unsigned int) val; 2641 syscallarg(unsigned int) val;
2642 syscallarg(int) flags; 2642 syscallarg(int) flags;
2643 } */ 2643 } */
2644 struct sys_eventfd_args ua; 2644 struct sys_eventfd_args ua;
2645 2645
2646 NETBSD32TO64_UAP(val); 2646 NETBSD32TO64_UAP(val);
2647 NETBSD32TO64_UAP(flags); 2647 NETBSD32TO64_UAP(flags);
2648 return sys_eventfd(l, &ua, retval); 2648 return sys_eventfd(l, &ua, retval);
2649} 2649}
2650 2650
 2651int
 2652netbsd32_memfd_create(struct lwp *l,
 2653 const struct netbsd32_memfd_create_args *uap, register_t *retval)
 2654{
 2655 /* {
 2656 syscallarg(const netbsd32_charp) name;
 2657 syscallarg(unsigned int) flags;
 2658 } */
 2659 struct sys_memfd_create_args ua;
 2660
 2661 NETBSD32TOP_UAP(name, const char);
 2662 NETBSD32TO64_UAP(flags);
 2663 return sys_memfd_create(l, &ua, retval);
 2664}
 2665
2651/* 2666/*
2652 * MI indirect system call support. 2667 * MI indirect system call support.
2653 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls. 2668 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.
2654 */ 2669 */
2655 2670
2656#define NETBSD32_SYSCALL 2671#define NETBSD32_SYSCALL
2657#undef SYS_NSYSENT 2672#undef SYS_NSYSENT
2658#define SYS_NSYSENT NETBSD32_SYS_NSYSENT 2673#define SYS_NSYSENT NETBSD32_SYS_NSYSENT
2659 2674
2660#define SYS_SYSCALL netbsd32_syscall 2675#define SYS_SYSCALL netbsd32_syscall
2661#include "../../kern/sys_syscall.c" 2676#include "../../kern/sys_syscall.c"
2662#undef SYS_SYSCALL 2677#undef SYS_SYSCALL
2663 2678

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

--- src/sys/compat/netbsd32/syscalls.master 2023/07/29 12:38:25 1.142
+++ src/sys/compat/netbsd32/syscalls.master 2023/07/30 05:30:45 1.143
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1 $NetBSD: syscalls.master,v 1.142 2023/07/29 12:38:25 rin Exp $ 1 $NetBSD: syscalls.master,v 1.143 2023/07/30 05:30:45 rin 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:
@@ -1204,23 +1204,24 @@ @@ -1204,23 +1204,24 @@
1204 acl_type_t type, netbsd32_aclp_t aclp); } 1204 acl_type_t type, netbsd32_aclp_t aclp); }
1205495 STD { int|netbsd32||__acl_delete_file( \ 1205495 STD { int|netbsd32||__acl_delete_file( \
1206 const netbsd32_charp path, \ 1206 const netbsd32_charp path, \
1207 acl_type_t type); } 1207 acl_type_t type); }
1208496 STD { int|netbsd32||__acl_delete_fd(int filedes, \ 1208496 STD { int|netbsd32||__acl_delete_fd(int filedes, \
1209 acl_type_t type); } 1209 acl_type_t type); }
1210497 STD { int|netbsd32||__acl_aclcheck_file( \ 1210497 STD { int|netbsd32||__acl_aclcheck_file( \
1211 const netbsd32_charp path, \ 1211 const netbsd32_charp path, \
1212 acl_type_t type, netbsd32_aclp_t aclp); } 1212 acl_type_t type, netbsd32_aclp_t aclp); }
1213498 STD { int|netbsd32||__acl_aclcheck_fd(int filedes, \ 1213498 STD { int|netbsd32||__acl_aclcheck_fd(int filedes, \
1214 acl_type_t type, netbsd32_aclp_t aclp); } 1214 acl_type_t type, netbsd32_aclp_t aclp); }
1215499 STD { long|netbsd32||lpathconf(const netbsd32_charp path, \ 1215499 STD { long|netbsd32||lpathconf(const netbsd32_charp path, \
1216 int name); } 1216 int name); }
1217500 UNIMPL memfd_create 1217500 STD { int|netbsd32||memfd_create( \
 1218 const netbsd32_charp name, unsigned int flags); }
1218501 STD { int|netbsd32|100|kevent(int fd, \ 1219501 STD { int|netbsd32|100|kevent(int fd, \
1219 const netbsd32_keventp_t changelist, \ 1220 const netbsd32_keventp_t changelist, \
1220 netbsd32_size_t nchanges, \ 1221 netbsd32_size_t nchanges, \
1221 netbsd32_keventp_t eventlist, \ 1222 netbsd32_keventp_t eventlist, \
1222 netbsd32_size_t nevents, \ 1223 netbsd32_size_t nevents, \
1223 const netbsd32_timespecp_t timeout); } 1224 const netbsd32_timespecp_t timeout); }
1224502 UNIMPL epoll_create1 1225502 UNIMPL epoll_create1
1225503 UNIMPL epoll_ctl 1226503 UNIMPL epoll_ctl
1226504 UNIMPL epoll_pwait2 1227504 UNIMPL epoll_pwait2