Skip to contentSkip to conversation

get_nprocs.3, get_nprocs_conf.3, program_invocation_name.3, sysvipc.7: Match page title with file name

PATCH New Alejandro Colomar 2 participants 4 messages Oct 30, 2022 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

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

#1 lore raw

PATCH 2/2 get_nprocs.3, get_nprocs_conf.3, program_invocation_name.3, sysvipc.7: Match page title with file name

Manually tweak a few pages that weren't covered by the script used in the previous commit.

Cc Ingo Schwarze <[email protected]>
Cc "G. Branden Robinson" <[email protected]>
---
 man3/get_nprocs.3              | 96 +++++++++++++++++++++++++++++++++-
 man3/get_nprocs_conf.3         | 96 +---------------------------------
 man3/program_invocation_name.3 |  2 +-
 man7/sysvipc.7                 |  2 +-
 4 files changed, 98 insertions(+), 98 deletions(-)
man3/get_nprocs.3 +95 -1
index 63c03bac7..98478cb80 100644
@@ -1 +1,95 @@
-.so man3/get_nprocs_conf.3
+.\" Copyright (c) 2012, Petr Benas
+.\" and Copyright (c) 2012, Michael Kerrisk <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH get_nprocs 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+get_nprocs, get_nprocs_conf \- get number of processors
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <sys/sysinfo.h>
+.PP
+.B int get_nprocs(void);
+.B int get_nprocs_conf(void);
+.fi
+.SH DESCRIPTION
+The function
+.BR get_nprocs_conf ()
+returns the number of processors configured by the operating system.
+.PP
+The function
+.BR get_nprocs ()
+returns the number of processors currently available in the system.
+This may be less than the number returned by
+.BR get_nprocs_conf ()
+because processors may be offline (e.g., on hotpluggable systems).
+.SH RETURN VALUE
+As given in DESCRIPTION.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.ad l
+.nh
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface	Attribute	Value
+T{
+.BR get_nprocs (),
+.BR get_nprocs_conf ()
+T}	Thread safety	MT-Safe
+.TE
+.hy
+.ad
+.sp 1
+.SH STANDARDS
+These functions are GNU extensions.
+.SH NOTES
+The current
+.\" glibc 2.15
+implementation of these functions is rather expensive,
+since they open and parse files in the
+.I /sys
+filesystem each time they are called.
+.PP
+The following
+.BR sysconf (3)
+calls make use of the functions documented on this page
+to return the same information.
+.PP
+.in +4n
+.EX
+np = sysconf(_SC_NPROCESSORS_CONF);     /* processors configured */
+np = sysconf(_SC_NPROCESSORS_ONLN);     /* processors available */
+.EE
+.in
+.SH EXAMPLES
+The following example shows how
+.BR get_nprocs ()
+and
+.BR get_nprocs_conf ()
+can be used.
+.PP
+.\" SRC BEGIN (get_nprocs_conf.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/sysinfo.h>
+
+int
+main(void)
+{
+    printf("This system has %d processors configured and "
+            "%d processors available.\en",
+            get_nprocs_conf(), get_nprocs());
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR nproc (1)
man3/get_nprocs_conf.3 +1 -95

96 lines not on this page · raw message

man3/program_invocation_name.3 +1 -1
index 6110d826e..97d787470 100644
@@ -21,7 +21,7 @@
 .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 .\" %%%LICENSE_END
 .\"
-.TH INVOCATION_NAME 3 (date) "Linux man-pages (unreleased)"
+.TH program_invocation_name 3 (date) "Linux man-pages (unreleased)"
 .SH NAME
 program_invocation_name, program_invocation_short_name \- \
 obtain name used to invoke calling program
man7/sysvipc.7 +1 -1
index e801794b0..4b3576157 100644
@@ -2,7 +2,7 @@
 .\"
 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
 .\"
-.TH SVIPC 7 (date) "Linux man-pages (unreleased)"
+.TH sysvipc 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 sysvipc \- System V interprocess communication mechanisms
 .SH DESCRIPTION
Signature · 1 line
2.37.2
#2 lore raw

PATCH v2 2/3 Various pages: Use correct letter case in page titles (TH)

In reply to a message not in the archive

Semi-scripted change:

$ find man* -type f \
  | xargs grep -L '\.so' \
  | while read f; do
      P=$(basename $f);
      T=$(grep '\.TH ' $f | cut -f2,3 -d' ' | sed 's/ /./');
      p=$(echo $P | tr '[:upper:]' '[:lower:]');
      t=$(echo $T | tr '[:upper:]' '[:lower:]');
      Tn=$(echo $T | sed 's/\.[^.]\+$//')
      Pn=$(echo $P | sed 's/\.[^.]\+$//')
      N=$(man_section $f NAME \
      | sed -n '/NAME/,/ - /p' \
      | sed 's/ - .*//' \
      | grep -v '^NAME$' \
      | tr ', ' '\n' \
      | grep -i "^$Pn$" \
      | head -n1)

      test $P = $T \
      && test -n $N \
      && continue;

      if test "x$p" != "x$t"; then
          echo 1 $P $T $N;
      elif test -z "$N"; then
          sed -i "/\.TH /s/$Tn/$Pn/" $f;
      fi;

done;

Most of the changes produced by this script needed to be reverted, but the some of them were good.

Cc Ingo Schwarze <[email protected]>
Cc "G. Branden Robinson" <[email protected]>
---
 man7/man-pages.7            | 2 +-
 man7/persistent-keyring.7   | 2 +-
 man7/process-keyring.7      | 2 +-
 man7/session-keyring.7      | 2 +-
 man7/signal-safety.7        | 2 +-
 man7/thread-keyring.7       | 2 +-
 man7/user-keyring.7         | 2 +-
 man7/user-session-keyring.7 | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
man7/man-pages.7 +1 -1
index 03b0e6c15..73c0522d1 100644
@@ -7,7 +7,7 @@
 .\" 2007-05-30 created by mtk, using text from old man.7 plus
 .\" rewrites and additional text.
 .\"
-.TH MAN-PAGES 7 (date) "Linux man-pages (unreleased)"
+.TH man-pages 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 man-pages \- conventions for writing Linux man pages
 .SH SYNOPSIS
man7/persistent-keyring.7 +1 -1
index a93c9d84f..2a7fe49c2 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH PERSISTENT-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH persistent-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 persistent-keyring \- per-user persistent keyring
 .SH DESCRIPTION
man7/process-keyring.7 +1 -1
index ec6fbc8f1..864b05bcd 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH PROCESS-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH process-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 process-keyring \- per-process shared keyring
 .SH DESCRIPTION
man7/session-keyring.7 +1 -1
index 1921ce8ab..cece09fa4 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH SESSION-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH session-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 session-keyring \- session shared process keyring
 .SH DESCRIPTION
man7/signal-safety.7 +1 -1
index b6a563b91..8833dbc3e 100644
@@ -2,7 +2,7 @@
 .\"
 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
 .\"
-.TH SIGNAL-SAFETY 7 (date) "Linux man-pages (unreleased)"
+.TH signal-safety 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 signal-safety \- async-signal-safe functions
 .SH DESCRIPTION
man7/thread-keyring.7 +1 -1
index c093b8fed..b47f68243 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH THREAD-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH thread-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 thread-keyring \- per-thread keyring
 .SH DESCRIPTION
man7/user-keyring.7 +1 -1
index 4634f5570..a6e29c9db 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH USER-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH user-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 user-keyring \- per-user keyring
 .SH DESCRIPTION
man7/user-session-keyring.7 +1 -1
index 009c404aa..bd0ba3d23 100644
@@ -3,7 +3,7 @@
 .\"
 .\" SPDX-License-Identifier: GPL-2.0-or-later
 .\"
-.TH USER-SESSION-KEYRING 7 (date) "Linux man-pages (unreleased)"
+.TH user-session-keyring 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 user-session-keyring \- per-user default session keyring
 .SH DESCRIPTION
Signature · 1 line
2.37.2
#3 lore raw

PATCH v2 3/3 get_nprocs.3, get_nprocs_conf.3, program_invocation_name.3, sysvipc.7: Match page title with file name and NAME section

In reply to a message not in the archive

Manually tweak a few pages that weren't covered by the scripts used in the 2 previous commits.

Cc Ingo Schwarze <[email protected]>
Cc "G. Branden Robinson" <[email protected]>
---
 man3/get_nprocs.3              | 96 +++++++++++++++++++++++++++++++++-
 man3/get_nprocs_conf.3         | 96 +---------------------------------
 man3/program_invocation_name.3 |  2 +-
 man7/sysvipc.7                 |  2 +-
 4 files changed, 98 insertions(+), 98 deletions(-)
man3/get_nprocs.3 +95 -1
index 63c03bac7..98478cb80 100644
@@ -1 +1,95 @@
-.so man3/get_nprocs_conf.3
+.\" Copyright (c) 2012, Petr Benas
+.\" and Copyright (c) 2012, Michael Kerrisk <[email protected]>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH get_nprocs 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+get_nprocs, get_nprocs_conf \- get number of processors
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <sys/sysinfo.h>
+.PP
+.B int get_nprocs(void);
+.B int get_nprocs_conf(void);
+.fi
+.SH DESCRIPTION
+The function
+.BR get_nprocs_conf ()
+returns the number of processors configured by the operating system.
+.PP
+The function
+.BR get_nprocs ()
+returns the number of processors currently available in the system.
+This may be less than the number returned by
+.BR get_nprocs_conf ()
+because processors may be offline (e.g., on hotpluggable systems).
+.SH RETURN VALUE
+As given in DESCRIPTION.
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.ad l
+.nh
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface	Attribute	Value
+T{
+.BR get_nprocs (),
+.BR get_nprocs_conf ()
+T}	Thread safety	MT-Safe
+.TE
+.hy
+.ad
+.sp 1
+.SH STANDARDS
+These functions are GNU extensions.
+.SH NOTES
+The current
+.\" glibc 2.15
+implementation of these functions is rather expensive,
+since they open and parse files in the
+.I /sys
+filesystem each time they are called.
+.PP
+The following
+.BR sysconf (3)
+calls make use of the functions documented on this page
+to return the same information.
+.PP
+.in +4n
+.EX
+np = sysconf(_SC_NPROCESSORS_CONF);     /* processors configured */
+np = sysconf(_SC_NPROCESSORS_ONLN);     /* processors available */
+.EE
+.in
+.SH EXAMPLES
+The following example shows how
+.BR get_nprocs ()
+and
+.BR get_nprocs_conf ()
+can be used.
+.PP
+.\" SRC BEGIN (get_nprocs_conf.c)
+.EX
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/sysinfo.h>
+
+int
+main(void)
+{
+    printf("This system has %d processors configured and "
+            "%d processors available.\en",
+            get_nprocs_conf(), get_nprocs());
+    exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR nproc (1)
man3/get_nprocs_conf.3 +1 -95

96 lines not on this page · raw message

man3/program_invocation_name.3 +1 -1
index 6110d826e..97d787470 100644
@@ -21,7 +21,7 @@
 .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 .\" %%%LICENSE_END
 .\"
-.TH INVOCATION_NAME 3 (date) "Linux man-pages (unreleased)"
+.TH program_invocation_name 3 (date) "Linux man-pages (unreleased)"
 .SH NAME
 program_invocation_name, program_invocation_short_name \- \
 obtain name used to invoke calling program
man7/sysvipc.7 +1 -1
index e801794b0..4b3576157 100644
@@ -2,7 +2,7 @@
 .\"
 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
 .\"
-.TH SVIPC 7 (date) "Linux man-pages (unreleased)"
+.TH sysvipc 7 (date) "Linux man-pages (unreleased)"
 .SH NAME
 sysvipc \- System V interprocess communication mechanisms
 .SH DESCRIPTION
Signature · 1 line
2.37.2
#4 lore raw

groff 1.23 status (was: [PATCH 1/2] All pages: Use correct letter case in page titles (TH))

In reply to a message not in the archive

Hi Alex!

Quoted 5 lines · Alejandro Colomar

I finally fixed the page titles for the Linux man-pages, using the same letter case as in the file name. I didn't compare against the NAME, as it would have complicated the script, and they normally match. I don't know from the top of my head if it's 100%, but we can assume some risk there.

For those to whom this change is coming as an unpleasant surprise, the forthcoming groff 1.23.0 features an option that will reverse this change at rendering time.

From groff_man(7):

-rCT=1 Capitalize titles, setting the man page title (the first
argument to .TH) in full capitals in headers and footers. This transformation is off by default because it discards case distinction information.

This register can also be set in a site-local "man.local" file to force it on for all pages. On Debian-based systems, this file is in /etc/groff. The following line will do the trick.

.nr CT 1

The groff_man_style(7) man page offers further examples of such rendering customization.

/usr/local/share/groff/site-tmac/man.local
Put site‐local changes and customizations into this file.

.\" Use narrower indentation on terminals and similar. .if n .nr IN 4n
.\" Put only one space after the end of a sentence. .ss 12 0 \" See groff(7).
.\" Keep pages narrow even on wide terminals. .if n .if \n[LL]>78n .nr LL 78n
.\" Ensure hyperlinks are enabled for terminals. .nr U 1

On multi‐user systems, it is more considerate to users whose preferences may differ from the administrator’s to be less aggressive with such settings, or to permit their override with a user‐specific man.local file. This can be achieved by placing one or both of following requests at the end of the site‐local file.
.soquiet \V[XDG_CONFIG_HOME]/man.local .soquiet \V[HOME]/.man.local
However, a security‐sandboxed man(1) program may lack permission to open such files.

Bertrand Garrigues and I hope to have the second groff 1.23.0 release candidate out very soon; the list of unmet release-goal tickets is almost exhausted.[1] I encourage people to have a look at what's forthcoming in groff 1.23 and try building it from source; feedback will improve the release.

https://git.savannah.gnu.org/cgit/groff.git/tree/ANNOUNCE
is a template for the release announcement.

https://git.savannah.gnu.org/cgit/groff.git/tree/NEWS
is a complete (we believe) list of user-visible changes in 1.23.

https://git.savannah.gnu.org/cgit/groff.git/tree/INSTALL.REPO
is a list of instructions for building groff from a Git checkout.

git clone https://git.savannah.gnu.org/git/groff.git
will get you started.

Regards,
Branden

[1] https://savannah.gnu.org/bugs/index.php?go_report=Apply&group=groff&func=&set=custom&msort=0&report_id=225&advsrch=0&bug_id=&summary=&submitted_by=0&resolution_id=0&assigned_to=0&bug_group_id=0&status_id=1&severity=0&category_id=0&plan_release_id=103&history_search=0&history_field=0&history_event=modified&history_date_dayfd=30&history_date_monthfd=10&history_date_yearfd=2022&chunksz=50&spamscore=5&boxoptionwanted=1#options