Message ID | 20210203194354.158439-1-alx.manpages@gmail.com |
---|---|
State | Not applicable |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 02038389680E; Wed, 3 Feb 2021 19:45:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02038389680E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612381545; bh=E8WvLiadF9C2jr4Z+T3VLTsZX0Aneasf/j7biIOKuRI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=oXE1kOj59HlFBEOrOszwr5IHKnda0mpQSLX7wyhNNhohYL87lOPk2g3D+bNFr1ir1 ydc4zpz21Y9gRqDdqmWYEmBrIGFnhp1Fy8l8eRKcYzf26CWpg1NNrYp3/PWzYEE81I 3rrVKO9g9WPwgNyrVGyLbzlgzAre2ZUbG7pkvmiY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 48FBF3890437 for <libc-alpha@sourceware.org>; Wed, 3 Feb 2021 19:45:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48FBF3890437 Received: by mail-wr1-x42c.google.com with SMTP id b3so637442wrj.5 for <libc-alpha@sourceware.org>; Wed, 03 Feb 2021 11:45:42 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=E8WvLiadF9C2jr4Z+T3VLTsZX0Aneasf/j7biIOKuRI=; b=r6XvTAR+AVFjL6SzsxaLK4msDFs/fCvrhRybPLmdIPTeRFooSMgA7F6aQ2DSWbHhGB 4NLIf6K7T/OYLqPbz5NXD+jtQG+Gh5t++NdFzvAf1Gb3um17TXB6Ef0dR/nVoMJT4MSB p9LFBcER6aufoYGkia4w33vgCNHMBVtGB54nvuVeaM92SQnqKp2A2jEMj2nWGUhvtjRG q6Se8J5ZdQQloSL+PAtYTsfWmzO3rrOtLvqYBd9DdSGuXdeOrH51814W6x+sCbeVTy0X 4YA+2SOxKXXjj3+b93jd5+leM9GCkxC0bK4FhQZTC3Lk6W25yul/vPZolGMjyl8I/Vf0 um9w== X-Gm-Message-State: AOAM5307BhGOsooDk0wfHMaIRSxbDHYR6Z+57zh0yKGO7gULef7edpEp mNx8vgMDR1kCeadF1kOYxtM= X-Google-Smtp-Source: ABdhPJz5iFFOs20IpKCna2QgjyEYoMNb2iMIbJFQRR6MCsqOznTVrFl6PnK0HR43/nT225KwTe3Q/g== X-Received: by 2002:a5d:654f:: with SMTP id z15mr5388010wrv.46.1612381541415; Wed, 03 Feb 2021 11:45:41 -0800 (PST) Received: from debian.vlc ([170.253.51.130]) by smtp.gmail.com with ESMTPSA id h14sm3381335wmq.39.2021.02.03.11.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 11:45:40 -0800 (PST) To: mtk.manpages@gmail.com Subject: [PATCH] getitimer.2: Use restrict in prototypes Date: Wed, 3 Feb 2021 20:43:55 +0100 Message-Id: <20210203194354.158439-1-alx.manpages@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Alejandro Colomar via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Alejandro Colomar <alx.manpages@gmail.com> Cc: Alejandro Colomar <alx.manpages@gmail.com>, linux-man@vger.kernel.org, libc-alpha@sourceware.org, Heinrich Schuchardt <xypron.glpk@gmx.de> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
getitimer.2: Use restrict in prototypes
|
|
Commit Message
Alejandro Colomar
Feb. 3, 2021, 7:43 p.m. UTC
POSIX specifies that the 2nd and 3rd parameters to setitimer() shall be 'restrict'. Glibc uses 'restrict' too. Let's use it here too. ...... .../glibc$ grep_syscall_wrapper setitimer time/sys/time.h:129: extern int setitimer (__itimer_which_t __which, const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __THROW; .../glibc$ function grep_syscall_wrapper() { if ! [ -v 1 ]; then >&2 echo "Usage: ${FUNCNAME[0]} <syscall>"; return ${EX_USAGE}; fi find * -type f \ |grep '\.h$' \ |sort -V \ |xargs pcregrep -Mn \ "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \ |sed -E 's/^[^:]+:[0-9]+:/&\n/'; } Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> --- man2/getitimer.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Alex, On Wed, 3 Feb 2021 at 20:45, Alejandro Colomar <alx.manpages@gmail.com> wrote: > > POSIX specifies that the 2nd and 3rd parameters to setitimer() > shall be 'restrict'. Glibc uses 'restrict' too. > Let's use it here too. I'm not against this change. But, as we know, 'restrict' is not used at all so far in the SYNOPSIS sections of the manual pages. DO you have an overall plan here? Thanks, Michael > ...... > > .../glibc$ grep_syscall_wrapper setitimer > time/sys/time.h:129: > extern int setitimer (__itimer_which_t __which, > const struct itimerval *__restrict __new, > struct itimerval *__restrict __old) __THROW; > .../glibc$ > > function grep_syscall_wrapper() > { > if ! [ -v 1 ]; then > >&2 echo "Usage: ${FUNCNAME[0]} <syscall>"; > return ${EX_USAGE}; > fi > > find * -type f \ > |grep '\.h$' \ > |sort -V \ > |xargs pcregrep -Mn \ > "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \ > |sed -E 's/^[^:]+:[0-9]+:/&\n/'; > } > > Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> > --- > man2/getitimer.2 | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/man2/getitimer.2 b/man2/getitimer.2 > index b435c343e..9ec32e836 100644 > --- a/man2/getitimer.2 > +++ b/man2/getitimer.2 > @@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer > .B #include <sys/time.h> > .PP > .BI "int getitimer(int " which ", struct itimerval *" curr_value ); > -.BI "int setitimer(int " which ", const struct itimerval *" new_value , > -.BI " struct itimerval *" old_value ); > +.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value , > +.BI " struct itimerval *restrict " old_value ); > .fi > .SH DESCRIPTION > These system calls provide access to interval timers, that is, > -- > 2.30.0 >
Hi Michael, On 2/6/21 10:58 AM, Michael Kerrisk (man-pages) wrote: > Hi Alex, > > On Wed, 3 Feb 2021 at 20:45, Alejandro Colomar <alx.manpages@gmail.com> wrote: >> >> POSIX specifies that the 2nd and 3rd parameters to setitimer() >> shall be 'restrict'. Glibc uses 'restrict' too. >> Let's use it here too. > > I'm not against this change. But, as we know, 'restrict' is not used > at all so far in the SYNOPSIS sections of the manual pages. DO you > have an overall plan here? Yes, I do. My plan is to fix all the prototypes that use restrict by adding the keyword. I'm using the man_section function I showed you to see all the man2 and man3 prototypes on one side, and grep_syscall_wrapper/grep_syscall on the other side to do it fast, so expect just a few weeks to do the change completely. Heinrich also proposed this change some time ago (I already had in my to-do list, but that reminded me to do it) here: <https://lore.kernel.org/linux-man/105b8883-d6a8-b3c3-3aff-ee1d6e88980a@gmail.com/T/>. Cheers, Alex > > Thanks, > > Michael > >> ...... >> >> .../glibc$ grep_syscall_wrapper setitimer >> time/sys/time.h:129: >> extern int setitimer (__itimer_which_t __which, >> const struct itimerval *__restrict __new, >> struct itimerval *__restrict __old) __THROW; >> .../glibc$ >> >> function grep_syscall_wrapper() >> { >> if ! [ -v 1 ]; then >> >&2 echo "Usage: ${FUNCNAME[0]} <syscall>"; >> return ${EX_USAGE}; >> fi >> >> find * -type f \ >> |grep '\.h$' \ >> |sort -V \ >> |xargs pcregrep -Mn \ >> "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \ >> |sed -E 's/^[^:]+:[0-9]+:/&\n/'; >> } >> >> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> >> --- >> man2/getitimer.2 | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/man2/getitimer.2 b/man2/getitimer.2 >> index b435c343e..9ec32e836 100644 >> --- a/man2/getitimer.2 >> +++ b/man2/getitimer.2 >> @@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer >> .B #include <sys/time.h> >> .PP >> .BI "int getitimer(int " which ", struct itimerval *" curr_value ); >> -.BI "int setitimer(int " which ", const struct itimerval *" new_value , >> -.BI " struct itimerval *" old_value ); >> +.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value , >> +.BI " struct itimerval *restrict " old_value ); >> .fi >> .SH DESCRIPTION >> These system calls provide access to interval timers, that is, >> -- >> 2.30.0 >> > >
Hi Alex, On 2/6/21 11:47 AM, Alejandro Colomar (man-pages) wrote: > Hi Michael, > > On 2/6/21 10:58 AM, Michael Kerrisk (man-pages) wrote: >> Hi Alex, >> >> On Wed, 3 Feb 2021 at 20:45, Alejandro Colomar <alx.manpages@gmail.com> wrote: >>> >>> POSIX specifies that the 2nd and 3rd parameters to setitimer() >>> shall be 'restrict'. Glibc uses 'restrict' too. >>> Let's use it here too. >> >> I'm not against this change. But, as we know, 'restrict' is not used >> at all so far in the SYNOPSIS sections of the manual pages. DO you >> have an overall plan here? > > Yes, I do. My plan is to fix all the prototypes that use restrict by > adding the keyword. It's not a pretty or glamorous job. So thank you very much for doing it! Thanks for this patch. I've applied it. Cheers, Michael > I'm using the man_section function I showed you to see all the man2 and > man3 prototypes on one side, and grep_syscall_wrapper/grep_syscall on > the other side to do it fast, so expect just a few weeks to do the > change completely. > > Heinrich also proposed this change some time ago (I already had in my > to-do list, but that reminded me to do it) here: > <https://lore.kernel.org/linux-man/105b8883-d6a8-b3c3-3aff-ee1d6e88980a@gmail.com/T/>. > > Cheers, > > Alex > >> >> Thanks, >> >> Michael >> >>> ...... >>> >>> .../glibc$ grep_syscall_wrapper setitimer >>> time/sys/time.h:129: >>> extern int setitimer (__itimer_which_t __which, >>> const struct itimerval *__restrict __new, >>> struct itimerval *__restrict __old) __THROW; >>> .../glibc$ >>> >>> function grep_syscall_wrapper() >>> { >>> if ! [ -v 1 ]; then >>> >&2 echo "Usage: ${FUNCNAME[0]} <syscall>"; >>> return ${EX_USAGE}; >>> fi >>> >>> find * -type f \ >>> |grep '\.h$' \ >>> |sort -V \ >>> |xargs pcregrep -Mn \ >>> "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \ >>> |sed -E 's/^[^:]+:[0-9]+:/&\n/'; >>> } >>> >>> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> >>> --- >>> man2/getitimer.2 | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/man2/getitimer.2 b/man2/getitimer.2 >>> index b435c343e..9ec32e836 100644 >>> --- a/man2/getitimer.2 >>> +++ b/man2/getitimer.2 >>> @@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer >>> .B #include <sys/time.h> >>> .PP >>> .BI "int getitimer(int " which ", struct itimerval *" curr_value ); >>> -.BI "int setitimer(int " which ", const struct itimerval *" new_value , >>> -.BI " struct itimerval *" old_value ); >>> +.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value , >>> +.BI " struct itimerval *restrict " old_value ); >>> .fi >>> .SH DESCRIPTION >>> These system calls provide access to interval timers, that is, >>> -- >>> 2.30.0 >>> >> >> > >
diff --git a/man2/getitimer.2 b/man2/getitimer.2 index b435c343e..9ec32e836 100644 --- a/man2/getitimer.2 +++ b/man2/getitimer.2 @@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer .B #include <sys/time.h> .PP .BI "int getitimer(int " which ", struct itimerval *" curr_value ); -.BI "int setitimer(int " which ", const struct itimerval *" new_value , -.BI " struct itimerval *" old_value ); +.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value , +.BI " struct itimerval *restrict " old_value ); .fi .SH DESCRIPTION These system calls provide access to interval timers, that is,