Module Name: src
Committed By: christos
Date: Sat Sep 28 19:35:56 UTC 2024
Modified Files:
src/sys/compat/linux/arch/aarch64: syscalls.master
src/sys/compat/linux/arch/alpha: syscalls.master
src/sys/compat/linux/arch/amd64: syscalls.master
src/sys/compat/linux/arch/arm: syscalls.master
src/sys/compat/linux/arch/i386: syscalls.master
src/sys/compat/linux/arch/m68k: syscalls.master
src/sys/compat/linux/arch/mips: syscalls.master
src/sys/compat/linux/arch/powerpc: syscalls.master
src/sys/compat/linux/common: linux_fcntl.h linux_file.c linux_misc.c
linux_sched.h
Log Message:
Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux/arch/aarch64/syscalls.master
cvs rdiff -u -r1.108 -r1.109 src/sys/compat/linux/arch/alpha/syscalls.master
cvs rdiff -u -r1.74 -r1.75 src/sys/compat/linux/arch/amd64/syscalls.master
cvs rdiff -u -r1.81 -r1.82 src/sys/compat/linux/arch/arm/syscalls.master
cvs rdiff -u -r1.136 -r1.137 src/sys/compat/linux/arch/i386/syscalls.master
cvs rdiff -u -r1.106 -r1.107 src/sys/compat/linux/arch/m68k/syscalls.master
cvs rdiff -u -r1.81 -r1.82 src/sys/compat/linux/arch/mips/syscalls.master
cvs rdiff -u -r1.86 -r1.87 src/sys/compat/linux/arch/powerpc/syscalls.master
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/linux/common/linux_fcntl.h
cvs rdiff -u -r1.124 -r1.125 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.264 -r1.265 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux/common/linux_sched.h
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/linux/arch/aarch64/syscalls.master
diff -u src/sys/compat/linux/arch/aarch64/syscalls.master:1.13 src/sys/compat/linux/arch/aarch64/syscalls.master:1.14
--- src/sys/compat/linux/arch/aarch64/syscalls.master:1.13 Sun Jun 30 21:35:52 2024
+++ src/sys/compat/linux/arch/aarch64/syscalls.master Sat Sep 28 15:35:55 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.13 2024/07/01 01:35:52 christos Exp $
+ $NetBSD: syscalls.master,v 1.14 2024/09/28 19:35:55 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -203,7 +203,8 @@
81 NOARGS { int|sys||sync(void); }
82 NOARGS { int|sys||fsync(int fd); }
83 STD { int|linux_sys||fdatasync(int fd); }
-84 UNIMPL sync_file_range
+84 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
85 STD { int|linux_sys||timerfd_create(clockid_t clock_id, \
int flags); }
86 STD { int|linux_sys||timerfd_settime(int fd, int flags, \
@@ -519,7 +520,7 @@
264 UNIMPL name_to_handle_at
265 UNIMPL open_by_handle_at
266 UNIMPL clock_adjtime
-267 UNIMPL syncfs
+267 STD { int|linux_sys||syncfs(int fd); }
268 UNIMPL setns
269 STD { int|linux_sys||sendmmsg(int s, \
struct linux_mmsghdr *msgvec, unsigned int vlen, \
@@ -530,7 +531,9 @@
273 UNIMPL finit_module
274 UNIMPL sched_setattr
275 UNIMPL sched_getattr
-276 UNIMPL renameat2
+276 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
277 UNIMPL seccomp
278 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
@@ -541,7 +544,9 @@
282 UNIMPL userfaultfd
283 UNIMPL membarrier
284 UNIMPL mlock2
-285 UNIMPL copy_file_range
+285 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
286 UNIMPL preadv2
287 UNIMPL pwritev2
288 UNIMPL pkey_mprotect
@@ -693,7 +698,9 @@
432 UNIMPL fsmount
433 UNIMPL fspick
434 UNIMPL pidfd_open
-435 UNIMPL clone3
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL openat2
Index: src/sys/compat/linux/arch/alpha/syscalls.master
diff -u src/sys/compat/linux/arch/alpha/syscalls.master:1.108 src/sys/compat/linux/arch/alpha/syscalls.master:1.109
--- src/sys/compat/linux/arch/alpha/syscalls.master:1.108 Sun Jun 30 21:35:52 2024
+++ src/sys/compat/linux/arch/alpha/syscalls.master Sat Sep 28 15:35:55 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.108 2024/07/01 01:35:52 christos Exp $
+ $NetBSD: syscalls.master,v 1.109 2024/09/28 19:35:55 christos Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -774,7 +774,8 @@
467 NOARGS { int|sys||__futex_get_robust_list(lwpid_t lwpid, \
void **headp, size_t *lenp); }
468 UNIMPL splice
-469 UNIMPL sync_file_range
+469 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
470 UNIMPL tee
471 UNIMPL vmsplice
472 UNIMPL move_pages
@@ -823,7 +824,7 @@
497 UNIMPL name_to_handle_at
498 UNIMPL open_by_handle_at
499 UNIMPL clock_adjtime
-500 UNIMPL syncfs
+500 STD { int|linux_sys||syncfs(int fd); }
501 UNIMPL setns
502 STD { int|linux_sys||accept4(int s, \
struct osockaddr *name, \
@@ -837,7 +838,9 @@
507 UNIMPL finit_module
508 UNIMPL sched_setattr
509 UNIMPL sched_getattr
-510 UNIMPL renameat2
+510 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
511 UNIMPL
512 UNIMPL
513 UNIMPL
@@ -846,7 +849,9 @@
516 UNIMPL
517 UNIMPL
518 UNIMPL
-519 UNIMPL
+519 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
520 UNIMPL
521 UNIMPL
522 STD { int|linux_sys||statx(int fd, const char *path, \
@@ -874,7 +879,9 @@
542 UNIMPL
543 UNIMPL
544 UNIMPL
-545 UNIMPL
+545 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
546 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
547 UNIMPL
Index: src/sys/compat/linux/arch/amd64/syscalls.master
diff -u src/sys/compat/linux/arch/amd64/syscalls.master:1.74 src/sys/compat/linux/arch/amd64/syscalls.master:1.75
--- src/sys/compat/linux/arch/amd64/syscalls.master:1.74 Sun Jun 30 21:35:52 2024
+++ src/sys/compat/linux/arch/amd64/syscalls.master Sat Sep 28 15:35:55 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.74 2024/07/01 01:35:52 christos Exp $
+ $NetBSD: syscalls.master,v 1.75 2024/09/28 19:35:55 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -62,6 +62,7 @@
#include <compat/linux/common/linux_siginfo.h>
#include <compat/linux/common/linux_mqueue.h>
#include <compat/linux/common/linux_machdep.h>
+#include <compat/linux/common/linux_sched.h>
#include <compat/linux/linux_syscallargs.h>
@@ -533,7 +534,8 @@
void **headp, size_t *lenp); }
275 UNIMPL splice
276 UNIMPL tee
-277 UNIMPL sync_file_range
+277 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
278 UNIMPL vmsplice
279 UNIMPL move_pages
280 STD { int|linux_sys||utimensat(int fd, const char *path, \
@@ -580,7 +582,7 @@
303 UNIMPL name_to_handle_at
304 UNIMPL open_by_handle_at
305 UNIMPL clock_adjtime
-306 UNIMPL syncfs
+306 STD { int|linux_sys||syncfs(int fd); }
307 STD { int|linux_sys||sendmmsg(int s, \
struct linux_mmsghdr *msgvec, unsigned int vlen, \
unsigned int flags); }
@@ -594,7 +596,9 @@
313 UNIMPL finit_module
314 UNIMPL sched_setattr
315 UNIMPL sched_getattr
-316 UNIMPL renameat2
+316 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
317 UNIMPL seccomp
318 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
@@ -606,7 +610,9 @@
323 UNIMPL userfaultfd
324 UNIMPL membarrier
325 UNIMPL mlock2
-326 UNIMPL copy_file_range
+326 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
327 UNIMPL preadv2
328 UNIMPL pwritev2
329 UNIMPL pkey_mprotect
@@ -717,7 +723,9 @@
432 UNIMPL fsmount
433 UNIMPL fspick
434 UNIMPL pidfd_open
-435 UNIMPL clone3
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL openat2
Index: src/sys/compat/linux/arch/arm/syscalls.master
diff -u src/sys/compat/linux/arch/arm/syscalls.master:1.81 src/sys/compat/linux/arch/arm/syscalls.master:1.82
--- src/sys/compat/linux/arch/arm/syscalls.master:1.81 Sun Jun 30 21:35:52 2024
+++ src/sys/compat/linux/arch/arm/syscalls.master Sat Sep 28 15:35:55 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.81 2024/07/01 01:35:52 christos Exp $
+ $NetBSD: syscalls.master,v 1.82 2024/09/28 19:35:55 christos Exp $
; Derived from sys/compat/linux/arch/*/syscalls.master
; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -573,7 +573,8 @@
339 NOARGS { int|sys||__futex_get_robust_list(lwpid_t lwpid, \
void **headp, size_t *lenp); }
340 UNIMPL splice
-341 UNIMPL sync_file_range2
+341 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
342 UNIMPL tee
343 UNIMPL vmsplice
344 UNIMPL move_pages
@@ -625,7 +626,7 @@
370 UNIMPL name_to_handle_at
371 UNIMPL open_by_handle_at
372 UNIMPL clock_adjtime
-373 UNIMPL syncfs
+373 STD { int|linux_sys||syncfs(int fd); }
374 STD { int|linux_sys||sendmmsg(int s, \
struct linux_mmsghdr *msgvec, unsigned int vlen, \
unsigned int flags); }
@@ -636,7 +637,9 @@
379 UNIMPL finit_module
380 UNIMPL sched_setattr
381 UNIMPL sched_getattr
-382 UNIMPL renameat2
+382 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
383 UNIMPL seccomp
; XXX FIX-me?
; 384 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
@@ -658,7 +661,9 @@
388 UNIMPL usr32
389 STD { int|linux_sys||set_tls(void *tls); }
390 UNIMPL
-391 UNIMPL
+391 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
392 UNIMPL
393 UNIMPL
394 UNIMPL
@@ -704,7 +709,9 @@
432 UNIMPL
433 UNIMPL
434 UNIMPL
-435 UNIMPL
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL
Index: src/sys/compat/linux/arch/i386/syscalls.master
diff -u src/sys/compat/linux/arch/i386/syscalls.master:1.136 src/sys/compat/linux/arch/i386/syscalls.master:1.137
--- src/sys/compat/linux/arch/i386/syscalls.master:1.136 Sun Jun 30 21:35:53 2024
+++ src/sys/compat/linux/arch/i386/syscalls.master Sat Sep 28 15:35:55 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.136 2024/07/01 01:35:53 christos Exp $
+ $NetBSD: syscalls.master,v 1.137 2024/09/28 19:35:55 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -540,7 +540,8 @@
312 NOARGS { int|sys||__futex_get_robust_list(lwpid_t lwpid, \
void **headp, size_t *lenp); }
313 UNIMPL splice
-314 UNIMPL sync_file_range
+314 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
315 UNIMPL tee
316 UNIMPL vmsplice
317 UNIMPL move_pages
@@ -586,7 +587,7 @@
341 UNIMPL name_to_handle_at
342 UNIMPL open_by_handle_at
343 UNIMPL clock_adjtime
-344 UNIMPL syncfs
+344 STD { int|linux_sys||syncfs(int fd); }
345 UNIMPL sendmmsg
346 UNIMPL setns
347 UNIMPL process_vm_readv
@@ -595,7 +596,9 @@
350 UNIMPL finit_module
351 UNIMPL sched_setattr
352 UNIMPL sched_getattr
-353 UNIMPL renameat2
+353 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
354 UNIMPL seccomp
355 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
@@ -621,7 +624,9 @@
374 UNIMPL userfaultfd
375 UNIMPL membarrier
376 UNIMPL mlock2
-377 UNIMPL copy_file_range
+377 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
378 UNIMPL preadv2
379 UNIMPL pwritev2
380 UNIMPL pkey_mprotect
@@ -681,7 +686,9 @@
432 UNIMPL fsmount
433 UNIMPL fspick
434 UNIMPL pidfd_open
-435 UNIMPL clone3
+435 STD { int|linux_sys||clone3(\
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL openat2
Index: src/sys/compat/linux/arch/m68k/syscalls.master
diff -u src/sys/compat/linux/arch/m68k/syscalls.master:1.106 src/sys/compat/linux/arch/m68k/syscalls.master:1.107
--- src/sys/compat/linux/arch/m68k/syscalls.master:1.106 Sun Jun 30 21:35:53 2024
+++ src/sys/compat/linux/arch/m68k/syscalls.master Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.106 2024/07/01 01:35:53 christos Exp $
+ $NetBSD: syscalls.master,v 1.107 2024/09/28 19:35:56 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -551,7 +551,8 @@
305 NOARGS { int|sys||__futex_get_robust_list(lwpid_t lwpid, \
void **headp, size_t *lenp); }
306 UNIMPL splice
-307 UNIMPL sync_file_range
+307 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
308 UNIMPL tee
309 UNIMPL vmsplice
310 UNIMPL move_pages
@@ -605,7 +606,7 @@
340 UNIMPL name_to_handle_at
341 UNIMPL open_by_handle_at
342 UNIMPL clock_adjtime
-343 UNIMPL syncfs
+343 STD { int|linux_sys||syncfs(int fd); }
344 UNIMPL setns
345 UNIMPL process_vm_readv
346 UNIMPL process_vm_writev
@@ -613,7 +614,9 @@
348 UNIMPL finit_module
349 UNIMPL sched_setattr
350 UNIMPL sched_getattr
-351 UNIMPL renameat2
+351 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
352 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
353 UNIMPL memfd_create
@@ -645,7 +648,9 @@
373 UNIMPL userfaultfd
374 UNIMPL membarrier
375 UNIMPL mlock2
-376 UNIMPL copy_file_range
+376 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
377 UNIMPL preadv2
378 UNIMPL pwritev2
379 STD { int|linux_sys||statx(int fd, const char *path, \
@@ -706,7 +711,9 @@
432 UNIMPL
433 UNIMPL
434 UNIMPL
-435 UNIMPL
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL
Index: src/sys/compat/linux/arch/mips/syscalls.master
diff -u src/sys/compat/linux/arch/mips/syscalls.master:1.81 src/sys/compat/linux/arch/mips/syscalls.master:1.82
--- src/sys/compat/linux/arch/mips/syscalls.master:1.81 Sun Jun 30 21:35:53 2024
+++ src/sys/compat/linux/arch/mips/syscalls.master Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.81 2024/07/01 01:35:53 christos Exp $
+ $NetBSD: syscalls.master,v 1.82 2024/09/28 19:35:56 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -534,7 +534,8 @@
linux_sigset_t *sigset); }
303 UNIMPL unshare
304 UNIMPL splice
-305 UNIMPL sync_file_range
+305 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
306 UNIMPL tee
307 UNIMPL vmsplice
308 UNIMPL move_pages
@@ -599,7 +600,7 @@
340 UNIMPL name_to_handle_at
341 UNIMPL open_by_handle_at
342 UNIMPL clock_adjtime
-343 UNIMPL syncfs
+343 STD { int|linux_sys||syncfs(int fd); }
344 STD { int|linux_sys||sendmmsg(int s, \
struct linux_mmsghdr *msgvec, unsigned int vlen, \
unsigned int flags); }
@@ -610,7 +611,9 @@
349 UNIMPL finit_module
350 UNIMPL sched_setattr
351 UNIMPL sched_getattr
-352 UNIMPL renameat2
+352 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
353 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
354 STD { int|linux_sys||memfd_create(const char *name, \
@@ -620,7 +623,9 @@
357 UNIMPL userfaultfd
358 UNIMPL membarrier
359 UNIMPL mlock2
-360 UNIMPL copy_file_range
+360 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
361 UNIMPL preadv2
362 UNIMPL pwritev2
363 UNIMPL pkey_mprotect
@@ -697,7 +702,9 @@
432 UNIMPL
433 UNIMPL
434 UNIMPL
-435 UNIMPL
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL
Index: src/sys/compat/linux/arch/powerpc/syscalls.master
diff -u src/sys/compat/linux/arch/powerpc/syscalls.master:1.86 src/sys/compat/linux/arch/powerpc/syscalls.master:1.87
--- src/sys/compat/linux/arch/powerpc/syscalls.master:1.86 Sun Jun 30 21:35:53 2024
+++ src/sys/compat/linux/arch/powerpc/syscalls.master Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.86 2024/07/01 01:35:53 christos Exp $
+ $NetBSD: syscalls.master,v 1.87 2024/09/28 19:35:56 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -560,7 +560,8 @@
306 STD { int|linux_sys||timerfd_create(clockid_t clock_id, \
int flags); }
307 STD { int|linux_sys||eventfd(unsigned int initval); }
-308 UNIMPL sync_file_range2
+308 STD { int|linux_sys||sync_file_range(int fd, \
+ off_t offset, off_t nbytes, unsigned int flags); }
309 STD { int|linux_sys||fallocate(int fd, int mode, \
off_t offset, off_t len); }
310 UNIMPL subpage_prot
@@ -614,7 +615,7 @@
345 UNIMPL name_to_handle_at
346 UNIMPL open_by_handle_at
347 UNIMPL clock_adjtime
-348 UNIMPL syncfs
+348 STD { int|linux_sys||syncfs(int fd); }
349 STD { int|linux_sys||sendmmsg(int s, \
struct linux_mmsghdr *msgvec, unsigned int vlen, \
unsigned int flags); }
@@ -625,7 +626,9 @@
354 UNIMPL kcmp
355 UNIMPL sched_setattr
356 UNIMPL sched_getattr
-357 UNIMPL renameat2
+357 STD { int|linux_sys||renameat2(int fromfd, \
+ const char *from, int tofd, const char *to, \
+ unsigned int flags); }
358 UNIMPL seccomp
359 NOARGS { ssize_t|sys||getrandom(void *buf, size_t buflen, \
unsigned int flags); }
@@ -648,7 +651,9 @@
376 UNIMPL
377 UNIMPL
378 UNIMPL mlock2
-379 UNIMPL copy_file_range
+379 STD { ssize_t|linux_sys||copy_file_range(int fd_in, \
+ off_t * off_in, int fd_out, off_t * off_out, \
+ size_t len, unsigned int flags); }
380 UNIMPL preadv2
381 UNIMPL pwritev2
382 UNIMPL kexec_file_load
@@ -706,7 +711,9 @@
432 UNIMPL
433 UNIMPL
434 UNIMPL
-435 UNIMPL
+435 STD { int|linux_sys||clone3( \
+ struct linux_user_clone3_args *cl_args, \
+ size_t size); }
436 STD { int|linux_sys||close_range(unsigned int first, \
unsigned int last, unsigned int flags); }
437 UNIMPL
Index: src/sys/compat/linux/common/linux_fcntl.h
diff -u src/sys/compat/linux/common/linux_fcntl.h:1.22 src/sys/compat/linux/common/linux_fcntl.h:1.23
--- src/sys/compat/linux/common/linux_fcntl.h:1.22 Sat Aug 19 13:57:54 2023
+++ src/sys/compat/linux/common/linux_fcntl.h Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_fcntl.h,v 1.22 2023/08/19 17:57:54 christos Exp $ */
+/* $NetBSD: linux_fcntl.h,v 1.23 2024/09/28 19:35:56 christos Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -55,6 +55,29 @@ struct stat;
#define LINUX_AT_NO_AUTOMOUNT 0x0800
#define LINUX_AT_EMPTY_PATH 0x1000
+
+/*
+ * sync_file_range flags
+ */
+#define LINUX_SYNC_FILE_RANGE_WAIT_BEFORE 1
+#define LINUX_SYNC_FILE_RANGE_WRITE 2
+#define LINUX_SYNC_FILE_RANGE_WAIT_AFTER 4
+#define LINUX_SYNC_FILE_RANGE_ALL \
+ (LINUX_SYNC_FILE_RANGE_WAIT_BEFORE | \
+ LINUX_SYNC_FILE_RANGE_WRITE | \
+ LINUX_SYNC_FILE_RANGE_WAIT_AFTER)
+
+/*
+ * renameat2 flags
+ */
+#define LINUX_RENAME_NOREPLACE 1
+#define LINUX_RENAME_EXCHANGE 2
+#define LINUX_RENAME_WHITEOUT 4
+#define LINUX_RENAME_ALL \
+ (LINUX_RENAME_NOREPLACE | \
+ LINUX_RENAME_EXCHANGE | \
+ LINUX_RENAME_WHITEOUT)
+
#ifdef _KERNEL
int linux_to_bsd_ioflags(int);
int linux_to_bsd_atflags(int);
Index: src/sys/compat/linux/common/linux_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.124 src/sys/compat/linux/common/linux_file.c:1.125
--- src/sys/compat/linux/common/linux_file.c:1.124 Sat Jun 29 09:46:10 2024
+++ src/sys/compat/linux/common/linux_file.c Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.124 2024/06/29 13:46:10 christos Exp $ */
+/* $NetBSD: linux_file.c,v 1.125 2024/09/28 19:35:56 christos Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,8 +35,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.124 2024/06/29 13:46:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.125 2024/09/28 19:35:56 christos Exp $");
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
@@ -44,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file.c
#include <sys/file.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
+#include <sys/vfs_syscalls.h>
#include <sys/filedesc.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
@@ -54,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file.c
#include <sys/socketvar.h>
#include <sys/conf.h>
#include <sys/pipe.h>
-
+#include <sys/fstrans.h>
#include <sys/syscallargs.h>
#include <sys/vfs_syscalls.h>
@@ -68,6 +70,14 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file.c
#include <compat/linux/linux_syscallargs.h>
+#ifdef DEBUG_LINUX
+#define DPRINTF(a, ...) uprintf(a, __VA_ARGS__)
+#else
+#define DPRINTF(a, ...)
+#endif
+
+#define LINUX_COPY_FILE_RANGE_MAX_CHUNK 8192
+
static int bsd_to_linux_ioflags(int);
#if !defined(__aarch64__) && !defined(__amd64__)
static void bsd_to_linux_stat(struct stat *, struct linux_stat *);
@@ -918,6 +928,343 @@ linux_sys_faccessat2(lwp_t *l, const str
}
+int
+linux_sys_sync_file_range(lwp_t *l,
+ const struct linux_sys_sync_file_range_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) fd;
+ syscallarg(off_t) offset;
+ syscallarg(off_t) nbytes;
+ syscallarg(unsigned int) flags;
+ } */
+
+ struct sys_fsync_range_args ua;
+
+ if (SCARG(uap, offset) < 0 || SCARG(uap, nbytes) < 0 ||
+ ((SCARG(uap, flags) & ~LINUX_SYNC_FILE_RANGE_ALL) != 0))
+ return EINVAL;
+
+ /* Fill ua with uap */
+ SCARG(&ua, fd) = SCARG(uap, fd);
+ SCARG(&ua, flags) = SCARG(uap, flags);
+
+ /* Round down offset to page boundary */
+ SCARG(&ua, start) = rounddown(SCARG(uap, offset), PAGE_SIZE);
+ SCARG(&ua, length) = SCARG(uap, nbytes);
+ if (SCARG(&ua, length) != 0) {
+ /* Round up length to nbytes+offset to page boundary */
+ SCARG(&ua, length) = roundup(SCARG(uap, nbytes)
+ + SCARG(uap, offset) - SCARG(&ua, start), PAGE_SIZE);
+ }
+
+ return sys_fsync_range(l, &ua, retval);
+}
+
+int
+linux_sys_syncfs(lwp_t *l, const struct linux_sys_syncfs_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) fd;
+ } */
+
+ struct mount *mp;
+ struct vnode *vp;
+ file_t *fp;
+ int error, fd;
+ fd = SCARG(uap, fd);
+
+ /* Get file pointer */
+ if ((error = fd_getvnode(fd, &fp)) != 0)
+ return error;
+
+ /* Get vnode and mount point */
+ vp = fp->f_vnode;
+ mp = vp->v_mount;
+
+ mutex_enter(mp->mnt_updating);
+ if ((mp->mnt_flag & MNT_RDONLY) == 0) {
+ int asyncflag = mp->mnt_flag & MNT_ASYNC;
+ mp->mnt_flag &= ~MNT_ASYNC;
+ VFS_SYNC(mp, MNT_NOWAIT, l->l_cred);
+ if (asyncflag)
+ mp->mnt_flag |= MNT_ASYNC;
+ }
+ mutex_exit(mp->mnt_updating);
+
+ /* Cleanup vnode and file pointer */
+ vrele(vp);
+ fd_putfile(fd);
+ return 0;
+
+}
+
+int
+linux_sys_renameat2(struct lwp *l, const struct linux_sys_renameat2_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) fromfd;
+ syscallarg(const char *) from;
+ syscallarg(int) tofd;
+ syscallarg(const char *) to;
+ syscallarg(unsigned int) flags;
+ } */
+
+ struct sys_renameat_args ua;
+ SCARG(&ua, fromfd) = SCARG(uap, fromfd);
+ SCARG(&ua, from) = SCARG(uap, from);
+ SCARG(&ua, tofd) = SCARG(uap, tofd);
+ SCARG(&ua, to) = SCARG(uap, to);
+
+ unsigned int flags = SCARG(uap, flags);
+ int error;
+
+ if (flags != 0) {
+ if (flags & ~LINUX_RENAME_ALL)
+ return EINVAL;
+ if ((flags & LINUX_RENAME_EXCHANGE) != 0 &&
+ (flags & (LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT))
+ != 0)
+ return EINVAL;
+ /*
+ * Suppoting renameat2 flags without support from file systems
+ * becomes a messy affair cause of locks and how VOP_RENAME
+ * protocol is implemented. So, return EOPNOTSUPP for now.
+ */
+ return EOPNOTSUPP;
+ }
+
+ error = sys_renameat(l, &ua, retval);
+ return error;
+}
+
+int linux_sys_copy_file_range(lwp_t *l,
+ const struct linux_sys_copy_file_range_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) fd_in;
+ syscallarg(unsigned long) off_in;
+ syscallarg(int) fd_out;
+ syscallarg(unsigned long) off_out;
+ syscallarg(size_t) len;
+ syscallarg(unsigned int) flags;
+ } */
+
+ int fd_in, fd_out;
+ file_t *fp_in, *fp_out;
+ struct vnode *invp, *outvp;
+ off_t off_in = 0, off_out = 0;
+ struct vattr vattr_in, vattr_out;
+ ssize_t total_copied = 0;
+ size_t bytes_left, to_copy;
+ bool have_off_in = false, have_off_out = false;
+ int error = 0;
+ size_t len = SCARG(uap, len);
+ unsigned int flags = SCARG(uap, flags);
+ // Structures for actual copy
+ char *buffer = NULL;
+ struct uio auio;
+ struct iovec aiov;
+
+
+ if (len > SSIZE_MAX) {
+ DPRINTF("%s: len is greater than SSIZE_MAX\n",
+ __func__);
+ return EOVERFLOW;
+ }
+
+ if(flags != 0) {
+ DPRINTF("%s: unsupported flags %#x\n", __func__, flags);
+ return EINVAL;
+ }
+
+ fd_in = SCARG(uap, fd_in);
+ fd_out = SCARG(uap, fd_out);
+ error = fd_getvnode(fd_in, &fp_in);
+ if (error) {
+ return error;
+ }
+
+ error = fd_getvnode(fd_out, &fp_out);
+ if (error) {
+ fd_putfile(fd_in);
+ return error;
+ }
+
+ invp = fp_in->f_vnode;
+ outvp = fp_out->f_vnode;
+
+ /* Get attributes of input and output files */
+ VOP_GETATTR(invp, &vattr_in, l->l_cred);
+ VOP_GETATTR(outvp, &vattr_out, l->l_cred);
+
+ /* Check if input and output files are regular files */
+ if (vattr_in.va_type == VDIR || vattr_out.va_type == VDIR) {
+ error = EISDIR;
+ DPRINTF("%s: Input or output is a directory\n", __func__);
+ goto out;
+ }
+ if ((SCARG(uap, off_in) != NULL && *SCARG(uap, off_in) < 0) ||
+ (SCARG(uap, off_out) != NULL && *SCARG(uap, off_out) < 0) ||
+ vattr_in.va_type != VREG || vattr_out.va_type != VREG)
+ {
+ error = EINVAL;
+ DPRINTF("%s: Invalid offset or file type\n", __func__);
+ goto out;
+ }
+
+ if ((fp_in->f_flag & FREAD) == 0 ||
+ (fp_out->f_flag & FWRITE) == 0 || (fp_out->f_flag & FAPPEND) != 0) {
+ DPRINTF("%s: input file can't be read or output file "
+ "can't be written\n", __func__);
+ error = EBADF;
+ goto out;
+ }
+ /* Retrieve and validate offsets if provided */
+ if (SCARG(uap, off_in) != NULL) {
+ error = copyin(SCARG(uap, off_in), &off_in, sizeof(off_in));
+ if (error) {
+ goto out;
+ }
+ have_off_in = true;
+ }
+
+ if (SCARG(uap, off_out) != NULL) {
+ error = copyin(SCARG(uap, off_out), &off_out, sizeof(off_out));
+ if (error) {
+ goto out;
+ }
+ have_off_out = true;
+ }
+
+ off_t new_size = off_out + len;
+ if (new_size < 0) {
+ DPRINTF("%s: New size is greater than OFF_MAX\n", __func__);
+ error = EFBIG;
+ goto out;
+ }
+
+ /* Identify overlapping ranges */
+ if ((invp == outvp) &&
+ ((off_in <= off_out && off_in + (off_t)len > off_out) ||
+ (off_in > off_out && off_out + (off_t)len > off_in))) {
+ DPRINTF("%s: Ranges overlap\n", __func__);
+ error = EINVAL;
+ goto out;
+ }
+
+ buffer = kmem_alloc(LINUX_COPY_FILE_RANGE_MAX_CHUNK, KM_SLEEP);
+ /* Allocation cannot fail, so no need for error handling? */
+ if (buffer == NULL) {
+ error = ENOMEM;
+ goto out;
+ }
+
+ bytes_left = len;
+
+ while (bytes_left > 0) {
+ to_copy = MIN(bytes_left, LINUX_COPY_FILE_RANGE_MAX_CHUNK);
+
+ /* Lock the input vnode for reading */
+ vn_lock(fp_in->f_vnode, LK_SHARED | LK_RETRY);
+ /* Set up iovec and uio for reading */
+ aiov.iov_base = buffer;
+ aiov.iov_len = to_copy;
+ auio.uio_iov = &aiov;
+ auio.uio_iovcnt = 1;
+ auio.uio_offset = have_off_in ? off_in : fp_in->f_offset;
+ auio.uio_resid = to_copy;
+ auio.uio_rw = UIO_READ;
+ auio.uio_vmspace = l->l_proc->p_vmspace;
+ UIO_SETUP_SYSSPACE(&auio);
+
+ /* Perform read using vn_read */
+ error = VOP_READ(fp_in->f_vnode, &auio, 0, l->l_cred);
+ VOP_UNLOCK(fp_in->f_vnode);
+ if (error) {
+ DPRINTF("%s: Read error %d\n", __func__, error);
+ break;
+ }
+
+ size_t read_bytes = to_copy - auio.uio_resid;
+ if (read_bytes == 0) {
+ /* EOF reached */
+ break;
+ }
+
+ /* Lock the output vnode for writing */
+ vn_lock(fp_out->f_vnode, LK_EXCLUSIVE | LK_RETRY);
+ /* Set up iovec and uio for writing */
+ aiov.iov_base = buffer;
+ aiov.iov_len = read_bytes;
+ auio.uio_iov = &aiov;
+ auio.uio_iovcnt = 1;
+ auio.uio_offset = have_off_out ? off_out : fp_out->f_offset;
+ auio.uio_resid = read_bytes;
+ auio.uio_rw = UIO_WRITE;
+ auio.uio_vmspace = l->l_proc->p_vmspace;
+ UIO_SETUP_SYSSPACE(&auio);
+
+ /* Perform the write */
+ error = VOP_WRITE(fp_out->f_vnode, &auio, 0, l->l_cred);
+ VOP_UNLOCK(fp_out->f_vnode);
+ if (error) {
+ DPRINTF("%s: Write error %d\n", __func__, error);
+ break;
+ }
+ size_t written_bytes = read_bytes - auio.uio_resid;
+ total_copied += written_bytes;
+ bytes_left -= written_bytes;
+
+ /* Update offsets if provided */
+ if (have_off_in) {
+ off_in += written_bytes;
+ } else {
+ fp_in->f_offset += written_bytes;
+ }
+ if (have_off_out) {
+ off_out += written_bytes;
+ } else {
+ fp_out->f_offset += written_bytes;
+ }
+ }
+
+ if (have_off_in) {
+ /* Adjust user space offset */
+ error = copyout(&off_in, SCARG(uap, off_in), sizeof(off_t));
+ if (error) {
+ DPRINTF("%s: Error adjusting user space offset\n",
+ __func__);
+ }
+ goto out;
+ }
+
+ if (have_off_out) {
+ /* Adjust user space offset */
+ error = copyout(&off_out, SCARG(uap, off_out), sizeof(off_t));
+ if (error) {
+ DPRINTF("%s: Error adjusting user space offset\n",
+ __func__);
+ }
+ }
+
+ *retval = total_copied;
+out:
+ if (buffer) {
+ kmem_free(buffer, LINUX_COPY_FILE_RANGE_MAX_CHUNK);
+ }
+ if (fp_out) {
+ fd_putfile(fd_out);
+ }
+ if (fp_in) {
+ fd_putfile(fd_in);
+ }
+ return error;
+}
+
+
#define LINUX_NOT_SUPPORTED(fun) \
int \
fun(struct lwp *l, const struct fun##_args *uap, register_t *retval) \
Index: src/sys/compat/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.264 src/sys/compat/linux/common/linux_misc.c:1.265
--- src/sys/compat/linux/common/linux_misc.c:1.264 Sat Jun 29 09:46:10 2024
+++ src/sys/compat/linux/common/linux_misc.c Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.264 2024/06/29 13:46:10 christos Exp $ */
+/* $NetBSD: linux_misc.c,v 1.265 2024/09/28 19:35:56 christos Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.264 2024/06/29 13:46:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.265 2024/09/28 19:35:56 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -169,11 +169,11 @@ const struct linux_mnttypes linux_fstype
};
const int linux_fstypes_cnt = sizeof(linux_fstypes) / sizeof(linux_fstypes[0]);
-# ifdef DEBUG_LINUX
-#define DPRINTF(a) uprintf a
-# else
-#define DPRINTF(a)
-# endif
+#ifdef DEBUG_LINUX
+#define DPRINTF(a, ...) uprintf(a, __VA_ARGS__)
+#else
+#define DPRINTF(a, ...)
+#endif
/* Local linux_misc.c functions: */
static void linux_to_bsd_mmap_args(struct sys_mmap_args *,
@@ -2052,8 +2052,8 @@ linux_sys_memfd_create(struct lwp *l,
}
if (lflags & ~LINUX_MFD_KNOWN_FLAGS) {
- DPRINTF(("linux_sys_memfd_create: ignored flags %x\n",
- lflags & ~LINUX_MFD_KNOWN_FLAGS));
+ DPRINTF("%s: ignored flags %#x\n", __func__,
+ lflags & ~LINUX_MFD_KNOWN_FLAGS);
}
SCARG(&muap, name) = SCARG(uap, name);
@@ -2171,3 +2171,63 @@ linux_sys_getcpu(lwp_t *l, const struct
return 0;
}
+
+int
+linux_sys_clone3(struct lwp *l, const struct linux_sys_clone3_args *uap, register_t *retval)
+{
+ struct linux_user_clone3_args cl_args;
+ struct linux_sys_clone_args clone_args;
+ int error;
+
+ if (SCARG(uap, size) != sizeof(cl_args)) {
+ DPRINTF("%s: Invalid size less or more\n", __func__);
+ return EINVAL;
+ }
+
+ error = copyin(SCARG(uap, cl_args), &cl_args, SCARG(uap, size));
+ if (error) {
+ DPRINTF("%s: Copyin failed: %d\n", __func__, error);
+ return error;
+ }
+
+ DPRINTF("%sFlags: %#lx\n", (unsigned long)cl_args.flags);
+
+ /* Define allowed flags */
+ if (cl_args.flags & LINUX_CLONE_UNIMPLEMENTED_FLAGS) {
+ DPRINTF("%s: Unsupported flags for clone3: %#x\n", __func__,
+ cl_args.flags & LINUX_CLONE_UNIMPLEMENTED_FLAGS);
+ return EOPNOTSUPP;
+ }
+ if (cl_args.flags & ~LINUX_CLONE_ALLOWED_FLAGS) {
+ DPRINTF("%s: Disallowed flags for clone3: %#x\n", __func__,
+ cl_args.flags & ~LINUX_CLONE_ALLOWED_FLAGS);
+ return EINVAL;
+ }
+
+ if ((cl_args.exit_signal & ~(uint64_t)LINUX_CLONE_CSIGNAL) != 0){
+ DPRINTF("%s: Disallowed flags for clone3: %#x\n", __func__,
+ cl_args.exit_signal & ~(uint64_t)LINUX_CLONE_CSIGNAL);
+ return EINVAL;
+ }
+
+ if (cl_args.stack == 0 && cl_args.stack_size != 0) {
+ DPRINTF("%s: Stack is NULL but stack size is not 0\n",
+ __func__);
+ return EINVAL;
+ }
+ if (cl_args.stack != 0 && cl_args.stack_size == 0) {
+ DPRINTF("%s: Stack is not NULL but stack size is 0\n",
+ __func__);
+ return EINVAL;
+ }
+
+ int flags = cl_args.flags & LINUX_CLONE_ALLOWED_FLAGS;
+ int sig = cl_args.exit_signal & LINUX_CLONE_CSIGNAL;
+ SCARG(&clone_args, flags) = flags | sig;
+ SCARG(&clone_args, stack) = (void *)cl_args.stack;
+ SCARG(&clone_args, parent_tidptr) = (void *)cl_args.parent_tid;
+ SCARG(&clone_args, tls) = (void *)cl_args.tls;
+ SCARG(&clone_args, child_tidptr) = (void *)cl_args.child_tid;
+
+ return linux_sys_clone(l, &clone_args, retval);
+}
Index: src/sys/compat/linux/common/linux_sched.h
diff -u src/sys/compat/linux/common/linux_sched.h:1.10 src/sys/compat/linux/common/linux_sched.h:1.11
--- src/sys/compat/linux/common/linux_sched.h:1.10 Sun Sep 19 19:51:37 2021
+++ src/sys/compat/linux/common/linux_sched.h Sat Sep 28 15:35:56 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sched.h,v 1.10 2021/09/19 23:51:37 thorpej Exp $ */
+/* $NetBSD: linux_sched.h,v 1.11 2024/09/28 19:35:56 christos Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -61,6 +61,38 @@
0x01000000 /* set TID in the child */
#define LINUX_CLONE_STOPPED 0x02000000 /* start in stopped state */
+/*
+ * Flags that clone supports but are yet to be supported in NetBSD
+ */
+
+#define LINUX_CLONE_PIDFD 0x00001000 /* since Linux 5.2 */
+#define LINUX_CLONE_NEWCGROUP 0x02000000 /* New cgroup NS */
+#define LINUX_CLONE_NEWUTS 0x04000000
+#define LINUX_CLONE_NEWIPC 0x08000000
+#define LINUX_CLONE_NEWUSER 0x10000000
+#define LINUX_CLONE_NEWPID 0x20000000
+#define LINUX_CLONE_NEWNET 0x40000000
+#define LINUX_CLONE_IO 0x80000000
+
+/* Flags for the clone3() syscall. */
+#define LINUX_CLONE_CLEAR_SIGHAND 0x100000000ULL
+#define LINUX_CLONE_INTO_CGROUP 0x200000000ULL
+#define LINUX_CLONE_NEWTIME 0x00000080
+
+#define LINUX_CLONE_LEGACY_FLAGS 0xffffffffULL
+
+#define LINUX_CLONE_ALLOWED_FLAGS ( \
+ LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \
+ LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD | LINUX_CLONE_VFORK | \
+ LINUX_CLONE_PARENT_SETTID | LINUX_CLONE_CHILD_CLEARTID | \
+ LINUX_CLONE_CHILD_SETTID | LINUX_CLONE_SETTLS)
+
+#define LINUX_CLONE_UNIMPLEMENTED_FLAGS ( \
+ LINUX_CLONE_NEWNS | LINUX_CLONE_NEWUTS | LINUX_CLONE_NEWIPC | \
+ LINUX_CLONE_NEWUSER | LINUX_CLONE_NEWPID | LINUX_CLONE_NEWNET | \
+ LINUX_CLONE_PIDFD)
+
+#define LINUX_CSIGNAL 0x000000ff
struct linux_sched_param {
int sched_priority;
};
@@ -79,6 +111,26 @@ struct linux_itimerspec {
struct linux_timespec it_value;
};
+struct linux_user_clone3_args {
+ uint64_t flags; /* Flags bit mask */
+ uint64_t pidfd; /* Where to store PID file descriptor (int *) */
+ uint64_t child_tid; /* Where to store child TID, in child's memory
+ (pid_t *) */
+ uint64_t parent_tid; /* Where to store child TID, in parent's memory
+ (pid_t *) */
+ uint64_t exit_signal; /* Signal to deliver to parent on child
+ termination */
+ uint64_t stack; /* Pointer to lowest byte of stack */
+ uint64_t stack_size; /* Size of stack */
+ uint64_t tls; /* Location of new TLS */
+ uint64_t set_tid; /* Pointer to a pid_t array (since Linux 5.5) */
+ uint64_t set_tid_size; /* Number of elements in set_tid (since Linux
+ 5.5) */
+ uint64_t cgroup; /* File descriptor for target cgroup of child
+ (since Linux 5.7) */
+};
+
+
#define LINUX_CLOCK_REALTIME 0
#define LINUX_CLOCK_MONOTONIC 1
#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2