From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-5.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 3C7861F8C6 for ; Tue, 7 Sep 2021 13:15:48 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 367253853826 for ; Tue, 7 Sep 2021 13:15:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 367253853826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631020547; bh=Q8dGiFlnCJ88OWT6Cud8PICcv0EIhptxgO/DaN3azKA=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ddgZ5JR09botOzTYLzjYvTj8p23ME3AWycz725Mnkt/Ys5tLtgoXZXGkJrWQWij+O MAdgW1AcNkwOC787Jh0EexROXEOqcef0Gs3hALqlV+2DjQbaQarFbZNLiE3ZCI0V7E 2KbTfJ49RaYGIcoZK7WBzNpFaxeZfCcI982e56Pk= Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 98DF0385842D for ; Tue, 7 Sep 2021 13:15:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 98DF0385842D Received: by mail-qk1-x729.google.com with SMTP id y144so9986966qkb.6 for ; Tue, 07 Sep 2021 06:15:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Q8dGiFlnCJ88OWT6Cud8PICcv0EIhptxgO/DaN3azKA=; b=fTcuaKUCSJeIRaYqgPWDHRYq1pRA50JtAgNRrfEhDYMYdZaPEFowude02wEJqXi7XD AwxoC4vDjs1aGabd3UG7Ap4iGOWUjjG346Hqm9FFcpawxdxSUHtyY3h4EcLe4JP9xaWj 9AxN1E15uX+poCIqsj1uKocCZpf+ZlAHbbvoXF2Jmn2uojMhtL6x9uN48josUC0wDy37 0spfBp7izZ4ead9AqLVdpGmXvk9VsGhqt0ZOOwiwhJNmNDd5bgmY/foiolzczQ13wmV6 cNHZTk9mEgCDr3FfDbV6l/F0Ep2dbY5sLShIhrYz0IFFSL6Ykpd5bcHvbEuIu/aagMph 1ewg== X-Gm-Message-State: AOAM530Jre3sWW1ZeXE21hQkhMp0xcXLus5F2IEZpplg6UmJIzJ8dlPB PQtyiaKWjbqpu/F7uw9pKgnnUA== X-Google-Smtp-Source: ABdhPJxi7iIO5MKhmDvbw7trQ56z07+zYXkjPJl3ap7Dc41qH002tTTU1l+mZSa4HOa4IAMQ3hXt0Q== X-Received: by 2002:a05:620a:448e:: with SMTP id x14mr15583046qkp.526.1631020528177; Tue, 07 Sep 2021 06:15:28 -0700 (PDT) Received: from ?IPv6:2804:431:c7cb:733d:f360:5bf3:9813:d8f5? ([2804:431:c7cb:733d:f360:5bf3:9813:d8f5]) by smtp.gmail.com with ESMTPSA id 207sm9076427qkh.45.2021.09.07.06.15.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Sep 2021 06:15:27 -0700 (PDT) Subject: Re: [PATCH] MIPS: Setup errno for {f,l,}xstat To: Jiaxun Yang , libc-alpha@sourceware.org References: <20210907053142.1774-1-jiaxun.yang@flygoat.com> Message-ID: <43d37c1b-6efc-c688-cc4a-f6514ff3c6b8@linaro.org> Date: Tue, 7 Sep 2021 10:15:25 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210907053142.1774-1-jiaxun.yang@flygoat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Cc: syq@debian.org, xry111@mengyan1223.wang Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 07/09/2021 02:31, Jiaxun Yang wrote: > {f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL > to do xstat syscall for glibc ver, However it leaves > errno untouched and thus giving bad errno output. > > Setup errno properly when syscall returns non-zero. > > Signed-off-by: Jiaxun Yang LGTM, thanks. I fixed the code style (using space instead of tabs as the current file is doing) and pushed upstream. Reviewed-by: Adhemerval Zanella > --- > sysdeps/unix/sysv/linux/mips/fxstat.c | 4 +++- > sysdeps/unix/sysv/linux/mips/lxstat.c | 4 +++- > sysdeps/unix/sysv/linux/mips/xstat.c | 4 +++- > 3 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c > index 11511d30b3..6d2750adcd 100644 > --- a/sysdeps/unix/sysv/linux/mips/fxstat.c > +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c > @@ -35,7 +35,9 @@ __fxstat (int vers, int fd, struct stat *buf) > { > struct kernel_stat kbuf; > int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); > - return r ?: __xstat_conv (vers, &kbuf, buf); > + if (r == 0) > + return __xstat_conv (vers, &kbuf, buf); > + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); > } > } > } > diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c > index 871fb6c6c5..77656be276 100644 > --- a/sysdeps/unix/sysv/linux/mips/lxstat.c > +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c > @@ -35,7 +35,9 @@ __lxstat (int vers, const char *name, struct stat *buf) > { > struct kernel_stat kbuf; > int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); > - return r ?: __xstat_conv (vers, &kbuf, buf); > + if (r == 0) > + return __xstat_conv (vers, &kbuf, buf); > + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); > } > } > } > diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c > index 9d810b6f65..4c6fabb502 100644 > --- a/sysdeps/unix/sysv/linux/mips/xstat.c > +++ b/sysdeps/unix/sysv/linux/mips/xstat.c > @@ -35,7 +35,9 @@ __xstat (int vers, const char *name, struct stat *buf) > { > struct kernel_stat kbuf; > int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); > - return r ?: __xstat_conv (vers, &kbuf, buf); > + if (r == 0) > + return __xstat_conv (vers, &kbuf, buf); > + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); > } > } > } >