|
@@ -364,6 +364,13 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
|
|
#ifdef __NR_exit_group
|
|
#ifdef __NR_exit_group
|
|
_syscall1(int,exit_group,int,error_code)
|
|
_syscall1(int,exit_group,int,error_code)
|
|
#endif
|
|
#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)
|
|
|
|
+#ifndef CLOSE_RANGE_CLOEXEC
|
|
|
|
+#define CLOSE_RANGE_CLOEXEC (1U << 2)
|
|
|
|
+#endif
|
|
|
|
+#endif
|
|
#if defined(__NR_futex)
|
|
#if defined(__NR_futex)
|
|
_syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
|
|
_syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
|
|
const struct timespec *,timeout,int *,uaddr2,int,val3)
|
|
const struct timespec *,timeout,int *,uaddr2,int,val3)
|
|
@@ -3346,7 +3353,8 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
|
|
if (fd_trans_host_to_target_data(fd)) {
|
|
if (fd_trans_host_to_target_data(fd)) {
|
|
ret = fd_trans_host_to_target_data(fd)(msg.msg_iov->iov_base,
|
|
ret = fd_trans_host_to_target_data(fd)(msg.msg_iov->iov_base,
|
|
MIN(msg.msg_iov->iov_len, len));
|
|
MIN(msg.msg_iov->iov_len, len));
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!is_error(ret)) {
|
|
ret = host_to_target_cmsg(msgp, &msg);
|
|
ret = host_to_target_cmsg(msgp, &msg);
|
|
}
|
|
}
|
|
if (!is_error(ret)) {
|
|
if (!is_error(ret)) {
|
|
@@ -8756,6 +8764,18 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
|
case TARGET_NR_close:
|
|
case TARGET_NR_close:
|
|
fd_trans_unregister(arg1);
|
|
fd_trans_unregister(arg1);
|
|
return get_errno(close(arg1));
|
|
return get_errno(close(arg1));
|
|
|
|
+#if defined(__NR_close_range) && defined(TARGET_NR_close_range)
|
|
|
|
+ case TARGET_NR_close_range:
|
|
|
|
+ ret = get_errno(sys_close_range(arg1, arg2, arg3));
|
|
|
|
+ if (ret == 0 && !(arg3 & CLOSE_RANGE_CLOEXEC)) {
|
|
|
|
+ abi_long fd, maxfd;
|
|
|
|
+ maxfd = MIN(arg2, target_fd_max);
|
|
|
|
+ for (fd = arg1; fd < maxfd; fd++) {
|
|
|
|
+ fd_trans_unregister(fd);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ret;
|
|
|
|
+#endif
|
|
|
|
|
|
case TARGET_NR_brk:
|
|
case TARGET_NR_brk:
|
|
return do_brk(arg1);
|
|
return do_brk(arg1);
|