diff mbox series

[20/22] posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes

Message ID 20210305235105.177359-21-alx.manpages@gmail.com
State Not Applicable
Headers show
Series man3: SYNOPSIS: Use 'restrict' in prototypes (batch 3) | expand

Commit Message

Alejandro Colomar March 5, 2021, 11:51 p.m. UTC
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 mbox series

Patch

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