From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Anthony Liguori <aliguori@amazon.com>,
Andreas Schwab <schwab@suse.de>
Subject: [Qemu-devel] [PULL for-2.0 3/7] linux-user: implement F_[GS]ETOWN_EX
Date: Wed, 19 Mar 2014 16:02:58 +0200 [thread overview]
Message-ID: <8d5d30046b9aadfeee60e09fe79c063f419993db.1395237255.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1395237255.git.riku.voipio@linaro.org>
From: Andreas Schwab <schwab@suse.de>
F_GETOWN is replaced by F_GETOWN_EX inside the glibc fcntl wrapper
Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
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 b5eadb1..b8086b8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4421,6 +4421,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;
}
@@ -4443,6 +4451,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);
@@ -4536,6 +4548,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 732c9e3..2a7d1db 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2123,6 +2123,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
@@ -2305,6 +2307,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.8.1.2
next prev parent reply other threads:[~2014-03-19 14:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 14:02 [Qemu-devel] [PULL for-2.0 0/7] linux-user patches riku.voipio
2014-03-19 14:02 ` [Qemu-devel] [PULL for-2.0 1/7] linux-user/signal.c: Correct error path for AArch64 do_rt_sigreturn riku.voipio
2014-03-19 14:02 ` [Qemu-devel] [PULL for-2.0 2/7] linux-user: Don't return uninitialized value for atomic_barrier syscall riku.voipio
2014-03-19 14:02 ` riku.voipio [this message]
2014-03-19 14:02 ` [Qemu-devel] [PULL for-2.0 4/7] linux-user: Don't reserve space for commpage for AArch64 riku.voipio
2014-03-19 14:03 ` [Qemu-devel] [PULL for-2.0 5/7] signal: added a wrapper for sigprocmask function riku.voipio
2014-03-19 14:03 ` [Qemu-devel] [PULL for-2.0 6/7] linux-user: Don't allow guest to block SIGSEGV riku.voipio
2014-03-19 14:03 ` [Qemu-devel] [PULL for-2.0 7/7] linux-user: Implement capget, capset riku.voipio
2014-03-19 15:10 ` Laurent Desnogues
2014-03-19 16:07 ` Peter Maydell
2014-03-19 14:43 ` [Qemu-devel] [PULL for-2.0 0/7] linux-user patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d5d30046b9aadfeee60e09fe79c063f419993db.1395237255.git.riku.voipio@linaro.org \
--to=riku.voipio@linaro.org \
--cc=aliguori@amazon.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).