From patchwork Wed Mar 19 14:02:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 26581 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B72F020560 for ; Wed, 19 Mar 2014 14:04:28 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp18sf32158944obc.0 for ; Wed, 19 Mar 2014 07:04:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=6VSRFdxjRXfXeJ55pNJqCjahsLxCBGD5k3UUydCyuJ4=; b=hR1mSkAqrBaA50seZ4IWpPgpI2hsdUAEj2h9P34vmpq8YSiTohqh2VEzU2WbF5EOTM rJsQd/Y8DLQQxoCDlG6I7f6I3uv82CkpXCP2+rrREFULiMDCDg3AtJDch+dh7sQVA2g3 fPdLYbth7kHhPyKYP8Q8NB0wbBmLbbOjXOosnkyVI6JmYt1b/bsAc7O5WweX05XVAZqe 3AaLFDMoa8C2f+psvIzDu8goLWMO95Lv8q7VJRfM7cvEmc6GfGWqEZ1XxLojfwusZgtc +nKqPyWXAUYC/fJrJ0nQcvSyVvj1zcLYIZ/alKIf0uuuF3oppdR706P/XPi3Kz+l92vd Rpjg== X-Gm-Message-State: ALoCoQmNxvczhGjVSAI/QLndevUtQ92yklEOHhgNb3X6Wx2H8pkIns9lVwx9Hw5PstR+dmFZuq5s X-Received: by 10.182.104.70 with SMTP id gc6mr1018859obb.35.1395237868211; Wed, 19 Mar 2014 07:04:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.100 with SMTP id b91ls2581260qgf.26.gmail; Wed, 19 Mar 2014 07:04:28 -0700 (PDT) X-Received: by 10.52.108.164 with SMTP id hl4mr3248053vdb.25.1395237867960; Wed, 19 Mar 2014 07:04:27 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id vd8si3535245vdc.124.2014.03.19.07.04.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Mar 2014 07:04:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so8960403vcb.39 for ; Wed, 19 Mar 2014 07:04:27 -0700 (PDT) X-Received: by 10.58.247.193 with SMTP id yg1mr5922vec.41.1395237866813; Wed, 19 Mar 2014 07:04:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp302277vck; Wed, 19 Mar 2014 07:04:26 -0700 (PDT) X-Received: by 10.180.189.139 with SMTP id gi11mr19736260wic.53.1395237865517; Wed, 19 Mar 2014 07:04:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id wa3si14792031wjc.79.2014.03.19.07.04.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Mar 2014 07:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQH6V-0000ZT-Pg for patch@linaro.org; Wed, 19 Mar 2014 10:04:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQH5K-0007jg-Qg for qemu-devel@nongnu.org; Wed, 19 Mar 2014 10:03:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQH5G-0005yk-8c for qemu-devel@nongnu.org; Wed, 19 Mar 2014 10:03:10 -0400 Received: from afflict.kos.to ([92.243.29.197]:54513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQH5F-0005vI-Tk for qemu-devel@nongnu.org; Wed, 19 Mar 2014 10:03:06 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 3C2B726566; Wed, 19 Mar 2014 15:03:04 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 19 Mar 2014 16:02:58 +0200 Message-Id: <8d5d30046b9aadfeee60e09fe79c063f419993db.1395237255.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Peter Maydell , Anthony Liguori , Andreas Schwab Subject: [Qemu-devel] [PULL for-2.0 3/7] linux-user: implement F_[GS]ETOWN_EX X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Andreas Schwab F_GETOWN is replaced by F_GETOWN_EX inside the glibc fcntl wrapper Signed-off-by: Andreas Schwab Signed-off-by: Riku Voipio --- 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);