random.4, gai.conf.5, slabinfo.5, cgroup_namespaces.7, feature_test_macros.7, keyrings.7, locale.7, man-pages.7, sock_diag.7: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-19 10:56:06 +02:00
parent 010c75a2bb
commit 9c40f2b9ba
9 changed files with 73 additions and 67 deletions

View File

@ -153,11 +153,13 @@ If your system does not have
\fI/dev/random\fP and \fI/dev/urandom\fP created already, they \fI/dev/random\fP and \fI/dev/urandom\fP created already, they
can be created with the following commands: can be created with the following commands:
.PP .PP
.nf .in +4n
mknod \-m 666 /dev/random c 1 8 .EX
mknod \-m 666 /dev/urandom c 1 9 mknod \-m 666 /dev/random c 1 8
chown root:root /dev/random /dev/urandom mknod \-m 666 /dev/urandom c 1 9
.fi chown root:root /dev/random /dev/urandom
.EE
.in
.PP .PP
When a Linux system starts up without much operator interaction, When a Linux system starts up without much operator interaction,
the entropy pool may be in a fairly predictable state. the entropy pool may be in a fairly predictable state.
@ -168,38 +170,42 @@ entropy pool information across shut-downs and start-ups.
To do this, add the lines to an appropriate script To do this, add the lines to an appropriate script
which is run during the Linux system start-up sequence: which is run during the Linux system start-up sequence:
.PP .PP
.nf .in +4n
echo "Initializing random number generator..." .EX
random_seed=/var/run/random-seed echo "Initializing random number generator..."
# Carry a random seed from start-up to start-up random_seed=/var/run/random-seed
# Load and then save the whole entropy pool # Carry a random seed from start-up to start-up
if [ \-f $random_seed ]; then # Load and then save the whole entropy pool
cat $random_seed >/dev/urandom if [ \-f $random_seed ]; then
else cat $random_seed >/dev/urandom
touch $random_seed else
fi touch $random_seed
chmod 600 $random_seed fi
poolfile=/proc/sys/kernel/random/poolsize chmod 600 $random_seed
[ \-r $poolfile ] && bits=$(cat $poolfile) || bits=4096 poolfile=/proc/sys/kernel/random/poolsize
bytes=$(expr $bits / 8) [ \-r $poolfile ] && bits=$(cat $poolfile) || bits=4096
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes bytes=$(expr $bits / 8)
.fi dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
.EE
.in
.PP .PP
Also, add the following lines in an appropriate script which is Also, add the following lines in an appropriate script which is
run during the Linux system shutdown: run during the Linux system shutdown:
.PP .PP
.nf .in +4n
# Carry a random seed from shut-down to start-up .EX
# Save the whole entropy pool # Carry a random seed from shut-down to start-up
echo "Saving random seed..." # Save the whole entropy pool
random_seed=/var/run/random-seed echo "Saving random seed..."
touch $random_seed random_seed=/var/run/random-seed
chmod 600 $random_seed touch $random_seed
poolfile=/proc/sys/kernel/random/poolsize chmod 600 $random_seed
[ \-r $poolfile ] && bits=$(cat $poolfile) || bits=4096 poolfile=/proc/sys/kernel/random/poolsize
bytes=$(expr $bits / 8) [ \-r $poolfile ] && bits=$(cat $poolfile) || bits=4096
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes bytes=$(expr $bits / 8)
.fi dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
.EE
.in
.PP .PP
In the above examples, we assume Linux 2.6.0 or later, where In the above examples, we assume Linux 2.6.0 or later, where
.IR /proc/sys/kernel/random/poolsize .IR /proc/sys/kernel/random/poolsize

View File

@ -80,7 +80,8 @@ file is supported by glibc since version 2.5.
The default table according to RFC\ 3484 would be specified with the The default table according to RFC\ 3484 would be specified with the
following configuration file: following configuration file:
.PP .PP
.nf .in +4n
.EX
label ::1/128 0 label ::1/128 0
label ::/0 1 label ::/0 1
label 2002::/16 2 label 2002::/16 2
@ -91,7 +92,8 @@ precedence ::/0 40
precedence 2002::/16 30 precedence 2002::/16 30
precedence ::/96 20 precedence ::/96 20
precedence ::ffff:0:0/96 10 precedence ::ffff:0:0/96 10
.fi .EE
.in
.\" .SH AUTHOR .\" .SH AUTHOR
.\" Ulrich Drepper <drepper@redhat.com> .\" Ulrich Drepper <drepper@redhat.com>
.\" .\"

View File

@ -39,7 +39,7 @@ The following (edited) output shows an example of the
contents of this file: contents of this file:
.PP .PP
.in 0 .in 0
.nf .EX
$ \fBsudo cat /proc/slabinfo\fP $ \fBsudo cat /proc/slabinfo\fP
slabinfo - version: 2.1 slabinfo - version: 2.1
# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> ... # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> ...
@ -95,7 +95,11 @@ the tunables for a particular cache can be set by writing
lines of the following form to lines of the following form to
.IR /proc/slabinfo : .IR /proc/slabinfo :
.PP .PP
# \fBecho 'name limit batchcount sharedfactor' > /proc/slabinfo\fP .in +4n
.EX
# \fBecho 'name limit batchcount sharedfactor' > /proc/slabinfo\fP
.EE
.in
.PP .PP
Here, Here,
.I name .I name

View File

@ -88,13 +88,11 @@ Next, we use
.BR unshare (1) .BR unshare (1)
to create a process running a new shell in new cgroup and mount namespaces: to create a process running a new shell in new cgroup and mount namespaces:
.PP .PP
.nf
.EX .EX
.in +4n .in +4n
# \fBunshare \-Cm bash\fP # \fBunshare \-Cm bash\fP
.in .in
.EE .EE
.fi
.PP .PP
We then inspect the We then inspect the
.IR /proc/[pid]/cgroup .IR /proc/[pid]/cgroup
@ -105,7 +103,6 @@ command, a process that is in the original cgroup namespace
with PID 1), and a process in a sibling cgroup with PID 1), and a process in a sibling cgroup
.RI ( sub2 ): .RI ( sub2 ):
.PP .PP
.nf
.EX .EX
.in +4n .in +4n
$ \fBcat /proc/self/cgroup | grep freezer\fP $ \fBcat /proc/self/cgroup | grep freezer\fP
@ -116,7 +113,6 @@ $ \fBcat /proc/20124/cgroup | grep freezer\fP
7:freezer:/../sub2 7:freezer:/../sub2
.in .in
.EE .EE
.fi
.PP .PP
From the output of the first command, From the output of the first command,
we see that the freezer cgroup membership of the new shell we see that the freezer cgroup membership of the new shell
@ -136,14 +132,12 @@ However, when we look in
.IR /proc/self/mountinfo .IR /proc/self/mountinfo
we see the following anomaly: we see the following anomaly:
.PP .PP
.nf
.EX .EX
.in +4n .in +4n
# \fBcat /proc/self/mountinfo | grep freezer\fP # \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 /.. /sys/fs/cgroup/freezer ... 155 145 0:32 /.. /sys/fs/cgroup/freezer ...
.in .in
.EE .EE
.fi
.PP .PP
The fourth field of this line The fourth field of this line
.RI ( /.. ) .RI ( /.. )
@ -159,7 +153,6 @@ filesystem corresponding to our initial shell process's cgroup namespace
We need to remount the freezer cgroup filesystem We need to remount the freezer cgroup filesystem
inside this cgroup namespace, after which we see the expected results: inside this cgroup namespace, after which we see the expected results:
.PP .PP
.nf
.EX .EX
.in +4n .in +4n
# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events # \fBmount \-\-make\-rslave /\fP # Don't propagate mount events
@ -170,7 +163,6 @@ inside this cgroup namespace, after which we see the expected results:
155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ... 155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ...
.in .in
.EE .EE
.fi
.PP .PP
Use of cgroup namespaces requires a kernel that is configured with the Use of cgroup namespaces requires a kernel that is configured with the
.B CONFIG_CGROUPS .B CONFIG_CGROUPS

View File

@ -85,13 +85,13 @@ from
.I either .I either
of the following macro of the following macro
definitions must be made before including any header files: definitions must be made before including any header files:
.RS .PP
.nf .in +4n
.EX
#define _BSD_SOURCE #define _BSD_SOURCE
#define _XOPEN_SOURCE /* or any value < 500 */ #define _XOPEN_SOURCE /* or any value < 500 */
.fi .EE
.RE .in
.PP .PP
Alternatively, equivalent definitions can be included in the Alternatively, equivalent definitions can be included in the
compilation command: compilation command:

View File

@ -540,8 +540,8 @@ An example of the data that one might see in this file
(with the columns numbered for easy reference below) (with the columns numbered for easy reference below)
is the following: is the following:
.IP .IP
.nf
.in 0n .in 0n
.EX
(1) (2) (3)(4) (5) (6) (7) (8) (9) (1) (2) (3)(4) (5) (6) (7) (8) (9)
009a2028 I--Q--- 1 perm 3f010000 1000 1000 user krb_ccache:primary: 12 009a2028 I--Q--- 1 perm 3f010000 1000 1000 user krb_ccache:primary: 12
1806c4ba I--Q--- 1 perm 3f010000 1000 1000 keyring _pid: 2 1806c4ba I--Q--- 1 perm 3f010000 1000 1000 keyring _pid: 2

View File

@ -260,9 +260,9 @@ Values about local numeric formatting is made available in a
returned by the returned by the
.BR localeconv (3) .BR localeconv (3)
function, which has the following declaration: function, which has the following declaration:
.in +2n .PP
.nf .in +4n
.EX
struct lconv { struct lconv {
/* Numeric (nonmonetary) information */ /* Numeric (nonmonetary) information */

View File

@ -174,9 +174,9 @@ Most manual pages should include at least the
sections. sections.
Arrange a new manual page so that sections Arrange a new manual page so that sections
are placed in the order shown in the list. are placed in the order shown in the list.
.in +0.5i .PP
.in +4n
.nf .nf
\fBNAME\fP \fBNAME\fP
\fBSYNOPSIS\fP \fBSYNOPSIS\fP
CONFIGURATION [Normally only in Section 4] CONFIGURATION [Normally only in Section 4]
@ -203,7 +203,7 @@ EXAMPLE
.\" AUTHORS sections are discouraged .\" AUTHORS sections are discouraged
.\" AUTHORS [Discouraged] .\" AUTHORS [Discouraged]
\fBSEE ALSO\fP \fBSEE ALSO\fP
.EE .fi
.in .in
.PP .PP
.IR "Where a traditional heading would apply" ", " "please use it" ; .IR "Where a traditional heading would apply" ", " "please use it" ;
@ -519,11 +519,11 @@ For example, in the
man page, references to the subject of the page would be written as: man page, references to the subject of the page would be written as:
.BR fcntl (). .BR fcntl ().
The preferred way to write this in the source file is: The preferred way to write this in the source file is:
.nf .PP
.EX
.BR fcntl () .BR fcntl ()
.EE
.fi .PP
(Using this format, rather than the use of "\\fB...\\fP()" (Using this format, rather than the use of "\\fB...\\fP()"
makes it easier to write tools that parse man page source files.) makes it easier to write tools that parse man page source files.)
.\" .\"
@ -588,11 +588,11 @@ formatted in Roman (normal) font, without any
separating spaces (e.g., separating spaces (e.g.,
.BR intro (2)). .BR intro (2)).
The preferred way to write this in the source file is: The preferred way to write this in the source file is:
.nf .PP
.EX
.BR intro (2) .BR intro (2)
.EE
.fi .PP
(Including the section number in cross references lets tools like (Including the section number in cross references lets tools like
.BR man2html (1) .BR man2html (1)
create properly hyperlinked pages.) create properly hyperlinked pages.)
@ -628,7 +628,9 @@ except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise. language requirements (e.g., identifier names) dictate otherwise.
For example: For example:
.PP .PP
.EX
.SS Unicode under Linux .SS Unicode under Linux
.EE
.\" .\"
.SS Indentation of structure definitions, shell session logs, and so on .SS Indentation of structure definitions, shell session logs, and so on
When structure definitions, shell session logs, and so on are included When structure definitions, shell session logs, and so on are included

View File

@ -641,7 +641,7 @@ were introduced in Linux 3.6.
The following example program prints inode number, peer's inode number, The following example program prints inode number, peer's inode number,
and name of all UNIX domain sockets in the current namespace. and name of all UNIX domain sockets in the current namespace.
.PP .PP
.nf .EX
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -834,7 +834,7 @@ main(void)
close(fd); close(fd);
return ret; return ret;
} }
.fi .EE
.SH SEE ALSO .SH SEE ALSO
.BR netlink (3), .BR netlink (3),
.BR rtnetlink (3), .BR rtnetlink (3),