[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/12] linux-user: Add close_range() syscall
From: |
Helge Deller |
Subject: |
[PULL 11/12] linux-user: Add close_range() syscall |
Date: |
Tue, 20 Sep 2022 19:31:51 +0200 |
Signed-off-by: Helge Deller <deller@gmx.de>
---
linux-user/strace.list | 3 +++
linux-user/syscall.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 215d971b2a..ad9ef94689 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -103,6 +103,9 @@
#ifdef TARGET_NR_close
{ TARGET_NR_close, "close" , "%s(%d)", NULL, NULL },
#endif
+#ifdef TARGET_NR_close_range
+{ TARGET_NR_close_range, "close_range" , "%s(%d,%d,%d)", NULL, NULL },
+#endif
#ifdef TARGET_NR_connect
{ TARGET_NR_connect, "connect" , "%s(%d,%#x,%d)", NULL, NULL },
#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca39acfceb..2e0e974562 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -338,6 +338,10 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
+#if defined(__NR_close_range) && defined(TARGET_NR_close_range)
+#define __NR_sys_close_range __NR_close_range
+_syscall3(int,sys_close_range,int,first,int,last,int,flags)
+#endif
#if defined(__NR_futex)
_syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
const struct timespec *,timeout,int *,uaddr2,int,val3)
@@ -8721,6 +8725,18 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int
num, abi_long arg1,
case TARGET_NR_close:
fd_trans_unregister(arg1);
return get_errno(close(arg1));
+#if defined(__NR_close_range) && defined(TARGET_NR_close_range)
+ case TARGET_NR_close_range:
+ {
+ abi_long fd;
+ abi_long maxfd = (arg2 == (abi_long)-1) ? target_fd_max : arg2;
+
+ for (fd = arg1; fd <= maxfd; fd++) {
+ fd_trans_unregister(fd);
+ }
+ }
+ return get_errno(sys_close_range(arg1, arg2, arg3));
+#endif
case TARGET_NR_brk:
return do_brk(arg1);
--
2.37.3
- [PULL 00/12] Publish1 patches, Helge Deller, 2022/09/20
- [PULL 11/12] linux-user: Add close_range() syscall,
Helge Deller <=
- [PULL 07/12] linux-user: Fix strace of chmod() if mode == 0, Helge Deller, 2022/09/20
- [PULL 03/12] linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls, Helge Deller, 2022/09/20
- [PULL 02/12] linux-user: Add missing clock_gettime64() syscall strace, Helge Deller, 2022/09/20
- [PULL 05/12] linux-user/hppa: Use EXCP_DUMP() to show enhanced debug info, Helge Deller, 2022/09/20
- [PULL 09/12] linux-user: Add strace for clock_nanosleep(), Helge Deller, 2022/09/20
- [PULL 01/12] linux-user: Add missing signals in strace output, Helge Deller, 2022/09/20
- [PULL 10/12] linux-user: Show timespec on strace for futex(), Helge Deller, 2022/09/20
- [PULL 08/12] linux-user/hppa: Set TASK_UNMAPPED_BASE to 0xfa000000 for hppa arch, Helge Deller, 2022/09/20
- [PULL 04/12] linux-user: Log failing executable in EXCP_DUMP(), Helge Deller, 2022/09/20
- [PULL 06/12] linux-user/hppa: Dump IIR on register dump, Helge Deller, 2022/09/20