All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4)
@ 2021-03-08 18:53 Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 01/23] pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages
  Cc: Alejandro Colomar, linux-man, libc-alpha, Heinrich Schuchardt

Hi Michael,

This fixes up til scandir.3.
I hope there aren't many more left :)

Please have a special look at two of them, because you may prefer a different formatting.  I'm referring to the previous email about "Formatting very long function parameters".  The functions are pthread_mutexattr_getpshared(3) and another one which I don't remember (there are only 2, and as I've finished with pthread_*() I highly doubt there will be any more).

Cheers,

A


Alejandro Colomar (23):
  pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_attr_setscope.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_attr_setstackaddr.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_attr_setstacksize.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_attr_setstack.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_create.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'
  pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes
  pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'
  pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in
    prototypes
  pthread_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
  putgrent.3: SYNOPSIS: Use 'restrict' in prototypes
  putpwent.3: SYNOPSIS: Use 'restrict' in prototypes
  puts.3: SYNOPSIS: Use 'restrict' in prototypes
  qecvt.3: SYNOPSIS: Use 'restrict' in prototypes
  random_r.3: SYNOPSIS: Use 'restrict' in prototypes
  rcmd.3: SYNOPSIS: Use 'restrict' in prototypes
  readdir_r.3: SYNOPSIS: Use 'restrict' in prototypes
  realpath.3: SYNOPSIS: Use 'restrict' in prototypes
  regex.3: SYNOPSIS: Use 'restrict' in prototypes
  rexec.3: SYNOPSIS: Use 'restrict' in prototypes
  scandir.3: SYNOPSIS: Use 'restrict' in prototypes
  scandir.3: SYNOPSIS: Use 'restrict' in prototypes

 man3/pthread_attr_setschedpolicy.3   |  7 +++----
 man3/pthread_attr_setscope.3         |  7 +++----
 man3/pthread_attr_setstack.3         |  5 +++--
 man3/pthread_attr_setstackaddr.3     |  4 ++--
 man3/pthread_attr_setstacksize.3     |  4 ++--
 man3/pthread_create.3                |  6 ++++--
 man3/pthread_getattr_default_np.3    |  2 +-
 man3/pthread_mutexattr_getpshared.3  |  7 ++++---
 man3/pthread_mutexattr_setrobust.3   |  2 +-
 man3/pthread_rwlockattr_setkind_np.3 |  7 ++++---
 man3/pthread_setschedparam.3         |  4 ++--
 man3/putgrent.3                      |  3 ++-
 man3/putpwent.3                      |  3 ++-
 man3/puts.3                          |  4 ++--
 man3/qecvt.3                         |  8 ++++++--
 man3/random_r.3                      | 10 ++++++----
 man3/rcmd.3                          | 26 ++++++++++++++------------
 man3/readdir_r.3                     |  4 ++--
 man3/realpath.3                      |  3 ++-
 man3/regex.3                         | 14 ++++++++------
 man3/rexec.3                         | 10 ++++++----
 man3/scandir.3                       |  4 ++--
 22 files changed, 81 insertions(+), 63 deletions(-)

-- 
2.30.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/23] pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 02/23] pthread_attr_setscope.3: " Alejandro Colomar
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_attr_getschedpolicy().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getschedpolicy
sysdeps/htl/pthread.h:113:
extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr,
					int *__restrict __policy)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:304:
extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
					__attr, int *__restrict __policy)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_attr_setschedpolicy.3 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/man3/pthread_attr_setschedpolicy.3 b/man3/pthread_attr_setschedpolicy.3
index 34fdc8631..e062fe685 100644
--- a/man3/pthread_attr_setschedpolicy.3
+++ b/man3/pthread_attr_setschedpolicy.3
@@ -31,10 +31,9 @@ scheduling policy attribute in thread attributes object
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr \
-", int " policy );
-.BI "int pthread_attr_getschedpolicy(const pthread_attr_t *" attr ,
-.BI "                                int " *policy );
+.BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr ", int " policy );
+.BI "int pthread_attr_getschedpolicy(const pthread_attr_t *restrict " attr ,
+.BI "                                int *restrict " policy );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/23] pthread_attr_setscope.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 01/23] pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 03/23] pthread_attr_setstackaddr.3: " Alejandro Colomar
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_attr_getscope().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getscope
sysdeps/htl/pthread.h:125:
extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
				  int *__restrict __contentionscope)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:324:
extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
				  int *__restrict __scope)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_attr_setscope.3 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/man3/pthread_attr_setscope.3 b/man3/pthread_attr_setscope.3
index 301ed1fef..835c9b514 100644
--- a/man3/pthread_attr_setscope.3
+++ b/man3/pthread_attr_setscope.3
@@ -31,10 +31,9 @@ attribute in thread attributes object
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_attr_setscope(pthread_attr_t *" attr \
-", int " scope );
-.BI "int pthread_attr_getscope(const pthread_attr_t *" attr \
-", int *" scope );
+.BI "int pthread_attr_setscope(pthread_attr_t *" attr ", int " scope );
+.BI "int pthread_attr_getscope(const pthread_attr_t *restrict " attr ,
+.BI "                          int *restrict " scope );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/23] pthread_attr_setstackaddr.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 01/23] pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 02/23] pthread_attr_setscope.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 04/23] pthread_attr_setstacksize.3: " Alejandro Colomar
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_attr_getstackaddr().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getstackaddr
sysdeps/htl/pthread.h:138:
extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
				      void **__restrict __stackaddr)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:333:
extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
				      __attr, void **__restrict __stackaddr)
     __THROW __nonnull ((1, 2)) __attribute_deprecated__;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_attr_setstackaddr.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/pthread_attr_setstackaddr.3 b/man3/pthread_attr_setstackaddr.3
index bf626c7cb..f926c16f2 100644
--- a/man3/pthread_attr_setstackaddr.3
+++ b/man3/pthread_attr_setstackaddr.3
@@ -33,8 +33,8 @@ set/get stack address attribute in thread attributes object
 .PP
 .BI "int pthread_attr_setstackaddr(pthread_attr_t *" attr \
 ", void *" stackaddr );
-.BI "int pthread_attr_getstackaddr(const pthread_attr_t *" attr ,
-.BI "                              void **" stackaddr );
+.BI "int pthread_attr_getstackaddr(const pthread_attr_t *restrict " attr ,
+.BI "                              void **restrict " stackaddr );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/23] pthread_attr_setstacksize.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (2 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 03/23] pthread_attr_setstackaddr.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 05/23] pthread_attr_setstack.3: " Alejandro Colomar
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_attr_getstacksize().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getstacksize
sysdeps/htl/pthread.h:192:
extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr,
				      size_t *__restrict __stacksize)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:346:
extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
				      __attr, size_t *__restrict __stacksize)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_attr_setstacksize.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/pthread_attr_setstacksize.3 b/man3/pthread_attr_setstacksize.3
index 824dbc5f7..e1e56aeee 100644
--- a/man3/pthread_attr_setstacksize.3
+++ b/man3/pthread_attr_setstacksize.3
@@ -33,8 +33,8 @@ attribute in thread attributes object
 .PP
 .BI "int pthread_attr_setstacksize(pthread_attr_t *" attr \
 ", size_t " stacksize );
-.BI "int pthread_attr_getstacksize(const pthread_attr_t *" attr ,
-.BI "                              size_t *" stacksize );
+.BI "int pthread_attr_getstacksize(const pthread_attr_t *restrict " attr ,
+.BI "                              size_t *restrict " stacksize );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/23] pthread_attr_setstack.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (3 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 04/23] pthread_attr_setstacksize.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 06/23] pthread_create.3: " Alejandro Colomar
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_attr_setstack().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_setstack
sysdeps/htl/pthread.h:158:
extern int pthread_attr_setstack (pthread_attr_t *__attr,
				  void *__stackaddr,
				  size_t __stacksize)
	__THROW __nonnull ((1));
sysdeps/nptl/pthread.h:367:
extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
				  size_t __stacksize) __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_attr_setstack.3 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/man3/pthread_attr_setstack.3 b/man3/pthread_attr_setstack.3
index 23b95cb32..6d0488a8b 100644
--- a/man3/pthread_attr_setstack.3
+++ b/man3/pthread_attr_setstack.3
@@ -33,8 +33,9 @@ attributes in thread attributes object
 .PP
 .BI "int pthread_attr_setstack(pthread_attr_t *" attr ,
 .BI "                          void *" stackaddr ", size_t " stacksize );
-.BI "int pthread_attr_getstack(const pthread_attr_t *" attr ,
-.BI "                          void **" stackaddr ", size_t *" stacksize );
+.BI "int pthread_attr_getstack(const pthread_attr_t *restrict " attr ,
+.BI "                          void **restrict " stackaddr ,
+.BI "                          size_t *restrict " stacksize );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/23] pthread_create.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (4 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 05/23] pthread_attr_setstack.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 07/23] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_create().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_create
sysdeps/htl/pthread.h:212:
extern int pthread_create (pthread_t *__restrict __threadp,
			   __const pthread_attr_t *__restrict __attr,
			   void *(*__start_routine)(void *),
			   void *__restrict __arg) __THROWNL __nonnull ((1, 3));
sysdeps/nptl/pthread.h:200:
extern int pthread_create (pthread_t *__restrict __newthread,
			   const pthread_attr_t *__restrict __attr,
			   void *(*__start_routine) (void *),
			   void *__restrict __arg) __THROWNL __nonnull ((1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_create.3 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/man3/pthread_create.3 b/man3/pthread_create.3
index a1ede6e96..14fd37220 100644
--- a/man3/pthread_create.3
+++ b/man3/pthread_create.3
@@ -30,8 +30,10 @@ pthread_create \- create a new thread
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_create(pthread_t *" thread ", const pthread_attr_t *" attr ,
-.BI "                   void *(*" start_routine ")(void *), void *" arg );
+.BI "int pthread_create(pthread_t *restrict " thread ,
+.BI "                   const pthread_attr_t *restrict " attr ,
+.BI "                   void *(*" start_routine ")(void *),"
+.BI "                   void *restrict " arg );
 .fi
 .PP
 Compile and link with \fI\-pthread\fP.
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/23] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (5 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 06/23] pthread_create.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 08/23] pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'const' in pthread_setattr_default_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_setattr_default_np
sysdeps/nptl/pthread.h:406:
extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_getattr_default_np.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/pthread_getattr_default_np.3 b/man3/pthread_getattr_default_np.3
index ad2a92f52..6a24006bf 100644
--- a/man3/pthread_getattr_default_np.3
+++ b/man3/pthread_getattr_default_np.3
@@ -32,7 +32,7 @@ get or set default thread-creation attributes
 .B #include <pthread.h>
 .PP
 .BI "int pthread_getattr_default_np(pthread_attr_t *" attr );
-.BI "int pthread_setattr_default_np(pthread_attr_t *" attr );
+.BI "int pthread_setattr_default_np(const pthread_attr_t *" attr );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/23] pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (6 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 07/23] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 09/23] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const' Alejandro Colomar
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in
pthread_mutexattr_getpshared().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_mutexattr_getpshared
sysdeps/htl/pthread.h:368:
extern int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict __attr,
					int *__restrict __pshared)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:830:
extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
					 __restrict __attr,
					 int *__restrict __pshared)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_mutexattr_getpshared.3 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/man3/pthread_mutexattr_getpshared.3 b/man3/pthread_mutexattr_getpshared.3
index 2fd48012e..0ae3c05ea 100644
--- a/man3/pthread_mutexattr_getpshared.3
+++ b/man3/pthread_mutexattr_getpshared.3
@@ -30,10 +30,11 @@ process-shared mutex attribute
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_mutexattr_getpshared(const pthread_mutexattr_t *" attr ,
-.BI "                                 int *" pshared );
+.BI "int pthread_mutexattr_getpshared("
+.BI "                              const pthread_mutexattr_t *restrict " attr ,
+.BI "                              int *restrict " pshared );
 .BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr ,
-.BI "                                 int " pshared );
+.BI "                              int " pshared );
 .fi
 .PP
 Compile and link with \fI\-pthread\fP.
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/23] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (7 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 08/23] pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 10/23] pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Neither POSIX or glibc use 'const' in
pthread_mutexattr_setrobust().
Remove it.

.../glibc$ grep_glibc_prototype pthread_mutexattr_setrobust
sysdeps/htl/pthread.h:355:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
sysdeps/nptl/pthread.h:888:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_mutexattr_setrobust.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/pthread_mutexattr_setrobust.3 b/man3/pthread_mutexattr_setrobust.3
index 9034d6faf..d2df02b00 100644
--- a/man3/pthread_mutexattr_setrobust.3
+++ b/man3/pthread_mutexattr_setrobust.3
@@ -33,7 +33,7 @@ pthread_mutexattr_getrobust, pthread_mutexattr_setrobust
 .PP
 .BI "int pthread_mutexattr_getrobust(const pthread_mutexattr_t *" attr ,
 .BI "                                int *" robustness ");"
-.BI "int pthread_mutexattr_setrobust(const pthread_mutexattr_t *" attr ,
+.BI "int pthread_mutexattr_setrobust(pthread_mutexattr_t *" attr ,
 .BI "                                int " robustness ");"
 .fi
 .PP
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/23] pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (8 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 09/23] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const' Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 11/23] pthread_setschedparam.3: " Alejandro Colomar
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in pthread_rwlockattr_getkind_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_rwlockattr_getkind_np
sysdeps/htl/pthread.h:633:
extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
					  __restrict __attr,
					  int *__restrict __pref)
     __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:983:
extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
					  __restrict __attr,
					  int *__restrict __pref)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_rwlockattr_setkind_np.3 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/man3/pthread_rwlockattr_setkind_np.3 b/man3/pthread_rwlockattr_setkind_np.3
index eb2dc19bf..7ade3ba7d 100644
--- a/man3/pthread_rwlockattr_setkind_np.3
+++ b/man3/pthread_rwlockattr_setkind_np.3
@@ -31,9 +31,10 @@ the read-write lock kind of the thread read-write lock attribute object
 .B #include <pthread.h>
 .PP
 .BI "int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *" attr ,
-.BI "                                   int " pref );
-.BI "int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *" attr ,
-.BI "                                   int *" pref );
+.BI "                             int " pref );
+.BI "int pthread_rwlockattr_getkind_np("
+.BI "                             const pthread_rwlockattr_t *restrict " attr ,
+.BI "                             int *restrict " pref );
 .PP
 Compile and link with \fI\-pthread\fP.
 .PP
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 11/23] pthread_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (9 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 10/23] pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 12/23] putgrent.3: " Alejandro Colomar
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in pthread_getschedparam().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_getschedparam
sysdeps/htl/pthread.h:882:
extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy,
				  struct sched_param *__restrict __param)
	__THROW __nonnull ((2, 3));
sysdeps/nptl/pthread.h:426:
extern int pthread_getschedparam (pthread_t __target_thread,
				  int *__restrict __policy,
				  struct sched_param *__restrict __param)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/pthread_setschedparam.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/pthread_setschedparam.3 b/man3/pthread_setschedparam.3
index b3ec5009c..d96d911d9 100644
--- a/man3/pthread_setschedparam.3
+++ b/man3/pthread_setschedparam.3
@@ -33,8 +33,8 @@ scheduling policy and parameters of a thread
 .PP
 .BI "int pthread_setschedparam(pthread_t " thread ", int " policy ,
 .BI "                          const struct sched_param *" param );
-.BI "int pthread_getschedparam(pthread_t " thread ", int *" policy ,
-.BI "                          struct sched_param *" param );
+.BI "int pthread_getschedparam(pthread_t " thread ", int *restrict " policy ,
+.BI "                          struct sched_param *restrict " param );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 12/23] putgrent.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (10 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 11/23] pthread_setschedparam.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 13/23] putpwent.3: " Alejandro Colomar
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in putgrent().
Let's use it here too.

.../glibc$ grep_glibc_prototype putgrent
grp/grp.h:93:
extern int putgrent (const struct group *__restrict __p,
		     FILE *__restrict __f);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/putgrent.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man3/putgrent.3 b/man3/putgrent.3
index 6ce977cb1..2a2801a96 100644
--- a/man3/putgrent.3
+++ b/man3/putgrent.3
@@ -12,7 +12,8 @@ putgrent \- write a group database entry to a file
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
 .B #include <grp.h>
 .PP
-.BI "int putgrent(const struct group *" grp ", FILE *" stream );
+.BI "int putgrent(const struct group *restrict " grp \
+", FILE *restrict " stream );
 .fi
 .SH DESCRIPTION
 The
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 13/23] putpwent.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (11 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 12/23] putgrent.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 14/23] puts.3: " Alejandro Colomar
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in putpwent().
Let's use it here too.

.../glibc$ grep_glibc_prototype putpwent
pwd/pwd.h:102:
extern int putpwent (const struct passwd *__restrict __p,
		     FILE *__restrict __f);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/putpwent.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man3/putpwent.3 b/man3/putpwent.3
index 4db31a78d..85caca9c7 100644
--- a/man3/putpwent.3
+++ b/man3/putpwent.3
@@ -36,7 +36,8 @@ putpwent \- write a password file entry
 .B #include <sys/types.h>
 .B #include <pwd.h>
 .PP
-.BI "int putpwent(const struct passwd *" p ", FILE *" stream );
+.BI "int putpwent(const struct passwd *restrict " p \
+", FILE *restrict " stream );
 .fi
 .PP
 .RS -4
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 14/23] puts.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (12 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 13/23] putpwent.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 15/23] qecvt.3: " Alejandro Colomar
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in fputs().
Let's use it here too.

.../glibc$ grep_glibc_prototype fputs
libio/stdio.h:631:
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/puts.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/puts.3 b/man3/puts.3
index 3b0fb9d2a..e9b0b0c8a 100644
--- a/man3/puts.3
+++ b/man3/puts.3
@@ -34,8 +34,8 @@ fputc, fputs, putc, putchar, puts \- output of characters and strings
 .BI "int putc(int " c ", FILE *" stream );
 .BI "int putchar(int " c );
 .PP
-.BI "int fputs(const char *" "s" ", FILE *" "stream" );
-.BI "int puts(const char *" "s" );
+.BI "int fputs(const char *restrict " s ", FILE *restrict " stream );
+.BI "int puts(const char *" s );
 .fi
 .SH DESCRIPTION
 .BR fputc ()
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 15/23] qecvt.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (13 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 14/23] puts.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 16/23] random_r.3: " Alejandro Colomar
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in qecvt(), qfcvt().
Let's use it here too.

.../glibc$ grep_glibc_prototype qecvt
stdlib/stdlib.h:890:
extern char *qecvt (long double __value, int __ndigit,
		    int *__restrict __decpt, int *__restrict __sign)
     __THROW __nonnull ((3, 4)) __wur;
.../glibc$ grep_glibc_prototype qfcvt
stdlib/stdlib.h:893:
extern char *qfcvt (long double __value, int __ndigit,
		    int *__restrict __decpt, int *__restrict __sign)
     __THROW __nonnull ((3, 4)) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/qecvt.3 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/man3/qecvt.3 b/man3/qecvt.3
index e38922dbf..f904bad54 100644
--- a/man3/qecvt.3
+++ b/man3/qecvt.3
@@ -32,8 +32,12 @@ qecvt, qfcvt, qgcvt \- convert a floating-point number to a string
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "char *qecvt(long double " number ", int " ndigits ", int *" decpt ", int *" sign );
-.BI "char *qfcvt(long double " number ", int " ndigits ", int *" decpt ",i int *" sign );
+.BI "char *qecvt(long double " number ", int " ndigits \
+", int *restrict " decpt ,
+.BI "            int *restrict " sign );
+.BI "char *qfcvt(long double " number ", int " ndigits \
+", int *restrict " decpt ,
+.BI "            int *restrict " sign );
 .BI "char *qgcvt(long double " number ", int " ndigit ", char *" buf );
 .fi
 .PP
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 16/23] random_r.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (14 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 15/23] qecvt.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 17/23] rcmd.3: " Alejandro Colomar
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in random_r(), initstate_r(), setstate_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype random_r
stdlib/stdlib.h:434:
extern int random_r (struct random_data *__restrict __buf,
		     int32_t *__restrict __result) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype initstate_r
stdlib/stdlib.h:440:
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
			size_t __statelen,
			struct random_data *__restrict __buf)
     __THROW __nonnull ((2, 4));
.../glibc$ grep_glibc_prototype setstate_r
stdlib/stdlib.h:445:
extern int setstate_r (char *__restrict __statebuf,
		       struct random_data *__restrict __buf)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/random_r.3 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/man3/random_r.3 b/man3/random_r.3
index 5363e5e78..882ba83a2 100644
--- a/man3/random_r.3
+++ b/man3/random_r.3
@@ -31,12 +31,14 @@ random number generator
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "int random_r(struct random_data *" buf ", int32_t *" result );
+.BI "int random_r(struct random_data *restrict " buf ,
+.BI "             int32_t *restrict " result );
 .BI "int srandom_r(unsigned int " seed ", struct random_data *" buf );
 .PP
-.BI "int initstate_r(unsigned int " seed ", char *" statebuf ,
-.BI "                size_t " statelen ", struct random_data *" buf );
-.BI "int setstate_r(char *" statebuf ", struct random_data *" buf );
+.BI "int initstate_r(unsigned int " seed ", char *restrict " statebuf ,
+.BI "             size_t " statelen ", struct random_data *restrict " buf );
+.BI "int setstate_r(char *restrict " statebuf ,
+.BI "             struct random_data *restrict " buf );
 .fi
 .PP
 .RS -4
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 17/23] rcmd.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (15 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 16/23] random_r.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 18/23] readdir_r.3: " Alejandro Colomar
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in rcmd(), rcmd_af(), iruserok_af().
Let's use it here too.

.../glibc$ grep_glibc_prototype rcmd
resolv/netdb.h:449:
extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
		 const char *__restrict __locuser,
		 const char *__restrict __remuser,
		 const char *__restrict __cmd, int *__restrict __fd2p);
.../glibc$ grep_glibc_prototype rcmd_af
resolv/netdb.h:461:
extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
		    const char *__restrict __locuser,
		    const char *__restrict __remuser,
		    const char *__restrict __cmd, int *__restrict __fd2p,
		    sa_family_t __af);
.../glibc$ grep_glibc_prototype iruserok_af
resolv/netdb.h:537:
extern int iruserok_af (const void *__raddr, int __suser,
			const char *__remuser, const char *__locuser,
			sa_family_t __af);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/rcmd.3 | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/man3/rcmd.3 b/man3/rcmd.3
index 0349646c7..d2df6b629 100644
--- a/man3/rcmd.3
+++ b/man3/rcmd.3
@@ -49,28 +49,30 @@ stream to a remote command
 .nf
 .BR "#include <netdb.h>    " "/* Or <unistd.h> on some systems */"
 .PP
-.BI "int rcmd(char **" ahost ", unsigned short " inport ", const char *" locuser ,
-.BI "             const char *" remuser ", const char *" cmd ", int *" fd2p );
+.BI "int rcmd(char **restrict " ahost ", unsigned short " inport ,
+.BI "         const char *restrict " locuser ", const char *restrict " remuser ,
+.BI "         const char *restrict " cmd ", int *restrict " fd2p );
 .PP
 .BI "int rresvport(int *" port );
 .PP
 .BI "int iruserok(uint32_t " raddr ", int " superuser ,
-.BI "             const char *" ruser ", const char *" luser );
+.BI "         const char *" ruser ", const char *" luser );
 .BI "int ruserok(const char *" rhost ", int " superuser ,
-.BI "             const char *" ruser ", const char *" luser );
+.BI "         const char *" ruser ", const char *" luser );
 .PP
-.BI "int rcmd_af(char **" ahost ", unsigned short " inport ", const char *" locuser ,
-.BI "             const char *" remuser ", const char *" cmd ", int *" fd2p ,
-.BI "             sa_family_t " af );
+.BI "int rcmd_af(char **restrict " ahost ", unsigned short " inport ,
+.BI "         const char *restrict " locuser ", const char *restrict " remuser ,
+.BI "         const char *restrict " cmd ", int *restrict " fd2p ,
+.BI "         sa_family_t " af );
 .PP
 .BI "int rresvport_af(int *" port ", sa_family_t " af );
 .PP
-.BI "int iruserok_af(const void *" raddr ", int " superuser ,
-.BI "             const char *" ruser ", const char *" luser \
-", sa_family_t " af );
+.BI "int iruserok_af(const void *restrict " raddr ", int " superuser ,
+.BI "        const char *restrict " ruser ", const char *restrict " luser ,
+.BI "        sa_family_t " af );
 .BI "int ruserok_af(const char *" rhost ", int " superuser ,
-.BI "             const char *" ruser ", const char *" luser \
-", sa_family_t " af );
+.BI "        const char *" ruser ", const char *" luser ,
+.BI "        sa_family_t " af );
 .fi
 .PP
 .RS -4
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 18/23] readdir_r.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (16 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 17/23] rcmd.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 19/23] realpath.3: " Alejandro Colomar
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in readdir_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype readdir_r
dirent/dirent.h:183:
extern int readdir_r (DIR *__restrict __dirp,
		      struct dirent *__restrict __entry,
		      struct dirent **__restrict __result)
     __nonnull ((1, 2, 3)) __attribute_deprecated__;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/readdir_r.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/readdir_r.3 b/man3/readdir_r.3
index f330adb35..ad8f405f8 100644
--- a/man3/readdir_r.3
+++ b/man3/readdir_r.3
@@ -30,8 +30,8 @@ readdir_r \- read a directory
 .nf
 .B #include <dirent.h>
 .PP
-.BI "int readdir_r(DIR *" dirp ", struct dirent *" entry \
-", struct dirent **" result );
+.BI "int readdir_r(DIR *restrict " dirp ", struct dirent *restrict " entry ,
+.BI "              struct dirent **restrict " result );
 .fi
 .PP
 .RS -4
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 19/23] realpath.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (17 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 18/23] readdir_r.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 20/23] regex.3: " Alejandro Colomar
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in realpath().
Let's use it here too.

.../glibc$ grep_glibc_prototype realpath
stdlib/stdlib.h:800:
extern char *realpath (const char *__restrict __name,
		       char *__restrict __resolved) __THROW __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/realpath.3 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man3/realpath.3 b/man3/realpath.3
index 643cdaaec..100567217 100644
--- a/man3/realpath.3
+++ b/man3/realpath.3
@@ -33,7 +33,8 @@ realpath \- return the canonicalized absolute pathname
 .B #include <limits.h>
 .B #include <stdlib.h>
 .PP
-.BI "char *realpath(const char *" path ", char *" resolved_path );
+.BI "char *realpath(const char *restrict " path ,
+.BI "               char *restrict " resolved_path );
 .fi
 .PP
 .RS -4
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 20/23] regex.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (18 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 19/23] realpath.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 21/23] rexec.3: " Alejandro Colomar
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in regcomp(), regexec(),
regerror().
Let's use it here too.

.../glibc$ grep_glibc_prototype regcomp
posix/regex.h:644:
extern int regcomp (regex_t *_Restrict_ __preg,
		    const char *_Restrict_ __pattern,
		    int __cflags);
.../glibc$ grep_glibc_prototype regexec
posix/regex.h:648:
extern int regexec (const regex_t *_Restrict_ __preg,
		    const char *_Restrict_ __String, size_t __nmatch,
		    regmatch_t __pmatch[_Restrict_arr_],
		    int __eflags);
.../glibc$ grep_glibc_prototype regerror
posix/regex.h:653:
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
			char *_Restrict_ __errbuf, size_t __errbuf_size);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/regex.3 | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/man3/regex.3 b/man3/regex.3
index 79af42ff4..12e43b3f9 100644
--- a/man3/regex.3
+++ b/man3/regex.3
@@ -34,13 +34,15 @@ regcomp, regexec, regerror, regfree \- POSIX regex functions
 .nf
 .B #include <regex.h>
 .PP
-.BI "int regcomp(regex_t *" preg ", const char *" regex ", int " cflags );
-.BI "int regexec(const regex_t *" preg ", const char *" string \
-", size_t " nmatch ,
-.BI "            regmatch_t " pmatch[] ", int " eflags );
+.BI "int regcomp(regex_t *restrict " preg ", const char *restrict " regex ,
+.BI "            int " cflags );
+.BI "int regexec(const regex_t *restrict " preg \
+", const char *restrict " string ,
+.BI "            size_t " nmatch ", regmatch_t " pmatch "[restrict]\
+, int " eflags );
 .PP
-.BI "size_t regerror(int " errcode ", const regex_t *" preg ", char *" errbuf ,
-.BI "            size_t " errbuf_size );
+.BI "size_t regerror(int " errcode ", const regex_t *restrict " preg ,
+.BI "            char *restrict " errbuf ", size_t " errbuf_size );
 .BI "void regfree(regex_t *" preg );
 .fi
 .SH DESCRIPTION
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 21/23] rexec.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (19 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 20/23] regex.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 22/23] scandir.3: " Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 23/23] " Alejandro Colomar
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in rexec(), rexec_af().
Let's use it here too.

.../glibc$ grep_glibc_prototype rexec
resolv/netdb.h:477:
extern int rexec (char **__restrict __ahost, int __rport,
		  const char *__restrict __name,
		  const char *__restrict __pass,
		  const char *__restrict __cmd, int *__restrict __fd2p);
.../glibc$ grep_glibc_prototype rexec_af
resolv/netdb.h:489:
extern int rexec_af (char **__restrict __ahost, int __rport,
		     const char *__restrict __name,
		     const char *__restrict __pass,
		     const char *__restrict __cmd, int *__restrict __fd2p,
		     sa_family_t __af);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/rexec.3 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/man3/rexec.3 b/man3/rexec.3
index 6c46e0e34..56d1a2442 100644
--- a/man3/rexec.3
+++ b/man3/rexec.3
@@ -45,10 +45,12 @@ rexec, rexec_af \- return stream to a remote command
 .nf
 .B #include <netdb.h>
 .PP
-.BI "int rexec(char **" ahost ", int " inport ", const char *" user ,
-.BI "          const char *" passwd ", const char *" cmd ", int *" fd2p );
-.BI "int rexec_af(char **" ahost ", int " inport ", const char *" user ,
-.BI "          const char *" passwd ", const char *" cmd ", int *" fd2p ,
+.BI "int rexec(char **restrict " ahost ", int " inport ,
+.BI "          const char *restrict " user ", const char *restrict " passwd ,
+.BI "          const char *restrict " cmd ", int *restrict " fd2p );
+.BI "int rexec_af(char **restrict " ahost ", int " inport ,
+.BI "          const char *restrict " user ", const char *restrict " passwd ,
+.BI "          const char *restrict " cmd ", int *restrict " fd2p ,
 .BI "          sa_family_t " af  );
 .fi
 .PP
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 22/23] scandir.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (20 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 21/23] rexec.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  2021-03-08 18:53 ` [PATCH 23/23] " Alejandro Colomar
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha, Ulrich Drepper

POSIX does NOT specify scandir() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype scandir
dirent/dirent.h:255:
extern int scandir (const char *__restrict __dir,
		    struct dirent ***__restrict __namelist,
		    int (*__selector) (const struct dirent *),
		    int (*__cmp) (const struct dirent **,
				  const struct dirent **))
     __nonnull ((1, 2));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/scandir.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/scandir.3 b/man3/scandir.3
index 83a5eea7d..262e125c1 100644
--- a/man3/scandir.3
+++ b/man3/scandir.3
@@ -67,7 +67,7 @@ a directory for matching entries
 .nf
 .B #include <dirent.h>
 .PP
-.BI "int scandir(const char *" dirp ", struct dirent ***" namelist ,
+.BI "int scandir(const char *restrict " dirp ", struct dirent ***restrict " namelist ,
 .BI "            int (*" filter ")(const struct dirent *),"
 .BI "            int (*" compar ")(const struct dirent **,"
 .BR "                          const struct dirent **));"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 23/23] scandir.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
                   ` (21 preceding siblings ...)
  2021-03-08 18:53 ` [PATCH 22/23] scandir.3: " Alejandro Colomar
@ 2021-03-08 18:53 ` Alejandro Colomar
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-08 18:53 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'restrict' in scandirat().
Let's use it here too.

.../glibc$ grep_glibc_prototype scandirat
dirent/dirent.h:293:
extern int scandirat (int __dfd, const char *__restrict __dir,
		      struct dirent ***__restrict __namelist,
		      int (*__selector) (const struct dirent *),
		      int (*__cmp) (const struct dirent **,
				    const struct dirent **))
     __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/scandir.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/scandir.3 b/man3/scandir.3
index 262e125c1..50328130f 100644
--- a/man3/scandir.3
+++ b/man3/scandir.3
@@ -78,7 +78,7 @@ a directory for matching entries
 .BR "#include <fcntl.h>" "          /* Definition of AT_* constants */"
 .B #include <dirent.h>
 .PP
-.BI "int scandirat(int " dirfd ", const char *" dirp ", struct dirent ***" namelist ,
+.BI "int scandirat(int " dirfd ", const char *restrict " dirp ", struct dirent ***restrict " namelist ,
 .BI "            int (*" filter ")(const struct dirent *),"
 .BI "            int (*" compar ")(const struct dirent **,"
 .BI "                          const struct dirent **));"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-03-08 18:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 18:53 [PATCH 00/23] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 4) Alejandro Colomar
2021-03-08 18:53 ` [PATCH 01/23] pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-08 18:53 ` [PATCH 02/23] pthread_attr_setscope.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 03/23] pthread_attr_setstackaddr.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 04/23] pthread_attr_setstacksize.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 05/23] pthread_attr_setstack.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 06/23] pthread_create.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 07/23] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
2021-03-08 18:53 ` [PATCH 08/23] pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-08 18:53 ` [PATCH 09/23] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const' Alejandro Colomar
2021-03-08 18:53 ` [PATCH 10/23] pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-08 18:53 ` [PATCH 11/23] pthread_setschedparam.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 12/23] putgrent.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 13/23] putpwent.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 14/23] puts.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 15/23] qecvt.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 16/23] random_r.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 17/23] rcmd.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 18/23] readdir_r.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 19/23] realpath.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 20/23] regex.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 21/23] rexec.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 22/23] scandir.3: " Alejandro Colomar
2021-03-08 18:53 ` [PATCH 23/23] " Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.