From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Stafford Horne <shorne@gmail.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 2/6] linux: Add prlimit64 C implementation
Date: Tue, 30 Nov 2021 08:51:59 -0300 [thread overview]
Message-ID: <5e0b865f-8193-a0eb-19cb-169e7913bf19@linaro.org> (raw)
In-Reply-To: <YaAerdRkpVSYmxwG@antec>
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 <sys/resource.h>
>> #include <sysdep.h>
>
> 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
>> + <https://www.gnu.org/licenses/>. */
>> +
>> +#define prlimit __redirect_prlimit
>> +#include <sys/resource.h>
>> +#undef prlimit
>> +#include <sysdep.h>
>> +
>> +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 <shlib-compat.h>
>> +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.
next prev parent reply other threads:[~2021-11-30 11:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 18:54 [PATCH 0/6] linux: Some syscall refactors Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 1/6] linux: Add fanotify_mark C implementation Adhemerval Zanella
2021-11-24 21:45 ` Stafford Horne
2021-11-25 12:55 ` Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 2/6] linux: Add prlimit64 " Adhemerval Zanella
2021-11-25 23:39 ` Stafford Horne
2021-11-30 11:51 ` Adhemerval Zanella [this message]
2021-11-22 18:54 ` [PATCH 3/6] linux: Implement mremap in C Adhemerval Zanella
2021-11-26 0:26 ` Stafford Horne
2021-11-30 11:55 ` Adhemerval Zanella
2024-06-06 15:15 ` Florian Weimer
2024-06-06 16:01 ` enh
2024-06-06 19:38 ` enh
2024-06-06 20:26 ` Adhemerval Zanella Netto
2024-06-07 8:40 ` Sam James
2024-06-07 8:51 ` Sam James
2024-06-07 9:06 ` Xi Ruoyao
2021-11-22 18:54 ` [PATCH 4/6] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
2021-11-26 23:03 ` Stafford Horne
2021-11-30 14:53 ` Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 5/6] linux: Add generic syscall implementation Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 6/6] linux: Add generic ioctl implementation Adhemerval Zanella
2021-12-04 7:50 ` Stafford Horne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e0b865f-8193-a0eb-19cb-169e7913bf19@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=shorne@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).