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 context 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,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.234 2023/07/30 05:10:47 rin Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin 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.234 2023/07/30 05:10:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $");
 
 /*
  * below are all the standard NetBSD system calls, in the 32bit
@@ -2646,6 +2646,21 @@
 	NETBSD32TO64_UAP(val);
 	NETBSD32TO64_UAP(flags);
 	return sys_eventfd(l, &ua, retval);
+}
+
+int
+netbsd32_memfd_create(struct lwp *l,
+    const struct netbsd32_memfd_create_args *uap, register_t *retval)
+{
+	/* {
+		syscallarg(const netbsd32_charp)	name;
+		syscallarg(unsigned int)		flags;
+	} */
+	struct sys_memfd_create_args ua;
+
+	NETBSD32TOP_UAP(name, const char);
+	NETBSD32TO64_UAP(flags);
+	return sys_memfd_create(l, &ua, retval);
 }
 
 /*

cvs diff -r1.142 -r1.143 src/sys/compat/netbsd32/syscalls.master (expand / switch to context 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,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.142 2023/07/29 12:38:25 rin Exp $
+	$NetBSD: syscalls.master,v 1.143 2023/07/30 05:30:45 rin Exp $
 
 ;	from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
@@ -1214,7 +1214,8 @@
 			    acl_type_t type, netbsd32_aclp_t aclp); }
 499	STD		{ long|netbsd32||lpathconf(const netbsd32_charp path, \
 			    int name); }
-500	UNIMPL		memfd_create
+500	STD		{ int|netbsd32||memfd_create( \
+			    const netbsd32_charp name, unsigned int flags); }
 501	STD		{ int|netbsd32|100|kevent(int fd, \
 			    const netbsd32_keventp_t changelist, \
 			    netbsd32_size_t nchanges, \