From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by sourceware.org (Postfix) with ESMTPS id 14A663858C2C for ; Tue, 30 Nov 2021 11:52:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14A663858C2C Received: by mail-ua1-x92b.google.com with SMTP id p2so40661597uad.11 for ; Tue, 30 Nov 2021 03:52:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=PBNl4diiB23TCgGmqjB6s+m3euydZTnbLWDiy3bE3KQ=; b=0eo4BbVV+fPiNnhHIm4ari0AFTh7txMRKSk9PD2FajuHLRk6IrLgXWUKVD1+9FTGTB lszIyjbSuaiiGOJC+E8p44Tcg/hgSwesQ6j0Lob80RHLpO/JVJfRbz0AN4eiBjF9hfh3 LuNRPV0gChR93B1QfQsPYjAX+Da0TQFnoFeVRyzKe1m++bmgWR9VX0Pnpy0BzgA3QuCr AATH6rf4wFT++p/4+w9vMHrMD4Kx7sYUTfNPoOOC3paWdHRDkm1tfc0RqJCoZ+AbFBe7 YUA0qFaoO6Hm2pFCyV5MBe6cwmd6foicwJXLoQTIknOdWWdB5MoVdcI3wHrhERFjWJl9 AEHA== X-Gm-Message-State: AOAM533ZHja0VXOHmAlgdd0Te1uUxirALe1h8ES5L+KjU3HCY8zTDWm0 05RG4VqpS7m/9168aDhQQr98j9XOyyJRqA== X-Google-Smtp-Source: ABdhPJwqIP/lqWgC0MZSE1mlm7Y5mrm9rWAy7XDhO4ea0C5dmz8QKnYqi8Ls5Xd15d89L5SdQHPb8A== X-Received: by 2002:a67:f88e:: with SMTP id h14mr39472332vso.37.1638273121478; Tue, 30 Nov 2021 03:52:01 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:30f8:6601:a360:bcd5:8568? ([2804:431:c7cb:30f8:6601:a360:bcd5:8568]) by smtp.gmail.com with ESMTPSA id p130sm9790047vke.56.2021.11.30.03.52.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Nov 2021 03:52:01 -0800 (PST) Message-ID: <5e0b865f-8193-a0eb-19cb-169e7913bf19@linaro.org> Date: Tue, 30 Nov 2021 08:51:59 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 2/6] linux: Add prlimit64 C implementation Content-Language: en-US To: Stafford Horne Cc: libc-alpha@sourceware.org References: <20211122185437.1934590-1-adhemerval.zanella@linaro.org> <20211122185437.1934590-3-adhemerval.zanella@linaro.org> From: Adhemerval Zanella In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 30 Nov 2021 11:52:04 -0000 On 25/11/2021 20:39, Stafford Horne wrote: > On Mon, Nov 22, 2021 at 03:54:33PM -0300, Adhemerval Zanella wrote: >> The LFS prlimit64 requires a arch-specific implementation in >> syscalls.list. Instead add a generic one that handles the >> required symbol alias for __RLIM_T_MATCHES_RLIM64_T. >> >> HPPA is the only outlier which requires a different default >> symbol. >> >> Checked on x86_64-linux-gnu and with build for the affected ABIs. >> --- >> sysdeps/unix/sysv/linux/Makefile | 2 +- >> sysdeps/unix/sysv/linux/arm/syscalls.list | 2 - >> .../linux/generic/wordsize-32/syscalls.list | 4 -- >> sysdeps/unix/sysv/linux/hppa/prlimit64.c | 2 + >> sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 - >> sysdeps/unix/sysv/linux/i386/syscalls.list | 2 - >> sysdeps/unix/sysv/linux/m68k/syscalls.list | 1 - >> .../unix/sysv/linux/microblaze/syscalls.list | 1 - >> .../unix/sysv/linux/mips/mips32/syscalls.list | 3 -- >> .../sysv/linux/mips/mips64/n32/syscalls.list | 2 - >> .../sysv/linux/mips/mips64/n64/syscalls.list | 2 - >> .../linux/powerpc/powerpc32/syscalls.list | 2 - >> sysdeps/unix/sysv/linux/prlimit.c | 2 + >> sysdeps/unix/sysv/linux/prlimit64.c | 39 +++++++++++++++++++ >> .../sysv/linux/s390/s390-32/syscalls.list | 1 - >> sysdeps/unix/sysv/linux/sh/syscalls.list | 2 - >> .../sysv/linux/sparc/sparc32/syscalls.list | 2 - >> .../unix/sysv/linux/wordsize-64/syscalls.list | 1 - >> 18 files changed, 44 insertions(+), 27 deletions(-) >> delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list >> create mode 100644 sysdeps/unix/sysv/linux/hppa/prlimit64.c >> delete mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscalls.list >> create mode 100644 sysdeps/unix/sysv/linux/prlimit64.c >> diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c >> index c12de52693..f9d9911a04 100644 >> --- a/sysdeps/unix/sysv/linux/prlimit.c >> +++ b/sysdeps/unix/sysv/linux/prlimit.c >> @@ -18,6 +18,7 @@ >> #include >> #include > > Possibly a comment here saying something like. > > /* For ports that support the 64-bit ABI we do not need to define prlimit > and instead prlimit aliases to prlimit64. See the prlimit64 > implementation. */ It is kinda implicit for other LFS aliais, but the extra comment is helpful. Ack. > >> +#if !__RLIM_T_MATCHES_RLIM64_T >> int >> prlimit (__pid_t pid, enum __rlimit_resource resource, >> const struct rlimit *new_rlimit, struct rlimit *old_rlimit) >> @@ -73,3 +74,4 @@ prlimit (__pid_t pid, enum __rlimit_resource resource, >> >> return res; >> } >> +#endif /* __RLIM_T_MATCHES_RLIM64_T */ >> diff --git a/sysdeps/unix/sysv/linux/prlimit64.c b/sysdeps/unix/sysv/linux/prlimit64.c >> new file mode 100644 >> index 0000000000..e3a8718b98 >> --- /dev/null >> +++ b/sysdeps/unix/sysv/linux/prlimit64.c >> @@ -0,0 +1,39 @@ >> +/* Get/set resource limits. Linux specific syscall. >> + Copyright (C) 2020 Free Software Foundation, Inc. > > 2021. Ack. > >> + This file is part of the GNU C Library. >> + >> + The GNU C Library is free software; you can redistribute it and/or >> + modify it under the terms of the GNU Lesser General Public >> + License as published by the Free Software Foundation; either >> + version 2.1 of the License, or (at your option) any later version. >> + >> + The GNU C Library is distributed in the hope that it will be useful, >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + Lesser General Public License for more details. >> + >> + You should have received a copy of the GNU Lesser General Public >> + License along with the GNU C Library; if not, see >> + . */ >> + >> +#define prlimit __redirect_prlimit >> +#include >> +#undef prlimit >> +#include >> + >> +int >> +__prlimit64 (pid_t pid, enum __rlimit_resource resource, >> + const struct rlimit64 *new_rlimit, struct rlimit64 *old_rlimit) >> +{ >> + return INLINE_SYSCALL_CALL (prlimit64, pid, resource, new_rlimit, >> + old_rlimit); >> +} >> +#ifdef VERSION_prlimit64 >> +# include >> +versioned_symbol (libc, __prlimit64, prlimit64, VERSION_prlimit64); >> +#else >> +strong_alias (__prlimit64, prlimit64) >> +# if __RLIM_T_MATCHES_RLIM64_T >> +strong_alias (prlimit64, prlimit) >> +# endif >> +#endif >> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list >> index 8e9b7c4b71..91d78d91ef 100644 >> --- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list >> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list >> @@ -15,5 +15,4 @@ getgroups - getgroups32 i:ip __getgroups getgroups >> setfsgid - setfsgid32 Ei:i setfsgid >> setfsuid - setfsuid32 Ei:i setfsuid >> >> -prlimit64 EXTRA prlimit64 i:iipp prlimit64 >> personality EXTRA personality Ei:i __personality personality >> diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list >> index 6ff3e8eb8a..78b2348c05 100644 >> --- a/sysdeps/unix/sysv/linux/sh/syscalls.list >> +++ b/sysdeps/unix/sysv/linux/sh/syscalls.list >> @@ -15,6 +15,4 @@ getgroups - getgroups32 i:ip __getgroups getgroups >> setfsgid - setfsgid32 Ei:i setfsgid >> setfsuid - setfsuid32 Ei:i setfsuid >> >> -prlimit64 EXTRA prlimit64 i:iipp prlimit64 >> - >> personality EXTRA personality Ei:i __personality personality >> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list >> index 4fcae65451..9e4eb0a165 100644 >> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list >> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list >> @@ -14,5 +14,3 @@ getgroups - getgroups32 i:ip __getgroups getgroups >> >> setfsgid - setfsgid32 Ei:i setfsgid >> setfsuid - setfsuid32 Ei:i setfsuid >> - >> -prlimit64 EXTRA prlimit64 i:iipp prlimit64 >> diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list >> index 8d97a32344..3232f11f51 100644 >> --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list >> +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list >> @@ -1,5 +1,4 @@ >> # File name Caller Syscall name # args Strong name Weak names >> >> sendfile - sendfile i:iipi sendfile sendfile64 >> -prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 >> personality EXTRA personality i:i __personality personality >> -- >> 2.32.0 > > Other than the year issue (as I understand the patch is from your old branch..). > > It looks fine to me. > > -Stafford Ack.