Skip to contentSkip to conversation

fflush.3: SEE ALSO: Add fpurge(3)

PATCH In review Alejandro Colomar 3 participants 79 messages May 9, 2021 – May 11, 2021 2 messages not in the archive

Subsystems (7)
VFS Kbuild NFS client NFS server +3 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fflush.3: SEE ALSO: Add fpurge(3)

fpurge(i_stream) does the same as fflush(i_stream), AFAIK.

---

Hi Michael,

This is the first of many separate patches that I had pending for you. Some of them I already sent you, and you should ignore the old versions. Some of them are new.
Please review them thoroughly, as I may have sent some patch that wasn't ready. In theory I have reviewed them enough, but there are a lot, and I might have overlooked something.

When you review this "set", I'll send you another one about the SYNOPSIS.

Thanks,

Alex

 man3/fflush.3 | 1 +
 1 file changed, 1 insertion(+)
man3/fflush.3 +1 -0
index 138c9bcfe..a600da2ae 100644
@@ -133,6 +133,7 @@ or
 .BR sync (2),
 .BR write (2),
 .BR fclose (3),
+.BR fpurge (3),
 .BR fileno (3),
 .BR fopen (3),
 .BR setbuf (3),
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/1 scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged()

---
 scripts/bash_aliases      | 17 ++++++++++++++++-
 scripts/modified_pages.sh | 34 ----------------------------------
 2 files changed, 16 insertions(+), 35 deletions(-)
 delete mode 100755 scripts/modified_pages.sh
scripts/bash_aliases +16 -1
index a14c65cd4..8cedc4efc 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ########################################################################
 #
-# (C) Copyright 2021, Alejandro Colomar
+# (C) Copyright 2020, 2021, Alejandro Colomar
 # These functions are free software; you can redistribute them and/or
 # modify them under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2.
@@ -147,6 +147,21 @@ function pdfman()
 	xdg-open ${tmp};
 }
 
+#  man_gitstaged  prints a list of all files with changes staged for commit
+# (basename only if the files are within <man?/>), separated by ", ".
+# Usage example:  .../man-pages$ git commit -m "$(man_gitstaged): msg";
+
+function man_gitstaged()
+{
+	git status							\
+	|sed "/Changes not staged for commit:/q"			\
+	|grep -E "^\s*(modified|deleted|new file):"			\
+	|sed "s/^.*:\s*/, /"						\
+	|sed "s%man[1-9]/%%"						\
+	|tr -d '\n'							\
+	|sed "s/^, //"
+}
+
 ########################################################################
 #	Glibc
 
scripts/modified_pages.sh deleted +0 -34
deleted file mode 100755
index f6c4a6cea..000000000
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-## SPDX-License-Identifier: GPL-2.0-only
-########################################################################
-##
-## (C) Copyright 2020, Alejandro Colomar
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; version 2.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details
-## (http://www.gnu.org/licenses/gpl-2.0.html).
-##
-########################################################################
-##
-## The output of this script is a
-## list of all files with changes staged for commit
-## (basename only if the files are within "man?/"),
-## separated by ", ".
-## Usage:
-## git commit -m "$(./scripts/modified_pages.sh): Short message here"
-##
-
-
-git status							\
-|sed "/Changes not staged for commit:/q"			\
-|grep -E "^\s*(modified|deleted|new file):"			\
-|sed "s/^.*:\s*/, /"						\
-|sed "s%man[1-9]/%%"						\
-|tr -d '\n'							\
-|sed "s/^, //"
Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH] scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged()

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied. (I take these patches to your own scripts on trust...)

Thanks,

Michael

Quoted 82 lines
---
 scripts/bash_aliases      | 17 ++++++++++++++++-
 scripts/modified_pages.sh | 34 ----------------------------------
 2 files changed, 16 insertions(+), 35 deletions(-)
 delete mode 100755 scripts/modified_pages.sh
scripts/bash_aliases +16 -1
index a14c65cd4..8cedc4efc 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ########################################################################
 #
-# (C) Copyright 2021, Alejandro Colomar
+# (C) Copyright 2020, 2021, Alejandro Colomar
 # These functions are free software; you can redistribute them and/or
 # modify them under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2.
@@ -147,6 +147,21 @@ function pdfman()
 	xdg-open ${tmp};
 }
 
+#  man_gitstaged  prints a list of all files with changes staged for commit
+# (basename only if the files are within <man?/>), separated by ", ".
+# Usage example:  .../man-pages$ git commit -m "$(man_gitstaged): msg";
+
+function man_gitstaged()
+{
+	git status							\
+	|sed "/Changes not staged for commit:/q"			\
+	|grep -E "^\s*(modified|deleted|new file):"			\
+	|sed "s/^.*:\s*/, /"						\
+	|sed "s%man[1-9]/%%"						\
+	|tr -d '\n'							\
+	|sed "s/^, //"
+}
+
 ########################################################################
 #	Glibc
 
scripts/modified_pages.sh deleted +0 -34
deleted file mode 100755
index f6c4a6cea..000000000
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-## SPDX-License-Identifier: GPL-2.0-only
-########################################################################
-##
-## (C) Copyright 2020, Alejandro Colomar
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; version 2.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details
-## (http://www.gnu.org/licenses/gpl-2.0.html).
-##
-########################################################################
-##
-## The output of this script is a
-## list of all files with changes staged for commit
-## (basename only if the files are within "man?/"),
-## separated by ", ".
-## Usage:
-## git commit -m "$(./scripts/modified_pages.sh): Short message here"
-##
-
-
-git status							\
-|sed "/Changes not staged for commit:/q"			\
-|grep -E "^\s*(modified|deleted|new file):"			\
-|sed "s/^.*:\s*/, /"						\
-|sed "s%man[1-9]/%%"						\
-|tr -d '\n'							\
-|sed "s/^, //"
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#3 lore raw

PATCH 1/1 scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command

In reply to Alejandro Colomar

The output of 'git status' is not stable.

The more stable 'git status --porcelain' is more complex, and scripting around it would be more complex.

However, 'git diff --staged --name-only' produces the output that we were lookiong for.

---
 scripts/bash_aliases | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
scripts/bash_aliases +3 -5
index 8cedc4efc..d9b6047d1 100644
@@ -153,13 +153,11 @@ function pdfman()
 
 function man_gitstaged()
 {
-	git status							\
-	|sed "/Changes not staged for commit:/q"			\
-	|grep -E "^\s*(modified|deleted|new file):"			\
-	|sed "s/^.*:\s*/, /"						\
+	git diff --staged --name-only					\
+	|sed "s/$/, /"							\
 	|sed "s%man[1-9]/%%"						\
 	|tr -d '\n'							\
-	|sed "s/^, //"
+	|sed "s/, $//"
 }
 
 ########################################################################
Signature · 1 line
2.31.1
#4 lore raw

Re: [PATCH] scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command

Hi Alex,

Quoted 10 lines · Alejandro Colomar

The output of 'git status' is not stable.

The more stable 'git status --porcelain' is more complex, and scripting around it would be more complex.

However, 'git diff --staged --name-only' produces the output that we were lookiong for.

Applied.

Thanks,

Michael

Quoted 26 lines
---
 scripts/bash_aliases | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
scripts/bash_aliases +3 -5
index 8cedc4efc..d9b6047d1 100644
@@ -153,13 +153,11 @@ function pdfman()
 
 function man_gitstaged()
 {
-	git status							\
-	|sed "/Changes not staged for commit:/q"			\
-	|grep -E "^\s*(modified|deleted|new file):"			\
-	|sed "s/^.*:\s*/, /"						\
+	git diff --staged --name-only					\
+	|sed "s/$/, /"							\
 	|sed "s%man[1-9]/%%"						\
 	|tr -d '\n'							\
-	|sed "s/^, //"
+	|sed "s/, $//"
 }
 
 ########################################################################
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#5 lore raw

PATCH 1/1 basename.3: SYNOPSIS: Add missing 'const'

In reply to Alejandro Colomar

Glibc uses 'const' for the basename() parameter.
Fix the prototype.

......

.../glibc$ grep_glibc_prototype basename string/string.h:511:
extern char *basename (const char *__filename) __THROW __nonnull ((1)); .../glibc$

---
 man3/basename.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/basename.3 +1 -1
index 65a14e8cb..51825eca4 100644
@@ -32,7 +32,7 @@ basename, dirname \- parse pathname components
 .B #include <libgen.h>
 .PP
 .BI "char *dirname(char *" path );
-.BI "char *basename(char *" path );
+.BI "char *basename(const char *" path );
 .fi
 .SH DESCRIPTION
 Warning: there are two different functions
Signature · 1 line
2.31.1
#6 lore raw

Re: [PATCH] basename.3: SYNOPSIS: Add missing 'const'

Hi Alex,

Quoted 2 lines · Alejandro Colomar

Glibc uses 'const' for the basename() parameter.
Fix the prototype.

Yes, but see basename(3p):

SYNOPSIS
#include <libgen.h>

char *basename(char *path);

...

The basename() function may modify the string pointed to by path, and may return a pointer to internal storage. The returned pointer might be invalidated or the storage might be overwritten by a sub‐ sequent call to basename(). The returned pointer might also be invalidated if the calling thread is terminated.

I'll skip this patch.

Thanks,

Michael

Quoted 26 lines

......

.../glibc$ grep_glibc_prototype basename string/string.h:511:
extern char *basename (const char *__filename) __THROW __nonnull ((1)); .../glibc$

---
 man3/basename.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/basename.3 +1 -1
index 65a14e8cb..51825eca4 100644
@@ -32,7 +32,7 @@ basename, dirname \- parse pathname components
 .B #include <libgen.h>
 .PP
 .BI "char *dirname(char *" path );
-.BI "char *basename(char *" path );
+.BI "char *basename(const char *" path );
 .fi
 .SH DESCRIPTION
 Warning: there are two different functions
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#7 lore raw

Re: [PATCH] basename.3: SYNOPSIS: Add missing 'const'

Hi Michael,

Quoted 15 lines · Michael Kerrisk (man-pages)

Hi Alex,

Quoted 2 lines · Alejandro Colomar

Glibc uses 'const' for the basename() parameter.
Fix the prototype.

Yes, but see basename(3p):

SYNOPSIS
#include <libgen.h>

char *basename(char *path);

...

Quoted 7 lines

The basename() function may modify the string pointed to by path, and may return a pointer to internal storage. The returned pointer might be invalidated or the storage might be overwritten by a sub‐ sequent call to basename(). The returned pointer might also be invalidated if the calling thread is terminated.

I'll skip this patch.

It's POSIX that states that, so yes, I'll drop it.

Cheers,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#8 lore raw

PATCH 1/1 dladdr.3: SYNOPSIS: Add missing 'const'

In reply to Alejandro Colomar

Glibc uses 'const' for the 1st parameter of these functions. Fix the prototypes.

......

.../glibc$ grep_glibc_prototype dladdr dlfcn/dlfcn.h:98:
extern int dladdr (const void *__address, Dl_info *__info)

     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dladdr1
dlfcn/dlfcn.h:102:
extern int dladdr1 (const void *__address, Dl_info *__info,
		    void **__extra_info, int __flags) __THROW __nonnull ((2));

.../glibc$

---
 man3/dladdr.3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man3/dladdr.3 +3 -3
index 19944174b..c95df4e49 100644
@@ -31,9 +31,9 @@ dladdr, dladdr1 \- translate address to symbolic information
 .B #define _GNU_SOURCE
 .B #include <dlfcn.h>
 .PP
-.BI "int dladdr(void *" addr ", Dl_info *" info );
-.BI "int dladdr1(void *" addr ", Dl_info *" info ", void **" \
-        extra_info ", int " flags );
+.BI "int dladdr(const void *" addr ", Dl_info *" info );
+.BI "int dladdr1(const void *" addr ", Dl_info *" info ", void **" extra_info ,
+.BI "            int " flags );
 .PP
 Link with \fI\-ldl\fP.
 .fi
Signature · 1 line
2.31.1
#9 lore raw

Re: [PATCH] dladdr.3: SYNOPSIS: Add missing 'const'

Hi Alex,

Quoted 2 lines · Alejandro Colomar

Glibc uses 'const' for the 1st parameter of these functions. Fix the prototypes.

Applied.

Thanks,

Michael

Quoted 35 lines

......

.../glibc$ grep_glibc_prototype dladdr dlfcn/dlfcn.h:98:
extern int dladdr (const void *__address, Dl_info *__info)

     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dladdr1
dlfcn/dlfcn.h:102:
extern int dladdr1 (const void *__address, Dl_info *__info,
		    void **__extra_info, int __flags) __THROW __nonnull ((2));

.../glibc$

---
 man3/dladdr.3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man3/dladdr.3 +3 -3
index 19944174b..c95df4e49 100644
@@ -31,9 +31,9 @@ dladdr, dladdr1 \- translate address to symbolic information
 .B #define _GNU_SOURCE
 .B #include <dlfcn.h>
 .PP
-.BI "int dladdr(void *" addr ", Dl_info *" info );
-.BI "int dladdr1(void *" addr ", Dl_info *" info ", void **" \
-        extra_info ", int " flags );
+.BI "int dladdr(const void *" addr ", Dl_info *" info );
+.BI "int dladdr1(const void *" addr ", Dl_info *" info ", void **" extra_info ,
+.BI "            int " flags );
 .PP
 Link with \fI\-ldl\fP.
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#10 lore raw

PATCH 1/1 open.2: Fix bug in linkat(2) call example

In reply to Alejandro Colomar

AT_EMPTY_PATH works with empty strings (""), but not with NULL (or at least it's not obvious).

The relevant kernel code is the following:

linux$ sed -n 189,198p fs/namei.c

	result->refcnt = 1;
	/* The empty path is special. */
	if (unlikely(!len)) {
		if (empty)
			*empty = 1;
		if (!(flags & LOOKUP_EMPTY)) {
			putname(result);
			return ERR_PTR(-ENOENT);
		}
	}
---
 man2/open.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/open.2 +1 -1
index 6360636af..bac1ee806 100644
@@ -824,7 +824,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
 
 /* File I/O on \(aqfd\(aq... */
 
-linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
+linkat(fd, "", AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
 
 /* If the caller doesn\(aqt have the CAP_DAC_READ_SEARCH
    capability (needed to use AT_EMPTY_PATH with linkat(2)),
Signature · 1 line
2.31.1
#11 lore raw

Re: [PATCH] open.2: Fix bug in linkat(2) call example

Hi ALex,

Quoted 17 lines · Alejandro Colomar

AT_EMPTY_PATH works with empty strings (""), but not with NULL (or at least it's not obvious).

The relevant kernel code is the following:

linux$ sed -n 189,198p fs/namei.c

	result->refcnt = 1;
	/* The empty path is special. */
	if (unlikely(!len)) {
		if (empty)
			*empty = 1;
		if (!(flags & LOOKUP_EMPTY)) {
			putname(result);
			return ERR_PTR(-ENOENT);
		}
	}
Quoted 4 lines

Thanks. Patch applied.

Cheers,

Michael

Quoted 18 lines
---
 man2/open.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/open.2 +1 -1
index 6360636af..bac1ee806 100644
@@ -824,7 +824,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
 
 /* File I/O on \(aqfd\(aq... */
 
-linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
+linkat(fd, "", AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
 
 /* If the caller doesn\(aqt have the CAP_DAC_READ_SEARCH
    capability (needed to use AT_EMPTY_PATH with linkat(2)),
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#12 lore raw

PATCH 1/1 malloc_usable_size.3: ffix

In reply to Alejandro Colomar
---
 man3/malloc_usable_size.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/malloc_usable_size.3 +1 -1
index 4b4ba3dca..5f892ef6c 100644
@@ -29,7 +29,7 @@ malloc_usable_size \- obtain size of block of memory allocated from heap
 .nf
 .B #include <malloc.h>
 .PP
-.BI "size_t malloc_usable_size (void *" ptr );
+.BI "size_t malloc_usable_size(void *" ptr );
 .fi
 .SH DESCRIPTION
 The
Signature · 1 line
2.31.1
#13 lore raw

Re: [PATCH] malloc_usable_size.3: ffix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/malloc_usable_size.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/malloc_usable_size.3 +1 -1
index 4b4ba3dca..5f892ef6c 100644
@@ -29,7 +29,7 @@ malloc_usable_size \- obtain size of block of memory allocated from heap
 .nf
 .B #include <malloc.h>
 .PP
-.BI "size_t malloc_usable_size (void *" ptr );
+.BI "size_t malloc_usable_size(void *" ptr );
 .fi
 .SH DESCRIPTION
 The
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#14 lore raw

PATCH 1/1 on_exit.3: ffix

In reply to Alejandro Colomar
---
 man3/on_exit.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/on_exit.3 +1 -1
index afcd9f9ed..7997b601e 100644
@@ -35,7 +35,7 @@ on_exit \- register a function to be called at normal process termination
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "int on_exit(void (*" function ")(int , void *), void *" arg );
+.BI "int on_exit(void (*" function ")(int, void *), void *" arg );
 .fi
 .PP
 .RS -4
Signature · 1 line
2.31.1
#15 lore raw

Re: [PATCH] on_exit.3: ffix

Hi ALex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/on_exit.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/on_exit.3 +1 -1
index afcd9f9ed..7997b601e 100644
@@ -35,7 +35,7 @@ on_exit \- register a function to be called at normal process termination
 .nf
 .B #include <stdlib.h>
 .PP
-.BI "int on_exit(void (*" function ")(int , void *), void *" arg );
+.BI "int on_exit(void (*" function ")(int, void *), void *" arg );
 .fi
 .PP
 .RS -4
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#16 lore raw

PATCH 1/1 perror.3: ffix

In reply to Alejandro Colomar
---
 man3/perror.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/perror.3 +1 -1
index ae271f343..e3eec1da3 100644
@@ -39,7 +39,7 @@ perror \- print a system error message
 .PP
 .B #include <errno.h>
 .PP
-.BI "const char * const " sys_errlist [];
+.BI "const char *const " sys_errlist [];
 .BI "int " sys_nerr ;
 .BI "int " errno ";       \fR/* Not really declared this way; see errno(3) */"
 .fi
Signature · 1 line
2.31.1
#17 lore raw

Re: [PATCH] perror.3: ffix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/perror.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/perror.3 +1 -1
index ae271f343..e3eec1da3 100644
@@ -39,7 +39,7 @@ perror \- print a system error message
 .PP
 .B #include <errno.h>
 .PP
-.BI "const char * const " sys_errlist [];
+.BI "const char *const " sys_errlist [];
 .BI "int " sys_nerr ;
 .BI "int " errno ";       \fR/* Not really declared this way; see errno(3) */"
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#18 lore raw

PATCH 1/1 getutmp.3: ffix

In reply to Alejandro Colomar
---
 man3/getutmp.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/getutmp.3 +2 -2
index e5e85aced..012cfdf6f 100644
@@ -31,8 +31,8 @@ getutmp, getutmpx \- copy utmp structure to utmpx, and vice versa
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
 .B #include <utmpx.h>
 .PP
-.BI " void getutmp(const struct utmpx *" ux ", struct utmp *" u );
-.BI " void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
+.BI "void getutmp(const struct utmpx *" ux ", struct utmp *" u );
+.BI "void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
 .fi
 .SH DESCRIPTION
 The
Signature · 1 line
2.31.1
#19 lore raw

Re: [PATCH] getutmp.3: ffix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 20 lines
---
 man3/getutmp.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/getutmp.3 +2 -2
index e5e85aced..012cfdf6f 100644
@@ -31,8 +31,8 @@ getutmp, getutmpx \- copy utmp structure to utmpx, and vice versa
 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
 .B #include <utmpx.h>
 .PP
-.BI " void getutmp(const struct utmpx *" ux ", struct utmp *" u );
-.BI " void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
+.BI "void getutmp(const struct utmpx *" ux ", struct utmp *" u );
+.BI "void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
 .fi
 .SH DESCRIPTION
 The
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#20 lore raw

PATCH 1/1 copy_file_range.2: Update cross-filesystem support for 5.12

In reply to Alejandro Colomar

Linux 5.12 fixes a regression.

Cross-filesystem (introduced in 5.3) copies were buggy.

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Related: <https://lwn.net/Articles/846403/>

Cc Greg KH <[email protected]>
Cc Michael Kerrisk <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Steve French <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Alexander Viro <[email protected]>
Cc "Darrick J. Wong" <[email protected]>
Cc Dave Chinner <[email protected]>
Cc Nicolas Boichat <[email protected]>
Cc Ian Lance Taylor <[email protected]>
Cc Luis Lozano <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc Olga Kornievskaia <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc ceph-devel <[email protected]>
Cc linux-kernel <[email protected]>
Cc samba-technical <[email protected]>
Cc linux-fsdevel <[email protected]>
Cc Linux NFS Mailing List <[email protected]>
Cc Walter Harms <[email protected]>
---
 man2/copy_file_range.2 | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
man2/copy_file_range.2 +23 -4
index 467a16300..843e02241 100644
@@ -169,6 +169,9 @@ Out of memory.
 .B ENOSPC
 There is not enough space on the target filesystem to complete the copy.
 .TP
+.BR EOPNOTSUPP " (since Linux 5.12)"
+The filesystem does not support this operation.
+.TP
 .B EOVERFLOW
 The requested source or destination range is too large to represent in the
 specified data types.
@@ -184,10 +187,17 @@ or
 .I fd_out
 refers to an active swap file.
 .TP
-.B EXDEV
+.BR EXDEV " (before Linux 5.3)"
+The files referred to by
+.IR fd_in " and " fd_out
+are not on the same filesystem.
+.TP
+.BR EXDEV " (since Linux 5.12)"
 The files referred to by
 .IR fd_in " and " fd_out
-are not on the same mounted filesystem (pre Linux 5.3).
+are not on the same filesystem,
+and the source and target filesystems are not of the same type,
+or do not support cross-filesystem copy.
 .SH VERSIONS
 The
 .BR copy_file_range ()
@@ -200,8 +210,11 @@ Areas of the API that weren't clearly defined were clarified and the API bounds
 are much more strictly checked than on earlier kernels.
 Applications should target the behaviour and requirements of 5.3 kernels.
 .PP
-First support for cross-filesystem copies was introduced in Linux 5.3.
-Older kernels will return -EXDEV when cross-filesystem copies are attempted.
+Since Linux 5.12,
+cross-filesystem copies can be achieved
+when both filesystems are of the same type,
+and that filesystem implements support for it.
+See BUGS for behavior prior to 5.12.
 .SH CONFORMING TO
 The
 .BR copy_file_range ()
@@ -226,6 +239,12 @@ gives filesystems an opportunity to implement "copy acceleration" techniques,
 such as the use of reflinks (i.e., two or more inodes that share
 pointers to the same copy-on-write disk blocks)
 or server-side-copy (in the case of NFS).
+.SH BUGS
+In Linux kernels 5.3 to 5.11,
+cross-filesystem copies were implemented by the kernel,
+if the operation was not supported by individual filesystems.
+However, on some virtual filesystems,
+the call failed to copy, while still reporting success.
 .SH EXAMPLES
 .EX
 #define _GNU_SOURCE
Signature · 1 line
2.31.1
#21 lore raw

Re: [PATCH] copy_file_range.2: Update cross-filesystem support for 5.12

Hi Alex,

Quoted 8 lines · Alejandro Colomar

Linux 5.12 fixes a regression.

Cross-filesystem (introduced in 5.3) copies were buggy.

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Thanks. Patch applied.

Cheers,

Michael

Quoted 94 lines

Related: <https://lwn.net/Articles/846403/>

Cc Greg KH <[email protected]>
Cc Michael Kerrisk <[email protected]>
Cc Anna Schumaker <[email protected]>
Cc Jeff Layton <[email protected]>
Cc Steve French <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Trond Myklebust <[email protected]>
Cc Alexander Viro <[email protected]>
Cc "Darrick J. Wong" <[email protected]>
Cc Dave Chinner <[email protected]>
Cc Nicolas Boichat <[email protected]>
Cc Ian Lance Taylor <[email protected]>
Cc Luis Lozano <[email protected]>
Cc Andreas Dilger <[email protected]>
Cc Olga Kornievskaia <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc ceph-devel <[email protected]>
Cc linux-kernel <[email protected]>
Cc samba-technical <[email protected]>
Cc linux-fsdevel <[email protected]>
Cc Linux NFS Mailing List <[email protected]>
Cc Walter Harms <[email protected]>
---
 man2/copy_file_range.2 | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
man2/copy_file_range.2 +23 -4
index 467a16300..843e02241 100644
@@ -169,6 +169,9 @@ Out of memory.
 .B ENOSPC
 There is not enough space on the target filesystem to complete the copy.
 .TP
+.BR EOPNOTSUPP " (since Linux 5.12)"
+The filesystem does not support this operation.
+.TP
 .B EOVERFLOW
 The requested source or destination range is too large to represent in the
 specified data types.
@@ -184,10 +187,17 @@ or
 .I fd_out
 refers to an active swap file.
 .TP
-.B EXDEV
+.BR EXDEV " (before Linux 5.3)"
+The files referred to by
+.IR fd_in " and " fd_out
+are not on the same filesystem.
+.TP
+.BR EXDEV " (since Linux 5.12)"
 The files referred to by
 .IR fd_in " and " fd_out
-are not on the same mounted filesystem (pre Linux 5.3).
+are not on the same filesystem,
+and the source and target filesystems are not of the same type,
+or do not support cross-filesystem copy.
 .SH VERSIONS
 The
 .BR copy_file_range ()
@@ -200,8 +210,11 @@ Areas of the API that weren't clearly defined were clarified and the API bounds
 are much more strictly checked than on earlier kernels.
 Applications should target the behaviour and requirements of 5.3 kernels.
 .PP
-First support for cross-filesystem copies was introduced in Linux 5.3.
-Older kernels will return -EXDEV when cross-filesystem copies are attempted.
+Since Linux 5.12,
+cross-filesystem copies can be achieved
+when both filesystems are of the same type,
+and that filesystem implements support for it.
+See BUGS for behavior prior to 5.12.
 .SH CONFORMING TO
 The
 .BR copy_file_range ()
@@ -226,6 +239,12 @@ gives filesystems an opportunity to implement "copy acceleration" techniques,
 such as the use of reflinks (i.e., two or more inodes that share
 pointers to the same copy-on-write disk blocks)
 or server-side-copy (in the case of NFS).
+.SH BUGS
+In Linux kernels 5.3 to 5.11,
+cross-filesystem copies were implemented by the kernel,
+if the operation was not supported by individual filesystems.
+However, on some virtual filesystems,
+the call failed to copy, while still reporting success.
 .SH EXAMPLES
 .EX
 #define _GNU_SOURCE
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#22 lore raw

Re: [PATCH] copy_file_range.2: Update cross-filesystem support for 5.12

Quoted 5 lines · Michael Kerrisk (man-pages)

Hi Alex,

Quoted 1 line · Alejandro Colomar

Linux 5.12 fixes a regression.

Nope.
That never happened:
https://lore.kernel.org/linux-fsdevel/[email protected]/

Quoted 9 lines
Quoted 7 lines

Cross-filesystem (introduced in 5.3) copies were buggy.

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Thanks. Patch applied.

I guess that would need to be reverted...

Thanks,
Amir.

#23 lore raw

Re: [PATCH] copy_file_range.2: Update cross-filesystem support for 5.12

Hi Amir,

Quoted 15 lines · Amir Goldstein
Quoted 5 lines · Michael Kerrisk (man-pages)

Hi Alex,

Quoted 1 line · Alejandro Colomar

Linux 5.12 fixes a regression.

Nope.
That never happened:
https://lore.kernel.org/linux-fsdevel/[email protected]/

Quoted 3 lines
Quoted 3 lines

Cross-filesystem (introduced in 5.3) copies were buggy.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Move the statements documenting cross-fs to BUGS.
Kernels 5.3..5.11 should be patched soon.

State version information for some errors related to this.

Thanks. Patch applied.

I guess that would need to be reverted...

Thanks for catching that. I had not pushed the patch, so I'll just drop it.

Cheers,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#24 lore raw

PATCH 1/1 sched_get_priority_max.2, open_memstream.3: tfix

In reply to Alejandro Colomar
---
 man2/sched_get_priority_max.2 | 2 +-
 man3/open_memstream.3         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
man2/sched_get_priority_max.2 +1 -1
index 8a857f6e7..2afd88681 100644
@@ -80,7 +80,7 @@ thus it is a good idea for portable applications to use a virtual
 priority range and map it to the interval given by
 .BR sched_get_priority_max ()
 and
-.BR sched_get_priority_min
+.BR sched_get_priority_min ()
 POSIX.1 requires
 .\" POSIX.1-2001, POSIX.1-2008 (XBD 2.8.4)
 a spread of at least 32 between the maximum and the minimum values for
man3/open_memstream.3 +1 -1
index ba6cbfa75..ea1489cb8 100644
@@ -110,7 +110,7 @@ l l l.
 Interface	Attribute	Value
 T{
 .BR open_memstream (),
-.BR open_wmemstream
+.BR open_wmemstream ()
 T}	Thread safety	MT-Safe
 .TE
 .hy
Signature · 1 line
2.31.1
#25 lore raw

Re: [PATCH] sched_get_priority_max.2, open_memstream.3: tfix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 32 lines
---
 man2/sched_get_priority_max.2 | 2 +-
 man3/open_memstream.3         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
man2/sched_get_priority_max.2 +1 -1
index 8a857f6e7..2afd88681 100644
@@ -80,7 +80,7 @@ thus it is a good idea for portable applications to use a virtual
 priority range and map it to the interval given by
 .BR sched_get_priority_max ()
 and
-.BR sched_get_priority_min
+.BR sched_get_priority_min ()
 POSIX.1 requires
 .\" POSIX.1-2001, POSIX.1-2008 (XBD 2.8.4)
 a spread of at least 32 between the maximum and the minimum values for
man3/open_memstream.3 +1 -1
index ba6cbfa75..ea1489cb8 100644
@@ -110,7 +110,7 @@ l l l.
 Interface	Attribute	Value
 T{
 .BR open_memstream (),
-.BR open_wmemstream
+.BR open_wmemstream ()
 T}	Thread safety	MT-Safe
 .TE
 .hy
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#26 lore raw

PATCH 1/1 __ppc_get_timebase.3: ffix

In reply to Alejandro Colomar
---
 man3/__ppc_get_timebase.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/__ppc_get_timebase.3 +1 -1
index 9939767ae..618ca74dc 100644
@@ -31,7 +31,7 @@ __ppc_get_timebase, __ppc_get_timebase_freq \- get the current value
 .nf
 .B #include <sys/platform/ppc.h>
 .PP
-.BI "uint64_t __ppc_get_timebase(void)"
+.BI "uint64_t __ppc_get_timebase(void);"
 .BI "uint64_t __ppc_get_timebase_freq(void);"
 .fi
 .SH DESCRIPTION
Signature · 1 line
2.31.1
#27 lore raw

Re: [PATCH] __ppc_get_timebase.3: ffix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/__ppc_get_timebase.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/__ppc_get_timebase.3 +1 -1
index 9939767ae..618ca74dc 100644
@@ -31,7 +31,7 @@ __ppc_get_timebase, __ppc_get_timebase_freq \- get the current value
 .nf
 .B #include <sys/platform/ppc.h>
 .PP
-.BI "uint64_t __ppc_get_timebase(void)"
+.BI "uint64_t __ppc_get_timebase(void);"
 .BI "uint64_t __ppc_get_timebase_freq(void);"
 .fi
 .SH DESCRIPTION
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#28 lore raw

PATCH 1/1 pthread_attr_setinheritsched.3: SYNOPSIS: Use 'restrict' in prototypes

In reply to Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_attr_getinheritsched sysdeps/htl/pthread.h:90:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,

					 int *__restrict __inheritsched)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:313:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
					 __attr, int *__restrict __inherit)
     __THROW __nonnull ((1, 2));

.../glibc$

---
 man3/pthread_attr_setinheritsched.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/pthread_attr_setinheritsched.3 +2 -2
index 4ac1e3e7f..b834c1fd7 100644
@@ -33,8 +33,8 @@ inherit-scheduler attribute in thread attributes object
 .PP
 .BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ,
 .BI "                                 int " inheritsched );
-.BI "int pthread_attr_getinheritsched(const pthread_attr_t *" attr ,
-.BI "                                 int *" inheritsched );
+.BI "int pthread_attr_getinheritsched(const pthread_attr_t *restrict " attr ,
+.BI "                                 int *restrict " inheritsched );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 1 line
2.31.1
#29 lore raw

Re: [PATCH] pthread_attr_setinheritsched.3: SYNOPSIS: Use 'restrict' in prototypes

Hi ALex,

Quoted 13 lines · Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_attr_getinheritsched sysdeps/htl/pthread.h:90:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,

					 int *__restrict __inheritsched)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:313:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
					 __attr, int *__restrict __inherit)
     __THROW __nonnull ((1, 2));
Quoted 3 lines

.../glibc$

Applied. Thanks!

Cheers,

Michael

Quoted 20 lines
---
 man3/pthread_attr_setinheritsched.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/pthread_attr_setinheritsched.3 +2 -2
index 4ac1e3e7f..b834c1fd7 100644
@@ -33,8 +33,8 @@ inherit-scheduler attribute in thread attributes object
 .PP
 .BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ,
 .BI "                                 int " inheritsched );
-.BI "int pthread_attr_getinheritsched(const pthread_attr_t *" attr ,
-.BI "                                 int *" inheritsched );
+.BI "int pthread_attr_getinheritsched(const pthread_attr_t *restrict " attr ,
+.BI "                                 int *restrict " inheritsched );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#30 lore raw

PATCH 1/1 scripts/bash_aliases: Make man_lsfunc() more robust; Add sed_rm_ccomments().

In reply to Alejandro Colomar

This patch makes man_lsfunc() search for the function prototypes, instead of relying on the current manual page formatting, which might change in the future, and break this function.

It also simplifies the code, by reusing man_section().

Create a new function sed_rm_ccomments(), which is needed by man_lsfunc(), and may also be useful in other cases.

---
 scripts/bash_aliases | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)
scripts/bash_aliases +21 -18
index d9b6047d1..c50108a16 100644
@@ -20,6 +20,21 @@
 EX_OK=0;
 EX_USAGE=64;
 
+########################################################################
+#	C
+
+#  sed_rm_ccomments()  removes C comments.
+# It can't handle multiple comments in a sinlge line correctly,
+# nor mixed or embedded //... and /*...*/ comments.
+# Use as a filter (see man_lsfunc() in this file).
+
+function sed_rm_ccomments()
+{
+	sed 's%/\*.*\*/%%' \
+	|sed -E '\%/\*%,\%\*/%{\%(\*/|/\*)%!d; s%/\*.*%%; s%.*\*/%%;}' \
+	|sed 's%//.*%%';
+}
+
 ########################################################################
 #	Linux kernel
 
@@ -106,25 +121,13 @@ function man_lsfunc()
 		return ${EX_USAGE};
 	fi
 
-	find "${@}" -type f \
-	|xargs grep -l "\.SH SYNOPSIS" \
-	|sort -V \
-	|while read -r manpage; do
-		<${manpage} \
-		sed -n \
-			-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-			-e "/^\.SH SYNOPSIS/p" \
-			-e "/^\.SH SYNOPSIS/,/^\.SH/{/^\.SH/!p}" \
-		|sed \
-			-e '/Feature/,$d' \
-			-e '/{/,/}/d' \
-		|man -P cat -l - 2>/dev/null;
+	for arg in "$@"; do
+		man_section "${arg}" 'SYNOPSIS';
 	done \
-	|sed -n "/^SYNOPSIS/,/^\w/p" \
-	|grep '^       \w' \
-	|grep -v ':' \
-	|sed 's/^[^(]* \**\(\w*\)(.*/\1/' \
-	|grep '^\w' \
+	|sed_rm_ccomments \
+	|pcregrep -Mn '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
+	|grep '^[0-9]' \
+	|sed -E 's/^[^(]+ \**(\w+)\(.*/\1/' \
 	|uniq;
 }
 
Signature · 1 line
2.31.1
#31 lore raw

Re: [PATCH] scripts/bash_aliases: Make man_lsfunc() more robust; Add sed_rm_ccomments().

Hi Alex,

Quoted 10 lines · Alejandro Colomar

This patch makes man_lsfunc() search for the function prototypes, instead of relying on the current manual page formatting, which might change in the future, and break this function.

It also simplifies the code, by reusing man_section().

Create a new function sed_rm_ccomments(), which is needed by man_lsfunc(), and may also be useful in other cases.

Applied.

Thanks,

Michael

Quoted 63 lines
---
 scripts/bash_aliases | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)
scripts/bash_aliases +21 -18
index d9b6047d1..c50108a16 100644
@@ -20,6 +20,21 @@
 EX_OK=0;
 EX_USAGE=64;
 
+########################################################################
+#	C
+
+#  sed_rm_ccomments()  removes C comments.
+# It can't handle multiple comments in a sinlge line correctly,
+# nor mixed or embedded //... and /*...*/ comments.
+# Use as a filter (see man_lsfunc() in this file).
+
+function sed_rm_ccomments()
+{
+	sed 's%/\*.*\*/%%' \
+	|sed -E '\%/\*%,\%\*/%{\%(\*/|/\*)%!d; s%/\*.*%%; s%.*\*/%%;}' \
+	|sed 's%//.*%%';
+}
+
 ########################################################################
 #	Linux kernel
 
@@ -106,25 +121,13 @@ function man_lsfunc()
 		return ${EX_USAGE};
 	fi
 
-	find "${@}" -type f \
-	|xargs grep -l "\.SH SYNOPSIS" \
-	|sort -V \
-	|while read -r manpage; do
-		<${manpage} \
-		sed -n \
-			-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-			-e "/^\.SH SYNOPSIS/p" \
-			-e "/^\.SH SYNOPSIS/,/^\.SH/{/^\.SH/!p}" \
-		|sed \
-			-e '/Feature/,$d' \
-			-e '/{/,/}/d' \
-		|man -P cat -l - 2>/dev/null;
+	for arg in "$@"; do
+		man_section "${arg}" 'SYNOPSIS';
 	done \
-	|sed -n "/^SYNOPSIS/,/^\w/p" \
-	|grep '^       \w' \
-	|grep -v ':' \
-	|sed 's/^[^(]* \**\(\w*\)(.*/\1/' \
-	|grep '^\w' \
+	|sed_rm_ccomments \
+	|pcregrep -Mn '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
+	|grep '^[0-9]' \
+	|sed -E 's/^[^(]+ \**(\w+)\(.*/\1/' \
 	|uniq;
 }
 
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#32 lore raw

PATCH 1/1 scripts/bash_aliases: Add man_lsvar(), similar to man_lsfunc() but lists variables

In reply to Alejandro Colomar
---
 scripts/bash_aliases | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
scripts/bash_aliases +27 -0
index c50108a16..813c00960 100644
@@ -131,6 +131,33 @@ function man_lsfunc()
 	|uniq;
 }
 
+#  man_lsvar()  prints the name of all C variables declared in the SYNOPSIS
+# of all manual pages in a directory (or in a single manual page file).
+# Each name is printed in a separate line
+# Usage example:  .../man-pages$ man_lsvar man3;
+
+function man_lsvar()
+{
+	if ! [ -v 1 ]; then
+		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		return ${EX_USAGE};
+	fi
+
+	for arg in "$@"; do
+		man_section "${arg}" 'SYNOPSIS';
+	done \
+	|sed_rm_ccomments \
+	|pcregrep -Mv '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
+	|pcregrep -Mn \
+	  -e '(?s)^ +extern [\w ]+ \**\(\*+[\w ]+\)\([\w\s(,)[\]*]+?\s*\); *$' \
+	  -e '^ +extern [\w ]+ \**[\w ]+; *$' \
+	|grep '^[0-9]' \
+	|grep -v 'typedef' \
+	|sed -E 's/^[0-9]+: +extern [^(]+ \**\(\*+(\w* )?(\w+)\)\(.*/\2/' \
+	|sed    's/^[0-9]\+: \+extern .* \**\(\w\+\); */\1/' \
+	|uniq;
+}
+
 #  pdfman()  renders a manual page in PDF
 # Usage example:  .../man-pages$ pdfman man2/membarrier.2;
 
Signature · 1 line
2.31.1
#33 lore raw

Re: [PATCH] scripts/bash_aliases: Add man_lsvar(), similar to man_lsfunc() but lists variables

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 43 lines
---
 scripts/bash_aliases | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
scripts/bash_aliases +27 -0
index c50108a16..813c00960 100644
@@ -131,6 +131,33 @@ function man_lsfunc()
 	|uniq;
 }
 
+#  man_lsvar()  prints the name of all C variables declared in the SYNOPSIS
+# of all manual pages in a directory (or in a single manual page file).
+# Each name is printed in a separate line
+# Usage example:  .../man-pages$ man_lsvar man3;
+
+function man_lsvar()
+{
+	if ! [ -v 1 ]; then
+		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		return ${EX_USAGE};
+	fi
+
+	for arg in "$@"; do
+		man_section "${arg}" 'SYNOPSIS';
+	done \
+	|sed_rm_ccomments \
+	|pcregrep -Mv '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
+	|pcregrep -Mn \
+	  -e '(?s)^ +extern [\w ]+ \**\(\*+[\w ]+\)\([\w\s(,)[\]*]+?\s*\); *$' \
+	  -e '^ +extern [\w ]+ \**[\w ]+; *$' \
+	|grep '^[0-9]' \
+	|grep -v 'typedef' \
+	|sed -E 's/^[0-9]+: +extern [^(]+ \**\(\*+(\w* )?(\w+)\)\(.*/\2/' \
+	|sed    's/^[0-9]\+: \+extern .* \**\(\w\+\); */\1/' \
+	|uniq;
+}
+
 #  pdfman()  renders a manual page in PDF
 # Usage example:  .../man-pages$ pdfman man2/membarrier.2;
 
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#34 lore raw

PATCH 1/1 pthread_attr_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes

In reply to Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_attr_getschedparam sysdeps/htl/pthread.h:102:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,

				       struct sched_param *__restrict __param)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:294:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype pthread_attr_setschedparam
sysdeps/htl/pthread.h:107:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:299:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));

.../glibc$

---
 man3/pthread_attr_setschedparam.3 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
man3/pthread_attr_setschedparam.3 +4 -4
index adc3fbcb2..72ee0143a 100644
@@ -31,10 +31,10 @@ scheduling parameter attributes in thread attributes object
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
-.BI "                               const struct sched_param *" param );
-.BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ,
-.BI "                               struct sched_param *" param );
+.BI "int pthread_attr_setschedparam(pthread_attr_t *restrict " attr ,
+.BI "                              const struct sched_param *restrict " param );
+.BI "int pthread_attr_getschedparam(const pthread_attr_t *restrict " attr ,
+.BI "                              struct sched_param *restrict " param );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 1 line
2.31.1
#35 lore raw

Re: [PATCH] pthread_attr_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes

Hi Alex,

Quoted 22 lines · Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_attr_getschedparam sysdeps/htl/pthread.h:102:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,

				       struct sched_param *__restrict __param)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:294:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype pthread_attr_setschedparam
sysdeps/htl/pthread.h:107:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:299:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
Quoted 3 lines

.../glibc$

Applied. Thanks!

Cheers,

Michael

Quoted 24 lines
---
 man3/pthread_attr_setschedparam.3 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
man3/pthread_attr_setschedparam.3 +4 -4
index adc3fbcb2..72ee0143a 100644
@@ -31,10 +31,10 @@ scheduling parameter attributes in thread attributes object
 .nf
 .B #include <pthread.h>
 .PP
-.BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
-.BI "                               const struct sched_param *" param );
-.BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ,
-.BI "                               struct sched_param *" param );
+.BI "int pthread_attr_setschedparam(pthread_attr_t *restrict " attr ,
+.BI "                              const struct sched_param *restrict " param );
+.BI "int pthread_attr_getschedparam(const pthread_attr_t *restrict " attr ,
+.BI "                              struct sched_param *restrict " param );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#36 lore raw

PATCH 1/1 strsignal.3: ffix

In reply to Alejandro Colomar
---
 man3/strsignal.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/strsignal.3 +1 -1
index cfea6c8b4..6a5a1e610 100644
@@ -39,7 +39,7 @@ strsignal, sigdescr_np, sigdescr_np, sys_siglist \- return string describing sig
 .BI "char *sigdescr_np(int " sig );
 .BI "char *sigabbrev_np(int " sig );
 .PP
-.BI "extern const char * const " sys_siglist [];
+.BI "extern const char *const " sys_siglist [];
 .fi
 .PP
 .RS -4
Signature · 1 line
2.31.1
#37 lore raw

Re: [PATCH] strsignal.3: ffix

Hi ALex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/strsignal.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/strsignal.3 +1 -1
index cfea6c8b4..6a5a1e610 100644
@@ -39,7 +39,7 @@ strsignal, sigdescr_np, sigdescr_np, sys_siglist \- return string describing sig
 .BI "char *sigdescr_np(int " sig );
 .BI "char *sigabbrev_np(int " sig );
 .PP
-.BI "extern const char * const " sys_siglist [];
+.BI "extern const char *const " sys_siglist [];
 .fi
 .PP
 .RS -4
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#38 lore raw

PATCH 1/1 strsignal.3: SYNOPSIS: Add missing 'const'

In reply to Alejandro Colomar

glibc uses 'const' in sigdescr_np(), sigabbrev_np(). Let's use it here too.

.../glibc$ grep_glibc_prototype sigdescr_np string/string.h:469:
extern const char *sigdescr_np (int __sig) __THROW; .../glibc$ grep_glibc_prototype sigabbrev_np string/string.h:466:
extern const char *sigabbrev_np (int __sig) __THROW; .../glibc$

---
 man3/strsignal.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/strsignal.3 +2 -2
index 6a5a1e610..bc4120303 100644
@@ -36,8 +36,8 @@ strsignal, sigdescr_np, sigdescr_np, sys_siglist \- return string describing sig
 .B #include <string.h>
 .PP
 .BI "char *strsignal(int " sig );
-.BI "char *sigdescr_np(int " sig );
-.BI "char *sigabbrev_np(int " sig );
+.BI "const char *sigdescr_np(int " sig );
+.BI "const char *sigabbrev_np(int " sig );
 .PP
 .BI "extern const char *const " sys_siglist [];
 .fi
Signature · 1 line
2.31.1
#39 lore raw

Re: [PATCH] strsignal.3: SYNOPSIS: Add missing 'const'

Hi Alex,

Quoted 11 lines · Alejandro Colomar

glibc uses 'const' in sigdescr_np(), sigabbrev_np(). Let's use it here too.

.../glibc$ grep_glibc_prototype sigdescr_np string/string.h:469:
extern const char *sigdescr_np (int __sig) __THROW; .../glibc$ grep_glibc_prototype sigabbrev_np string/string.h:466:
extern const char *sigabbrev_np (int __sig) __THROW; .../glibc$

Quoted 1 line

Applied.

Thanks,

Michael

Quoted 20 lines
---
 man3/strsignal.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/strsignal.3 +2 -2
index 6a5a1e610..bc4120303 100644
@@ -36,8 +36,8 @@ strsignal, sigdescr_np, sigdescr_np, sys_siglist \- return string describing sig
 .B #include <string.h>
 .PP
 .BI "char *strsignal(int " sig );
-.BI "char *sigdescr_np(int " sig );
-.BI "char *sigabbrev_np(int " sig );
+.BI "const char *sigdescr_np(int " sig );
+.BI "const char *sigabbrev_np(int " sig );
 .PP
 .BI "extern const char *const " sys_siglist [];
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#40 lore raw

PATCH 1/1 rpc.3: SYNOPSIS: Fix prototypes (misc.)

In reply to Alejandro Colomar

Fix the types for the following functions:

authunix_create(),
callrpc(),
clnt_create(),
clnt_pcreateerror(),
clnt_perror(),
clnt_spcreateerror(),
clnt_sperror(),
pmap_set(),
svc_register(),
svcerr_progvers().

.../glibc$ grep_glibc_prototype authunix_create sunrpc/rpc/auth.h:158:
extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,

			      int __len, __gid_t *__aup_gids);

.../glibc$ grep_glibc_prototype callrpc sunrpc/rpc/clnt.h:359:
extern int callrpc (const char *__host, const u_long __prognum,
const u_long __versnum, const u_long __procnum, const xdrproc_t __inproc, const char *__in, const xdrproc_t __outproc, char *__out) __THROW;
.../glibc$ grep_glibc_prototype clnt_create sunrpc/rpc/clnt.h:291:
extern CLIENT *clnt_create (const char *__host, const u_long __prog,

			    const u_long __vers, const char *__prot)
     __THROW;

.../glibc$ grep_glibc_prototype clnt_pcreateerror sunrpc/rpc/clnt.h:368:
extern void clnt_pcreateerror (const char *__msg); /* stderr */
.../glibc$ grep_glibc_prototype clnt_perror sunrpc/rpc/clnt.h:379:
extern void clnt_perror (CLIENT *__clnt, const char *__msg); .../glibc$ grep_glibc_prototype clnt_spcreateerror sunrpc/rpc/clnt.h:369:
extern char *clnt_spcreateerror(const char *__msg) __THROW; /* string */
.../glibc$ grep_glibc_prototype clnt_sperror sunrpc/rpc/clnt.h:381:
extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW; .../glibc$ grep_glibc_prototype pmap_set sunrpc/rpc/pmap_clnt.h:69:
extern bool_t pmap_set (const u_long __program, const u_long __vers,

			int __protocol, u_short __port) __THROW;
.../glibc$ grep_glibc_prototype svc_register
sunrpc/rpc/svc.h:188:
extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
			    rpcvers_t __vers, __dispatch_fn_t __dispatch,
			    rpcprot_t __protocol) __THROW;
.../glibc$ grep_glibc_prototype svcerr_progvers
sunrpc/rpc/svc.h:253:
extern void	svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
				 rpcvers_t __high_vers) __THROW;

.../glibc$

---
 man3/rpc.3 | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
man3/rpc.3 +13 -12
index 1daaaad7e..3d2fe4243 100644
@@ -70,8 +70,8 @@ information with each remote procedure call.
 This is the default authentication used by RPC.
 .PP
 .nf
-.BI "AUTH *authunix_create(char *" host ", int " uid ", int " gid ,
-.BI "                      int " len ", int *" aup_gids );
+.BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
+.BI "                      int " len ", gid_t *" aup_gids );
 .fi
 .IP
 Create and return an RPC authentication handle that contains
@@ -100,7 +100,7 @@ with the appropriate parameters.
 .nf
 .BI "int callrpc(char *" host ", unsigned long " prognum ,
 .BI "            unsigned long " versnum ", unsigned long " procnum ,
-.BI "            xdrproc_t " inproc ", char *" in ,
+.BI "            xdrproc_t " inproc ", const char *" in ,
 .BI "            xdrproc_t " outproc ", char *" out );
 .fi
 .IP
@@ -216,8 +216,8 @@ If the RPC library opened the associated socket, it will close it also.
 Otherwise, the socket remains open.
 .PP
 .nf
-.BI "CLIENT *clnt_create(char *" host ", unsigned long " prog ,
-.BI "                    unsigned long " vers ", char *" proto );
+.BI "CLIENT *clnt_create(const char *" host ", unsigned long " prog ,
+.BI "                    unsigned long " vers ", const char *" proto );
 .fi
 .IP
 Generic client creation routine.
@@ -305,7 +305,7 @@ handle to the structure at address
 .IR errp .
 .PP
 .nf
-.BI "void clnt_pcreateerror(char *" s );
+.BI "void clnt_pcreateerror(const char *" s );
 .fi
 .IP
 Print a message to standard error indicating why a client RPC
@@ -332,7 +332,7 @@ Used after
 .BR callrpc ().
 .PP
 .nf
-.BI "clnt_perror(CLIENT *" clnt ", char *" s );
+.BI "clnt_perror(CLIENT *" clnt ", const char *" s );
 .fi
 .IP
 Print a message to standard error indicating why an RPC call failed;
@@ -345,7 +345,7 @@ Used after
 .BR clnt_call ().
 .PP
 .nf
-.BI "char *clnt_spcreateerror(char *" s );
+.BI "char *clnt_spcreateerror(const char *" s );
 .fi
 .IP
 Like
@@ -383,7 +383,7 @@ returns pointer to static data, but the
 result will not get overwritten on each call.
 .PP
 .nf
-.BI "char *clnt_sperror(CLIENT *" rpch ", char *" s );
+.BI "char *clnt_sperror(CLIENT *" rpch ", const char *" s );
 .fi
 .IP
 Like
@@ -601,7 +601,7 @@ See also
 .PP
 .nf
 .BI "bool_t pmap_set(unsigned long " prognum ", unsigned long " versnum ,
-.BI "                unsigned int " protocol ", unsigned short " port );
+.BI "                int " protocol ", unsigned short " port );
 .fi
 .IP
 A user interface to the
@@ -781,7 +781,7 @@ This interface is obsoleted by
 .nf
 .BI "bool_t svc_register(SVCXPRT *" xprt ", unsigned long " prognum ,
 .BI "                    unsigned long " versnum ,
-.BI "                    void (*" dispatch ")(svc_req *, SVCXPRT *),"
+.BI "                    void (*" dispatch ")(struct svc_req *, SVCXPRT *),"
 .BI "                    unsigned long " protocol );
 .fi
 .IP
@@ -894,7 +894,8 @@ Called when the desired program is not registered with the RPC package.
 Service implementors usually do not need this routine.
 .PP
 .nf
-.BI "void svcerr_progvers(SVCXPRT *" xprt );
+.BI "void svcerr_progvers(SVCXPRT *" xprt ", unsigned long " low_vers ,
+.BI "                     unsigned long " high_vers );
 .fi
 .IP
 Called when the desired version of a program is not registered
Signature · 1 line
2.31.1
#41 lore raw

Re: [PATCH] rpc.3: SYNOPSIS: Fix prototypes (misc.)

Hi ALex,

Quoted 53 lines · Alejandro Colomar

Fix the types for the following functions:

authunix_create(),
callrpc(),
clnt_create(),
clnt_pcreateerror(),
clnt_perror(),
clnt_spcreateerror(),
clnt_sperror(),
pmap_set(),
svc_register(),
svcerr_progvers().

.../glibc$ grep_glibc_prototype authunix_create sunrpc/rpc/auth.h:158:
extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,

			      int __len, __gid_t *__aup_gids);

.../glibc$ grep_glibc_prototype callrpc sunrpc/rpc/clnt.h:359:
extern int callrpc (const char *__host, const u_long __prognum,
const u_long __versnum, const u_long __procnum, const xdrproc_t __inproc, const char *__in, const xdrproc_t __outproc, char *__out) __THROW;
.../glibc$ grep_glibc_prototype clnt_create sunrpc/rpc/clnt.h:291:
extern CLIENT *clnt_create (const char *__host, const u_long __prog,

			    const u_long __vers, const char *__prot)
     __THROW;

.../glibc$ grep_glibc_prototype clnt_pcreateerror sunrpc/rpc/clnt.h:368:
extern void clnt_pcreateerror (const char *__msg); /* stderr */
.../glibc$ grep_glibc_prototype clnt_perror sunrpc/rpc/clnt.h:379:
extern void clnt_perror (CLIENT *__clnt, const char *__msg); .../glibc$ grep_glibc_prototype clnt_spcreateerror sunrpc/rpc/clnt.h:369:
extern char *clnt_spcreateerror(const char *__msg) __THROW; /* string */
.../glibc$ grep_glibc_prototype clnt_sperror sunrpc/rpc/clnt.h:381:
extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW; .../glibc$ grep_glibc_prototype pmap_set sunrpc/rpc/pmap_clnt.h:69:
extern bool_t pmap_set (const u_long __program, const u_long __vers,

			int __protocol, u_short __port) __THROW;
.../glibc$ grep_glibc_prototype svc_register
sunrpc/rpc/svc.h:188:
extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
			    rpcvers_t __vers, __dispatch_fn_t __dispatch,
			    rpcprot_t __protocol) __THROW;
.../glibc$ grep_glibc_prototype svcerr_progvers
sunrpc/rpc/svc.h:253:
extern void	svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
				 rpcvers_t __high_vers) __THROW;
Quoted 3 lines

.../glibc$

Applied. Thanks!

Cheers,

Michael

Quoted 104 lines
---
 man3/rpc.3 | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
man3/rpc.3 +13 -12
index 1daaaad7e..3d2fe4243 100644
@@ -70,8 +70,8 @@ information with each remote procedure call.
 This is the default authentication used by RPC.
 .PP
 .nf
-.BI "AUTH *authunix_create(char *" host ", int " uid ", int " gid ,
-.BI "                      int " len ", int *" aup_gids );
+.BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
+.BI "                      int " len ", gid_t *" aup_gids );
 .fi
 .IP
 Create and return an RPC authentication handle that contains
@@ -100,7 +100,7 @@ with the appropriate parameters.
 .nf
 .BI "int callrpc(char *" host ", unsigned long " prognum ,
 .BI "            unsigned long " versnum ", unsigned long " procnum ,
-.BI "            xdrproc_t " inproc ", char *" in ,
+.BI "            xdrproc_t " inproc ", const char *" in ,
 .BI "            xdrproc_t " outproc ", char *" out );
 .fi
 .IP
@@ -216,8 +216,8 @@ If the RPC library opened the associated socket, it will close it also.
 Otherwise, the socket remains open.
 .PP
 .nf
-.BI "CLIENT *clnt_create(char *" host ", unsigned long " prog ,
-.BI "                    unsigned long " vers ", char *" proto );
+.BI "CLIENT *clnt_create(const char *" host ", unsigned long " prog ,
+.BI "                    unsigned long " vers ", const char *" proto );
 .fi
 .IP
 Generic client creation routine.
@@ -305,7 +305,7 @@ handle to the structure at address
 .IR errp .
 .PP
 .nf
-.BI "void clnt_pcreateerror(char *" s );
+.BI "void clnt_pcreateerror(const char *" s );
 .fi
 .IP
 Print a message to standard error indicating why a client RPC
@@ -332,7 +332,7 @@ Used after
 .BR callrpc ().
 .PP
 .nf
-.BI "clnt_perror(CLIENT *" clnt ", char *" s );
+.BI "clnt_perror(CLIENT *" clnt ", const char *" s );
 .fi
 .IP
 Print a message to standard error indicating why an RPC call failed;
@@ -345,7 +345,7 @@ Used after
 .BR clnt_call ().
 .PP
 .nf
-.BI "char *clnt_spcreateerror(char *" s );
+.BI "char *clnt_spcreateerror(const char *" s );
 .fi
 .IP
 Like
@@ -383,7 +383,7 @@ returns pointer to static data, but the
 result will not get overwritten on each call.
 .PP
 .nf
-.BI "char *clnt_sperror(CLIENT *" rpch ", char *" s );
+.BI "char *clnt_sperror(CLIENT *" rpch ", const char *" s );
 .fi
 .IP
 Like
@@ -601,7 +601,7 @@ See also
 .PP
 .nf
 .BI "bool_t pmap_set(unsigned long " prognum ", unsigned long " versnum ,
-.BI "                unsigned int " protocol ", unsigned short " port );
+.BI "                int " protocol ", unsigned short " port );
 .fi
 .IP
 A user interface to the
@@ -781,7 +781,7 @@ This interface is obsoleted by
 .nf
 .BI "bool_t svc_register(SVCXPRT *" xprt ", unsigned long " prognum ,
 .BI "                    unsigned long " versnum ,
-.BI "                    void (*" dispatch ")(svc_req *, SVCXPRT *),"
+.BI "                    void (*" dispatch ")(struct svc_req *, SVCXPRT *),"
 .BI "                    unsigned long " protocol );
 .fi
 .IP
@@ -894,7 +894,8 @@ Called when the desired program is not registered with the RPC package.
 Service implementors usually do not need this routine.
 .PP
 .nf
-.BI "void svcerr_progvers(SVCXPRT *" xprt );
+.BI "void svcerr_progvers(SVCXPRT *" xprt ", unsigned long " low_vers ,
+.BI "                     unsigned long " high_vers );
 .fi
 .IP
 Called when the desired version of a program is not registered
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#42 lore raw

PATCH 1/1 pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'

In reply to Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_mutexattr_setrobust sysdeps/htl/pthread.h:355:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,

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

.../glibc$

---
 man3/pthread_mutexattr_setrobust.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/pthread_mutexattr_setrobust.3 +1 -1
index dbf429c48..86aab88ed 100644
@@ -33,7 +33,7 @@ pthread_mutexattr_getrobust, pthread_mutexattr_setrobust
 .PP
 .BI "int pthread_mutexattr_getrobust(const pthread_mutexattr_t *" attr ,
 .BI "                                int *" robustness ");"
-.BI "int pthread_mutexattr_setrobust(const pthread_mutexattr_t *" attr ,
+.BI "int pthread_mutexattr_setrobust(pthread_mutexattr_t *" attr ,
 .BI "                                int " robustness ");"
 .fi
 .PP
Signature · 1 line
2.31.1
#43 lore raw

Re: [PATCH] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'

Hi ALex,

Quoted 13 lines · Alejandro Colomar

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

.../glibc$ grep_glibc_prototype pthread_mutexattr_setrobust sysdeps/htl/pthread.h:355:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,

					int __robustness)
     __THROW __nonnull ((1));
sysdeps/nptl/pthread.h:888:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
Quoted 3 lines

.../glibc$

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/pthread_mutexattr_setrobust.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/pthread_mutexattr_setrobust.3 +1 -1
index dbf429c48..86aab88ed 100644
@@ -33,7 +33,7 @@ pthread_mutexattr_getrobust, pthread_mutexattr_setrobust
 .PP
 .BI "int pthread_mutexattr_getrobust(const pthread_mutexattr_t *" attr ,
 .BI "                                int *" robustness ");"
-.BI "int pthread_mutexattr_setrobust(const pthread_mutexattr_t *" attr ,
+.BI "int pthread_mutexattr_setrobust(pthread_mutexattr_t *" attr ,
 .BI "                                int " robustness ");"
 .fi
 .PP
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#44 lore raw

PATCH 1/1 pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'

In reply to Alejandro Colomar

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

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

     __THROW __nonnull ((1));

.../glibc$

---
 man3/pthread_getattr_default_np.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/pthread_getattr_default_np.3 +1 -1
index 903d5095a..5973af5ec 100644
@@ -32,7 +32,7 @@ get or set default thread-creation attributes
 .B #include <pthread.h>
 .PP
 .BI "int pthread_getattr_default_np(pthread_attr_t *" attr );
-.BI "int pthread_setattr_default_np(pthread_attr_t *" attr );
+.BI "int pthread_setattr_default_np(const pthread_attr_t *" attr );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 1 line
2.31.1
#45 lore raw

Re: [PATCH] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'

Hi Alex,

Quoted 2 lines · Alejandro Colomar

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

Applied.

Thanks,

Michael

Quoted 26 lines

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

     __THROW __nonnull ((1));

.../glibc$

---
 man3/pthread_getattr_default_np.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/pthread_getattr_default_np.3 +1 -1
index 903d5095a..5973af5ec 100644
@@ -32,7 +32,7 @@ get or set default thread-creation attributes
 .B #include <pthread.h>
 .PP
 .BI "int pthread_getattr_default_np(pthread_attr_t *" attr );
-.BI "int pthread_setattr_default_np(pthread_attr_t *" attr );
+.BI "int pthread_setattr_default_np(const pthread_attr_t *" attr );
 .PP
 Compile and link with \fI\-pthread\fP.
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#46 lore raw

PATCH 1/1 tzset.3: ffix

In reply to Alejandro Colomar
---
 man3/tzset.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/tzset.3 +1 -1
index e4660be8b..c80da53f8 100644
@@ -37,7 +37,7 @@ tzset, tzname, timezone, daylight \- initialize time conversion information
 .nf
 .B #include <time.h>
 .PP
-.B void tzset (void);
+.B void tzset(void);
 .PP
 .BI "extern char *" tzname [2];
 .BI "extern long " timezone ;
Signature · 1 line
2.31.1
#47 lore raw

Re: [PATCH] tzset.3: ffix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man3/tzset.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man3/tzset.3 +1 -1
index e4660be8b..c80da53f8 100644
@@ -37,7 +37,7 @@ tzset, tzname, timezone, daylight \- initialize time conversion information
 .nf
 .B #include <time.h>
 .PP
-.B void tzset (void);
+.B void tzset(void);
 .PP
 .BI "extern char *" tzname [2];
 .BI "extern long " timezone ;
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#48 lore raw

PATCH 1/1 xdr.3: SYNOPSIS: Fix prototype types

In reply to Alejandro Colomar

Use the same types glibc uses, and add a missing 'const'.

.../glibc$ grep_glibc_prototype xdr_union sunrpc/rpc/xdr.h:315:
extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,

			 const struct xdr_discrim *__choices,
			 xdrproc_t __dfault) __THROW;

.../glibc$

---
 man3/xdr.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/xdr.3 +2 -2
index ea6359787..83f668dc9 100644
@@ -460,8 +460,8 @@ integers and their external representations.
 This routine returns one if it succeeds, zero otherwise.
 .PP
 .nf
-.BI "bool_t xdr_union(XDR *" xdrs ", int *" dscmp ", char *" unp ,
-.BI "                 struct xdr_discrim *" choices ,
+.BI "bool_t xdr_union(XDR *" xdrs ", enum_t *" dscmp ", char *" unp ,
+.BI "                 const struct xdr_discrim *" choices ,
 .BI "                 xdrproc_t " defaultarm ");     /* may equal NULL */"
 .fi
 .IP
Signature · 1 line
2.31.1
#49 lore raw

Re: [PATCH] xdr.3: SYNOPSIS: Fix prototype types

Hi Alex,

Quoted 10 lines · Alejandro Colomar

Use the same types glibc uses, and add a missing 'const'.

.../glibc$ grep_glibc_prototype xdr_union sunrpc/rpc/xdr.h:315:
extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,

			 const struct xdr_discrim *__choices,
			 xdrproc_t __dfault) __THROW;

.../glibc$

Applied. Thanks!

Cheers,

Michael

Quoted 20 lines
---
 man3/xdr.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
man3/xdr.3 +2 -2
index ea6359787..83f668dc9 100644
@@ -460,8 +460,8 @@ integers and their external representations.
 This routine returns one if it succeeds, zero otherwise.
 .PP
 .nf
-.BI "bool_t xdr_union(XDR *" xdrs ", int *" dscmp ", char *" unp ,
-.BI "                 struct xdr_discrim *" choices ,
+.BI "bool_t xdr_union(XDR *" xdrs ", enum_t *" dscmp ", char *" unp ,
+.BI "                 const struct xdr_discrim *" choices ,
 .BI "                 xdrproc_t " defaultarm ");     /* may equal NULL */"
 .fi
 .IP
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#50 lore raw

PATCH 1/1 scripts/bash_aliases: man_section(): Accept multiple sections

In reply to Alejandro Colomar
---
 scripts/bash_aliases | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
scripts/bash_aliases +19 -10
index 813c00960..7b1b7da9c 100644
@@ -85,26 +85,35 @@ function grep_syscall_def()
 ########################################################################
 #	Linux man-pages
 
-#  man_section()  prints a specific manual page section (DESCRIPTION, SYNOPSIS,
+#  man_section()  prints specific manual page sections (DESCRIPTION, SYNOPSIS,
 # ...) of all manual pages in a directory (or in a single manual page file).
-# Usage example:  .../man-pages$ man_section man2 SYNOPSIS;
+# Usage example:  .../man-pages$ man_section man2 SYNOPSIS 'CONFORMING TO';
 
 function man_section()
 {
 	if ! [ -v 2 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
 		return ${EX_USAGE};
 	fi
 
-	find "${1}" -type f \
-	|xargs grep -l "\.SH ${2}" \
+	local page="$1";
+	shift;
+	local sect="$@";
+
+	find "${page}" -type f \
+	|xargs wc -l \
+	|grep -v -e '\b1 ' -e '\btotal\b' \
+	|awk '{ print $2 }' \
 	|sort -V \
 	|while read -r manpage; do
-		<${manpage} \
-		sed -n \
-			-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-			-e "/^\.SH ${2}/p" \
-			-e "/^\.SH ${2}/,/^\.SH/{/^\.SH/!p}" \
+		cat \
+		<(<${manpage} sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}') \
+		<(for s in ${sect}; do
+			<${manpage} \
+			sed -n \
+				-e "/^\.SH ${s}/p" \
+				-e "/^\.SH ${s}/,/^\.SH/{/^\.SH/!p}"; \
+		  done;) \
 		|man -P cat -l - 2>/dev/null;
 	done;
 }
Signature · 1 line
2.31.1
#51 lore raw

Re: [PATCH] scripts/bash_aliases: man_section(): Accept multiple sections

Hi ALex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 55 lines
---
 scripts/bash_aliases | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
scripts/bash_aliases +19 -10
index 813c00960..7b1b7da9c 100644
@@ -85,26 +85,35 @@ function grep_syscall_def()
 ########################################################################
 #	Linux man-pages
 
-#  man_section()  prints a specific manual page section (DESCRIPTION, SYNOPSIS,
+#  man_section()  prints specific manual page sections (DESCRIPTION, SYNOPSIS,
 # ...) of all manual pages in a directory (or in a single manual page file).
-# Usage example:  .../man-pages$ man_section man2 SYNOPSIS;
+# Usage example:  .../man-pages$ man_section man2 SYNOPSIS 'CONFORMING TO';
 
 function man_section()
 {
 	if ! [ -v 2 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
 		return ${EX_USAGE};
 	fi
 
-	find "${1}" -type f \
-	|xargs grep -l "\.SH ${2}" \
+	local page="$1";
+	shift;
+	local sect="$@";
+
+	find "${page}" -type f \
+	|xargs wc -l \
+	|grep -v -e '\b1 ' -e '\btotal\b' \
+	|awk '{ print $2 }' \
 	|sort -V \
 	|while read -r manpage; do
-		<${manpage} \
-		sed -n \
-			-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-			-e "/^\.SH ${2}/p" \
-			-e "/^\.SH ${2}/,/^\.SH/{/^\.SH/!p}" \
+		cat \
+		<(<${manpage} sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}') \
+		<(for s in ${sect}; do
+			<${manpage} \
+			sed -n \
+				-e "/^\.SH ${s}/p" \
+				-e "/^\.SH ${s}/,/^\.SH/{/^\.SH/!p}"; \
+		  done;) \
 		|man -P cat -l - 2>/dev/null;
 	done;
 }
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#52 lore raw

PATCH 1/1 epoll_wait.2: Move subsection to NOTES from BUGS

In reply to Alejandro Colomar

'C library/kernel differences' was added to BUGS incorrectly. Fix it

---
 man2/epoll_wait.2 | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
man2/epoll_wait.2 +12 -12
index f9b5749df..69c79d6ec 100644
@@ -285,18 +285,6 @@ instance whose interest list is currently empty
 or removed from the interest in another thread).
 The call will block until some file descriptor is later added to the
 interest list (in another thread) and that file descriptor becomes ready.
-.SH BUGS
-In kernels before 2.6.37, a
-.I timeout
-value larger than approximately
-.I LONG_MAX / HZ
-milliseconds is treated as \-1 (i.e., infinity).
-Thus, for example, on a system where
-.I sizeof(long)
-is 4 and the kernel
-.I HZ
-value is 1000,
-this means that timeouts greater than 35.79 minutes are treated as infinity.
 .SS C library/kernel differences
 The raw
 .BR epoll_pwait ()
@@ -312,6 +300,18 @@ The glibc
 wrapper function specifies this argument as a fixed value
 (equal to
 .IR sizeof(sigset_t) ).
+.SH BUGS
+In kernels before 2.6.37, a
+.I timeout
+value larger than approximately
+.I LONG_MAX / HZ
+milliseconds is treated as \-1 (i.e., infinity).
+Thus, for example, on a system where
+.I sizeof(long)
+is 4 and the kernel
+.I HZ
+value is 1000,
+this means that timeouts greater than 35.79 minutes are treated as infinity.
 .SH SEE ALSO
 .BR epoll_create (2),
 .BR epoll_ctl (2),
Signature · 1 line
2.31.1
#53 lore raw

Re: [PATCH] epoll_wait.2: Move subsection to NOTES from BUGS

Hi Alex,

Quoted 4 lines · Alejandro Colomar

'C library/kernel differences' was added to BUGS incorrectly. Fix it

Applied. Thanks!

Cheers,

Michael

Quoted 47 lines
---
 man2/epoll_wait.2 | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
man2/epoll_wait.2 +12 -12
index f9b5749df..69c79d6ec 100644
@@ -285,18 +285,6 @@ instance whose interest list is currently empty
 or removed from the interest in another thread).
 The call will block until some file descriptor is later added to the
 interest list (in another thread) and that file descriptor becomes ready.
-.SH BUGS
-In kernels before 2.6.37, a
-.I timeout
-value larger than approximately
-.I LONG_MAX / HZ
-milliseconds is treated as \-1 (i.e., infinity).
-Thus, for example, on a system where
-.I sizeof(long)
-is 4 and the kernel
-.I HZ
-value is 1000,
-this means that timeouts greater than 35.79 minutes are treated as infinity.
 .SS C library/kernel differences
 The raw
 .BR epoll_pwait ()
@@ -312,6 +300,18 @@ The glibc
 wrapper function specifies this argument as a fixed value
 (equal to
 .IR sizeof(sigset_t) ).
+.SH BUGS
+In kernels before 2.6.37, a
+.I timeout
+value larger than approximately
+.I LONG_MAX / HZ
+milliseconds is treated as \-1 (i.e., infinity).
+Thus, for example, on a system where
+.I sizeof(long)
+is 4 and the kernel
+.I HZ
+value is 1000,
+this means that timeouts greater than 35.79 minutes are treated as infinity.
 .SH SEE ALSO
 .BR epoll_create (2),
 .BR epoll_ctl (2),
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#54 lore raw

PATCH 1/1 scripts/bash_aliases: Fix error messages

In reply to Alejandro Colomar

Fix the error messages to clearly show that both dirs and manual pages are accepted, and that more than one argument is accepted.

---
 scripts/bash_aliases | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bash_aliases +2 -2
index 7b1b7da9c..a14026bda 100644
@@ -126,7 +126,7 @@ function man_section()
 function man_lsfunc()
 {
 	if ! [ -v 1 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
 
@@ -148,7 +148,7 @@ function man_lsfunc()
 function man_lsvar()
 {
 	if ! [ -v 1 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
 
Signature · 1 line
2.31.1
#55 lore raw

Re: [PATCH] scripts/bash_aliases: Fix error messages

Hi ALex,

Quoted 4 lines · Alejandro Colomar

Fix the error messages to clearly show that both dirs and manual pages are accepted, and that more than one argument is accepted.

Applied.

Thanks,

Michael

Quoted 27 lines
---
 scripts/bash_aliases | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bash_aliases +2 -2
index 7b1b7da9c..a14026bda 100644
@@ -126,7 +126,7 @@ function man_section()
 function man_lsfunc()
 {
 	if ! [ -v 1 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
 
@@ -148,7 +148,7 @@ function man_lsfunc()
 function man_lsvar()
 {
 	if ! [ -v 1 ]; then
-		>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
+		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
 
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#56 lore raw

PATCH 1/1 clone.2: tfix

In reply to Alejandro Colomar
---
 man2/clone.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/clone.2 +1 -1
index 838fbd669..04b4ec38c 100644
@@ -969,7 +969,7 @@ mask must also include
 .B CLONE_VM
 if
 .B CLONE_SIGHAND
-is specified
+is specified.
 .TP
 .BR CLONE_STOPPED " (since Linux 2.6.0)"
 .\" Precisely: Linux 2.6.0-test2
Signature · 1 line
2.31.1
#57 lore raw

Re: [PATCH] clone.2: tfix

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 18 lines
---
 man2/clone.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/clone.2 +1 -1
index 838fbd669..04b4ec38c 100644
@@ -969,7 +969,7 @@ mask must also include
 .B CLONE_VM
 if
 .B CLONE_SIGHAND
-is specified
+is specified.
 .TP
 .BR CLONE_STOPPED " (since Linux 2.6.0)"
 .\" Precisely: Linux 2.6.0-test2
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#58 lore raw

PATCH 1/1 scripts/bash_aliases: srcfix

In reply to Alejandro Colomar

I clarified the code about two things:

- Checking how many arguments are being passed.
Here, some functions didn't reject extra arguments when they weren't being used. Fix that.
I also changed the code to use $#, which is more explicit. And use arithmetic expressions, which better indicate that we're dealing with numbers.

- Remove unneeded options from sort.

After Stefan asked about why am I using 'sort -V', I noticed that I really don't need '-V', and it may confuse people trying to understand the script, so even though I slightly prefer the output of 'sort -V', in this case, it's better to use the simpler 'sort' (yet I need 'sort', to maintain consistency in the results (find is quite random)).

---
 scripts/bash_aliases | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
scripts/bash_aliases +12 -12
index a14026bda..358e2f37a 100644
@@ -45,20 +45,20 @@ function sed_rm_ccomments()
 
 function grep_syscall()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.c$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 
 	find * -type f \
 	|grep '\.[ch]$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 }
@@ -70,14 +70,14 @@ function grep_syscall()
 
 function grep_syscall_def()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.c$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?^}" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 }
@@ -91,7 +91,7 @@ function grep_syscall_def()
 
 function man_section()
 {
-	if ! [ -v 2 ]; then
+	if (($# < 2)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
 		return ${EX_USAGE};
 	fi
@@ -104,7 +104,7 @@ function man_section()
 	|xargs wc -l \
 	|grep -v -e '\b1 ' -e '\btotal\b' \
 	|awk '{ print $2 }' \
-	|sort -V \
+	|sort \
 	|while read -r manpage; do
 		cat \
 		<(<${manpage} sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}') \
@@ -125,7 +125,7 @@ function man_section()
 
 function man_lsfunc()
 {
-	if ! [ -v 1 ]; then
+	if (($# < 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
@@ -147,7 +147,7 @@ function man_lsfunc()
 
 function man_lsvar()
 {
-	if ! [ -v 1 ]; then
+	if (($# < 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
@@ -172,7 +172,7 @@ function man_lsvar()
 
 function pdfman()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <man-page.n>";
 		return ${EX_USAGE};
 	fi;
@@ -209,14 +209,14 @@ function man_gitstaged()
 
 function grep_glibc_prototype()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.h$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn \
 	  "(?s)^[\w[][\w\s(,)[:\]]+\s+\**${1}\s*\([\w\s(,)[\]*]+?(...)?\)[\w\s(,)[:\]]*;" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
Signature · 1 line
2.31.1
#59 lore raw

Re: [PATCH] scripts/bash_aliases: srcfix

Hi Alex,

Quoted 11 lines · Alejandro Colomar

I clarified the code about two things:

- Checking how many arguments are being passed.
Here, some functions didn't reject extra arguments when they weren't being used. Fix that.
I also changed the code to use $#, which is more explicit. And use arithmetic expressions, which better indicate that we're dealing with numbers.

- Remove unneeded options from sort.

Quoted 8 lines

After Stefan asked about why am I using 'sort -V', I noticed that I really don't need '-V', and it may confuse people trying to understand the script, so even though I slightly prefer the output of 'sort -V', in this case, it's better to use the simpler 'sort' (yet I need 'sort', to maintain consistency in the results (find is quite random)).

Applied.

Thanks,

Michael

Quoted 112 lines
---
 scripts/bash_aliases | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
scripts/bash_aliases +12 -12
index a14026bda..358e2f37a 100644
@@ -45,20 +45,20 @@ function sed_rm_ccomments()
 
 function grep_syscall()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.c$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 
 	find * -type f \
 	|grep '\.[ch]$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 }
@@ -70,14 +70,14 @@ function grep_syscall()
 
 function grep_syscall_def()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.c$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?^}" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
 }
@@ -91,7 +91,7 @@ function grep_syscall_def()
 
 function man_section()
 {
-	if ! [ -v 2 ]; then
+	if (($# < 2)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
 		return ${EX_USAGE};
 	fi
@@ -104,7 +104,7 @@ function man_section()
 	|xargs wc -l \
 	|grep -v -e '\b1 ' -e '\btotal\b' \
 	|awk '{ print $2 }' \
-	|sort -V \
+	|sort \
 	|while read -r manpage; do
 		cat \
 		<(<${manpage} sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}') \
@@ -125,7 +125,7 @@ function man_section()
 
 function man_lsfunc()
 {
-	if ! [ -v 1 ]; then
+	if (($# < 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
@@ -147,7 +147,7 @@ function man_lsfunc()
 
 function man_lsvar()
 {
-	if ! [ -v 1 ]; then
+	if (($# < 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
 		return ${EX_USAGE};
 	fi
@@ -172,7 +172,7 @@ function man_lsvar()
 
 function pdfman()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <man-page.n>";
 		return ${EX_USAGE};
 	fi;
@@ -209,14 +209,14 @@ function man_gitstaged()
 
 function grep_glibc_prototype()
 {
-	if ! [ -v 1 ]; then
+	if (($# != 1)); then
 		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
 		return ${EX_USAGE};
 	fi
 
 	find * -type f \
 	|grep '\.h$' \
-	|sort -V \
+	|sort \
 	|xargs pcregrep -Mn \
 	  "(?s)^[\w[][\w\s(,)[:\]]+\s+\**${1}\s*\([\w\s(,)[\]*]+?(...)?\)[\w\s(,)[:\]]*;" \
 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#60 lore raw

PATCH 1/1 cpow.3: Use 'complex' after the type consistently

In reply to Alejandro Colomar
---
 man3/cpow.3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man3/cpow.3 +3 -3
index 494b88f74..be93bff74 100644
@@ -11,10 +11,10 @@ cpow, cpowf, cpowl \- complex power function
 .nf
 .B #include <complex.h>
 .PP
-.BI "double complex cpow(double complex " x ", complex double " z ");"
-.BI "float complex cpowf(float complex " x ", complex float " z ");"
+.BI "double complex cpow(double complex " x ", double complex " z );
+.BI "float complex cpowf(float complex " x ", float complex " z );
 .BI "long double complex cpowl(long double complex " x ,
-.BI "                          complex long double " z ");"
+.BI "                          long double complex " z );
 .PP
 Link with \fI\-lm\fP.
 .fi
Signature · 1 line
2.31.1
#61 lore raw

Re: [PATCH] cpow.3: Use 'complex' after the type consistently

Hi Alex,

Quoted 1 line · Alejandro Colomar

Applied.

Thanks,

Michael

Quoted 23 lines
---
 man3/cpow.3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man3/cpow.3 +3 -3
index 494b88f74..be93bff74 100644
@@ -11,10 +11,10 @@ cpow, cpowf, cpowl \- complex power function
 .nf
 .B #include <complex.h>
 .PP
-.BI "double complex cpow(double complex " x ", complex double " z ");"
-.BI "float complex cpowf(float complex " x ", complex float " z ");"
+.BI "double complex cpow(double complex " x ", double complex " z );
+.BI "float complex cpowf(float complex " x ", float complex " z );
 .BI "long double complex cpowl(long double complex " x ,
-.BI "                          complex long double " z ");"
+.BI "                          long double complex " z );
 .PP
 Link with \fI\-lm\fP.
 .fi
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#62 lore raw

PATCH 1/1 Makefile: Fix bug when running in parallel

In reply to Alejandro Colomar

Prerequisites can run in parallel. This wouldn't make any sense when uninstalling and installing again.

For that, use consecutive commands, which run one after the other even with multiple cores.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 430090801..fdfaf9645 100644
@@ -20,7 +20,9 @@ INSTALL_DATA = $(INSTALL) -m 644
 INSTALL_DIR = $(INSTALL) -m 755 -d
 
 .PHONY: all
-all: remove install
+all:
+	$(MAKE) uninstall;
+	$(MAKE) install;
 
 # Use with
 #  make HTOPTS=whatever html
Signature · 1 line
2.31.1
#63 lore raw

Re: [PATCH] Makefile: Fix bug when running in parallel

Hi ALex,

Quoted 7 lines · Alejandro Colomar

Prerequisites can run in parallel. This wouldn't make any sense when uninstalling and installing again.

For that, use consecutive commands, which run one after the other even with multiple cores.

Applied.

Thanks,

Michael

Quoted 20 lines
---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 430090801..fdfaf9645 100644
@@ -20,7 +20,9 @@ INSTALL_DATA = $(INSTALL) -m 644
 INSTALL_DIR = $(INSTALL) -m 755 -d
 
 .PHONY: all
-all: remove install
+all:
+	$(MAKE) uninstall;
+	$(MAKE) install;
 
 # Use with
 #  make HTOPTS=whatever html
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#64 lore raw

PATCH 1/1 system_data_types.7: tfix

In reply to Alejandro Colomar

Those pages didn't exist. Fix the section number. I noticed the typo thanks to the HTML pages on man7.org.

---
 man7/system_data_types.7 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man7/system_data_types.7 +3 -3
index e038aab1e..ddabefd16 100644
@@ -374,7 +374,7 @@ POSIX.1-2001 and later.
 .BR getegid (2),
 .BR getgroups (2),
 .BR getresgid (2),
-.BR getgrnam (2),
+.BR getgrnam (3),
 .BR credentials (7)
 .RE
 .\"------------------------------------- id_t -------------------------/
@@ -675,7 +675,7 @@ C11 and later; POSIX.1-2001 and later.
 .IR "See also" :
 .BR setlocale (3),
 .BR localeconv (3),
-.BR charsets (5),
+.BR charsets (7),
 .BR locale (7)
 .RE
 .\"------------------------------------- ldiv_t -----------------------/
@@ -1534,7 +1534,7 @@ POSIX.1-2001 and later.
 .BR getuid (2),
 .BR geteuid (2),
 .BR getresuid (2),
-.BR getpwnam (2),
+.BR getpwnam (3),
 .BR credentials (7)
 .RE
 .\"------------------------------------- uintmax_t --------------------/
Signature · 1 line
2.31.1
#65 lore raw

Re: [PATCH] system_data_types.7: tfix

Hi Alex,

Quoted 4 lines · Alejandro Colomar

Those pages didn't exist. Fix the section number. I noticed the typo thanks to the HTML pages on man7.org.

Applied.

Thanks,

Michael

Quoted 36 lines
---
 man7/system_data_types.7 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
man7/system_data_types.7 +3 -3
index e038aab1e..ddabefd16 100644
@@ -374,7 +374,7 @@ POSIX.1-2001 and later.
 .BR getegid (2),
 .BR getgroups (2),
 .BR getresgid (2),
-.BR getgrnam (2),
+.BR getgrnam (3),
 .BR credentials (7)
 .RE
 .\"------------------------------------- id_t -------------------------/
@@ -675,7 +675,7 @@ C11 and later; POSIX.1-2001 and later.
 .IR "See also" :
 .BR setlocale (3),
 .BR localeconv (3),
-.BR charsets (5),
+.BR charsets (7),
 .BR locale (7)
 .RE
 .\"------------------------------------- ldiv_t -----------------------/
@@ -1534,7 +1534,7 @@ POSIX.1-2001 and later.
 .BR getuid (2),
 .BR geteuid (2),
 .BR getresuid (2),
-.BR getpwnam (2),
+.BR getpwnam (3),
 .BR credentials (7)
 .RE
 .\"------------------------------------- uintmax_t --------------------/
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#66 lore raw

PATCH 1/1 bswap.3: bswap_*() are implemented using functions

In reply to Alejandro Colomar

See <bits/byteswap.h> in glibc.
These macros call functions of the form __bswap_N(), which use uintN_t.

Eventhough it's true that they are macros,
it's transparent to the user.

The user will see their results casted to unsigned types after the conversion do to the underlying functions, so it's better to document these as the underlying functions, specifying the types.

---
 man3/bswap.3 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
man3/bswap.3 +7 -7
index 937ef0416..369daa411 100644
@@ -29,19 +29,19 @@ bswap_16, bswap_32, bswap_64 \- reverse order of bytes
 .nf
 .B #include <byteswap.h>
 .PP
-.BI bswap_16( x );
-.BI bswap_32( x );
-.BI bswap_64( x );
+.BI "uint16_t bswap_16(uint16_t " x );
+.BI "uint32_t bswap_32(uint32_t " x );
+.BI "uint64_t bswap_64(uint64_t " x );
 .fi
 .SH DESCRIPTION
-These macros return a value in which the order of the bytes
+These functions return a value in which the order of the bytes
 in their 2-, 4-, or 8-byte arguments is reversed.
 .SH RETURN VALUE
-These macros return the value of their argument with the bytes reversed.
+These functions return the value of their argument with the bytes reversed.
 .SH ERRORS
-These macros always succeed.
+These functions always succeed.
 .SH CONFORMING TO
-These macros are GNU extensions.
+These functions are GNU extensions.
 .SH EXAMPLES
 The program below swaps the bytes of the 8-byte integer supplied as
 its command-line argument.
Signature · 1 line
2.31.1
#67 lore raw

Re: [PATCH] bswap.3: bswap_*() are implemented using functions

Hi ALex,

Quoted 9 lines · Alejandro Colomar

See <bits/byteswap.h> in glibc.
These macros call functions of the form __bswap_N(), which use uintN_t.

Eventhough it's true that they are macros,
it's transparent to the user.

The user will see their results casted to unsigned types after the conversion do to the underlying functions,

^do^due

Quoted 4 lines

so it's better to document these as the underlying functions, specifying the types.

Applied. Thanks! (Typo in commit message fixed.)

Cheers,

Michael

Quoted 36 lines
---
 man3/bswap.3 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
man3/bswap.3 +7 -7
index 937ef0416..369daa411 100644
@@ -29,19 +29,19 @@ bswap_16, bswap_32, bswap_64 \- reverse order of bytes
 .nf
 .B #include <byteswap.h>
 .PP
-.BI bswap_16( x );
-.BI bswap_32( x );
-.BI bswap_64( x );
+.BI "uint16_t bswap_16(uint16_t " x );
+.BI "uint32_t bswap_32(uint32_t " x );
+.BI "uint64_t bswap_64(uint64_t " x );
 .fi
 .SH DESCRIPTION
-These macros return a value in which the order of the bytes
+These functions return a value in which the order of the bytes
 in their 2-, 4-, or 8-byte arguments is reversed.
 .SH RETURN VALUE
-These macros return the value of their argument with the bytes reversed.
+These functions return the value of their argument with the bytes reversed.
 .SH ERRORS
-These macros always succeed.
+These functions always succeed.
 .SH CONFORMING TO
-These macros are GNU extensions.
+These functions are GNU extensions.
 .SH EXAMPLES
 The program below swaps the bytes of the 8-byte integer supplied as
 its command-line argument.
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#68 lore raw

PATCH 1/1 .gitignore: Add file

In reply to Alejandro Colomar

Ignore everything new by default.

This avoids having to update the .gitignore when we need to ignore something new. It also avoids accidents that may add an unwanted temporary file.

Cc Debian man-pages <[email protected]>
Cc Dr. Tobias Quathamer <[email protected]>
---
 .gitignore | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 .gitignore
.gitignore new file +13 -0
new file mode 100644
index 000000000..9eb9fc096
@@ -0,0 +1,13 @@
+# Ignore everything new by default
+/*
+
+# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
+!/man?/
+/man?/**
+!/man?/**.?
+
+# These files change name in each release
+!/man-pages*.Announce
+!/man-pages*.lsm
+
+!/scripts/
Signature · 1 line
2.31.1
#69 lore raw

Re: [PATCH] .gitignore: Add file

Hi Alex,

Quoted 20 lines · Alejandro Colomar

Ignore everything new by default.

This avoids having to update the .gitignore when we need to ignore something new. It also avoids accidents that may add an unwanted temporary file.

Cc Debian man-pages <[email protected]>
Cc Dr. Tobias Quathamer <[email protected]>
---
 .gitignore | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 .gitignore
.gitignore new file +0 -0
new file mode 100644
index 000000000..9eb9fc096

.gitignore line 7

Quoted 7 lines
.gitignore new file +7 -0
@@ -0,0 +1,13 @@
+# Ignore everything new by default
+/*
+
+# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
+!/man?/
+/man?/**
+!/man?/**.?

Why '**'? Is '*' not sufficient in both of the above?

Thanks,

Michael

Quoted 7 lines
.gitignore new file +6 -0
+
+# These files change name in each release
+!/man-pages*.Announce
+!/man-pages*.lsm
+
+!/scripts/
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#70 lore raw

Re: [PATCH] .gitignore: Add file

Hi Michael,

Quoted 7 lines · Michael Kerrisk (man-pages)
Quoted 7 lines
.gitignore new file +1 -0
new file mode 100644
index 000000000..9eb9fc096
@@ -0,0 +1,13 @@
+# Ignore everything new by default
Quoted 8 lines

.gitignore line 7

Quoted 6 lines
.gitignore new file +6 -0
+/*
+
+# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
+!/man?/
+/man?/**
+!/man?/**.?

Why '**'? Is '*' not sufficient in both of the above?

You're right. '*' is sufficient. Please fix it yourself :)

Thanks,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#71 lore raw

Re: [PATCH] .gitignore: Add file

Quoted 19 lines · Alejandro Colomar (man-pages)

Hi Michael,

Quoted 7 lines · Michael Kerrisk (man-pages)
Quoted 7 lines
.gitignore new file +1 -0
new file mode 100644
index 000000000..9eb9fc096
@@ -0,0 +1,13 @@
+# Ignore everything new by default
Quoted 8 lines

.gitignore line 7

Quoted 6 lines
.gitignore new file +6 -0
+/*
+
+# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
+!/man?/
+/man?/**
+!/man?/**.?

Why '**'? Is '*' not sufficient in both of the above?

Quoted 1 line

You're right. '*' is sufficient. Please fix it yourself :)

Okay -- patch applied, and I've tweaked.

Cheers,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#72 lore raw

PATCH 1/1 Makefile: Simplify error handling

In reply to Alejandro Colomar

Instead of having to write '|| exit $$?' all the time, use the shell's '-Eeuo pipefail' options, which handle errors even better. However, pipefail needs bash, so POSIX sh (default) is not valid.

---

Hi Michael,

I'm not sure how much POSIX sh compatibility is needed for the man pages Makefile. There are probably projects out there that don't have bash, and still want to use it. So maybe we should't apply this. I don't know. Up to you.

Thanks,

Alex

 Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
Makefile +12 -12
index fdfaf9645..4df4f5846 100644
@@ -1,4 +1,5 @@
 #!/usr/bin/make -f
+SHELL = /bin/bash -Eeuo pipefail
 
 # Do not print "Entering directory ..."
 MAKEFLAGS += --no-print-directory
@@ -33,15 +34,14 @@ html: | builddirs-html
 	|while read f; do \
 		man2html $(HTOPTS) "$$f" \
 		|sed -e '1,2d' \
-		>"$(htmlbuilddir)/$${f}$(htmlext)" \
-			|| exit $$?; \
+		>"$(htmlbuilddir)/$${f}$(htmlext)"; \
 	done;
 
 .PHONY: builddirs-html
 builddirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(htmlbuilddir)/$$d"; \
 	done;
 
 .PHONY: install-html
@@ -49,57 +49,57 @@ install-html: | installdirs-html
 	cd $(htmlbuilddir) && \
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f"; \
 	done;
 
 .PHONY: installdirs-html
 installdirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d"; \
 	done;
 
 .PHONY: install
 install: | installdirs
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f"; \
 	done;
 
 .PHONY: installdirs
 installdirs:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d"; \
 	done;
 
 .PHONY: uninstall remove
 uninstall remove:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
-		rm -f "$(DESTDIR)$(mandir)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(mandir)/$$f"; \
+		rm -f "$(DESTDIR)$(mandir)/$$f".*; \
 	done;
 
 .PHONY: uninstall-html
 uninstall-html:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(htmldir_)/$$f".*; \
 	done;
 
 .PHONY: clean
 clean:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(htmlbuilddir)/$$f".* || exit $$?; \
+		rm -f "$(htmlbuilddir)/$$f".*; \
 	done;
 
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from https://lintian.debian.org/tags/groff-message.html
 .PHONY: check-groff-warnings
 check-groff-warnings:
-	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
+	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)"; \
 	for i in man?/*.[1-9]; \
 	do \
 		if grep -q 'SH.*NAME' "$$i"; then \
Signature · 1 line
2.31.1
#73 lore raw

Re: [PATCH] Makefile: Simplify error handling

Hi Alex,

Quoted 6 lines · Alejandro Colomar

Instead of having to write '|| exit $$?' all the time, use the shell's '-Eeuo pipefail' options, which handle errors even better. However, pipefail needs bash, so POSIX sh (default) is not valid.

Quoted 8 lines

---

Hi Michael,

I'm not sure how much POSIX sh compatibility is needed for the man pages Makefile. There are probably projects out there that don't have bash, and still want to use it. So maybe we should't apply this. I don't know. Up to you.

I think I'll skip this one. I'm not sure if it might cause some problem for Debian, where the default shall is dash(1), I believe.

Thanks,

Michael

Quoted 99 lines
 Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
Makefile +12 -12
index fdfaf9645..4df4f5846 100644
@@ -1,4 +1,5 @@
 #!/usr/bin/make -f
+SHELL = /bin/bash -Eeuo pipefail
 
 # Do not print "Entering directory ..."
 MAKEFLAGS += --no-print-directory
@@ -33,15 +34,14 @@ html: | builddirs-html
 	|while read f; do \
 		man2html $(HTOPTS) "$$f" \
 		|sed -e '1,2d' \
-		>"$(htmlbuilddir)/$${f}$(htmlext)" \
-			|| exit $$?; \
+		>"$(htmlbuilddir)/$${f}$(htmlext)"; \
 	done;
 
 .PHONY: builddirs-html
 builddirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(htmlbuilddir)/$$d"; \
 	done;
 
 .PHONY: install-html
@@ -49,57 +49,57 @@ install-html: | installdirs-html
 	cd $(htmlbuilddir) && \
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f"; \
 	done;
 
 .PHONY: installdirs-html
 installdirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d"; \
 	done;
 
 .PHONY: install
 install: | installdirs
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f"; \
 	done;
 
 .PHONY: installdirs
 installdirs:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d"; \
 	done;
 
 .PHONY: uninstall remove
 uninstall remove:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
-		rm -f "$(DESTDIR)$(mandir)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(mandir)/$$f"; \
+		rm -f "$(DESTDIR)$(mandir)/$$f".*; \
 	done;
 
 .PHONY: uninstall-html
 uninstall-html:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(htmldir_)/$$f".*; \
 	done;
 
 .PHONY: clean
 clean:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(htmlbuilddir)/$$f".* || exit $$?; \
+		rm -f "$(htmlbuilddir)/$$f".*; \
 	done;
 
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from https://lintian.debian.org/tags/groff-message.html
 .PHONY: check-groff-warnings
 check-groff-warnings:
-	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
+	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)"; \
 	for i in man?/*.[1-9]; \
 	do \
 		if grep -q 'SH.*NAME' "$$i"; then \
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#74 lore raw

Re: [PATCH] Makefile: Simplify error handling

[CC += Tobias, Mathias, Andrej]

Hi Michael,

Quoted 13 lines · Michael Kerrisk (man-pages)

Hi Alex,

Quoted 10 lines · Alejandro Colomar

Instead of having to write '|| exit $$?' all the time, use the shell's '-Eeuo pipefail' options, which handle errors even better. However, pipefail needs bash, so POSIX sh (default) is not valid.

---

Hi Michael,

Quoted 7 lines
Quoted 4 lines

I'm not sure how much POSIX sh compatibility is needed for the man pages Makefile. There are probably projects out there that don't have bash, and still want to use it. So maybe we should't apply this. I don't know. Up to you.

I think I'll skip this one. I'm not sure if it might cause some problem for Debian, where the default shall is dash(1), I believe.

Debian has dash(1) as the default _non-interactive_ shell, but also has bash(1) as the default _interactive_ shell. See <https://wiki.debian.org/Shell>.

I can confirm that using Debian (sid) myself (and having not installed bash(1) myself) I'm using this Makefile without any issue.

However, it's true that other smaller distros might not come with bash(1).

So still up to you :)

I forgot to CC the Debian maintainer of manpages in this patch this time; fixed. I also CCed the bash(1) and dash(1) Debian maintainers, just in case they have any comments.

Thanks,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#75 lore raw
In reply to Alejandro Colomar

Hi Alex,

Quoted 3 lines · Alejandro Colomar

fpurge(i_stream) does the same as fflush(i_stream), AFAIK.

Thanks. Patch applied.

Quoted 10 lines

---

Hi Michael,

This is the first of many separate patches that I had pending for you. Some of them I already sent you, and you should ignore the old versions. Some of them are new.
Please review them thoroughly, as I may have sent some patch that wasn't ready. In theory I have reviewed them enough, but there are a lot, and I might have overlooked something.

Some I looked at more closely. Others (e.g., patches to the scripts), I've taken on trust.

Quoted 1 line

When you review this "set", I'll send you another one about the SYNOPSIS.

Okay.

Cheers,

Michael

Quoted 16 lines
 man3/fflush.3 | 1 +
 1 file changed, 1 insertion(+)
man3/fflush.3 +1 -0
index 138c9bcfe..a600da2ae 100644
@@ -133,6 +133,7 @@ or
 .BR sync (2),
 .BR write (2),
 .BR fclose (3),
+.BR fpurge (3),
 .BR fileno (3),
 .BR fopen (3),
 .BR setbuf (3),
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#78 lore raw

Re: [PATCH] Makefile: Use standard features (IMPORTANT: default prefix changed)

Hi Michael,

Quoted 4 lines · Michael Kerrisk (man-pages)
Quoted 1 line

- Specify shebang

Why? It's not quite obvious to me, and the commit message should really explain...

Hmmm. I have some minor reasons to add it, but not a really good one.

* Some editors don't recognize 'Makefile' as a special name, so the shebang helps detecting which language the file is using (e.g., for coloring).

* I tend to subdivide a big Makefile into a small Makefile and many submakefiles stored in <./libexec/>. Those obviously need different names, and given that the makefile extension is not very standard (I use .mk), having a shebang helps knowing what the file is. After that, I also have it on the main Makefile for consistency. But here we only have one Makefile, so it doesn apply very much.

And some similar reasons.

Thanks,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#79 lore raw

Re: [PATCH] Makefile: Use standard features (IMPORTANT: default prefix changed)

Hi Alex,

Quoted 14 lines · Alejandro Colomar (man-pages)

Hi Michael,

Quoted 4 lines · Michael Kerrisk (man-pages)
Quoted 1 line

- Specify shebang

Why? It's not quite obvious to me, and the commit message should really explain...

Hmmm. I have some minor reasons to add it, but not a really good one.

* Some editors don't recognize 'Makefile' as a special name, so the shebang helps detecting which language the file is using (e.g., for coloring).

Quoted 6 lines

* I tend to subdivide a big Makefile into a small Makefile and many submakefiles stored in <./libexec/>. Those obviously need different names, and given that the makefile extension is not very standard (I use .mk), having a shebang helps knowing what the file is. After that, I
also have it on the main Makefile for consistency. But here we only
have one Makefile, so it doesn apply very much.

I think I'll remove it. It is kind of idiosyncratic, leaves the reader asking "why?".

Thanks,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
#80 lore raw

Re: [PATCH] Makefile: Use standard features (IMPORTANT: default prefix changed)

Quoted 10 lines · Michael Kerrisk (man-pages)

Hi Alex,

Quoted 7 lines · Alejandro Colomar (man-pages)

Hi Michael,

Quoted 4 lines · Michael Kerrisk (man-pages)
Quoted 1 line

- Specify shebang

Why? It's not quite obvious to me, and the commit message should really explain...

[...]

Quoted 2 lines

I think I'll remove it. It is kind of idiosyncratic, leaves the reader asking "why?".

Agreed.

Cheers,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/