* [Qemu-devel] [PATCH] linux-user: implement F_[GS]ETOWN_EX
@ 2014-03-06 23:59 Andreas Schwab
2014-03-07 8:46 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2014-03-06 23:59 UTC (permalink / raw)
To: qemu-devel
F_[GS]ETOWN is replaced by F_[GS]ETOWN_EX inside the glibc fcntl wrapper.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
linux-user/syscall.c | 10 ++++++++++
linux-user/syscall_defs.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2f573b8..51fbc91 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4366,6 +4366,14 @@ static int target_to_host_fcntl_cmd(int cmd)
#endif
case TARGET_F_NOTIFY:
return F_NOTIFY;
+#ifdef F_GETOWN_EX
+ case TARGET_F_GETOWN_EX:
+ return F_GETOWN_EX;
+#endif
+#ifdef F_SETOWN_EX
+ case TARGET_F_SETOWN_EX:
+ return F_SETOWN_EX;
+#endif
default:
return -TARGET_EINVAL;
}
@@ -4487,6 +4495,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
case TARGET_F_GETSIG:
case TARGET_F_SETLEASE:
case TARGET_F_GETLEASE:
+ case TARGET_F_GETOWN_EX:
+ case TARGET_F_SETOWN_EX:
ret = get_errno(fcntl(fd, host_cmd, arg));
break;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 3c8869e..ed3d1a6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2134,6 +2134,9 @@ struct target_statfs64 {
#define TARGET_F_SETSIG 10 /* for sockets. */
#define TARGET_F_GETSIG 11 /* for sockets. */
+#define TARGET_F_SETOWN_EX 15
+#define TARGET_F_GETOWN_EX 16
+
#if defined(TARGET_MIPS)
#define TARGET_F_GETLK64 33 /* using 'struct flock64' */
#define TARGET_F_SETLK64 34
--
1.9.0
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: implement F_[GS]ETOWN_EX
2014-03-06 23:59 [Qemu-devel] [PATCH] linux-user: implement F_[GS]ETOWN_EX Andreas Schwab
@ 2014-03-07 8:46 ` Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2014-03-07 8:46 UTC (permalink / raw)
To: qemu-devel
Please ignore this patch, it was prematurely sent.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH] linux-user: implement F_[GS]ETOWN_EX
@ 2014-03-07 14:24 Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2014-03-07 14:24 UTC (permalink / raw)
To: qemu-devel
F_GETOWN is replaced by F_GETOWN_EX inside the glibc fcntl wrapper
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
Only tested so far with the gnulib test-fcntl module, which mainly tests
proper error handling only.
---
linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++++++
linux-user/syscall_defs.h | 7 +++++++
2 files changed, 43 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2f573b8..54bc56a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4366,6 +4366,14 @@ static int target_to_host_fcntl_cmd(int cmd)
#endif
case TARGET_F_NOTIFY:
return F_NOTIFY;
+#ifdef F_GETOWN_EX
+ case TARGET_F_GETOWN_EX:
+ return F_GETOWN_EX;
+#endif
+#ifdef F_SETOWN_EX
+ case TARGET_F_SETOWN_EX:
+ return F_SETOWN_EX;
+#endif
default:
return -TARGET_EINVAL;
}
@@ -4388,6 +4396,10 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
struct target_flock *target_fl;
struct flock64 fl64;
struct target_flock64 *target_fl64;
+#ifdef F_GETOWN_EX
+ struct f_owner_ex fox;
+ struct target_f_owner_ex *target_fox;
+#endif
abi_long ret;
int host_cmd = target_to_host_fcntl_cmd(cmd);
@@ -4481,6 +4493,30 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
ret = get_errno(fcntl(fd, host_cmd, target_to_host_bitmask(arg, fcntl_flags_tbl)));
break;
+#ifdef F_GETOWN_EX
+ case TARGET_F_GETOWN_EX:
+ ret = get_errno(fcntl(fd, host_cmd, &fox));
+ if (ret >= 0) {
+ if (!lock_user_struct(VERIFY_WRITE, target_fox, arg, 0))
+ return -TARGET_EFAULT;
+ target_fox->type = tswap32(fox.type);
+ target_fox->pid = tswap32(fox.pid);
+ unlock_user_struct(target_fox, arg, 1);
+ }
+ break;
+#endif
+
+#ifdef F_SETOWN_EX
+ case TARGET_F_SETOWN_EX:
+ if (!lock_user_struct(VERIFY_READ, target_fox, arg, 1))
+ return -TARGET_EFAULT;
+ fox.type = tswap32(target_fox->type);
+ fox.pid = tswap32(target_fox->pid);
+ unlock_user_struct(target_fox, arg, 0);
+ ret = get_errno(fcntl(fd, host_cmd, &fox));
+ break;
+#endif
+
case TARGET_F_SETOWN:
case TARGET_F_GETOWN:
case TARGET_F_SETSIG:
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 3c8869e..f3c3b49 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2118,6 +2118,8 @@ struct target_statfs64 {
#define TARGET_F_SETOWN 8 /* for sockets. */
#define TARGET_F_GETOWN 9 /* for sockets. */
#endif
+#define TARGET_F_SETOWN_EX 15
+#define TARGET_F_GETOWN_EX 16
#ifndef TARGET_F_RDLCK
#define TARGET_F_RDLCK 0
@@ -2300,6 +2302,11 @@ struct target_eabi_flock64 {
} QEMU_PACKED;
#endif
+struct target_f_owner_ex {
+ int type; /* Owner type of ID. */
+ int pid; /* ID of owner. */
+};
+
/* soundcard defines */
/* XXX: convert them all to arch indepedent entries */
#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
--
1.9.0
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-07 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 23:59 [Qemu-devel] [PATCH] linux-user: implement F_[GS]ETOWN_EX Andreas Schwab
2014-03-07 8:46 ` Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
2014-03-07 14:24 Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).