Commit Graph

6948 Commits

Author SHA1 Message Date
Alejandro Colomar 716df87cf9 regex.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 0f8d366c7e realpath.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 1c82c77213 readdir_r.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar a353324694 rcmd.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar e5dc2f3405 random_r.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 7ecee41323 qecvt.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 315a87ce92 puts.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar fbe8945399 putpwent.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 5952677947 putgrent.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 4beb303a63 pthread_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 9ab24a89a3 pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 26f78eec84 pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 71f5a50a03 pthread_create.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 5a00663af2 pthread_attr_setstack.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 07bd2112f2 pthread_attr_setstacksize.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 4517c06e47 pthread_attr_setstackaddr.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar c5144bd329 pthread_attr_setscope.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar f0171b8a51 pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar c355fea451 pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b5ca16254f printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 0864c24079 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>
2021-03-07 11:16:21 +01:00
Alejandro Colomar a2471dc690 posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 6d512409df mq_receive.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 7369646c2b mq_getattr.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 34aec7f9e8 mempcpy.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 855b2aeb8c mbtowc.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 0634d31b54 mbstowcs.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b4a5b81892 mbsrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 68802a1ec5 mbsnrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b0d2d2e0e3 mbrtowc.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 95bc7a7667 mbrlen.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar ca2eb1e614 malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar e64e5812b3 makecontext.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar c445280cf3 lio_listio.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 6d1cb47e4e inet_pton.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar cd18d63b1a inet_ntop.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar decc37b2f7 iconv.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 86ce858344 glob.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 48294a557d getsubopt.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 956e8829b5 getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes
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>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 4dfd2b4f70 getpwnam.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify these functions to use 'restrict'.
However, glibc uses 'restrict' in getpwnam_r(), getpwuid_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getpwnam_r
pwd/pwd.h:151:
extern int getpwnam_r (const char *__restrict __name,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((1, 2, 3, 5));
.../glibc$ grep_glibc_prototype getpwuid_r
pwd/pwd.h:145:
extern int getpwuid_r (__uid_t __uid,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((2, 3, 5));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 69b7afbe94 getpwent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getpwent_r(), fgetpwent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getpwent_r
pwd/pwd.h:139:
extern int getpwent_r (struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((1, 2, 4));
.../glibc$ grep_glibc_prototype fgetpwent_r
pwd/pwd.h:166:
extern int fgetpwent_r (FILE *__restrict __stream,
			struct passwd *__restrict __resultbuf,
			char *__restrict __buffer, size_t __buflen,
			struct passwd **__restrict __result)
			__nonnull ((1, 2, 3, 5));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 698bf7902f getprotoent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getprotoent_r(), getprotobyname_r(),
getprotobynumber_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getprotoent_r
resolv/netdb.h:372:
extern int getprotoent_r (struct protoent *__restrict __result_buf,
			  char *__restrict __buf, size_t __buflen,
			  struct protoent **__restrict __result);
.../glibc$ grep_glibc_prototype getprotobyname_r
resolv/netdb.h:376:
extern int getprotobyname_r (const char *__restrict __name,
			     struct protoent *__restrict __result_buf,
			     char *__restrict __buf, size_t __buflen,
			     struct protoent **__restrict __result);
.../glibc$ grep_glibc_prototype getprotobynumber_r
resolv/netdb.h:381:
extern int getprotobynumber_r (int __proto,
			       struct protoent *__restrict __result_buf,
			       char *__restrict __buf, size_t __buflen,
			       struct protoent **__restrict __result);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 0bbc1dec0e getnetent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getnetent_r(), getnetbyname_r(),
getnetbyaddr_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getnetent_r
resolv/netdb.h:235:
extern int getnetent_r (struct netent *__restrict __result_buf,
			char *__restrict __buf, size_t __buflen,
			struct netent **__restrict __result,
			int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype getnetbyname_r
resolv/netdb.h:246:
extern int getnetbyname_r (const char *__restrict __name,
			   struct netent *__restrict __result_buf,
			   char *__restrict __buf, size_t __buflen,
			   struct netent **__restrict __result,
			   int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype getnetbyaddr_r
resolv/netdb.h:240:
extern int getnetbyaddr_r (uint32_t __net, int __type,
			   struct netent *__restrict __result_buf,
			   char *__restrict __buf, size_t __buflen,
			   struct netent **__restrict __result,
			   int *__restrict __h_errnop);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar ce73ed19b0 getnameinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getnameinfo().
Let's use it here too.

I consciously 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.

.../glibc$ grep_glibc_prototype getnameinfo
resolv/netdb.h:675:
extern int getnameinfo (const struct sockaddr *__restrict __sa,
			socklen_t __salen, char *__restrict __host,
			socklen_t __hostlen, char *__restrict __serv,
			socklen_t __servlen, int __flags);
.../glibc$

Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:16 +01:00
Alejandro Colomar 8fbe36d625 getmntent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in addmntent(), getmntent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype addmntent
misc/mntent.h:81:
extern int addmntent (FILE *__restrict __stream,
		      const struct mntent *__restrict __mnt) __THROW;
.../glibc$ grep_glibc_prototype getmntent_r
misc/mntent.h:73:
extern struct mntent *getmntent_r (FILE *__restrict __stream,
				   struct mntent *__restrict __result,
				   char *__restrict __buffer,
				   int __bufsize) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 22f4c26563 getline.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getline(), getdelim().
Let's use it here too.

.../glibc$ grep_glibc_prototype getline
libio/stdio.h:621:
extern __ssize_t getline (char **__restrict __lineptr,
                          size_t *__restrict __n,
                          FILE *__restrict __stream) __wur;
.../glibc$ grep_glibc_prototype getdelim
libio/stdio.h:611:
extern __ssize_t getdelim (char **__restrict __lineptr,
                           size_t *__restrict __n, int __delimiter,
                           FILE *__restrict __stream) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 938c8215eb gethostbyname.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in gethostent_r(), gethostbyaddr_r(),
gethostbyname_r(), gethostbyname2_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype gethostent_r
resolv/netdb.h:165:
extern int gethostent_r (struct hostent *__restrict __result_buf,
			 char *__restrict __buf, size_t __buflen,
			 struct hostent **__restrict __result,
			 int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyaddr_r
resolv/netdb.h:170:
extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
			    int __type,
			    struct hostent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct hostent **__restrict __result,
			    int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyname_r
resolv/netdb.h:177:
extern int gethostbyname_r (const char *__restrict __name,
			    struct hostent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct hostent **__restrict __result,
			    int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyname2_r
resolv/netdb.h:183:
extern int gethostbyname2_r (const char *__restrict __name, int __af,
			     struct hostent *__restrict __result_buf,
			     char *__restrict __buf, size_t __buflen,
			     struct hostent **__restrict __result,
			     int *__restrict __h_errnop);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 2bebee6f60 getgrnam.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify these functions to use 'restrict'.
However, glibc uses 'restrict' in getgrnam_r(), getgrgid_r().
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype getgrnam_r
grp/grp.h:148:
extern int getgrnam_r (const char *__restrict __name,
		       struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$ grep_glibc_prototype getgrgid_r
grp/grp.h:140:
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 61f75e878a getgrent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getgrent_r(), fgetgrent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getgrent_r
grp/grp.h:131:
extern int getgrent_r (struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$ grep_glibc_prototype fgetgrent_r
grp/grp.h:161:
extern int fgetgrent_r (FILE *__restrict __stream,
			struct group *__restrict __resultbuf,
			char *__restrict __buffer, size_t __buflen,
			struct group **__restrict __result);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 934e516236 getdirentries.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getdirentries().
Let's use it here too.

.../glibc$ grep_glibc_prototype getdirentries
dirent/dirent.h:353:
extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
				size_t __nbytes,
				__off_t *__restrict __basep)
     __THROW __nonnull ((2, 4));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 5e0058dce8 getdate.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getdate_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getdate_r
time/time.h:297:
extern int getdate_r (const char *__restrict __string,
		      struct tm *__restrict __resbufp);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 79201b695e getaddrinfo_a.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getaddrinfo_a().
Let's use it here too.

.../glibc$ grep_glibc_prototype getaddrinfo_a
resolv/netdb.h:690:
extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
			  int __ent, struct sigevent *__restrict __sig);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 854214715b getaddrinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getaddrinfo().
Let's use it here too.

.../glibc$ grep_glibc_prototype getaddrinfo;
resolv/netdb.h:660:
extern int getaddrinfo (const char *__restrict __name,
			const char *__restrict __service,
			const struct addrinfo *__restrict __req,
			struct addrinfo **__restrict __pai);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 2b19457ac5 fseek.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fgetpos().
Let's use it here too.

glibc:
=============================  fgetpos
libio/stdio.h:736:
int fgetpos (FILE *restrict stream, fpos_t *restrict pos);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 93a4d1d504 fread.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in these functions.
Let's use it here too.

glibc:
=============================  fread
libio/stdio.h:651:
size_t fread (void *restrict ptr, size_t size,
                     size_t n, FILE *restrict stream) wur;
=============================  fwrite
libio/stdio.h:657:
size_t fwrite (const void *restrict ptr, size_t size,
                      size_t n, FILE *restrict s);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar a7bbdaf7b8 fputws.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fputws().
Let's use it here too.

glibc:
=============================  fputws
wcsmbs/wchar.h:765:
int fputws (const wchar_t *restrict ws,
                   FILE *restrict stream);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 1ac0a9ccbc fopen.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' for some of these functions.
Let's use it here too.

glibc:
=============================  fopen
libio/stdio.h:246:
FILE *fopen (const char *restrict filename,
                    const char *restrict modes) wur;
=============================  fdopen
libio/stdio.h:279:
FILE *fdopen (int fd, const char *modes) THROW wur;
=============================  freopen
libio/stdio.h:252:
FILE *freopen (const char *restrict filename,
                      const char *restrict modes,
                      FILE *restrict stream) wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f61d0340cc fopencookie.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' for fopencookie().
Let's use it here too.

glibc:
libio/stdio.h:285:
FILE *fopencookie (void *restrict magic_cookie,
                          const char *restrict modes,
                          cookie_io_functions_t io_funcs) THROW wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar e7bb37ab1b fgetws.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' for fgetws().
Let's use it here too.

glibc:
wcsmbs/wchar.h:758:
wchar_t *fgetws (wchar_t *restrict ws, int n,
                        FILE *restrict stream);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ef5781cf66 fgetc.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fgets().
Let's use it here too.

glibc:
libio/stdio.h:568:
char *fgets (char *restrict s, int n, FILE *restrict stream)
     wur attr_access ((write_only__, 1, 2));

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ebf67ad6ad envz_add.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for these functions
Let's use it here too.

=============================  envz_add
string/envz.h:49:
error_t envz_add (char **restrict envz,
                         size_t *restrict envz_len,
                         const char *restrict name,
                         const char *restrict value) THROW;
=============================  envz_entry
string/envz.h:33:
char *envz_entry (const char *restrict envz, size_t envz_len,
                         const char *restrict name)
     THROW attribute_pure__;
=============================  envz_get
string/envz.h:39:
char *envz_get (const char *restrict envz, size_t envz_len,
                       const char *restrict name)
     THROW attribute_pure__;
=============================  envz_merge
string/envz.h:57:
error_t envz_merge (char **restrict envz,
                           size_t *restrict envz_len,
                           const char *restrict envz2,
                           size_t envz2_len, int override) THROW;
=============================  envz_remove
string/envz.h:63:
void envz_remove (char **restrict envz,
                         size_t *restrict envz_len,
                         const char *restrict name) THROW;
=============================  envz_strip
string/envz.h:68:
void envz_strip (char **restrict envz,
                        size_t *restrict envz_len) THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 017103fa19 ecvt.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX.1-2001 and glibc use 'restrict' for these functions.
Let's use it here too.

glibc:
=============================  ecvt
stdlib/stdlib.h:872:
char *ecvt (double value, int ndigit, int *restrict decpt,
                   int *restrict sign) THROW nonnull ((3, 4)) wur;
=============================  fcvt
stdlib/stdlib.h:878:
char *fcvt (double value, int ndigit, int *restrict decpt,
                   int *restrict sign) THROW nonnull ((3, 4)) wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f0eb582b99 ecvt_r.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for these functions

=============================  ecvt_r
stdlib/stdlib.h:902:
int ecvt_r (double value, int ndigit, int *restrict decpt,
                   int *restrict sign, char *restrict buf,
                   size_t len) THROW nonnull ((3, 4, 5));
=============================  fcvt_r
stdlib/stdlib.h:905:
int fcvt_r (double value, int ndigit, int *restrict decpt,
                   int *restrict sign, char *restrict buf,
                   size_t len) THROW nonnull ((3, 4, 5));
=============================  qecvt_r
stdlib/stdlib.h:909:
int qecvt_r (long double value, int ndigit,
                    int *restrict decpt, int *restrict sign,
                    char *restrict buf, size_t len)
     THROW nonnull ((3, 4, 5));
=============================  qfcvt_r
stdlib/stdlib.h:913:
int qfcvt_r (long double value, int ndigit,
                    int *restrict decpt, int *restrict sign,
                    char *restrict buf, size_t len)
     THROW nonnull ((3, 4, 5));

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f6ce9b1dbe drand48_r.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for some of the functions in this page:

=============================  drand48_r
stdlib/stdlib.h:501:
int drand48_r (struct drand48_data *restrict buffer,
                      double *restrict result) THROW nonnull ((1, 2));
=============================  erand48_r
stdlib/stdlib.h:503:
int erand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      double *restrict result) THROW nonnull ((1, 2));
=============================  lrand48_r
stdlib/stdlib.h:508:
int lrand48_r (struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  nrand48_r
stdlib/stdlib.h:511:
int nrand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  mrand48_r
stdlib/stdlib.h:517:
int mrand48_r (struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  jrand48_r
stdlib/stdlib.h:520:
int jrand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  srand48_r
stdlib/stdlib.h:526:
int srand48_r (long int seedval, struct drand48_data *buffer)
     THROW nonnull ((2));
=============================  seed48_r
stdlib/stdlib.h:529:
int seed48_r (unsigned short int seed16v[3],
                     struct drand48_data *buffer) THROW nonnull ((1, 2));
=============================  lcong48_r
stdlib/stdlib.h:532:
int lcong48_r (unsigned short int param[7],
                      struct drand48_data *buffer)
     THROW nonnull ((1, 2));

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ad85578a68 dlsym.3: SYNOPSIS: Use 'restrict' in prototypes; add missing 'const' too
POSIX specifies that the parameters of dlsym()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

The glibc specific dlvsym() also uses 'restrict'.
Its 2nd and 3rd parameters are 'const' too.

Fix the prototypes to add these qualifiers.

......

.../glibc$ grep_glibc_prototype dlsym
dlfcn/dlfcn.h:64:
extern void *dlsym (void *__restrict __handle,
		    const char *__restrict __name) __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dlvsym
dlfcn/dlfcn.h:73:
extern void *dlvsym (void *__restrict __handle,
		     const char *__restrict __name,
		     const char *__restrict __version)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar fbea610b4a dlinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for dlinfo().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype dlinfo
dlfcn/dlfcn.h:123:
extern int dlinfo (void *__restrict __handle,
		   int __request, void *__restrict __arg)
     __THROW __nonnull ((1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 0300d62fc1 ctime.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify ctime_r() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

.../glibc$ grep_glibc_prototype ctime_r
timezone/private.h:504:
char *ctime_r(time_t const *, char *);
timezone/private.h:712:
char *ctime_r(time_t const *, char *);
time/time.h:153:
extern char *ctime_r (const time_t *__restrict __timer,
		      char *__restrict __buf) __THROW;
.../glibc$

Cc: <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar cd7ebdf9ae ctime.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of asctime_r(), gmtime_r(),
and localtime_r() shall be restrict.  Glibc uses 'restrict' too.
Let's use it here too.

ctime_r will be covered in a future commit,
as the glibc implementation differs from POSIX.

......

=============================  asctime
timezone/private.h:501:
char *asctime(struct tm const *);
time/time.h:139:
char *asctime (const struct tm *tp) THROW;
=============================  asctime_r
timezone/private.h:502:
char *asctime_r(struct tm const *restrict, char *restrict);
timezone/private.h:522:
char *asctime_r(struct tm const *restrict, char *restrict);
timezone/private.h:711:
char *asctime_r(struct tm const *, char *);
time/time.h:149:
char *asctime_r (const struct tm *restrict tp,
                        char *restrict buf) THROW;
=============================  ctime
timezone/private.h:503:
char *ctime(time_t const *);
time/time.h:142:
char *ctime (const time_t *timer) THROW;
=============================  ctime_r
timezone/private.h:504:
char *ctime_r(time_t const *, char *);
timezone/private.h:712:
char *ctime_r(time_t const *, char *);
time/time.h:153:
char *ctime_r (const time_t *restrict timer,
                      char *restrict buf) THROW;
=============================  gmtime
timezone/private.h:512:
struct tm *gmtime(time_t const *);
time/time.h:119:
struct tm *gmtime (const time_t *timer) THROW;
=============================  gmtime_r
timezone/private.h:513:
struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
time/time.h:128:
struct tm *gmtime_r (const time_t *restrict timer,
                            struct tm *restrict tp) THROW;
=============================  localtime
timezone/private.h:514:
struct tm *localtime(time_t const *);
time/time.h:123:
struct tm *localtime (const time_t *timer) THROW;
=============================  localtime_r
timezone/private.h:515:
struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
time/time.h:133:
struct tm *localtime_r (const time_t *restrict timer,
                               struct tm *restrict tp) THROW;
=============================  mktime
timezone/private.h:516:
time_t mktime(struct tm *);
time/time.h:82:
time_t mktime (struct tm *tp) THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar b5e85c2ef5 crypt.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for the 3rd parameter of crypt_r().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype crypt_t
crypt/crypt.h:63:
extern char *crypt_r (const char *__phrase, const char *__salt,
		      struct crypt_data * __restrict __data)
     __THROW __nonnull ((1, 2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 9112c654ed memcpy.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of memcpy()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

It's especially important in memcpy(),
as it's been a historical source of bugs.

......

.../glibc$ grep_glibc_prototype memcpy
posix/regex_internal.h:746:
{
  memcpy (dest, src, sizeof (bitset_t));
string/string.h:43:
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
		     size_t __n) __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 98a1e7336e memccpy.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of memccpy()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype memccpy
string/string.h:54:
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
		      int __c, size_t __n)
    __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 4));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 23bdd87451 asprintf.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for [v]asprintf().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype asprintf
libio/stdio.h:372:
extern int asprintf (char **__restrict __ptr,
		     const char *__restrict __fmt, ...)
     __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
.../glibc$ grep_glibc_prototype vasprintf
libio/stdio.h:366:
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
		      __gnuc_va_list __arg)
     __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 62b6077961 argz_add.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for some of the functions in this page:

=============================  argz_add
string/argz.h:76:
error_t argz_add (char **restrict argz,
                         size_t *restrict argz_len,
                         const char *restrict str) THROW;
=============================  argz_add_sep
string/argz.h:82:
error_t argz_add_sep (char **restrict argz,
                             size_t *restrict argz_len,
                             const char *restrict string, int delim)
     THROW;
=============================  argz_append
string/argz.h:70:
error_t argz_append (char **restrict argz,
                            size_t *restrict argz_len,
                            const char *restrict buf, size_t buf_len)
     THROW;
=============================  argz_count
string/argz.h:54:
size_t argz_count (const char *argz, size_t len)
     THROW attribute_pure__;
=============================  argz_create
string/argz.h:40:
error_t argz_create (char *const argv[], char **restrict argz,
                            size_t *restrict len) THROW;
=============================  argz_create_sep
string/argz.h:47:
error_t argz_create_sep (const char *restrict string,
                                int sep, char **restrict argz,
                                size_t *restrict len) THROW;
=============================  argz_delete
string/argz.h:88:
void argz_delete (char **restrict argz,
                         size_t *restrict argz_len,
                         char *restrict entry) THROW;
=============================  argz_extract
string/argz.h:61:
void argz_extract (const char *restrict argz, size_t len,
                          char **restrict argv) THROW;
=============================  argz_insert
string/argz.h:98:
error_t argz_insert (char **restrict argz,
                            size_t *restrict argz_len,
                            char *restrict before,
                            const char *restrict entry) THROW;
=============================  argz_next
string/argz.h:128:
char *argz_next (const char *restrict argz, size_t argz_len,
                        const char *restrict entry) THROW;
=============================  argz_replace
string/argz.h:106:
error_t argz_replace (char **restrict argz,
                             size_t *restrict argz_len,
                             const char *restrict str,
                             const char *restrict with,
                             unsigned int *restrict replace_count);
=============================  argz_stringify
string/argz.h:67:
void argz_stringify (char *argz, size_t len, int sep) THROW;

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Michael Kerrisk d7461050ad pthread_create.3: Fix a signedness error in the example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Michael Kerrisk 9b4d747db7 pthread_create.3: Fix undeclared variable error in example program
Reported-by: Paran Lee <p4ranlee@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Alejandro Colomar e82f7bbb11 ftw.3: SYNOPSIS: Remove duplicate header
Both functions have the same header.
There's no reason to separate the prototypes repeating the header.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Alejandro Colomar 7f8d77c52b getopt.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Alejandro Colomar cad9592876 aio_suspend.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify aio_suspend() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

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

Cc: libc-alpha@sourceware.org
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 15:36:11 +01:00
Alejandro Colomar aa4bbfd5ed setjmp.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that [sig]longjmp() shall not return,
transferring control back to the caller of [sig]setjmp().
Glibc uses __attribute__((__noreturn__)) for [sig]longjmp().
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 6c49c14bdb pthread_exit.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that pthread_exit() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar cec1239183 exit.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that exit() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 9ca4896771 err.3: SYNOPSIS: Use 'noreturn' in prototypes
Glibc uses __attribute__((__noreturn__)) for [v]err[x]().
These functions never return.
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 0dfa5792bc abort.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that abort() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Michael Kerrisk 2b15f8c59e error.3: Clarify the meaning of 'status==0' for error(3)
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:21:50 +01:00
Alejandro Colomar fb0390dc5b strerror.3: VERSIONS: Document that strerrorname_np() and strerrordesc_np() functions first appeared on glibc 2.32
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-18 08:57:27 +01:00
Alejandro Colomar 9f80f9e34a simpleq.3, stailq.3, queue.7, SIMPLEQ_*.3: Document SIMPLEQ_*() as an alias to STAILQ_*() macros
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 21:31:33 +01:00
Michael Kerrisk d5ff9ffcdc rpc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:16:43 +01:00
Michael Kerrisk ba50f49c69 getpriority.2, recv.2, fts.3: wfix
These pages have the odd wording 'the external variable errno',
which does not occur in other pages. Make these pages conform with
the norm.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk a23bf7259c ferror.3: POSIX.1-2008: these functions won't change 'errno' if 'stream' is valid
See https://www.austingroupbugs.net/view.php?id=401.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk 5b921fc469 ferror.3: Add a RETURN VALUE section
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk 15267cb8a1 ferror.3: Remove fileno(3) content that was migrated to new fileno(3) page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk acd8a0e37e fileno.3: Split fileno(3) content out of ferror(3) into new page
fileno(3) differs from the other functions in various ways.
For example, it is governed by different standards,
and can set 'errno'. Conversely, the other functions
are about examining the status of a stream, while
fileno(3) simply obtains the underlying file descriptor.
Furthermore, splitting this function out allows
for some cleaner upcoming changes in ferror(3).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk bdd65639ba setbuf.3: POSIX doesn't require to errno to be unchanged after successful setbuf()
See https://www.austingroupbugs.net/view.php?id=397#c799

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:26:43 +01:00
Michael Kerrisk c7c869e66d setbuf.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:19:25 +01:00
Dmitry Vorobev 04f20d64e0 malloc_trim.3: Remove mention of free() call
'malloc_trim' was and is never called from the 'free' function.
see related bug in glibc tracker:
https://sourceware.org/bugzilla/show_bug.cgi?id=2531. or
'__int_free' function. Only the top part of the heap is trimmed
after some calls to 'free', which is different from 'malloc_trim'
which also releases memory in between chunks from all the
arenas/heaps.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-01 13:05:30 +01:00
Michael Kerrisk f2a4cb6592 tmpfile.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-29 13:34:09 +01:00
Michael Kerrisk a9b03562b0 rcmd.3: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:56:01 +01:00
Jakub Wilk 29dee4ce10 semget.2, shm_open.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:33:35 +01:00
Alejandro Colomar 27fce38a2a random.3: srcfix: Don't break proper names into different lines
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:32:44 +01:00
Alejandro Colomar 8b55111d74 fopencookie.3: wsfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 15:51:58 +01:00
Michael Kerrisk cd415e7364 Various pages: use "\-" to generate real minus in circumstances where appropriate
Use \- for math formulas, pathnames, manual page cross references,
etc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:53:59 +01:00
Michael Kerrisk b49c2acb42 Various pages: use real minus signs in pathnames
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk 694d07544e confstr.3: ffix: Use real minus sign inside a string
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk d064d41a4b Various pages: Inside code blocks (.EX/.EE) use \- to get real minus signs
A real minus can be cut and pasted...

THere are a few exceptions that gave been excluded in the this
change.  For example, where there' is a string such as "<p1-name>",
where p1-name is soome sort of pseudo-identifier.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Alessandro Bono d5de9d1dc5 fread.3: Swap size and nmemb params
It works both way, but this one feels more right. We are reading
four elements sizeof(*buffer) bytes each.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 21:30:43 +01:00
Alejandro Colomar a3377dcec6 circleq.3: Fix CIRCLEQ_LOOP_*() return type
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 09:52:57 +01:00
Michael Kerrisk 91c6bf1ce9 system.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:34:52 +01:00
Alejandro Colomar 4797383171 system.3: Document bug and workaround when the command name starts with a hypen
man-pages bug: 211029
 https://bugzilla.kernel.org/show_bug.cgi?id=211029

Complete workaround example
(it was too long for the page, but it may be useful here):

......

$ sudo ln -s -T /usr/bin/echo /usr/bin/-echo;
$ cc -o system_hyphen -x c - ;
#include <stdlib.h>

int
main(void)
{
    system(" -echo Hello world!");
    exit(EXIT_SUCCESS);
}

$ ./system_hyphen;
Hello world!

Reported-by: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:33:34 +01:00
Alyssa Ross 0218166754 ulimit.3: tfix
The parentheses here make it look like a function rather than a
command.

This was a typo introduced by a script-assisted global edit.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Michael Kerrisk f199762139 crypt.3: Update crypt() FTM requirements to note glibc 2.28 changes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:38:14 +01:00
Michael Kerrisk d7200ac321 crypt.3: Reformat FTM info (in preparation for next patch)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:33:07 +01:00
Alejandro Colomar da116d481b malloc.3: Document that realloc(p, 0) is specific to glibc and nonportable
A more detailed notice is on realloc(3p).

......

$ man 3p realloc \
  |sed -n \
     -e '/APPLICATION USAGE/,/^$/p' \
     -e '/FUTURE DIRECTIONS/,/^$/p';
APPLICATION USAGE
       The description of realloc() has been modified from  pre‐
       vious  versions  of  this  standard  to  align  with  the
       ISO/IEC 9899:1999 standard. Previous versions  explicitly
       permitted  a  call  to  realloc(p,  0)  to free the space
       pointed to by p and return a null pointer. While this be‐
       havior  could be interpreted as permitted by this version
       of the standard, the C language committee have  indicated
       that   this  interpretation  is  incorrect.  Applications
       should assume that if realloc() returns a  null  pointer,
       the  space pointed to by p has not been freed. Since this
       could lead to double-frees, implementations  should  also
       set errno if a null pointer actually indicates a failure,
       and applications should only free the space if errno  was
       changed.

FUTURE DIRECTIONS
       This  standard  defers  to the ISO C standard. While that
       standard currently has language that might  permit  real‐
       loc(p, 0), where p is not a null pointer, to free p while
       still returning a null pointer, the committee responsible
       for  that standard is considering clarifying the language
       to explicitly prohibit that alternative.

Bug: 211039 <https://bugzilla.kernel.org/show_bug.cgi?id=211039>
Reported-by: Johannes Pfister <johannes.pfister@josttech.ch>
Cc: libc-alpha@sourceware.org
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:18:22 +01:00
Alejandro Colomar ccca30c230 Various pages: srcfix: Remove redundant .PP
.PP are redundant just after .SH or .SS.
Remove them.

$ find man? -type f \
  |xargs sed -i '/^\.S[HS]/{n;/\.PP/d}';

Plus a couple manual edits.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:15:48 +01:00
Michael Kerrisk dc9cadc1c2 Revert "stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP"
Do this in order to apply a better patch from Alex Colomar.

This reverts commit f7fc28f97a.
2021-01-10 09:15:12 +01:00
Michael Kerrisk a60e8c598e xcrypt.3: srcfix: use .PP rather than .LP
.LP is equivalent .PP, but the latter is what is used
throughout man-pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk 7c2838715f shm_open.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk f7fc28f97a stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk feaef5f266 getfsent.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:43:31 +01:00
Michael Kerrisk 0a23e9aac0 mprotect.2, readv.2, sigaltstack.2, sigreturn.2, ctime.3, scandir.3, random.4, pkeys.7: ffix: s/-1/\-1/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:08:50 +01:00
Michael Kerrisk 3d81c05a79 time.1, ioctl_console.2, daemon.3, updwtmp.3, mouse.4, smartpqi.4: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:53:15 +01:00
Michael Kerrisk 3ded684c1a Various pages: tfix (Oxford comma)
Found using:

    git grep -lE '^[^.].*,.*,.*[^,] (and|or)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:26 +01:00
Michael Kerrisk 6b67fcc064 tailq.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:22 +01:00
Michael Kerrisk 735334d454 Various pages: tfix (Oxford comma)
Discovered using:

    git grep -lE '^[^.].*, [^ ]*[^,] (or|and)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:02:33 +01:00
Michael Kerrisk 61eaa18945 round.3: wsfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:45:38 +01:00
Michael Kerrisk 2ddebe1a77 circleq.3, list.3, slist.3, stailq.3, queue.7: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:41:55 +01:00
Michael Kerrisk 31e9088393 encrypt.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:35:56 +01:00
Michael Kerrisk f2fa055834 ioctl_console.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shm_open.3, shmget.2, shmop.2: ERRORS: remove redundant statement that 'errno' is set
This is implied in every other manual page. There is no need to
state it explicitly in these pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:21:57 +01:00
Michael Kerrisk 402f955e66 setlocale.3: Restructure a particularly difficult sentence
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:44:09 +01:00
Alejandro Colomar aa0da2b9b1 Various pages: tfix: Use Oxford comma
Found using:
$ pcregrep -rnM "^\.[B|I]R .*,\n\.[B|I].*[^,]\nor" man? \
  |grep ^man \
  |sort;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:57:24 +01:00
Alejandro Colomar 03659d7d46 close.2, getpriority.2, ioctl_userfaultfd.2, expm1.3, lio_listio.3, rcmd.3, lirc.4, mount_namespaces.7: tfix: Fix punctuation
Found using:
$ pcregrep -rnM '^..[^"].*[^.]\.\n[a-z]' man?

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:55:25 +01:00
Michael Kerrisk 8c7307e8c6 rcmd.3: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 7a6227d368 Various pages: Various improvements in wording in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:00 +01:00
Michael Kerrisk cb6a894ee7 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, miscellaneous descriptions of the setting
of 'errno' are reworded to the norm of "is set to indicate
the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk c112329ffe Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, reword various cases saying that 'errno' is set
"appropriately" to "is set to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk f6a4078be5 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, fix some instances stating that 'errno' is set
"appropriately" to instead say "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:35 +01:00
Michael Kerrisk 855d489a7f Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, "to indicate the cause of the error"
is changed to "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:27 +01:00
Michael Kerrisk 3cf2958737 wordexp.3: Minor wording fixes in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 0b174fe008 clone.2, ioctl_tty.2, syslog.2, setlocale.3, stdio.3, console_codes.4, inode.7, namespaces.7, netlink.7, signal-safety.7, socket.7: Better table formatting
In particular, allow for rendering in widths different from
(especially less than) 80 columns.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 29b18c3946 slist.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:53:34 +01:00
Michael Kerrisk 9d281e06da Various pages: add missing .nf/.fi in FTM info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 422d5327a8 rcmd.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 5c10d2c5e2 Various pages: Remove redundant escaping of space characters in FTM info
Since we are using .nf/.fi to bracket FTM info, escaping
space characters serves no space and clutters the source.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Alejandro Colomar 554afbe862 circleq.3, list.3, slist.3, stailq.3, tailq.3: Improve readability, especially in SYNOPSIS
- Group macros by kinds.
- Align so that it's easiest to distinguish differences
  between related macros.
  (Align all continuations for consistency on PDF.)
- Fix minor typos.
- Remove redundant text:
    'The macro xxx() ...':
        The first paragraph already says that these are macros.
    'circular|tail|... queue':
        Don't need to repeat every time.
        Generic text makes it easier to spot the differences.
- Fit lines into 78 columns.
- Reorder descriptions to match SYNOPSIS,
  and add subsections to DESCRIPTION.
- srcfix: fix a few semantic newlines.

I noticed a bug which should be fixed next:
CIRCLEQ_LOOP_*() return a 'struct TYPE *'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk b32feea59e Various pages: Formatting tweaks after "Improve formatting in ATTRIBUTES"
Various ATTRIBUTES table improvements following the previous
commit. In particular, make use of T{...T} to allow wrapping
in table cells that have a lot of text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk c466875ecd Various pages: Improve formatting in ATTRIBUTES
Make the formatting more consistent inside the tables in the
ATTRIBUTES sections. Make the source code more uniform; in
particular, eliminate the use of custom tweaks using
'lbwNN'/'lwNN' and .br macros.  In addition, ensure that
hyphenation and text justification do not occur inside the tables.

This is a script-driven edit:

[[
PAGE_LIST=$(git grep -l 'SH ATTRIBUTES' man[23])

# Strip out any preexisting .sp/.br/.ad macros

sed -i '/SH ATTR/,/^\.SH/{/^\.sp/d; /^\.br/d; /\.ad/d}' $PAGE_LIST

# Eliminate any use of 'wNN' in tables; default first column
# to fill unused space

sed -i '/SH ATTR/,/^\.SH/s/lbw[0-9]*/lb/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/lw[0-9]*/l/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/^lb /lbx /' $PAGE_LIST

# Nest the tables inside ".ad l"+".nh" and ".hy"+".ad"+".sp 1"
# ".ad l" ==> no right justification of text in table cells
# ".nh" ==> No hyphenation in table cells
# ".sp 1" ==> ensure a blank line before the next section heading

sed -i '/SH ATTR/,/^\.SH/{/\.TS/i.ad l\n.nh
}'  $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/{/\.TE/a.hy\n.ad\n.sp 1
}'  $PAGE_LIST

# In a few of the tables, the third column has a lot of text, so
# make that column wide (rather than the first column)

sed -i '/^lbx/{s/lbx/lb/;s/lb$/lbx/}' \
        man3/bindresvport.3 \
        man3/fmtmsg.3 man3/gethostbyname.3 man3/getlogin.3 \
        man3/getnetent.3 man3/getprotoent.3 man3/getpwent.3 \
        man3/getservent.3 man3/getspnam.3 man3/getutent.3 man3/glob.3 \
        man3/login.3 \
        man3/setnetgrent.3 \
        man3/wordexp.3
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:39 +01:00
Michael Kerrisk daaf6d327b getlogin.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 10:32:26 +01:00
Michael Kerrisk f2667a7212 Various pages: Use internally consistent continuation indents in SYNOPSIS
In the SYNOPSIS, a long function prototype may need to be
continued over to the next line. The continuation line is
indented according to the following rules:

1. If there is a single such prototype that needs to be continued,
   then align the continuation line so that when the page is
   rendered on a fixed-width font device (e.g., on an xterm) the
   continuation line starts just below the start of the argument
   list in the line above.  (Exception: the indentation may be
   adjusted if necessary to prevent a very long continuation line
   or a further continuation line where the function prototype is
   very long.)

   Thus:

       int tcsetattr(int fd, int optional_actions,
                     const struct termios *termios_p);

2. But, where multiple functions in the SYNOPSIS require
   continuation lines, and the function names have different
   lengths, then align all continuation lines to start in the
   same column.  This provides a nicer rendering in PDF output
   (because the SYNOPSIS uses a variable width font where
   spaces render narrower than most characters).

   Thus:

       int getopt(int argc, char * const argv[],
                  const char *optstring);
       int getopt_long(int argc, char * const argv[],
                  const char *optstring,
                  const struct option *longopts, int *longindex);

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 20:27:11 +01:00
Michael Kerrisk 1dd0d7b4e4 Various pages: ffix: More layout consistency fixes for FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 13:22:01 +01:00
Michael Kerrisk 72af9e8351 fseeko.3: Move info about obsolete FTM from SYNOPSIS to NOTES
This makes the SYNOPSIS more consistent with other pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk cc4423f732 j0.3, strerror.3, y0.3: wspfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 58a6844d20 brk.2, chmod.2, gethostname.2, setpgid.2, wait4.2, atoi.3, fwide.3, getlogin.3, printf.3, strtoul.3, wprintf.3: Consistency fix-up in FTMs
Generally, place '||' at start of a line, rather than the end of
the previous line.

Rationale: this placement clearly indicates that that each piece
is an alternative.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 16fe373c85 qecvt.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk b15b92a585 fsync.2, gethostname.2, stat.2, getutent.3: Minor consistency clean-ups in FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 9d2adbae20 Various pages: Simplify mark-up for Feature Test Macro requirements
Different source styles are used in different pages to achieve the
same formatted output, and in some cases the source mark-up is a
rather convoluted combination of .RS/.RE/.TP/.PD macros. Simplify
this greatly, and unify all of the pages to use more or less the
same source code style. This makes the source code rather easier
to read, and may simplify future scripted global changes.

The feature test macro info is currently bracketed by .nf/.fi
pairs. This is not strictly necessary (i.e., it makes no
difference to the rendered output), but for the moment we keep
these "brackets" in case they may be replaced with something else.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:01 +01:00
Michael Kerrisk 1a412fc5cb gethostid.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:27:45 +01:00
Michael Kerrisk e36f10f91d Various pages: replace '.ad b' macro with '.ad'
Verified no change in rendered output

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:25:50 +01:00
Michael Kerrisk 3d614fb849 clock_getres.2, atan2.3, ctime.3, getcwd.3, isgreater.3, iswblank.3, scalbln.3: ffix
Consistently use 4-space indents for FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:55:20 +01:00
Michael Kerrisk 255d42333e chroot.2, rename.2, getgrent.3, nextafter.3, ttyslot.3, wprintf.3: ffix
Bring a bit more consistency to the layout of FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk c418bc9d16 grantpt.3, ptsname.3, unlockpt.3: Remove mention of _XOPEN_SOURCE_EXTENDED FTM
This rather ancient FTM is not mentioned in other pages for
reasons discussed in feature_test_macros(7).  Remove this FTM
from the three pages where it does appear.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk db198f06a8 nice.2, putenv.3, strtok.3, toascii.3, tzset.3: ffix
Where FTM requirements span multiple lines, start the FTMs on
a new line.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:19:02 +01:00
Michael Kerrisk 3754620f0e getpagesize.2, getdtablesize.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:10:10 +01:00
Michael Kerrisk 028350ffb8 exec.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Michael Kerrisk 10afe9f58d malloc_hook.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:56 +01:00
Michael Kerrisk 2bb103326f ecvt.3, gcvt.3: Update FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:10:59 +01:00
Michael Kerrisk 9e8a25d700 getpagesize.2, getdtablesize.3: Update/correct FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 12:13:37 +01:00
Michael Kerrisk 49b843f53a gethostid.3: Update FTM requirements for gethostid()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:55:58 +01:00
Michael Kerrisk 51a6f93d71 wait.2, getaddrinfo.3, getnameinfo.3: ffix: Bring greater consistency to FTM layout
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 10:10:05 +01:00
Michael Kerrisk b1a4a24634 qecvt.3: Update feature test macro requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk 4653ec6ef2 Various pages: Use .nf/.fi in SYNOPSIS
Fix various pages missed in commit
c7db92b96a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk e3528453c0 getutent.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:54:44 +01:00
Michael Kerrisk fe05d0458e bsd_signal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:53:50 +01:00
Michael Kerrisk 464ba16d1e scandir.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:48:01 +01:00
Michael Kerrisk 5b72a11386 string.3: tfix
Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 20:50:04 +01:00
Michael Kerrisk 05d13bfb42 string.3: SEE ALSO: add bstring(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk 28f288d395 bstring.3: SEE ALSO: add string(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk c7db92b96a Various pages: Use .nf/.fi in SYNOPSIS
The majority of pages use .nf/.fi in SYNOPSIS, but there are
still many that don't and use .br to achieve newlines. Fix many
of those. This brings greater consistency to the pages, which
eases editing and may ease future scripted edits to the pages.

Many of these changes were script-assisted, with some additional
manual edits.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:47 +01:00
Michael Kerrisk 511bb71b0c Various pages: Further clean-ups after "bring more whitespace consistency in SYNOPSIS"
Yet more clean-ups after commit
15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:36 +01:00
Michael Kerrisk ff21c173ea wordexp.3: ffix
Reported-by: "Alejandro Colomar" <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 20:57:59 +01:00
Alejandro Colomar 771aecbeff Various pages: Consistently use 'unsigned int'
Most pages use 'unsigned int' (and the kernel too).
Make them all do so.

$ find man? -type f \
  | xargs sed -i \
	-e 's/unsigned \*/unsigned int */g'
	-e 's/unsigned "/unsigned int "/g';

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 08:31:43 +01:00
Michael Kerrisk e878a2de3e get_phys_pages.3: Minor relocation of text
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:38:00 +01:00
Alejandro Colomar 984126f454 off64_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:31:50 +01:00
Michael Kerrisk 7b5d39f48f Various pages: clean-ups after "bring more whitespace consistency in SYNOPSIS"
Cleann-ups after commit 15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:28:14 +01:00
Michael Kerrisk 15d6565317 Various pages: bring more whitespace consistency in SYNOPSIS
The use of vertical white space in the SYNOPSIS sections
is rather inconsistent. Make it more consistent, subject to the
following heuristics:

* Prefer no blank lines between function signatures by default.
* Where many functions are defined in the SYNOPSIS, add blank
  lines where needed to improve readability, possibly by using
  blank lines to separate logical groups of functions.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:40:22 +01:00
Michael Kerrisk 742694e926 gethostbyname.3: Move mention of <sys/socket.h> from SYNOPSIS to DESCRIPTION
The functions are all declared in <netdb.h>. <sys/socket.h> is only
needed for the AF_* constants.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:26:47 +01:00
Michael Kerrisk 460aeeb46d puts.3: Reorder functions more logically (group related fuinctions together)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 23:38:02 +01:00
Michael Kerrisk cbd813e73c getdirentries.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 22:50:57 +01:00
Michael Kerrisk d4f9c56ac5 drand48.3: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:19:28 +01:00
Michael Kerrisk 1210ac324b dl_iterate_phdr.3: wsppfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:16:41 +01:00
Michael Kerrisk 9834f61da2 wait4.2, endian.3, isalpha.3, unlocked_stdio.3: Minor consistency fix for Feature Test Macro info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk ea40ab1199 strsignal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk 7d8d2f0941 Various pages: s/Glibc versions </Glibc </ in Feature Test Macro discussions
Use a more compact notation that will render less wide
on the terminal.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:22 +01:00
Michael Kerrisk 38c1dbe910 pread.2, rename.2, syscall.2, utimensat.2, gethostid.3, rcmd.3, seekdir.3, setnetgrent.3, strerror.3, strsignal.3: ffix: Various tweaks for greater consistency in Feature Test Macros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:48:51 +01:00
Michael Kerrisk 0129eef26c chown.2, ffs.3, fpclassify.3, gamma.3, getgrent.3, ilogb.3, strdup.3: ffix
Bring a bit more consistency to Feature Test Macro information
(mainly .PP between differnt FTM lists).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:27:24 +01:00
Michael Kerrisk 98c9347c15 Various pages: Formatting fix
Use .PP (which gives a bit of vertical white space) rather than
.br to separate functions in Feature Test Macro requirement lists.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Michael Kerrisk 1faebd253c Various pages: srcfix: remove redundant .br
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Alejandro Colomar a6f73f75e6 get_phys_pages.3: glibc gets the info from sysinfo(2) since 2.23
See glibc's commit: 0ce657c576bf1b24
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=0ce657c576bf1b24

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:18:04 +01:00
Jakub Wilk 704b5ab54c ftime.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:17 +01:00
Michael Kerrisk 312b0eb182 userfaultfd.2, posix_spawn.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk 0421538981 pthread_mutexattr_setrobust.3: wfix: remove redundant comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00