From patchwork Fri Jun 1 07:30:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137485 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp619492lji; Fri, 1 Jun 2018 00:53:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK4ZnFaKu08h2CwkYXplGdsCZbb9QhIkS9wQCfNlDZxJOXxWjPeyhkhwezpHXEu0fm3Wjqj X-Received: by 2002:ac8:34f1:: with SMTP id x46-v6mr9791781qtb.135.1527839588768; Fri, 01 Jun 2018 00:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527839588; cv=none; d=google.com; s=arc-20160816; b=qEPnwyHH38h3tX4ATfOOwpttdVW6bPOXOJLMudMqi/gNL54L58Jw+7ZryZnOkf7691 9KPoQSpl62sJlk06307oLETHFjmXQ4gtW7hjr3FtdlnfUOkPzRYIydz4pjh20jPkX6Gd 1RApZG7mOeBTZOpG6+cEJawEKfaX/EugplxNbyOvNiNZyksB8yjkiQc097SUqxQ3KdUk 8Rtrowffxlc2FFvMtlWNby1mwTIDCbVzlkUvHjN/405STVOJ5C11TevdDklfqE35vL3q wZaGPEkw1/OSRWoGYNasuPRuQ+MGTzcqT4zfdKgJaQ+hmt1GbmkV5PeXbPrsUSv5hOAe bp8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=0BslVQ5gJKshsDyU0oWNTmplcPAKwDJr0uW2lGkq6xE=; b=wjs1N0fJeihzL+LkvUKJF6Tj0Ql1UvUh7n4t5yelSArehk/Mv1Gw36WNRhbX7pR8Qt erI2KgOzlbqt9Kfuk+dp+kK2fj1Ls8DexEaynndg2XhRiO7RCt3N2yygmLkaDOk4ZzcU Xsqgvlvf7iCSnLkiQPRFXtNs6y2DnBV76rhjQP2iymdnhsu1/1azhNAo8rK6Pgkq34RA XJ33vg6Jiu1wOlluTKwX/SXZMGmJZXmf+/aSU/jjdm9w3S3aW8AHFI88PZSOh7YBws+b vjxyT9TItWcNNZ/DCN+HET3jyTFum64qvpagh5iuUKIqg4vBaz3Prr//4GSEuWYNkPqm OiCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JUdDgDh2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f5-v6si1051561qvi.257.2018.06.01.00.53.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Jun 2018 00:53:08 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JUdDgDh2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOes0-0004b3-6v for patch@linaro.org; Fri, 01 Jun 2018 03:53:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOeWy-0005gQ-FH for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOeWx-0000c8-IC for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:24 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:33834) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOeWx-0000bR-CD for qemu-devel@nongnu.org; Fri, 01 Jun 2018 03:31:23 -0400 Received: by mail-pl0-x243.google.com with SMTP id ay10-v6so14819429plb.1 for ; Fri, 01 Jun 2018 00:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0BslVQ5gJKshsDyU0oWNTmplcPAKwDJr0uW2lGkq6xE=; b=JUdDgDh2h2DO5l0ItUYYNomc6VoVs6MdaB7EtjIKLs8gfpesuc8ievAtOS9hXWizC5 hNTbzmJCfSia+BlEC5mdSmL/yJ288GnvRt1RRDXDXOmE91+SvbriLeKECqD+eFXQgxIa qmGAJxoXJ9+CBQkHwqUdoxH0AHQgBV48JTt+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0BslVQ5gJKshsDyU0oWNTmplcPAKwDJr0uW2lGkq6xE=; b=lyet1L+n3IdfgEhNlKdNhFAVS8tYHxKisMEX2rHNhMKCWDDfXQcnZzSuRFbYqOV/tL xQy7iBYsWJUin6zYFVAYS6tSxdDLzglDQEZ6MfrmJwaEdjXQXWccAoBIYzive57x+Ava 0JJVGOI/7vhsCR5KYjcQoxYvcQcWtX2qGYtCTd0g5gc+InoNOkNAaW40YpNhLWGDiBpb 4zh4NV1Epf0DPVKp3w3m4GGQwKkX1V3QJmyreHOFuw5H+OSJnlXBp/4MPjQcSkUq5/F/ +fl7Y/vznkTtdkyMjsoQPsqtLeAwFa/pUNSlyWocehkQzwa0ftWvnZy7UfS4Q3j619O/ zz7A== X-Gm-Message-State: ALKqPwdFmsl1xwYJqiqFqnPNFMzdbFX4x7JZe9kYkRXicIlClKtNYmfQ PwM0RzUb9I+jDVM4oBq0wDmTymCWeeA= X-Received: by 2002:a17:902:2f84:: with SMTP id t4-v6mr10350070plb.24.1527838282110; Fri, 01 Jun 2018 00:31:22 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id c4-v6sm4431782pgv.86.2018.06.01.00.31.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 00:31:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 1 Jun 2018 00:30:37 -0700 Message-Id: <20180601073050.8054-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180601073050.8054-1-richard.henderson@linaro.org> References: <20180601073050.8054-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH 20/33] linux-user: Split out getpid, getxpid, lseek X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 45 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) -- 2.17.0 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6a701ea8f6..b568144369 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8106,6 +8106,21 @@ IMPL(fork) } #endif +#ifdef TARGET_NR_getpid +IMPL(getpid) +{ + return get_errno(getpid()); +} +#endif + +#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) +IMPL(getxpid) +{ + ((CPUAlphaState *)cpu_env)->ir[IR_A4] = getppid(); + return get_errno(getpid()); +} +#endif + #ifdef TARGET_NR_link IMPL(link) { @@ -8143,6 +8158,14 @@ IMPL(linkat) } #endif +IMPL(lseek) +{ + if (is_hostfd(arg1)) { + return -TARGET_EBADF; + } + return get_errno(lseek(arg1, arg2, arg3)); +} + #ifdef TARGET_NR_mknod IMPL(mknod) { @@ -8460,21 +8483,6 @@ IMPL(everything_else) char *fn; switch(num) { - case TARGET_NR_lseek: - if (is_hostfd(arg1)) { - return -TARGET_EBADF; - } - return get_errno(lseek(arg1, arg2, arg3)); -#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) - /* Alpha specific */ - case TARGET_NR_getxpid: - ((CPUAlphaState *)cpu_env)->ir[IR_A4] = getppid(); - return get_errno(getpid()); -#endif -#ifdef TARGET_NR_getpid - case TARGET_NR_getpid: - return get_errno(getpid()); -#endif case TARGET_NR_mount: { /* need to look at the data field */ @@ -12869,12 +12877,19 @@ static impl_fn * const syscall_table[] = { #ifdef TARGET_NR_fork [TARGET_NR_fork] = impl_fork, #endif +#ifdef TARGET_NR_getpid + [TARGET_NR_getpid] = impl_getpid, +#endif +#if defined(TARGET_NR_getxpid) && defined(TARGET_ALPHA) + [TARGET_NR_getxpid] = impl_getxpid, +#endif #ifdef TARGET_NR_link [TARGET_NR_link] = impl_link, #endif #if defined(TARGET_NR_linkat) [TARGET_NR_linkat] = impl_linkat, #endif + [TARGET_NR_lseek] = impl_lseek, #ifdef TARGET_NR_mknod [TARGET_NR_mknod] = impl_mknod, #endif