From patchwork Sun Jun 10 03:01:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138120 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2592029lji; Sat, 9 Jun 2018 20:35:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImEaMUiFqbqiDgn1KVjeAlmoqhFmhlSh8WbTN5k1ADSaHUXEkSZ/ROnNEikc2UDIjLOa1u X-Received: by 2002:ac8:24fa:: with SMTP id t55-v6mr11854679qtt.196.1528601737577; Sat, 09 Jun 2018 20:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601737; cv=none; d=google.com; s=arc-20160816; b=SqQa6X2vcxJ6cGHOdO1gFlvS0AtZIun9QKBX7K/X/PgkIivMdSRA8QKnUdP2xWdXO2 Hep+MY46cIcP3xCp/lzPnlCcPQTBQUilusdX18RzhwQP97DBBAZ4PnPe4sxSNR03fcZD Ne9hxEGQ5ITuvgcLxvp1Q6MwFjzyeZrAzaJi/i5cSnVvsIV5rA5eupvGwCMrP7smLT5x qoPjfzQXdFc2bGB5GtGxsazyVS8Png5t2s/Uhu5pPJmNflaqfuFFUYAzQKaCYFWJb9Y1 OpHjZ4BmhlXaxDcZeo8gH2FE2xJimevpte27pGwJAIjkbW+RawAtQHUVdG7zBI93zLmX kfBw== 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=MUvX6lyiWfqoJVTOqtiDDnvFbBTaBxc2WWyvr2yzI6U=; b=L4xKSVdW+uBTOF2KS62Ht0bxKse9Pq8RCii4c2Eoty99m95Ksssf/2FSUxqPQezKAo yudoTnYHrlIbUs27V1cKX2glLjqsqrIPZeKnCfoO85+gl8thFjG/zEoIGUBJOpPuxqF3 o7i6tK7oiAqvyaz/Izn2Wcc4wWep1O4GdyODaJ8Kt8d1MoX8ij4vNDMiOXEamkdNxWyC gOeoQwmOS4LhF3EdycRlapxVGsVbtC1Kjzr2ZjfHGWnTFhpPVg6f2rcWLb2FIBu74PQH Y0aAJ64soTwPsouZkCzcJ9IgRkx3fqGsg8L+jaC1iEH/Z1F/YoDBsc6DJbjVL01kiJfJ 9ZIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kGyHA2WY; 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 s203-v6si7366102qke.188.2018.06.09.20.35.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:35:37 -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=kGyHA2WY; 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]:42354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRr8j-0005XF-2i for patch@linaro.org; Sat, 09 Jun 2018 23:35:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqeN-00034o-70 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqeM-0003iZ-69 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:15 -0400 Received: from mail-pl0-x232.google.com ([2607:f8b0:400e:c01::232]:42131) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqeM-0003iF-0Y for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:14 -0400 Received: by mail-pl0-x232.google.com with SMTP id w17-v6so10390336pll.9 for ; Sat, 09 Jun 2018 20:04:13 -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=MUvX6lyiWfqoJVTOqtiDDnvFbBTaBxc2WWyvr2yzI6U=; b=kGyHA2WYGfG+sq8JMb6cq32o7dVPPhnhJ8eWxAhagMEUViPJ8cQ+4sIVs4SvCgqWtG Qw+Zh9r9MJ9yKv/kvASZiWJk1IwKFhy9TKP0uLhRQx/R+SxjasisdqU8W2pusk87dz6r PPQduZnOHKxiRSQ+qWP+cfNmKGY5q8ay8yZ+U= 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=MUvX6lyiWfqoJVTOqtiDDnvFbBTaBxc2WWyvr2yzI6U=; b=sq9OEKRIlprQN7icvGguLzrR/5C/Y1ph8WireGKkOfwppxJJYb5gaWLUlIUfaN6X6g FTJPy8E17U6XJ/54bD87aAER9FSIYiBh2IAD/3TfRT2n01qKOTohi0AXROPzlzVE73mR 7Ze0qO8z8cQTHCJRjW898Tpq+V1XJt6xuy/bR6/Yk4THpyJX9gYgvFkasUWfXbwuv10K WjVr330nfznHwNLTuI1C/JWVeXkR4WQ6XZSHhz8PdkMUScoAhps3ThfXjd/NwSPO95Zt GDok4fnX+Hv4efHwHBNe+4Cx4vCxX6b7KgjJm9r9vNcBMfJGcXSTjDtnJ82KqTaBpNsb 9Hwg== X-Gm-Message-State: APt69E1iGw1PKOKXWejQlsqs/uuARmWDNP6wIizY1tw2vhcdbU9D9kDI VUs0qNcFtfhfc3mTkESyo7Te/9K7sYE= X-Received: by 2002:a17:902:8e87:: with SMTP id bg7-v6mr12895596plb.129.1528599852827; Sat, 09 Jun 2018 20:04:12 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.04.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:04:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:21 -1000 Message-Id: <20180610030220.3777-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-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::232 Subject: [Qemu-devel] [PATCH v2 049/108] linux-user: Fix stub gettid 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" A "proper" implementation of the stub would assign ENOSYS to errno and return -1. As it is, the subsequent get_error will return whatever garbage value was in errno. Use the bogus syscall method for defining the stub function. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4dc2312ae6..46c7c485fd 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -256,17 +256,12 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \ #ifndef __NR_getrandom #define __NR_getrandom -1 #endif - -#ifdef __NR_gettid -_syscall0(int, gettid) -#else -/* This is a replacement for the host gettid() and must return a host - errno. */ -static int gettid(void) { - return -ENOSYS; -} +#ifndef __NR_gettid +#define __NR_gettid -1 #endif +_syscall0(int, gettid) + /* For the 64-bit guest on 32-bit host case we must emulate * getdents using getdents64, because otherwise the host * might hand us back more dirent records than we can fit