From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 044013858022 for ; Sat, 6 Feb 2021 20:38:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 044013858022 Received: by mail-wm1-x32b.google.com with SMTP id f16so8958974wmq.5 for ; Sat, 06 Feb 2021 12:38:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uhbPwFNRdaAoXW2viAN3XACdriQjRCodL3I0lvMxRUI=; b=ZRuoIGxUqsj52Pg1Y87vw/aYkHjGSivczCQzPWWX2UZBpC26cvgZ4JuuZhpqzloQMQ 47/lPa7PP3Y1WJmIQhYftOWEZDvh5Zj/atYhsd2bJK1WLIRpIU6Akq5p3o/Iddw+CF+v xhqsVegFL6RM7voPA2BYaTeItUc5hKdQy9V/4hkKVvXgdVD2YG/XoZQMXxPFkwlqvPsk Myr5lkmrrKWk7t5l4oRN0LKrq50qc0QQRpRtGV9HJ2enSL+ya6pGa3XXqt9k75GRXmfe 2q3bDENmaN2q2UnwLGxZroLwqx6xMbFXghBFWKJX1gA+TubIuHz3RzKgoPv/TlpsriSI 3jbw== X-Gm-Message-State: AOAM532W7q7ItnwOCXDeeIWLfuKlJaQoidmVyZ64F/iDylzd+3VbhrqR 8NGZeMmrdNTu+iGV6W5oC6ZFpZs3kQo= X-Google-Smtp-Source: ABdhPJzvkMrHbUcA6hW2EteG2aVk9VG3KMWW1MafUhwm3ejHaIuLmZWBandcEl9q1Jx7PW4JTDfbHQ== X-Received: by 2002:a1c:6387:: with SMTP id x129mr8784131wmb.84.1612643902007; Sat, 06 Feb 2021 12:38:22 -0800 (PST) Received: from ?IPv6:2001:a61:2542:b001:294f:8948:78a8:d929? ([2001:a61:2542:b001:294f:8948:78a8:d929]) by smtp.gmail.com with ESMTPSA id r1sm16989434wrl.95.2021.02.06.12.38.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Feb 2021 12:38:21 -0800 (PST) Cc: mtk.manpages@gmail.com, linux-man , Heinrich Schuchardt , "libc-alpha@sourceware.org" Subject: Re: [PATCH] getitimer.2: Use restrict in prototypes To: "Alejandro Colomar (man-pages)" References: <20210203194354.158439-1-alx.manpages@gmail.com> From: "Michael Kerrisk (man-pages)" Message-ID: <5c543624-1c0b-a15d-a1c7-e607135fbc15@gmail.com> Date: Sat, 6 Feb 2021 21:38:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.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=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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.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 20:38:25 -0000 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 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: > . > > 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 >>> >> >> > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/