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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 5327A1F45E for ; Tue, 11 Feb 2020 20:53:35 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=STJyOXfFOJbIt5z9 kidIMl2MOp8VlfV1re2zqwiswTcaoYLFHlbhhv7DWUFtF3fGbxN/blM+eW4QE0/D LbnW/E0HqtF5iTcRy42htjgByBo6sjGrTMv6PAKMkJOjud1epKFDZ8AW6qtQjj8q J7CzSwp3yYBNyVsC6khK9qrvCpk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=0EGtvrV/q76KUR6ap/b/SJ a/ooc=; b=GZ2WXHUMkNFoI3NqrDfJClVV7+/m8B4WU2wwvd1Fzv2VSKHnv72Vl4 4YpNoVzg7WPz9aEqkUX7wV8meT5bqslD8HRHfxQU8Ghc3TWphKg0Yq3gtEE3vQ60 b0RW88kX+V+MBeiYdPnR28y5SvV6u8g2z7OAlGWs887oj2azNZfHk= Received: (qmail 118135 invoked by alias); 11 Feb 2020 20:53:33 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 118118 invoked by uid 89); 11 Feb 2020 20:53:32 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-qv1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:references:from:autocrypt:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KJdhEmh7FIVnJOoY2GN9EUskgoP0KXKd5XwGr4U+vf4=; b=FaW76Coi9wYnM9OAFMhA0hdXF/XVNjdCVC4GLqBM66ZNjR9SrnTXSg8Yh58aoNXvJR EjQS7G84fLDa30n/z9irHWBNpkgnuduyQVSbQ4ShFmpg08waLfhs6/7rkiJiNlvDlMPZ /pbJqynumDSOCexTn2KJPftWiqMVIGXXh5w/qk7VUBkBAKznCqiyrnGFWz3U4KZ/SQfH ydfAuK5fDt3/HrlGclNNf0LhvLAp38Ef+i5OX8CeaH+sneDjf3fpJqfPZkXJ8xWGxQSC 4ORkIRA7/mtTZXpbW8bW6JODSuvAn2x74bg5hcmCrrgvMzxIWKNRCypjVwbG0QAGy9z8 nlMA== To: Florian Weimer Cc: libc-alpha@sourceware.org References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> <20200210192038.23588-13-adhemerval.zanella@linaro.org> <878sl9nxeb.fsf@oldenburg2.str.redhat.com> From: Adhemerval Zanella Subject: Re: [PATCH 13/15] linux: Consolidate INLINE_SYSCALL Message-ID: <3af4d52d-e39d-6666-f068-498d97bee6ab@linaro.org> Date: Tue, 11 Feb 2020 17:53:26 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <878sl9nxeb.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 11/02/2020 09:03, Florian Weimer wrote: > * Adhemerval Zanella: > >> diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h >> index c7f3e54d37..389c94cfda 100644 >> --- a/sysdeps/unix/sysv/linux/sysdep.h >> +++ b/sysdeps/unix/sysv/linux/sysdep.h >> @@ -15,8 +15,44 @@ >> License along with the GNU C Library; if not, see >> . */ >> >> +#ifndef _SYSDEP_LINUX_H >> +#define _SYSDEP_LINUX_H >> + >> #include >> #include >> +#include >> + >> +#ifndef __ASSEMBLER__ >> + >> +#undef INTERNAL_SYSCALL_DECL >> +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) > > I think these preprocessor directives should be indented (including most > of the rest of the file). I usually avoid such changes since it generated changes unrelated to the patch itself. The __ASSEMBLER__ is not really required, so I removed it. Also, my idea is to refactor this code to use inline function, so I add the indentation change once __ASSEMBLER__ closure is really required. > >> +#undef INTERNAL_SYSCALL_ERROR_P >> +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ >> + ((unsigned long) (val) > -4096UL) >> + >> +#ifndef SYSCALL_ERROR_LABEL >> +# define SYSCALL_ERROR_LABEL(sc_err) \ >> + ({ \ >> + __set_errno (sc_err); \ >> + -1L; \ >> + }) >> +#endif >> + >> +/* This version is for kernels that implement system calls that >> + behave like function calls as far as register saving. */ >> +#undef INLINE_SYSCALL >> +#define INLINE_SYSCALL(name, nr, args...) \ >> + ({ \ >> + INTERNAL_SYSCALL_DECL (sc_err); \ >> + long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ >> + __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ >> + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \ >> + : sc_ret; \ >> + }) > > The comment seems misleading to me. Does “register saving” really > matter here? I think it's about the -errno behavior. I think the > comment should explain how this macro is to be used (i.e., it sets errno > on failure). Indeed, it is an artefact from powerpc version. What about: /* Define a macro which expands into the inline wrapper code for a system call. It sets the errno and returns -1 on a failure, or the syscall return value otherwise. */ > > Thanks, > Florian >