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: 927250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kGyHA2WY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 413MHb2Szkz9ry1 for ; Sun, 10 Jun 2018 13:35:55 +1000 (AEST) Received: from localhost ([::1]:42354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRr8y-0005XF-Up for incoming@patchwork.ozlabs.org; Sat, 09 Jun 2018 23:35:53 -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-Google-Smtp-Source: ADUXVKLNWqzmZPXUAdkqIvAeBE4lhEwsYeWWuGm1R1YdIHhWU7uiWURj0t0Vsg1L0mI9OIOnWNjbew== 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+incoming=patchwork.ozlabs.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(-) 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