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

Hi Michael,

This fixes up to pthread_attr_setguardsize.3 to use 'restrict'.
Please have a special look at printf.3, because of the ffix.

Also, I included in this patchset one patch about 'volatile': malloc_hook.3.
I introduced it by accident into this patch set,
and I'm too lazy to remove it :P
I have no other patches related to 'volatile' pending.
If you think it's likely that there are more cases, please tell me,
and I'll try to have a look (I'd have to create a list of
man[23] variables for that, similar to man_lsfunc()).

Cheers,

Alex

Alejandro Colomar (22):
  getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes
  getsubopt.3: SYNOPSIS: Use 'restrict' in prototypes
  glob.3: SYNOPSIS: Use 'restrict' in prototypes
  iconv.3: SYNOPSIS: Use 'restrict' in prototypes
  inet_ntop.3: SYNOPSIS: Use 'restrict' in prototypes
  inet_pton.3: SYNOPSIS: Use 'restrict' in prototypes
  lio_listio.3: SYNOPSIS: Use 'restrict' in prototypes
  makecontext.3: SYNOPSIS: Use 'restrict' in prototypes
  malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes
  mbrlen.3: SYNOPSIS: Use 'restrict' in prototypes
  mbrtowc.3: SYNOPSIS: Use 'restrict' in prototypes
  mbsnrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
  mbsrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
  mbstowcs.3: SYNOPSIS: Use 'restrict' in prototypes
  mbtowc.3: SYNOPSIS: Use 'restrict' in prototypes
  mempcpy.3: SYNOPSIS: Use 'restrict' in prototypes
  mq_getattr.3: SYNOPSIS: Use 'restrict' in prototypes
  mq_receive.3: SYNOPSIS: Use 'restrict' in prototypes
  posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
  posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
  printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
  pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes

 man3/getservent_r.3              | 21 +++++++++++++--------
 man3/getsubopt.3                 |  4 ++--
 man3/glob.3                      |  4 ++--
 man3/iconv.3                     |  4 ++--
 man3/inet_ntop.3                 |  4 ++--
 man3/inet_pton.3                 |  3 ++-
 man3/lio_listio.3                |  4 ++--
 man3/makecontext.3               |  6 ++++--
 man3/malloc_hook.3               | 10 +++++-----
 man3/mbrlen.3                    |  3 ++-
 man3/mbrtowc.3                   |  5 +++--
 man3/mbsnrtowcs.3                |  5 +++--
 man3/mbsrtowcs.3                 |  4 ++--
 man3/mbstowcs.3                  |  3 ++-
 man3/mbtowc.3                    |  3 ++-
 man3/mempcpy.3                   |  7 +++++--
 man3/mq_getattr.3                |  4 ++--
 man3/mq_receive.3                |  6 +++---
 man3/posix_spawn.3               | 18 ++++++++++--------
 man3/printf.3                    | 29 ++++++++++++++++++-----------
 man3/pthread_attr_setguardsize.3 |  4 ++--
 21 files changed, 88 insertions(+), 63 deletions(-)

-- 
2.30.1.721.g45526154a5


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

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

glibc uses 'restrict' in getservent_r(), getservbyname_r(),
getservbyport_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getservent_r
resolv/netdb.h:306:
extern int getservent_r (struct servent *__restrict __result_buf,
			 char *__restrict __buf, size_t __buflen,
			 struct servent **__restrict __result);
.../glibc$ grep_glibc_prototype getservbyname_r
resolv/netdb.h:310:
extern int getservbyname_r (const char *__restrict __name,
			    const char *__restrict __proto,
			    struct servent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct servent **__restrict __result);
.../glibc$ grep_glibc_prototype getservbyport_r
resolv/netdb.h:316:
extern int getservbyport_r (int __port, const char *__restrict __proto,
			    struct servent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct servent **__restrict __result);
.../glibc$

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

diff --git a/man3/getservent_r.3 b/man3/getservent_r.3
index ad7fd22e4..c73a93afc 100644
--- a/man3/getservent_r.3
+++ b/man3/getservent_r.3
@@ -31,14 +31,19 @@ service entry (reentrant)
 .nf
 .B #include <netdb.h>
 .PP
-.BI "int getservent_r(struct servent *" result_buf ", char *" buf ,
-.BI "                size_t " buflen ", struct servent **" result );
-.BI "int getservbyname_r(const char *" name ", const char *" proto ,
-.BI "                struct servent *" result_buf ", char *" buf ,
-.BI "                size_t " buflen ", struct servent **" result );
-.BI "int getservbyport_r(int " port ", const char *" proto ,
-.BI "                struct servent *" result_buf ", char *" buf ,
-.BI "                size_t " buflen ", struct servent **" result );
+.BI "int getservent_r(struct servent *restrict " result_buf ,
+.BI "                 char *restrict " buf ", size_t " buflen ,
+.BI "                 struct servent **restrict " result );
+.BI "int getservbyname_r(const char *restrict " name ,
+.BI "                 const char *restrict " proto ,
+.BI "                 struct servent *restrict " result_buf ,
+.BI "                 char *restrict " buf ", size_t " buflen ,
+.BI "                 struct servent **restrict " result );
+.BI "int getservbyport_r(int " port ,
+.BI "                 const char *restrict " proto ,
+.BI "                 struct servent *restrict " result_buf ,
+.BI "                 char *restrict " buf ", size_t " buflen ,
+.BI "                 struct servent **restrict " result );
 .PP
 .fi
 .RS -4
-- 
2.30.1.721.g45526154a5


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

* [PATCH 02/22] getsubopt.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 01/22] getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 03/22] glob.3: " Alejandro Colomar
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha, Ulrich Drepper

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

.../glibc$ grep_glibc_prototype getsubopt
stdlib/stdlib.h:958:
extern int getsubopt (char **__restrict __optionp,
		      char *const *__restrict __tokens,
		      char **__restrict __valuep)
     __THROW __nonnull ((1, 2, 3)) __wur;
.../glibc$

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

diff --git a/man3/getsubopt.3 b/man3/getsubopt.3
index ed6a24ed6..9bceed075 100644
--- a/man3/getsubopt.3
+++ b/man3/getsubopt.3
@@ -29,8 +29,8 @@ getsubopt \- parse suboption arguments from a string
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "int getsubopt(char **"optionp ", char * const *" tokens \
-", char **" valuep );
+.BI "int getsubopt(char **restrict " optionp ", char *const *restrict " tokens ,
+.BI "              char **restrict " valuep );
 .fi
 .PP
 .RS -4
-- 
2.30.1.721.g45526154a5


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

* [PATCH 03/22] glob.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 01/22] getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 02/22] getsubopt.3: " Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 04/22] iconv.3: " Alejandro Colomar
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

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

.../glibc$ grep_glibc_prototype glob
posix/glob.h:146:
extern int glob (const char *__restrict __pattern, int __flags,
		 int (*__errfunc) (const char *, int),
		 glob_t *__restrict __pglob) __THROW;
.../glibc$

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

diff --git a/man3/glob.3 b/man3/glob.3
index 94e668e0d..be41fec13 100644
--- a/man3/glob.3
+++ b/man3/glob.3
@@ -38,9 +38,9 @@ glob, globfree \- find pathnames matching a pattern, free memory from glob()
 .nf
 .B #include <glob.h>
 .PP
-.BI "int glob(const char *" pattern ", int " flags ,
+.BI "int glob(const char *restrict " pattern ", int " flags ,
 .BI "         int (*" errfunc ")(const char *" epath ", int " eerrno ),
-.BI "         glob_t *" pglob );
+.BI "         glob_t *restrict " pglob );
 .BI "void globfree(glob_t *" pglob );
 .fi
 .SH DESCRIPTION
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype iconv
iconv/iconv.h:42:
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
		     size_t *__restrict __inbytesleft,
		     char **__restrict __outbuf,
		     size_t *__restrict __outbytesleft);
.../glibc$

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

diff --git a/man3/iconv.3 b/man3/iconv.3
index c3c243e3a..b40eca387 100644
--- a/man3/iconv.3
+++ b/man3/iconv.3
@@ -23,8 +23,8 @@ iconv \- perform character set conversion
 .B #include <iconv.h>
 .PP
 .BI "size_t iconv(iconv_t " cd ,
-.BI "             char **" inbuf ", size_t *" inbytesleft ,
-.BI "             char **" outbuf ", size_t *" outbytesleft );
+.BI "             char **restrict " inbuf ", size_t *restrict " inbytesleft ,
+.BI "             char **restrict " outbuf ", size_t *restrict " outbytesleft );
 .fi
 .SH DESCRIPTION
 The
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype inet_ntop
inet/arpa/inet.h:64:
extern const char *inet_ntop (int __af, const void *__restrict __cp,
			      char *__restrict __buf, socklen_t __len)
     __THROW;
.../glibc$

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

diff --git a/man3/inet_ntop.3 b/man3/inet_ntop.3
index 9abb9556d..fc15ba859 100644
--- a/man3/inet_ntop.3
+++ b/man3/inet_ntop.3
@@ -30,8 +30,8 @@ inet_ntop \- convert IPv4 and IPv6 addresses from binary to text form
 .nf
 .B #include <arpa/inet.h>
 .PP
-.BI "const char *inet_ntop(int " "af" ", const void *" "src" ,
-.BI "                      char *" "dst" ", socklen_t " "size" );
+.BI "const char *inet_ntop(int " af ", const void *restrict " src ,
+.BI "                      char *restrict " dst ", socklen_t " size );
 .fi
 .SH DESCRIPTION
 This function converts the network address structure
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype inet_pton
inet/arpa/inet.h:58:
extern int inet_pton (int __af, const char *__restrict __cp,
		      void *__restrict __buf) __THROW;
.../glibc$

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

diff --git a/man3/inet_pton.3 b/man3/inet_pton.3
index 304aafb1e..f367fc6d2 100644
--- a/man3/inet_pton.3
+++ b/man3/inet_pton.3
@@ -31,7 +31,8 @@ inet_pton \- convert IPv4 and IPv6 addresses from text to binary form
 .nf
 .B #include <arpa/inet.h>
 .PP
-.BI "int inet_pton(int " "af" ", const char *" "src" ", void *" "dst" );
+.BI "int inet_pton(int " af ", const char *restrict " src \
+", void *restrict " dst );
 .fi
 .SH DESCRIPTION
 This function converts the character string
-- 
2.30.1.721.g45526154a5


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

* [PATCH 07/22] lio_listio.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (5 preceding siblings ...)
  2021-03-05 23:50 ` [PATCH 06/22] inet_pton.3: " Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 08/22] makecontext.3: " Alejandro Colomar
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages
  Cc: Alejandro Colomar, linux-man, libc-alpha, Szabolcs Nagy,
	Joseph S. Myers, Ulrich Drepper, Florian Weimer

Both POSIX and glibc use 'restrict' in lio_listio().
However, POSIX is a bit more restrictive than glibc
for the second parameter.
Let's document the more restrictive POSIX variant.

$ man 3p lio_listio |sed -n '/^SYNOPSIS/,/;/p'
SYNOPSIS
       #include <aio.h>

       int lio_listio(int mode, struct aiocb *restrict const list[restrict],
           int nent, struct sigevent *restrict sig);
$

.../glibc$ grep_glibc_prototype lio_listio
rt/aio.h:148:
extern int lio_listio (int __mode,
		       struct aiocb *const __list[__restrict_arr],
		       int __nent, struct sigevent *__restrict __sig)
  __THROW __nonnull ((2));
.../glibc$

Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: glibc <libc-alpha@sourceware.org>
Bug: glibc <https://sourceware.org/bugzilla/show_bug.cgi?id=16747>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/lio_listio.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man3/lio_listio.3 b/man3/lio_listio.3
index d89670f7c..d40ac89fb 100644
--- a/man3/lio_listio.3
+++ b/man3/lio_listio.3
@@ -28,8 +28,8 @@ lio_listio \- initiate a list of I/O requests
 .nf
 .B "#include <aio.h>"
 .PP
-.BI "int lio_listio(int " mode ", struct aiocb *const " aiocb_list [],
-.BI "               int " nitems ", struct sigevent *" sevp );
+.BI "int lio_listio(int " mode ", struct aiocb *restrict const " aiocb_list [restrict],
+.BI "               int " nitems ", struct sigevent *restrict " sevp );
 .PP
 Link with \fI\-lrt\fP.
 .fi
-- 
2.30.1.721.g45526154a5


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

* [PATCH 08/22] makecontext.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (6 preceding siblings ...)
  2021-03-05 23:50 ` [PATCH 07/22] lio_listio.3: " Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 09/22] malloc_hook.3: SYNOPSIS: Use 'volatile' " Alejandro Colomar
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX.1-2001 and glibc use 'restrict' in swapcontext().
Let's use it here too.

.../glibc$ grep_glibc_prototype swapcontext
stdlib/ucontext.h:41:
extern int swapcontext (ucontext_t *__restrict __oucp,
			const ucontext_t *__restrict __ucp)
  __THROWNL __INDIRECT_RETURN;
.../glibc$

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

diff --git a/man3/makecontext.3 b/man3/makecontext.3
index 83720dd2c..859181ddb 100644
--- a/man3/makecontext.3
+++ b/man3/makecontext.3
@@ -32,8 +32,10 @@ makecontext, swapcontext \- manipulate user context
 .nf
 .B #include <ucontext.h>
 .PP
-.BI "void makecontext(ucontext_t *" ucp ", void (*" func ")(), int " argc ", ...);"
-.BI "int swapcontext(ucontext_t *" oucp ", const ucontext_t *" ucp );
+.BI "void makecontext(ucontext_t *" ucp ", void (*" func ")(), int " argc \
+", ...);"
+.BI "int swapcontext(ucontext_t *restrict " oucp ,
+.BI "                const ucontext_t *restrict " ucp );
 .fi
 .SH DESCRIPTION
 In a System V-like environment, one has the type
-- 
2.30.1.721.g45526154a5


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

* [PATCH 09/22] malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (7 preceding siblings ...)
  2021-03-05 23:50 ` [PATCH 08/22] makecontext.3: " Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 10/22] mbrlen.3: SYNOPSIS: Use 'restrict' " Alejandro Colomar
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

glibc uses 'volatile' in __malloc_hook, __realloc_hook,
__memalign_hook, __free_hook, and __after_morecore_hook.
Let's use it here too.

.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__malloc_hook\b.*?;';
malloc/malloc.h:168:
extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size,
                                                     const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__realloc_hook\b.*?;';
malloc/malloc.h:171:
extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr,
                                                      size_t __size,
                                                      const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
 |grep '\.h$' \
 |xargs pcregrep -Mn '(?s)\b__memalign_hook\b.*?;';
malloc/malloc.h:175:
extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                       size_t __size,
                                                       const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__free_hook\b.*?;';
malloc/malloc.h:165:
extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
                                                   const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__malloc_initialize_hook\b.*?;';
malloc/malloc-hooks.h:22:
void (*__malloc_initialize_hook) (void);
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__after_morecore_hook\b.*?;';
malloc/malloc.h:179:
extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
  __MALLOC_DEPRECATED;
.../glibc$

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

diff --git a/man3/malloc_hook.3 b/man3/malloc_hook.3
index 7f1e35043..74c493c83 100644
--- a/man3/malloc_hook.3
+++ b/man3/malloc_hook.3
@@ -16,19 +16,19 @@ __after_morecore_hook \- malloc debugging variables
 .nf
 .B "#include <malloc.h>"
 .PP
-.BI "void *(*__malloc_hook)(size_t " size ", const void *" caller );
+.BI "void *(*volatile __malloc_hook)(size_t " size ", const void *" caller );
 .PP
-.BI "void *(*__realloc_hook)(void *" ptr ", size_t " size \
+.BI "void *(*volatile __realloc_hook)(void *" ptr ", size_t " size \
 ", const void *" caller );
 .PP
-.BI "void *(*__memalign_hook)(size_t " alignment ", size_t " size ,
+.BI "void *(*volatile __memalign_hook)(size_t " alignment ", size_t " size ,
 .BI "                         const void *" caller );
 .PP
-.BI "void (*__free_hook)(void *" ptr ", const void *" caller );
+.BI "void (*volatile __free_hook)(void *" ptr ", const void *" caller );
 .PP
 .B "void (*__malloc_initialize_hook)(void);"
 .PP
-.B "void (*__after_morecore_hook)(void);"
+.B "void (*volatile __after_morecore_hook)(void);"
 .fi
 .SH DESCRIPTION
 The GNU C library lets you modify the behavior of
-- 
2.30.1.721.g45526154a5


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

* [PATCH 10/22] mbrlen.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (8 preceding siblings ...)
  2021-03-05 23:50 ` [PATCH 09/22] malloc_hook.3: SYNOPSIS: Use 'volatile' " Alejandro Colomar
@ 2021-03-05 23:50 ` Alejandro Colomar
  2021-03-05 23:50 ` [PATCH 11/22] mbrtowc.3: " Alejandro Colomar
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:50 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

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

.../glibc$ grep_glibc_prototype mbrlen
wcsmbs/wchar.h:307:
extern size_t mbrlen (const char *__restrict __s, size_t __n,
		      mbstate_t *__restrict __ps) __THROW;
.../glibc$

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

diff --git a/man3/mbrlen.3 b/man3/mbrlen.3
index 8ef088724..9167eeae5 100644
--- a/man3/mbrlen.3
+++ b/man3/mbrlen.3
@@ -20,7 +20,8 @@ mbrlen \- determine number of bytes in next multibyte character
 .nf
 .B #include <wchar.h>
 .PP
-.BI "size_t mbrlen(const char *" s ", size_t " n ", mbstate_t *" ps );
+.BI "size_t mbrlen(const char *restrict " s ", size_t " n ,
+.BI "              mbstate_t *restrict " ps );
 .fi
 .SH DESCRIPTION
 The
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mbrtowc
wcsmbs/wchar.h:296:
extern size_t mbrtowc (wchar_t *__restrict __pwc,
		       const char *__restrict __s, size_t __n,
		       mbstate_t *__restrict __p) __THROW;
.../glibc$

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

diff --git a/man3/mbrtowc.3 b/man3/mbrtowc.3
index c092b2d63..f3ea9d049 100644
--- a/man3/mbrtowc.3
+++ b/man3/mbrtowc.3
@@ -21,8 +21,9 @@ mbrtowc \- convert a multibyte sequence to a wide character
 .nf
 .B #include <wchar.h>
 .PP
-.BI "size_t mbrtowc(wchar_t *" pwc ", const char *" s ", size_t " n \
-", mbstate_t *" ps );
+.BI "size_t mbrtowc(wchar_t *restrict " pwc ", const char *restrict " s \
+", size_t " n ,
+.BI "               mbstate_t *restrict " ps );
 .fi
 .SH DESCRIPTION
 The main case for this function is when
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mbsnrtowcs
wcsmbs/wchar.h:351:
extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
			  const char **__restrict __src, size_t __nmc,
			  size_t __len, mbstate_t *__restrict __ps) __THROW;
.../glibc$

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

diff --git a/man3/mbsnrtowcs.3 b/man3/mbsnrtowcs.3
index 68b7dc02d..c6428e001 100644
--- a/man3/mbsnrtowcs.3
+++ b/man3/mbsnrtowcs.3
@@ -19,8 +19,9 @@ mbsnrtowcs \- convert a multibyte string to a wide-character string
 .nf
 .B #include <wchar.h>
 .PP
-.BI "size_t mbsnrtowcs(wchar_t *" dest ", const char **" src ,
-.BI "                  size_t " nms ", size_t " len ", mbstate_t *" ps );
+.BI "size_t mbsnrtowcs(wchar_t *restrict " dest ", const char **restrict " src ,
+.BI "                  size_t " nms ", size_t " len \
+", mbstate_t *restrict " ps );
 .fi
 .PP
 .RS -4
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mbsrtowcs
wcsmbs/wchar.h:337:
extern size_t mbsrtowcs (wchar_t *__restrict __dst,
			 const char **__restrict __src, size_t __len,
			 mbstate_t *__restrict __ps) __THROW;
.../glibc$

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

diff --git a/man3/mbsrtowcs.3 b/man3/mbsrtowcs.3
index 429af329e..7b7acaf7c 100644
--- a/man3/mbsrtowcs.3
+++ b/man3/mbsrtowcs.3
@@ -20,8 +20,8 @@ mbsrtowcs \- convert a multibyte string to a wide-character string
 .nf
 .B #include <wchar.h>
 .PP
-.BI "size_t mbsrtowcs(wchar_t *" dest ", const char **" src ,
-.BI "                  size_t " len ", mbstate_t *" ps );
+.BI "size_t mbsrtowcs(wchar_t *restrict " dest ", const char **restrict " src ,
+.BI "                 size_t " len ", mbstate_t *restrict " ps );
 .fi
 .SH DESCRIPTION
 If
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mbstowcs
stdlib/stdlib.h:933:
extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
			const char *__restrict __s, size_t __n) __THROW
    __attr_access ((__read_only__, 2));
.../glibc$

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

diff --git a/man3/mbstowcs.3 b/man3/mbstowcs.3
index 03078c81d..c79ba9044 100644
--- a/man3/mbstowcs.3
+++ b/man3/mbstowcs.3
@@ -21,7 +21,8 @@ mbstowcs \- convert a multibyte string to a wide-character string
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "size_t mbstowcs(wchar_t *" dest ", const char *" src ", size_t " n );
+.BI "size_t mbstowcs(wchar_t *restrict " dest ", const char *restrict " src ,
+.BI "                size_t " n );
 .fi
 .SH DESCRIPTION
 If
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mbtowc
stdlib/stdlib.h:925:
extern int mbtowc (wchar_t *__restrict __pwc,
		   const char *__restrict __s, size_t __n) __THROW;
.../glibc$

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

diff --git a/man3/mbtowc.3 b/man3/mbtowc.3
index d0af36831..80058a192 100644
--- a/man3/mbtowc.3
+++ b/man3/mbtowc.3
@@ -20,7 +20,8 @@ mbtowc \- convert a multibyte sequence to a wide character
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "int mbtowc(wchar_t *" pwc ", const char *" s ", size_t " n );
+.BI "int mbtowc(wchar_t *restrict " pwc ", const char *restrict " s \
+", size_t " n );
 .fi
 .SH DESCRIPTION
 The main case for this function is when
-- 
2.30.1.721.g45526154a5


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

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

glibc uses 'restrict' in mempcpy(), wmempcpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype mempcpy
string/string.h:384:
extern void *mempcpy (void *__restrict __dest,
		      const void *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype wmempcpy
wcsmbs/wchar.h:276:
extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
			  const wchar_t *__restrict __s2, size_t __n)
     __THROW;
.../glibc$

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

diff --git a/man3/mempcpy.3 b/man3/mempcpy.3
index 33c032c50..8a810e6a5 100644
--- a/man3/mempcpy.3
+++ b/man3/mempcpy.3
@@ -15,12 +15,15 @@ mempcpy, wmempcpy  \- copy memory area
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
 .B #include <string.h>
 .PP
-.BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
+.BI "void *mempcpy(void *restrict " dest ", const void *restrict " src \
+", size_t " n );
 .PP
 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
 .B #include <wchar.h>
 .PP
-.BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n );
+.BI "wchar_t *wmempcpy(wchar_t *restrict " dest \
+", const wchar_t *restrict " src ,
+.BI "                  size_t " n );
 .fi
 .SH DESCRIPTION
 The
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mq_setattr
rt/mqueue.h:51:
extern int mq_setattr (mqd_t __mqdes,
		       const struct mq_attr *__restrict __mqstat,
		       struct mq_attr *__restrict __omqstat)
  __THROW __nonnull ((2));
.../glibc$

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

diff --git a/man3/mq_getattr.3 b/man3/mq_getattr.3
index 32bfe21be..f1925fc71 100644
--- a/man3/mq_getattr.3
+++ b/man3/mq_getattr.3
@@ -30,8 +30,8 @@ mq_getattr, mq_setattr \- get/set message queue attributes
 .B #include <mqueue.h>
 .PP
 .BI "int mq_getattr(mqd_t " mqdes ", struct mq_attr *" attr );
-.BI "int mq_setattr(mqd_t " mqdes ", const struct mq_attr *" newattr ","
-.BI "               struct mq_attr *" oldattr );
+.BI "int mq_setattr(mqd_t " mqdes ", const struct mq_attr *restrict " newattr ,
+.BI "               struct mq_attr *restrict " oldattr );
 .fi
 .PP
 Link with \fI\-lrt\fP.
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype mq_timedreceive
rt/mqueue.h:76:
extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
				size_t __msg_len,
				unsigned int *__restrict __msg_prio,
				const struct timespec *__restrict __abs_timeout)
  __nonnull ((2, 5));
.../glibc$

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

diff --git a/man3/mq_receive.3 b/man3/mq_receive.3
index 418330bac..4dc1c3342 100644
--- a/man3/mq_receive.3
+++ b/man3/mq_receive.3
@@ -35,9 +35,9 @@ mq_receive, mq_timedreceive \- receive a message from a message queue
 .B #include <time.h>
 .B #include <mqueue.h>
 .PP
-.BI "ssize_t mq_timedreceive(mqd_t " mqdes ", char *" msg_ptr ,
-.BI "                   size_t " msg_len ", unsigned int *" msg_prio ,
-.BI "                   const struct timespec *" abs_timeout );
+.BI "ssize_t mq_timedreceive(mqd_t " mqdes ", char *restrict " msg_ptr ,
+.BI "                   size_t " msg_len ", unsigned int *restrict " msg_prio ,
+.BI "                   const struct timespec *restrict " abs_timeout );
 .fi
 .PP
 Link with \fI\-lrt\fP.
-- 
2.30.1.721.g45526154a5


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

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

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

.../glibc$ grep_glibc_prototype posix_spawn
posix/spawn.h:72:
extern int posix_spawn (pid_t *__restrict __pid,
			const char *__restrict __path,
			const posix_spawn_file_actions_t *__restrict
			__file_actions,
			const posix_spawnattr_t *__restrict __attrp,
			char *const __argv[__restrict_arr],
			char *const __envp[__restrict_arr])
    __nonnull ((2, 5));
.../glibc$

I conciously did an exception with respect to the right margin
of the rendered page.  Instead of having the right margin at 78
as usual (per Branden's recommendation), I let it use col 79
this time, to avoid breaking the prototype in an ugly way,
or shifting all of the parameters to the left, unaligned with
respect to the function parentheses.

Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/posix_spawn.3 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/man3/posix_spawn.3 b/man3/posix_spawn.3
index a56aa3e86..02f86fddd 100644
--- a/man3/posix_spawn.3
+++ b/man3/posix_spawn.3
@@ -35,10 +35,11 @@ posix_spawn, posix_spawnp \- spawn a process
 .nf
 .B #include <spawn.h>
 .PP
-.BI "int posix_spawn(pid_t *" pid ", const char *" path ,
-.BI "                 const posix_spawn_file_actions_t *" file_actions ,
-.BI "                 const posix_spawnattr_t *" attrp ,
-.BI "                 char *const " argv[] ", char *const " envp[] );
+.BI "int posix_spawn(pid_t *restrict " pid ", const char *restrict " path ,
+.BI "                const posix_spawn_file_actions_t *restrict " file_actions ,
+.BI "                const posix_spawnattr_t *restrict " attrp ,
+.BI "                char *const " argv [restrict],
+.BI "                char *const " envp [restrict]);
 .BI "int posix_spawnp(pid_t *" pid ", const char *" file ,
 .BI "                 const posix_spawn_file_actions_t *" file_actions ,
 .BI "                 const posix_spawnattr_t *" attrp ,
-- 
2.30.1.721.g45526154a5


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

* [PATCH 20/22] posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (18 preceding siblings ...)
  2021-03-05 23:51 ` [PATCH 19/22] posix_spawn.3: " Alejandro Colomar
@ 2021-03-05 23:51 ` Alejandro Colomar
  2021-03-05 23:51 ` [PATCH 21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too Alejandro Colomar
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:51 UTC (permalink / raw)
  To: mtk.manpages
  Cc: Alejandro Colomar, linux-man, libc-alpha, G . Branden Robinson

POSIX uses 'restrict' in posix_spawnp().
However, glibc doesn't.
Let's document here the more restrictive of them, which is POSIX.
I reported a bug to glibc about this.

$ man 3p posix_spawnp |sed -n '/^SYNOPSIS/,/;/p'
SYNOPSIS
       #include <spawn.h>

       int posix_spawnp(pid_t *restrict pid, const char *restrict file,
           const posix_spawn_file_actions_t *file_actions,
           const posix_spawnattr_t *restrict attrp,
           char *const argv[restrict], char *const envp[restrict]);
$

.../glibc$ grep_glibc_prototype posix_spawnp
posix/spawn.h:85:
extern int posix_spawnp (pid_t *__pid, const char *__file,
			 const posix_spawn_file_actions_t *__file_actions,
			 const posix_spawnattr_t *__attrp,
			 char *const __argv[], char *const __envp[])
    __nonnull ((2, 5));
.../glibc$

I conciously did an exception with respect to the right margin
of the rendered page.  Instead of having the right margin at 78
as usual (per Branden's recommendation), I let it use col 79
this time, to avoid breaking the prototype in an ugly way,
or shifting all of the parameters to the left, unaligned with
respect to the function parentheses.

Bug: glibc <https://sourceware.org/bugzilla/show_bug.cgi?id=27529>
Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Cc: glibc <libc-alpha@sourceware.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man3/posix_spawn.3 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/man3/posix_spawn.3 b/man3/posix_spawn.3
index 02f86fddd..df82a81df 100644
--- a/man3/posix_spawn.3
+++ b/man3/posix_spawn.3
@@ -40,10 +40,11 @@ posix_spawn, posix_spawnp \- spawn a process
 .BI "                const posix_spawnattr_t *restrict " attrp ,
 .BI "                char *const " argv [restrict],
 .BI "                char *const " envp [restrict]);
-.BI "int posix_spawnp(pid_t *" pid ", const char *" file ,
-.BI "                 const posix_spawn_file_actions_t *" file_actions ,
-.BI "                 const posix_spawnattr_t *" attrp ,
-.BI "                 char *const " argv[] ", char *const " envp[] );
+.BI "int posix_spawnp(pid_t *restrict " pid ", const char *restrict " file ,
+.BI "                const posix_spawn_file_actions_t *restrict " file_actions ,
+.BI "                const posix_spawnattr_t *restrict " attrp ,
+.BI "                char *const " argv [restrict],
+.BI "                char *const " envp [restrict]);
 .fi
 .SH DESCRIPTION
 The
-- 
2.30.1.721.g45526154a5


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

* [PATCH 21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (19 preceding siblings ...)
  2021-03-05 23:51 ` [PATCH 20/22] " Alejandro Colomar
@ 2021-03-05 23:51 ` Alejandro Colomar
  2021-03-05 23:51 ` [PATCH 22/22] pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
  2021-03-07 10:20 ` [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Michael Kerrisk (man-pages)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:51 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

Both POSIX and glibc use 'restrict' in printf(), fprintf(),
dprintf(), sprintf(), snprintf(), vprintf(), vfprintf(),
vdprintf(), vsprintf(), vsnprintf().
Let's use it here too.

.../glibc$ grep_glibc_prototype printf
libio/stdio.h:332:
extern int printf (const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype fprintf
libio/stdio.h:326:
extern int fprintf (FILE *__restrict __stream,
		    const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype dprintf
libio/stdio.h:382:
extern int dprintf (int __fd, const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));
.../glibc$ grep_glibc_prototype sprintf
libio/stdio.h:334:
extern int sprintf (char *__restrict __s,
		    const char *__restrict __format, ...) __THROWNL;
.../glibc$ grep_glibc_prototype snprintf
libio/stdio.h:354:
extern int snprintf (char *__restrict __s, size_t __maxlen,
		     const char *__restrict __format, ...)
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
.../glibc$ grep_glibc_prototype vprintf
libio/stdio.h:347:
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vfprintf
libio/stdio.h:341:
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
		     __gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vdprintf
libio/stdio.h:379:
extern int vdprintf (int __fd, const char *__restrict __fmt,
		     __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));
.../glibc$ grep_glibc_prototype vsprintf
libio/stdio.h:349:
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
		     __gnuc_va_list __arg) __THROWNL;
.../glibc$ grep_glibc_prototype vsnprintf
libio/stdio.h:358:
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
		      const char *__restrict __format, __gnuc_va_list __arg)
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
.../glibc$

ffix: Align common parameters.

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

diff --git a/man3/printf.3 b/man3/printf.3
index 48bb9771d..fa6564426 100644
--- a/man3/printf.3
+++ b/man3/printf.3
@@ -39,20 +39,27 @@ vsprintf, vsnprintf \- formatted output conversion
 .nf
 .B #include <stdio.h>
 .PP
-.BI "int printf(const char *" format ", ...);"
-.BI "int fprintf(FILE *" stream ", const char *" format ", ...);"
-.BI "int dprintf(int " fd ", const char *" format ", ...);"
-.BI "int sprintf(char *" str ", const char *" format ", ...);"
-.BI "int snprintf(char *" str ", size_t " size ", const char *" format ", ...);"
+.BI "int printf(const char *restrict " format ", ...);"
+.BI "int fprintf(FILE *restrict " stream ,
+.BI "            const char *restrict " format ", ...);"
+.BI "int dprintf(int " fd ,
+.BI "            const char *restrict " format ", ...);"
+.BI "int sprintf(char *restrict " str ,
+.BI "            const char *restrict " format ", ...);"
+.BI "int snprintf(char *restrict " str ", size_t " size ,
+.BI "            const char *restrict " format ", ...);"
 .PP
 .B #include <stdarg.h>
 .PP
-.BI "int vprintf(const char *" format ", va_list " ap );
-.BI "int vfprintf(FILE *" stream ", const char *" format ", va_list " ap );
-.BI "int vdprintf(int " fd ", const char *" format ", va_list " ap );
-.BI "int vsprintf(char *" str ", const char *" format ", va_list " ap );
-.BI "int vsnprintf(char *" str ", size_t " size ", const char *" format \
-", va_list " ap );
+.BI "int vprintf(const char *restrict " format ", va_list " ap );
+.BI "int vfprintf(FILE *restrict " stream ,
+.BI "            const char *restrict " format ", va_list " ap );
+.BI "int vdprintf(int " fd ,
+.BI "            const char *restrict " format ", va_list " ap );
+.BI "int vsprintf(char *restrict " str ,
+.BI "            const char *restrict " format ", va_list " ap );
+.BI "int vsnprintf(char *restrict " str ", size_t " size ,
+.BI "            const char *restrict " format ", va_list " ap );
 .fi
 .PP
 .RS -4
-- 
2.30.1.721.g45526154a5


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

* [PATCH 22/22] pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (20 preceding siblings ...)
  2021-03-05 23:51 ` [PATCH 21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too Alejandro Colomar
@ 2021-03-05 23:51 ` Alejandro Colomar
  2021-03-07 10:20 ` [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Michael Kerrisk (man-pages)
  22 siblings, 0 replies; 24+ messages in thread
From: Alejandro Colomar @ 2021-03-05 23:51 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

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

.../glibc$ grep_glibc_prototype pthread_attr_getguardsize
sysdeps/htl/pthread.h:180:
extern int pthread_attr_getguardsize (const pthread_attr_t *__restrict __attr,
				      size_t *__restrict __guardsize)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:283:
extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
				      size_t *__guardsize)
     __THROW __nonnull ((1, 2));
.../glibc$

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

diff --git a/man3/pthread_attr_setguardsize.3 b/man3/pthread_attr_setguardsize.3
index 94d900ef5..ca225d1e5 100644
--- a/man3/pthread_attr_setguardsize.3
+++ b/man3/pthread_attr_setguardsize.3
@@ -33,8 +33,8 @@ attribute in thread attributes object
 .PP
 .BI "int pthread_attr_setguardsize(pthread_attr_t *" attr \
 ", size_t " guardsize );
-.BI "int pthread_attr_getguardsize(const pthread_attr_t *" attr ,
-.BI "                              size_t *" guardsize );
+.BI "int pthread_attr_getguardsize(const pthread_attr_t *restrict " attr ,
+.BI "                              size_t *restrict " guardsize );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
-- 
2.30.1.721.g45526154a5


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

* Re: [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3)
  2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
                   ` (21 preceding siblings ...)
  2021-03-05 23:51 ` [PATCH 22/22] pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
@ 2021-03-07 10:20 ` Michael Kerrisk (man-pages)
  22 siblings, 0 replies; 24+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-03-07 10:20 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: mtk.manpages, linux-man, libc-alpha, Heinrich Schuchardt

Hi Alex,

On 3/6/21 12:50 AM, Alejandro Colomar wrote:
> Hi Michael,
> 
> This fixes up to pthread_attr_setguardsize.3 to use 'restrict'.

Thanks!

> Please have a special look at printf.3, because of the ffix.

It looks okay to me.

> Also, I included in this patchset one patch about 'volatile': malloc_hook.3.
> I introduced it by accident into this patch set,
> and I'm too lazy to remove it :P

Okay.

> I have no other patches related to 'volatile' pending.
> If you think it's likely that there are more cases, please tell me,
> and I'll try to have a look (I'd have to create a list of
> man[23] variables for that, similar to man_lsfunc()).

I'm not aware of other 'volatile' cases.

> 
> Cheers,
> 
> Alex
> 
> Alejandro Colomar (22):
>   getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes
>   getsubopt.3: SYNOPSIS: Use 'restrict' in prototypes
>   glob.3: SYNOPSIS: Use 'restrict' in prototypes
>   iconv.3: SYNOPSIS: Use 'restrict' in prototypes
>   inet_ntop.3: SYNOPSIS: Use 'restrict' in prototypes
>   inet_pton.3: SYNOPSIS: Use 'restrict' in prototypes
>   lio_listio.3: SYNOPSIS: Use 'restrict' in prototypes
>   makecontext.3: SYNOPSIS: Use 'restrict' in prototypes
>   malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes
>   mbrlen.3: SYNOPSIS: Use 'restrict' in prototypes
>   mbrtowc.3: SYNOPSIS: Use 'restrict' in prototypes
>   mbsnrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
>   mbsrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
>   mbstowcs.3: SYNOPSIS: Use 'restrict' in prototypes
>   mbtowc.3: SYNOPSIS: Use 'restrict' in prototypes
>   mempcpy.3: SYNOPSIS: Use 'restrict' in prototypes
>   mq_getattr.3: SYNOPSIS: Use 'restrict' in prototypes
>   mq_receive.3: SYNOPSIS: Use 'restrict' in prototypes
>   posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
>   posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
>   printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
>   pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes

I've applied all of these.

Thanks!

Michael

>  man3/getservent_r.3              | 21 +++++++++++++--------
>  man3/getsubopt.3                 |  4 ++--
>  man3/glob.3                      |  4 ++--
>  man3/iconv.3                     |  4 ++--
>  man3/inet_ntop.3                 |  4 ++--
>  man3/inet_pton.3                 |  3 ++-
>  man3/lio_listio.3                |  4 ++--
>  man3/makecontext.3               |  6 ++++--
>  man3/malloc_hook.3               | 10 +++++-----
>  man3/mbrlen.3                    |  3 ++-
>  man3/mbrtowc.3                   |  5 +++--
>  man3/mbsnrtowcs.3                |  5 +++--
>  man3/mbsrtowcs.3                 |  4 ++--
>  man3/mbstowcs.3                  |  3 ++-
>  man3/mbtowc.3                    |  3 ++-
>  man3/mempcpy.3                   |  7 +++++--
>  man3/mq_getattr.3                |  4 ++--
>  man3/mq_receive.3                |  6 +++---
>  man3/posix_spawn.3               | 18 ++++++++++--------
>  man3/printf.3                    | 29 ++++++++++++++++++-----------
>  man3/pthread_attr_setguardsize.3 |  4 ++--
>  21 files changed, 88 insertions(+), 63 deletions(-)
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

end of thread, other threads:[~2021-03-07 10:21 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 23:50 [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Alejandro Colomar
2021-03-05 23:50 ` [PATCH 01/22] getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-05 23:50 ` [PATCH 02/22] getsubopt.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 03/22] glob.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 04/22] iconv.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 05/22] inet_ntop.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 06/22] inet_pton.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 07/22] lio_listio.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 08/22] makecontext.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 09/22] malloc_hook.3: SYNOPSIS: Use 'volatile' " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 10/22] mbrlen.3: SYNOPSIS: Use 'restrict' " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 11/22] mbrtowc.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 12/22] mbsnrtowcs.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 13/22] mbsrtowcs.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 14/22] mbstowcs.3: " Alejandro Colomar
2021-03-05 23:50 ` [PATCH 15/22] mbtowc.3: " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 16/22] mempcpy.3: " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 17/22] mq_getattr.3: " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 18/22] mq_receive.3: " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 19/22] posix_spawn.3: " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 20/22] " Alejandro Colomar
2021-03-05 23:51 ` [PATCH 21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too Alejandro Colomar
2021-03-05 23:51 ` [PATCH 22/22] pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-03-07 10:20 ` [PATCH 00/22] man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) Michael Kerrisk (man-pages)

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.