Module Name:    src
Committed By:   rin
Date:           Sun Jul 30 05:30:45 UTC 2023

Modified Files:
        src/sys/compat/netbsd32: netbsd32_netbsd.c syscalls.master

Log Message:
COMPAT_NETBSD32: Add support for memfd_create(2).


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.142 -r1.143 src/sys/compat/netbsd32/syscalls.master

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.234 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.235
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.234	Sun Jul 30 05:10:47 2023
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Sun Jul 30 05:30:45 2023
@@ -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
@@ -2648,6 +2648,21 @@ netbsd32_eventfd(struct lwp *l,
 	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);
+}
+
 /*
  * MI indirect system call support.
  * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.

Index: src/sys/compat/netbsd32/syscalls.master
diff -u src/sys/compat/netbsd32/syscalls.master:1.142 src/sys/compat/netbsd32/syscalls.master:1.143
--- src/sys/compat/netbsd32/syscalls.master:1.142	Sat Jul 29 12:38:25 2023
+++ src/sys/compat/netbsd32/syscalls.master	Sun Jul 30 05:30:45 2023
@@ -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, \

Reply via email to