From patchwork Fri Jan 18 21:31:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156080 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3745586jaa; Fri, 18 Jan 2019 13:59:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN6i5lbFelXEu6eCKW3Rt42C4WWAIyKPVyHtrYSrD4xQYGyOJY5PPa6U40P34Zvej1gk0BfG X-Received: by 2002:a1c:c483:: with SMTP id u125mr16809970wmf.14.1547848743215; Fri, 18 Jan 2019 13:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547848743; cv=none; d=google.com; s=arc-20160816; b=Wd2lBBt1tC8Awbz1uh2JgDAwC6Hy34JtuN2nEgIgB5NXspOGl7n66gek2AmREkfCLd PLDumAOuA0d3LNS126S3xQ02hfgdQ0e8xtraDeF3gAYdFaFiNDybLuBoO5/ORWzTk/Kb TlgfHXbNJpbzYrXWufRgPFX2DMbz9JO1MbxQUbUKnrqXnBrZeCxyUptExHQuyCcQ+wS7 TtWzS7fSWUDRPmcvYdaIvxlZr9Fxf6ZkQVlq06DgiKpTqp/PY5bYWNv9Mlr+dbkISvKn Zee3LXldqGzpDpRyMIFj2EfRwYmSEk11penL5fmfz4yoJX529MU33Z9ml0HT9Vf9XMnf jhPw== 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; bh=LLOQ0aPeYq0RU7owywYYSEV/qQ8eh0gn9IoFhaLpsAY=; b=ibIdSVEMZfI2Ss9GHCjN29e45oseFlwM/nVK7Cu1XwvAGiI7ezeUKfW6flaDI9bYRw bc4AbL8rMAWukuu61pOHtrv1wYmvi7S/RlRWT2Dt/YA9k4QBtPvGsQgJ73um1OlLj+vs V1jM5fktN5YCgmKotmRq2XJRmNhVx/GWNDj+0FlwwxsrRzDcp7creGuYVPux73+0hoWQ NGefhu3MtHiNaTDbt9vqihZesWeQhpHLN9sWMqxNE8VF6sxdL7JYhSeSh3CcVuWho/ik JuXUW//m4qKUGG8IuSz8BVljqjg/XCFtBsbHzEwfrWB7TN0Gp0lRU1qebfEUnnRfdjWQ zB2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Aka7+PCg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id r16si62770725wrp.189.2019.01.18.13.59.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 18 Jan 2019 13:59:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Aka7+PCg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:47756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkcAI-00016a-4V for patch@linaro.org; Fri, 18 Jan 2019 16:59:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkbkt-0005YW-9z for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkbkp-00055c-H0 for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:45 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34622) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkbkn-00052s-IU for qemu-devel@nongnu.org; Fri, 18 Jan 2019 16:32:42 -0500 Received: by mail-pf1-x444.google.com with SMTP id h3so7218884pfg.1 for ; Fri, 18 Jan 2019 13:32:40 -0800 (PST) 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=LLOQ0aPeYq0RU7owywYYSEV/qQ8eh0gn9IoFhaLpsAY=; b=Aka7+PCgeg2zFkvAuYcabAnsHvRQYcQwNI4i+zlEskk3ViQgVCTYzDg0aS1hRaMoqF 2KJxM2YvWDRq9lc26itUhrThk+DjX8w+v6XDvEIxjj5YxoIo4vZBwPe6GkXOqN6TnE+f tTrK5jK92yWC/FbJ6lCSMFz4dhz1pC34CcSoI= 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=LLOQ0aPeYq0RU7owywYYSEV/qQ8eh0gn9IoFhaLpsAY=; b=dYnJ5kvAYB9L43vzahYDeZvW8ljMWkrBRKEsRKg/+Nmxp5Qw+/QBw7oEgoX5eJJpxn XCvhrlAv15CW2nTJzwgc6pU/KXOlhCScYOtGWt/RB/ltV42vok3my/Xri+n1OguzUPlX CZjQPdRGEP9XI488cDznLcocEgfmeZ66TlF8yOemAsMW3IrGvGProgHamyPFgf8td9xv ZLccRKHONnpxB/cwyn7aawj0pwTaHOArofMW6e49rI3Yw3GaWRWnCGsf/ra1pjy0m/E/ uBiKEtBbrXClr7ACecwXiZ9VrXte75QXtr1g6GlCAr6jzD1cbyzMXHMZrA3u/wShSpnc 4VoQ== X-Gm-Message-State: AJcUukd8fxu8hfUdy5B+FhIC/LuWk44wlJMFwTN9NXbJ0/bkHc7KucsS 6dlAuMitq64qSjjp0anVbS69pxcnVl8= X-Received: by 2002:a62:7892:: with SMTP id t140mr20940712pfc.237.1547847159783; Fri, 18 Jan 2019 13:32:39 -0800 (PST) Received: from cloudburst.twiddle.net ([2001:8000:10e0:a000:c673:a6b6:fdef:1933]) by smtp.gmail.com with ESMTPSA id v12sm5833667pgg.41.2019.01.18.13.32.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:32:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 19 Jan 2019 08:31:04 +1100 Message-Id: <20190118213122.22865-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190118213122.22865-1-richard.henderson@linaro.org> References: <20190118213122.22865-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v6 31/49] linux-user: Split out getpid, getppid, getxpid 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-defs.h | 9 +++++++++ linux-user/syscall-proc.inc.c | 23 +++++++++++++++++++++++ linux-user/syscall.c | 14 -------------- linux-user/strace.list | 9 --------- 4 files changed, 32 insertions(+), 23 deletions(-) -- 2.17.2 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 3453e7afdf..d163bbf409 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -36,6 +36,15 @@ SYSCALL_DEF(fchmodat, ARG_ATDIRFD, ARG_STR, ARG_MODEFLAG); #ifdef TARGET_NR_fork SYSCALL_DEF(fork); #endif +#ifdef TARGET_NR_getpid +SYSCALL_DEF(getpid); +#endif +#ifdef TARGET_NR_getppid +SYSCALL_DEF(getppid); +#endif +#ifdef TARGET_NR_getxpid +SYSCALL_DEF(getxpid); +#endif #ifdef TARGET_NR_ipc SYSCALL_DEF_ARGS(ipc, ARG_HEX, ARG_DEC, ARG_DEC, ARG_HEX, ARG_PTR, ARG_HEX); #endif diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c index 699370c290..c09c83775c 100644 --- a/linux-user/syscall-proc.inc.c +++ b/linux-user/syscall-proc.inc.c @@ -438,6 +438,29 @@ SYSCALL_IMPL(fork) } #endif +#ifdef TARGET_NR_getpid +SYSCALL_IMPL(getpid) +{ + return getpid(); +} +#endif + +#ifdef TARGET_NR_getppid +SYSCALL_IMPL(getppid) +{ + return getppid(); +} +#endif + +#ifdef TARGET_NR_getxpid +SYSCALL_IMPL(getxpid) +{ + /* Alpha specific */ + cpu_env->ir[IR_A4] = getppid(); + return getpid(); +} +#endif + /* * Map host to target signal numbers for the wait family of syscalls. * Assume all other status bits are the same. diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 09fcec7812..6ea1a67345 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5327,16 +5327,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { -#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 */ @@ -5668,10 +5658,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return ret; } #endif -#ifdef TARGET_NR_getppid /* not on alpha */ - case TARGET_NR_getppid: - return get_errno(getppid()); -#endif #ifdef TARGET_NR_getpgrp case TARGET_NR_getpgrp: return get_errno(getpgrp()); diff --git a/linux-user/strace.list b/linux-user/strace.list index 18c93ccc2d..344a2232d6 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -298,15 +298,9 @@ #ifdef TARGET_NR_getpgrp { TARGET_NR_getpgrp, "getpgrp" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getpid -{ TARGET_NR_getpid, "getpid" , "%s()", NULL, NULL }, -#endif #ifdef TARGET_NR_getpmsg { TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getppid -{ TARGET_NR_getppid, "getppid" , "%s()", NULL, NULL }, -#endif #ifdef TARGET_NR_getpriority { TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL }, #endif @@ -365,9 +359,6 @@ #ifdef TARGET_NR_getxgid { TARGET_NR_getxgid, "getxgid" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_getxpid -{ TARGET_NR_getxpid, "getxpid" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_getxuid { TARGET_NR_getxuid, "getxuid" , NULL, NULL, NULL }, #endif