From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 25FC73865479 for ; Sat, 6 Feb 2021 10:47:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 25FC73865479 Received: by mail-wm1-x332.google.com with SMTP id f16so8036019wmq.5 for ; Sat, 06 Feb 2021 02:47:13 -0800 (PST) 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=9b35jzBZ64wGb10Onjtk/0ZyVz+wwHkG3G7B0ysuCOY=; b=T7baOAD1vwNJuz+yhkIp4McwRg/eoshbQGHdnUDuR4rmPCh+v7wUnmUg4qP6LGZJm3 ZpzxINQYttz4d+Xdw8ORE6fNxiH26oR1mIEi9xT7Hc5hlL43qmQKXJOoKCWq0KGNQcaz nobV7JDCPkC4WxrKvVjp4c6ZjkdZRACz20KTfUu6B4RjE+ouonRa5aW1BXpnIbFr6fRw fOdfBelL+Qg/Xylp1j94ppQ4dzOc9HjD+d9BM6aa60TAwnSzQTZQKgXcZTc/MIEZHuZI NmFUxhlkfKZ+1PRvzDib48CGQxCQLg9NZGCsrEpnIEfdDs0uAuHsA9GGw+M1Lm0ovIrh O1xg== X-Gm-Message-State: AOAM530JQUUnFOrruE9YhwFGq8Zv478/90+aiwhKbb5PSV+pekSHFqJj Iehdj4783BAZu1919tKh9kM6M8J8x5c= X-Google-Smtp-Source: ABdhPJzRmpm7sMJ3PCgqzUg4AhWFXnRUimvRlZZOo41QycA6gGhdeUpJYXkfPYwMDqxhYwruWLmFdQ== X-Received: by 2002:a1c:3b02:: with SMTP id i2mr6948830wma.141.1612608432159; Sat, 06 Feb 2021 02:47:12 -0800 (PST) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with UTF8SMTPSA id z14sm15303279wrm.5.2021.02.06.02.47.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Feb 2021 02:47:11 -0800 (PST) Subject: Re: [PATCH] getitimer.2: Use restrict in prototypes To: mtk.manpages@gmail.com Cc: linux-man , Heinrich Schuchardt , "libc-alpha@sourceware.org" References: <20210203194354.158439-1-alx.manpages@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: Date: Sat, 6 Feb 2021 11:47:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2021 10:47:23 -0000 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 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: . 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]} "; >> 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 >> --- >> 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 >> .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 >> > > -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/