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

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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-03-06 00:51:04 +01:00 committed by Michael Kerrisk
parent a2471dc690
commit 0864c24079
1 changed files with 5 additions and 4 deletions

View File

@ -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