aio_suspend.3: SYNOPSIS: Use 'restrict' in prototypes

Message ID 20210218223356.320470-1-alx.manpages@gmail.com
State New
Headers show
Series
  • aio_suspend.3: SYNOPSIS: Use 'restrict' in prototypes
Related show

Commit Message

DJ Delorie via Libc-alpha Feb. 18, 2021, 10:33 p.m.
POSIX does NOT specify aio_suspend() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

.../glibc$ grep_glibc_prototype aio_suspend
rt/aio.h:167:
extern int aio_suspend (const struct aiocb *const __list[], int __nent,
			const struct timespec *__restrict __timeout)
  __nonnull ((1));
.../glibc$

Cc: libc-alpha@sourceware.org
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

---

Hello Michael,

I sent this patch separately because it's a bit different,
and would like someone from glibc to check it.
I CCd Ulrich, who added 'restrict' to the function in glibc.

Thanks,

Alex

---
 man3/aio_suspend.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.30.1.721.g45526154a5

Comments

DJ Delorie via Libc-alpha Feb. 19, 2021, 12:25 p.m. | #1
Hello Alex,

On 2/18/21 11:33 PM, Alejandro Colomar wrote:
> POSIX does NOT specify aio_suspend() to use 'restrict'.

> However, glibc uses 'restrict'.

> Users might be surprised by this!  Let's use it here too!


Thanks for spotting this. Perhaps if we apply this,
the patch should include something in CONFORMING TO to
note that POSIX doesn't specify 'restrict'. What do 
you think?

Cheers,

Michael

> ......

> 

> .../glibc$ grep_glibc_prototype aio_suspend

> rt/aio.h:167:

> extern int aio_suspend (const struct aiocb *const __list[], int __nent,

> 			const struct timespec *__restrict __timeout)

>   __nonnull ((1));

> .../glibc$

> 

> Cc: libc-alpha@sourceware.org

> Cc: Ulrich Drepper <drepper@redhat.com>

> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

> ---

> 

> Hello Michael,

> 

> I sent this patch separately because it's a bit different,

> and would like someone from glibc to check it.

> I CCd Ulrich, who added 'restrict' to the function in glibc.

> 

> Thanks,

> 

> Alex

> 

> ---

>  man3/aio_suspend.3 | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/man3/aio_suspend.3 b/man3/aio_suspend.3

> index 76a05f48e..dcae51e1c 100644

> --- a/man3/aio_suspend.3

> +++ b/man3/aio_suspend.3

> @@ -31,7 +31,8 @@ aio_suspend \- wait for asynchronous I/O operation or timeout

>  .B "#include <aio.h>"

>  .PP

>  .BI "int aio_suspend(const struct aiocb * const " aiocb_list [],

> -.BI "                int " nitems ", const struct timespec *" timeout );

> +.BI "                int " nitems \

> +", const struct timespec *restrict " timeout );

>  .PP

>  Link with \fI\-lrt\fP.

>  .fi

> 



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
DJ Delorie via Libc-alpha Feb. 19, 2021, 12:30 p.m. | #2
On 2/19/21 1:25 PM, Michael Kerrisk (man-pages) wrote:
> Hello Alex,

> 

> On 2/18/21 11:33 PM, Alejandro Colomar wrote:

>> POSIX does NOT specify aio_suspend() to use 'restrict'.

>> However, glibc uses 'restrict'.

>> Users might be surprised by this!  Let's use it here too!

> 

> Thanks for spotting this. Perhaps if we apply this,

> the patch should include something in CONFORMING TO to

> note that POSIX doesn't specify 'restrict'. What do

> you think?


Hi Michael,

I was about to ask exactly that in the email, but I forgot :)
Yes.

Cheers,

Alex

> 

> Cheers,

> 

> Michael

> 

>> ......

>>

>> .../glibc$ grep_glibc_prototype aio_suspend

>> rt/aio.h:167:

>> extern int aio_suspend (const struct aiocb *const __list[], int __nent,

>> 			const struct timespec *__restrict __timeout)

>>    __nonnull ((1));

>> .../glibc$

>>

>> Cc: libc-alpha@sourceware.org

>> Cc: Ulrich Drepper <drepper@redhat.com>

>> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

>> ---

>>

>> Hello Michael,

>>

>> I sent this patch separately because it's a bit different,

>> and would like someone from glibc to check it.

>> I CCd Ulrich, who added 'restrict' to the function in glibc.

>>

>> Thanks,

>>

>> Alex

>>

>> ---

>>   man3/aio_suspend.3 | 3 ++-

>>   1 file changed, 2 insertions(+), 1 deletion(-)

>>

>> diff --git a/man3/aio_suspend.3 b/man3/aio_suspend.3

>> index 76a05f48e..dcae51e1c 100644

>> --- a/man3/aio_suspend.3

>> +++ b/man3/aio_suspend.3

>> @@ -31,7 +31,8 @@ aio_suspend \- wait for asynchronous I/O operation or timeout

>>   .B "#include <aio.h>"

>>   .PP

>>   .BI "int aio_suspend(const struct aiocb * const " aiocb_list [],

>> -.BI "                int " nitems ", const struct timespec *" timeout );

>> +.BI "                int " nitems \

>> +", const struct timespec *restrict " timeout );

>>   .PP

>>   Link with \fI\-lrt\fP.

>>   .fi

>>

> 

> 


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

Patch

diff --git a/man3/aio_suspend.3 b/man3/aio_suspend.3
index 76a05f48e..dcae51e1c 100644
--- a/man3/aio_suspend.3
+++ b/man3/aio_suspend.3
@@ -31,7 +31,8 @@  aio_suspend \- wait for asynchronous I/O operation or timeout
 .B "#include <aio.h>"
 .PP
 .BI "int aio_suspend(const struct aiocb * const " aiocb_list [],
-.BI "                int " nitems ", const struct timespec *" timeout );
+.BI "                int " nitems \
+", const struct timespec *restrict " timeout );
 .PP
 Link with \fI\-lrt\fP.
 .fi