[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] linux-user: add SO_LINGER to setsockopt
From: |
Carlo Marcelo Arenas Belón |
Subject: |
[Qemu-devel] [PATCH 2/3] linux-user: add SO_LINGER to setsockopt |
Date: |
Tue, 19 Sep 2017 16:06:42 -0700 |
Original implementation by Chen Gang; all bugs mine
Signed-off-by: Chen Gang <address@hidden>
Signed-off-by: Carlo Marcelo Arenas Belón <address@hidden>
---
linux-user/syscall.c | 15 +++++++++++++++
linux-user/syscall_defs.h | 5 +++++
2 files changed, 20 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9b6364a266..ad689dad50 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3071,6 +3071,21 @@ set_timeout:
unlock_user (dev_ifname, optval_addr, 0);
return ret;
}
+ case TARGET_SO_LINGER:
+ {
+ struct linger lg;
+ struct target_linger *tlg;
+
+ if (!lock_user_struct(VERIFY_READ, tlg, optval_addr, 1)) {
+ return -TARGET_EFAULT;
+ }
+ __get_user(lg.l_onoff, &tlg->l_onoff);
+ __get_user(lg.l_linger, &tlg->l_linger);
+ ret = get_errno(setsockopt(sockfd, SOL_SOCKET, SO_LINGER,
+ &lg, optlen));
+ unlock_user_struct(tlg, optval_addr, 0);
+ return ret;
+ }
/* Options with 'int' argument. */
case TARGET_SO_DEBUG:
optname = SO_DEBUG;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 40c5027e93..a60d6bb163 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -202,6 +202,11 @@ struct target_ip_mreq_source {
uint32_t imr_sourceaddr;
};
+struct target_linger {
+ abi_int l_onoff; /* Linger active */
+ abi_int l_linger; /* How long to linger for */
+};
+
struct target_timeval {
abi_long tv_sec;
abi_long tv_usec;
--
2.14.1