_syscall.2, shmget.2, stat.2, syscall.2, sysctl.2, utimensat.2, wait.2, CPU_SET.3, a64l.3, alloca.3, atexit.3, basename.3, cacos.3, cacosh.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, ccos.3, ccosh.3, cexp.3, cimag.3, clearenv.3, clog.3, conj.3, cosh.3, creal.3, csin.3, csinh.3, ctan.3, ctanh.3, difftime.3, div.3, dl_iterate_phdr.3, encrypt.3, envz_add.3, expm1.3, fenv.3, fmtmsg.3, fopen.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getcontext.3, getline.3, getpt.3, getpwnam.3, getsubopt.3, getttyent.3, getutent.3, hsearch.3, log1p.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbsinit.3, mempcpy.3, mtrace.3, nan.3, nl_langinfo.3, printf.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, sigvec.3: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-18 22:48:35 +02:00
parent 0a92ddef8b
commit 207050fa9e
72 changed files with 294 additions and 253 deletions

View File

@ -140,7 +140,7 @@ passed by-value or by-pointer (for aggregates like structs).
.\" Otherwise, the use of a _syscall macro is required.
.\"
.SH EXAMPLE
.nf
.EX
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@ -169,9 +169,9 @@ main(void)
s_info.procs);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SS Sample output
.nf
.EX
code error = 0
uptime = 502034s
Load: 1 min 13376 / 5 min 5504 / 15 min 1152
@ -179,7 +179,7 @@ RAM: total 15343616 / free 827392 / shared 8237056
Memory in buffers = 5066752
Swap: total 27881472 / free 24698880
Number of processes = 40
.fi
.EE
.SH SEE ALSO
.BR intro (2),
.BR syscall (2),

View File

@ -126,6 +126,7 @@ Thus, the above two constants are defined as:
.IP
.nf
.in +4
.EX
#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
.EE

View File

@ -629,8 +629,8 @@ The following program calls
and displays selected fields in the returned
.I stat
structure.
.nf
.PP
.EX
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
@ -691,7 +691,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR ls (1),
.BR stat (1),

View File

@ -301,7 +301,7 @@ arguments 5 through 8 on the user stack.
Note that these tables don't cover the entire calling convention\(emsome
architectures may indiscriminately clobber other registers not listed here.
.SH EXAMPLE
.nf
.EX
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
@ -316,7 +316,7 @@ main(int argc, char *argv[])
tid = syscall(SYS_gettid);
syscall(SYS_tgkill, getpid(), tid, SIGHUP);
}
.fi
.EE
.SH SEE ALSO
.BR _syscall (2),
.BR intro (2),

View File

@ -141,7 +141,7 @@ Not all available objects are properly documented.
It is not yet possible to change operating system by writing to
.IR /proc/sys/kernel/ostype .
.SH EXAMPLE
.nf
.EX
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
@ -177,6 +177,6 @@ main(void)
printf("This machine is running %*s\\n", osnamelth, osname);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR proc (5)

View File

@ -473,10 +473,12 @@ the file referred to by the file descriptor
Using this feature, the call
.I "futimens(fd,\ times)"
is implemented as:
.nf
utimensat(fd, NULL, times, 0);
.fi
.PP
.in +4n
.EX
utimensat(fd, NULL, times, 0);
.EE
.in
.PP
Note, however, that the glibc wrapper for
.BR utimensat ()

View File

@ -114,10 +114,12 @@ children terminates.
The call
.I wait(&wstatus)
is equivalent to:
.nf
waitpid(\-1, &wstatus, 0);
.fi
.PP
.in +4n
.EX
waitpid(\-1, &wstatus, 0);
.EE
.in
.PP
The
.BR waitpid ()

View File

@ -316,7 +316,7 @@ These bugs are fixed in glibc 2.9.
The following program demonstrates the use of some of the macros
used for dynamically allocated CPU sets.
.PP
.nf
.EX
#define _GNU_SOURCE
#include <sched.h>
#include <stdlib.h>
@ -355,7 +355,7 @@ main(int argc, char *argv[])
CPU_FREE(cpusetp);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR sched_setaffinity (2),
.BR pthread_attr_setaffinity_np (3),

View File

@ -50,17 +50,17 @@ and
sign-extends its 32-bit result.
.PP
The 64 digits in the base-64 system are:
.PP
.RS
.nf
\&\(aq.\(aq represents a 0
\&\(aq/\(aq represents a 1
0-9 represent 2-11
A-Z represent 12-37
a-z represent 38-63
.fi
.RE
.PP
So 123 = 59*64^0 + 1*64^1 = "v/".
.SH ATTRIBUTES
For an explanation of the terms used in this section, see

View File

@ -133,13 +133,15 @@ Otherwise, (without an \-ansi or \-std=c* option) the glibc version of
includes
.I <alloca.h>
and that contains the lines:
.nf
#ifdef __GNUC__
#define alloca(size) __builtin_alloca (size)
#endif
.fi
.PP
.in +4n
.EX
#ifdef __GNUC__
#define alloca(size) __builtin_alloca (size)
#endif
.EE
.in
.PP
with messy consequences if one has a private version of this function.
.PP
The fact that the code is inlined means that it is impossible

View File

@ -144,7 +144,7 @@ Since glibc 2.2.3,
can be used within a shared library to establish functions
that are called when the shared library is unloaded.
.SH EXAMPLE
.nf
.EX
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -172,7 +172,7 @@ main(void)
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR _exit (2),
.BR dlopen (3),

View File

@ -147,14 +147,14 @@ There are two different versions of
.BR basename ()
- the POSIX version described above, and the GNU version, which one gets
after
.br
.nf
.PP
.in +4n
.EX
.BR " #define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.br
.B " #include <string.h>"
.fi
.EE
.in
.PP
The GNU version never modifies its argument, and returns the
empty string when
.I path

View File

@ -27,8 +27,8 @@ The real part of
is chosen in the interval [0,pi].
.PP
One has:
.PP
.nf
cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
.fi
.SH VERSIONS
@ -50,7 +50,7 @@ T} Thread safety MT-Safe
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
.SH EXAMPLE
.nf
.EX
/* Link with "\-lm" */
#include <complex.h>
@ -81,7 +81,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR ccos (3),
.BR clog (3),

View File

@ -30,8 +30,8 @@ The real part of
is chosen nonnegative.
.PP
One has:
.PP
.nf
cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
.fi
.SH VERSIONS
@ -53,7 +53,7 @@ T} Thread safety MT-Safe
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
.SH EXAMPLE
.nf
.EX
/* Link with "\-lm" */
#include <complex.h>
@ -81,7 +81,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR acosh (3),
.BR cabs (3),

View File

@ -35,11 +35,11 @@ and
.IR "y\ =\ cimag(z)" .
.PP
Or one may use polar coordinates and gets
.PP
.nf
z = r * cexp(I * a)
.fi
.PP
where
.IR "r\ =\ cabs(z)"
is the "radius", the "modulus", the absolute value of
@ -50,8 +50,8 @@ is the "phase angle", the argument of
.IR z .
.PP
One has:
.PP
.nf
tan(carg(z)) = cimag(z) / creal(z)
.fi
.SH RETURN VALUE

View File

@ -26,8 +26,8 @@ The real part of
is chosen in the interval [\-pi/2,pi/2].
.PP
One has:
.PP
.nf
casin(z) = \-i clog(iz + csqrt(1 \- z * z))
.fi
.SH VERSIONS

View File

@ -26,8 +26,8 @@ The imaginary part of
is chosen in the interval [\-pi/2,pi/2].
.PP
One has:
.PP
.nf
casinh(z) = clog(z + csqrt(z * z + 1))
.fi
.SH VERSIONS

View File

@ -25,8 +25,8 @@ If \fIy\ =\ catan(z)\fP, then \fIz\ =\ ctan(y)\fP.
The real part of y is chosen in the interval [\-pi/2,pi/2].
.PP
One has:
.PP
.nf
catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
.fi
.SH VERSIONS
@ -48,7 +48,7 @@ T} Thread safety MT-Safe
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
.SH EXAMPLE
.nf
.EX
/* Link with "\-lm" */
#include <complex.h>
@ -77,7 +77,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR ccos (3),
.BR clog (3),

View File

@ -27,8 +27,8 @@ The imaginary part of
is chosen in the interval [\-pi/2,pi/2].
.PP
One has:
.PP
.nf
catanh(z) = 0.5 * (clog(1 + z) \- clog(1 \- z))
.fi
.SH VERSIONS
@ -50,7 +50,7 @@ T} Thread safety MT-Safe
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
.SH EXAMPLE
.nf
.EX
/* Link with "\-lm" */
#include <complex.h>
@ -78,7 +78,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR atanh (3),
.BR cabs (3),

View File

@ -22,8 +22,8 @@ These functions calculate the complex cosine of
.IR z .
.PP
The complex cosine function is defined as:
.PP
.nf
ccos(z) = (exp(i * z) + exp(\-i * z)) / 2
.fi
.SH VERSIONS

View File

@ -22,8 +22,8 @@ These functions calculate the complex hyperbolic cosine of
.IR z .
.PP
The complex hyperbolic cosine function is defined as:
.PP
.nf
ccosh(z) = (exp(z)+exp(\-z))/2
.fi
.SH VERSIONS

View File

@ -23,8 +23,8 @@ raised to the power of
.IR z .
.PP
One has:
.PP
.nf
cexp(I * z) = ccos(z) + I * csin(z)
.fi
.SH VERSIONS

View File

@ -22,8 +22,8 @@ These functions return the imaginary part of the complex number
.IR z .
.PP
One has:
.PP
.nf
z = creal(z) + I * cimag(z)
.fi
.SH VERSIONS

View File

@ -92,11 +92,13 @@ and rejected
On systems where
.BR clearenv ()
is unavailable, the assignment
.nf
environ = NULL;
.fi
.PP
.in +4n
.EX
environ = NULL;
.EE
.in
.PP
will probably do.
.PP
The

View File

@ -32,8 +32,8 @@ The imaginary part of
is chosen in the interval [\-pi,pi].
.PP
One has:
.PP
.nf
clog(z) = log(cabs(z)) + I * carg(z)
.fi
.PP

View File

@ -23,8 +23,8 @@ These functions return the complex conjugate value of
That is the value obtained by changing the sign of the imaginary part.
.PP
One has:
.PP
.nf
cabs(z) = csqrt(z * conj(z))
.fi
.SH VERSIONS

View File

@ -67,8 +67,8 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
These functions return the hyperbolic cosine of
.IR x ,
which is defined mathematically as:
.PP
.nf
cosh(x) = (exp(x) + exp(\-x)) / 2
.fi
.SH RETURN VALUE

View File

@ -22,8 +22,8 @@ These functions return the real part of the complex number
.IR z .
.PP
One has:
.PP
.nf
z = creal(z) + I * cimag(z)
.fi
.SH VERSIONS

View File

@ -22,8 +22,8 @@ These functions calculate the complex sine of
.IR z .
.PP
The complex sine function is defined as:
.PP
.nf
csin(z) = (exp(i * z) \- exp(\-i * z)) / (2 * i)
.fi
.SH VERSIONS

View File

@ -22,8 +22,8 @@ These functions calculate the complex hyperbolic sine of
.IR z .
.PP
The complex hyperbolic sine function is defined as:
.PP
.nf
csinh(z) = (exp(z)\-exp(\-z))/2
.fi
.SH VERSIONS

View File

@ -22,8 +22,8 @@ These functions calculate the complex tangent of
.IR z .
.PP
The complex tangent function is defined as:
.PP
.nf
ctan(z) = csin(z) / ccos(z)
.fi
.SH VERSIONS

View File

@ -23,8 +23,8 @@ These functions calculate the complex hyperbolic tangent of
.PP
The complex hyperbolic tangent function is defined
mathematically as:
.PP
.nf
ctanh(z) = csinh(z) / ccosh(z)
.fi
.SH VERSIONS

View File

@ -64,13 +64,13 @@ On a POSIX system,
.I time_t
is an arithmetic type, and one could just
define
.RS
.nf
.PP
.in +4n
.EX
#define difftime(t1,t0) (double)(t1 \- t0)
.fi
.RE
.EX
.in
.PP
when the possible overflow in the subtraction is not a concern.
.SH SEE ALSO
.BR date (1),

View File

@ -108,11 +108,13 @@ and
were added in C99.
.SH EXAMPLE
After
.nf
div_t q = div(\-5, 3);
.fi
.PP
.in +4n
.EX
div_t q = div(\-5, 3);
.EE
.in
.PP
the values \fIq.quot\fP and \fIq.rem\fP are \-1 and \-2, respectively.
.SH SEE ALSO
.BR abs (3),

View File

@ -166,9 +166,11 @@ Note that we can calculate the location of a particular program header,
.IR x ,
in virtual memory using the formula:
.PP
.nf
addr == info\->dlpi_addr + info\->dlpi_phdr[x].p_vaddr;
.fi
.in +4n
.EX
addr == info\->dlpi_addr + info\->dlpi_phdr[x].p_vaddr;
.EE
.in
.PP
Possible values for
.I p_type

View File

@ -151,7 +151,7 @@ are GNU extensions.
.SH NOTES
In glibc 2.2, these functions use the DES algorithm.
.SH EXAMPLE
.nf
.EX
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
@ -198,7 +198,7 @@ main(void)
printf("After decrypting: %s\\n", txt);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR cbc_crypt (3),
.BR crypt (3),

View File

@ -139,7 +139,7 @@ T} Thread safety MT-Safe
These functions are a GNU extension.
Handle with care.
.SH EXAMPLE
.nf
.EX
#include <stdio.h>
#include <stdlib.h>
#include <envz.h>
@ -159,6 +159,6 @@ main(int argc, char *argv[], char *envp[])
printf("%s\en", str);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR argz_add (3)

View File

@ -68,11 +68,11 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
.ad b
.SH DESCRIPTION
These functions return a value equivalent to
.PP
.nf
exp(x) \- 1
.fi
.PP
The result is computed in a way that is accurate even if the value of
.I x
is near

View File

@ -317,14 +317,12 @@ to set individual floating-point traps, and
to query the state.
.PP
.nf
.EX
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B "#include <fenv.h>"
.PP
.BI "int feenableexcept(int " excepts );
.BI "int fedisableexcept(int " excepts );
.B "int fegetexcept(void);"
.EE
.fi
.PP
The

View File

@ -269,7 +269,7 @@ System V and UnixWare man pages tell us that these functions
have been replaced by "pfmt() and addsev()" or by "pfmt(),
vpfmt(), lfmt(), and vlfmt()", and will be removed later.
.SH EXAMPLE
.nf
.EX
#include <stdio.h>
#include <stdlib.h>
#include <fmtmsg.h>
@ -300,27 +300,34 @@ main(void)
}
exit(EXIT_SUCCESS);
}
.fi
.EE
.PP
The output should be:
.nf
util\-linux:mount: ERROR: unknown mount option
TO FIX: See mount(8). util\-linux:mount:017
.fi
.PP
.in +4n
.EX
util\-linux:mount: ERROR: unknown mount option
TO FIX: See mount(8). util\-linux:mount:017
.EE
.in
.PP
and after
.nf
MSGVERB=text:action; export MSGVERB
.fi
.PP
.in +4n
.EX
MSGVERB=text:action; export MSGVERB
.EE
.in
.PP
the output becomes:
.nf
unknown mount option
TO FIX: See mount(8).
.fi
.PP
.in +4n
.EX
unknown mount option
TO FIX: See mount(8).
.EE
.in
.PP
.SH SEE ALSO
.BR addseverity (3),
.BR perror (3)

View File

@ -143,10 +143,12 @@ Opening a file in append mode (\fBa\fP as the first character of
.IR mode )
causes all subsequent write operations to this stream to occur
at end-of-file, as if preceded the call:
.nf
fseek(stream, 0, SEEK_END);
.fi
.PP
.in +4n
.EX
fseek(stream, 0, SEEK_END);
.EE
.in
.PP
The file descriptor associated with the stream is opened as if by a call to
.BR open (2)

View File

@ -74,11 +74,13 @@ The following
.BR sysconf (3)
calls make use of the functions documented on this page
to return the same information.
.nf
np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
.fi
.PP
.in +4n
.EX
np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
.EE
.in
.SH EXAMPLE
The following example shows how
.BR get_nprocs ()
@ -86,7 +88,7 @@ and
.BR get_nprocs_conf ()
can be used.
.PP
.nf
.EX
#include <stdlib.h>
#include <stdio.h>
#include <sys/sysinfo.h>
@ -99,5 +101,5 @@ main(int argc, char *argv[])
get_nprocs_conf(), get_nprocs());
exit(EXIT_SUCCESS);
}
.fi
.EE
.PP

View File

@ -69,10 +69,12 @@ The following
calls provide a portable means of obtaining the same information as the
functions described on this page.
.PP
.nf
total_pages = sysconf(_SC_PHYS_PAGES); /* total pages */
avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
.fi
.in +4n
.EX
total_pages = sysconf(_SC_PHYS_PAGES); /* total pages */
avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
.EE
.in
.SH EXAMPLE
The following example shows how
.BR get_phys_pages ()
@ -80,7 +82,7 @@ and
.BR get_avphys_pages ()
can be used.
.PP
.nf
.EX
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysinfo.h>
@ -93,6 +95,6 @@ main(int argc, char *argv[])
get_phys_pages(), get_avphys_pages());
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR sysconf (3)

View File

@ -653,7 +653,7 @@ and
The programs are an echo server and client for UDP datagrams.
.SS Server program
\&
.nf
.EX
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
@ -745,10 +745,10 @@ main(int argc, char *argv[])
fprintf(stderr, "Error sending response\\n");
}
}
.fi
.EE
.SS Client program
\&
.nf
.EX
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
@ -841,7 +841,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.\" .BR getipnodebyaddr (3),
.\" .BR getipnodebyname (3),

View File

@ -348,8 +348,8 @@ gnu.cz: 87.236.197.13
.in
.PP
Here is the program source code
.nf
.PP
.EX
#define _GNU_SOURCE
#include <netdb.h>
#include <stdio.h>
@ -408,7 +408,7 @@ main(int argc, char *argv[])
}
exit(EXIT_SUCCESS);
}
.fi
.EE
.SS Asynchronous example
This example shows a simple interactive
.BR getaddrinfo_a ()
@ -438,7 +438,7 @@ $ \fB./a.out\fP
.PP
The program source is as follows:
.PP
.nf
.EX
#define _GNU_SOURCE
#include <netdb.h>
#include <stdio.h>
@ -613,7 +613,7 @@ main(int argc, char *argv[])
}
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR getaddrinfo (3),
.BR inet (3),

View File

@ -54,9 +54,9 @@ The
.I ucontext_t
type is a structure that has at least
the following fields:
.PP
.in +4
.nf
.EX
typedef struct ucontext_t {
struct ucontext_t *uc_link;
sigset_t uc_sigmask;

View File

@ -159,7 +159,7 @@ and
were originally GNU extensions.
They were standardized in POSIX.1-2008.
.SH EXAMPLE
.nf
.EX
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
@ -192,7 +192,7 @@ main(int argc, char *argv[])
fclose(stream);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR read (2),
.BR fgets (3),

View File

@ -18,11 +18,13 @@ getpt \- open the pseudoterminal master (PTM)
.BR getpt ()
opens a pseudoterminal master and returns its file descriptor.
It is equivalent to
.nf
open(/dev/ptmx, O_RDWR | O_NOCTTY);
.fi
.PP
.in +4n
.EX
open(/dev/ptmx, O_RDWR | O_NOCTTY);
.EE
.in
.PP
on Linux systems, though the pseudoterminal master is located
elsewhere on some systems that use GNU Libc.
.SH RETURN VALUE

View File

@ -281,7 +281,7 @@ The program below demonstrates the use of
to find the full username and user ID for the username
supplied as a command-line argument.
.PP
.nf
.EX
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@ -326,7 +326,7 @@ main(int argc, char *argv[])
printf("Name: %s; UID: %ld\\n", pwd.pw_gecos, (long) pwd.pw_uid);
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR endpwent (3),
.BR fgetpwent (3),

View File

@ -152,7 +152,7 @@ that string must be writable; it cannot be a string constant.
.SH EXAMPLE
The following program expects suboptions following a "\-o" option.
.PP
.nf
.EX
#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <assert.h>
@ -237,6 +237,6 @@ main(int argc, char **argv)
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR getopt (3)

View File

@ -63,12 +63,13 @@ struct ttyent {
.PP
.I ty_status
can be:
.br
.nf
.PP
.in +4n
.EX
#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
#define TTY_SECURE 0x02 /* allow UID 0 to login */
.fi
.EE
.in
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).

View File

@ -314,7 +314,7 @@ should check the return values of
and
.BR ttyname (3).
.PP
.nf
.EX
#include <string.h>
#include <stdlib.h>
#include <pwd.h>
@ -354,7 +354,7 @@ main(int argc, char *argv[])
endutent();
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR getutmp (3),
.BR utmp (5)

View File

@ -125,9 +125,9 @@ and if successful returns a pointer to it.
.PP
The argument \fIitem\fP is of type \fIENTRY\fP, which is defined in
\fI<search.h>\fP as follows:
.in +4n
.PP
.nf
.in +4n
.EX
typedef struct entry {
char *key;
void *data;
@ -302,8 +302,8 @@ Individual hash table entries can be added, but not deleted.
.PP
The following program inserts 24 items into a hash table, then prints
some of them.
.nf
.PP
.EX
#include <stdio.h>
#include <stdlib.h>
#include <search.h>
@ -347,7 +347,7 @@ main(void)
hdestroy();
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR bsearch (3),
.BR lsearch (3),

View File

@ -67,11 +67,11 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
.ad b
.SH DESCRIPTION
These functions return a value equivalent to
.PP
.nf
log (1 + \fIx\fP)
.fi
.PP
The result is computed in a way
that is accurate even if the value of
.I x

View File

@ -47,11 +47,13 @@ points at a function that is called once when the malloc implementation
is initialized.
This is a weak variable, so it can be overridden in
the application with a definition like the following:
.nf
void (*__malloc_initialize_hook)(void) = my_init_hook;
.fi
.PP
.in +4n
.EX
void (*__malloc_initialize_hook)(void) = my_init_hook;
.EE
.in
.PP
Now the function
.IR my_init_hook ()
can do the initialization of all hooks.

View File

@ -120,9 +120,9 @@ allocate 10000 blocks of memory.
After the blocks of memory have been allocated,
.BR malloc_info ()
shows the state of two allocation arenas.
.PP
.in +4
.nf
.EX
.RB "$ " "getconf GNU_LIBC_VERSION"
glibc 2.13
.RB "$ " "./a.out 1 10000 100"
@ -179,7 +179,6 @@ glibc 2.13
.in
.SS Program source
.EX
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>

View File

@ -473,11 +473,13 @@ a call of the form:
.\" malloc requests are rounded up:
.\" (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK
.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129
.nf
mallopt(M_MXFAST, n)
.fi
.PP
.in +4n
.EX
mallopt(M_MXFAST, n)
.EE
.in
.PP
does not result in fastbins being employed for all allocations of size up to
.IR n .
To ensure desired results,

View File

@ -208,9 +208,9 @@ If the "Msg?" columns contains "y",
then the system prints an error message on standard error.
.PP
The table uses the following notations and abbreviations:
.PP
.RS
.nf
x first argument to function
y second argument to function
fin finite value for argument

View File

@ -55,17 +55,21 @@ produce non-initial states when interrupted in the middle of a character.
One possible way to create an
.I mbstate_t
in initial state is to set it to zero:
.nf
mbstate_t state;
memset(&state,0,sizeof(mbstate_t));
.fi
.PP
.in +4n
.EX
mbstate_t state;
memset(&state,0,sizeof(mbstate_t));
.EE
.in
.PP
On Linux, the following works as well, but might generate compiler warnings:
.nf
mbstate_t state = { 0 };
.fi
.PP
.in +4n
.EX
mbstate_t state = { 0 };
.EE
.in
.PP
The function
.BR mbsinit ()

View File

@ -71,7 +71,7 @@ T} Thread safety MT-Safe
.SH CONFORMING TO
This function is a GNU extension.
.SH EXAMPLE
.nf
.EX
void *
combine(void *o1, size_t s1, void *o2, size_t s2)
{
@ -80,7 +80,7 @@ combine(void *o1, size_t s1, void *o2, size_t s2)
mempcpy(mempcpy(result, o1, s1), o2, s2);
return result;
}
.fi
.EE
.SH SEE ALSO
.BR memccpy (3),
.BR memcpy (3),

View File

@ -134,9 +134,9 @@ function and the
.BR mtrace (1)
command in a program that has memory leaks at two different locations.
The demonstration uses the following program:
.PP
.in +4
.nf
.EX
.RB "$ " "cat t_mtrace.c"
#include <mcheck.h>
#include <stdlib.h>

View File

@ -45,8 +45,8 @@ quiet NaNs, these functions return zero.
The call
.I nan("char-sequence")
is equivalent to:
.PP
.nf
strtod("NAN(char-sequence)", NULL);
.fi
.PP

View File

@ -194,7 +194,7 @@ The following program sets the character type and the numeric locale
according to the environment and queries the terminal character set and
the radix character.
.PP
.nf
.EX
#include <langinfo.h>
#include <locale.h>
#include <stdio.h>
@ -211,12 +211,12 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR locale (1),
.BR localeconv (3),
.BR setlocale (3),
.BR charsets (7),
.BR locale (7)
.br
.PP
The GNU C Library Reference Manual

View File

@ -1128,8 +1128,8 @@ one might obtain "Sonntag, 3. Juli, 10:02".
.PP
To allocate a sufficiently large string and print into it
(code correct for both glibc 2.0 and glibc 2.1):
.nf
.PP
.EX
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -1166,7 +1166,7 @@ make_message(const char *fmt, ...)
return p;
}
.fi
.EE
.PP
If truncation occurs in glibc versions prior to 2.0.6, this is treated as an
error instead of being handled gracefully.

View File

@ -169,7 +169,7 @@ and then calls
.BR pthread_getaffinity_np ()
to check the resulting CPU affinity mask of the thread.
.PP
.nf
.EX
#define _GNU_SOURCE
#include <pthread.h>
#include <stdio.h>
@ -211,7 +211,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR sched_setaffinity (2),
.BR CPU_SET (3),

View File

@ -138,23 +138,25 @@ hence the suffix "_np" (nonportable) in the names.
.SH EXAMPLE
The following code waits to join for up to 5 seconds:
.PP
.nf
struct timespec ts;
int s;
.in +4n
.EX
struct timespec ts;
int s;
...
\&...
if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
/* Handle error */
}
if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
/* Handle error */
}
ts.tv_sec += 5;
ts.tv_sec += 5;
s = pthread_timedjoin_np(thread, NULL, &ts);
if (s != 0) {
/* Handle error */
}
.fi
s = pthread_timedjoin_np(thread, NULL, &ts);
if (s != 0) {
/* Handle error */
}
.EX
.in
.SH SEE ALSO
.BR clock_gettime (2),
.BR pthread_exit (3),

View File

@ -136,8 +136,8 @@ and
The following program displays the results when
.BR rpmatch ()
is applied to the string given in the program's command-line argument.
.nf
.PP
.EX
#define _SVID_SOURCE
#include <locale.h>
#include <stdlib.h>
@ -156,7 +156,7 @@ main(int argc, char *argv[])
printf("rpmatch() returns: %d\\n", rpmatch(argv[1]));
exit(EXIT_SUCCESS);
}
.fi
.EE
.SH SEE ALSO
.BR fgets (3),
.BR getline (3),

View File

@ -77,11 +77,11 @@ Try the example program with
set to 1.
.PP
Libc5 uses the prototype
.PP
.nf
int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
.fi
.PP
and requires
.I <sys/time.h>
instead of

View File

@ -86,38 +86,41 @@ This manual page is incomplete.
.SH EXAMPLE
.\" FIXME . ? would be better to use libnetlink in the EXAMPLE code here
Creating a rtnetlink message to set the MTU of a device:
.nf
#include <linux/rtnetlink.h>
.PP
.in +4n
.EX
#include <linux/rtnetlink.h>
...
\&...
struct {
struct nlmsghdr nh;
struct ifinfomsg if;
char attrbuf[512];
} req;
struct {
struct nlmsghdr nh;
struct ifinfomsg if;
char attrbuf[512];
} req;
struct rtattr *rta;
unsigned int mtu = 1000;
struct rtattr *rta;
unsigned int mtu = 1000;
int rtnetlink_sk = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
int rtnetlink_sk = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
memset(&req, 0, sizeof(req));
req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
req.nh.nlmsg_flags = NLM_F_REQUEST;
req.nh.nlmsg_type = RTM_NEWLINK;
req.if.ifi_family = AF_UNSPEC;
req.if.ifi_index = INTERFACE_INDEX;
req.if.ifi_change = 0xffffffff; /* ??? */
rta = (struct rtattr *)(((char *) &req) +
NLMSG_ALIGN(req.nh.nlmsg_len));
rta\->rta_type = IFLA_MTU;
rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
req.nh.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
RTA_LENGTH(sizeof(mtu));
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
send(rtnetlink_sk, &req, req.nh.nlmsg_len, 0);
.fi
memset(&req, 0, sizeof(req));
req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
req.nh.nlmsg_flags = NLM_F_REQUEST;
req.nh.nlmsg_type = RTM_NEWLINK;
req.if.ifi_family = AF_UNSPEC;
req.if.ifi_index = INTERFACE_INDEX;
req.if.ifi_change = 0xffffffff; /* ??? */
rta = (struct rtattr *)(((char *) &req) +
NLMSG_ALIGN(req.nh.nlmsg_len));
rta\->rta_type = IFLA_MTU;
rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
req.nh.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
RTA_LENGTH(sizeof(mtu));
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
send(rtnetlink_sk, &req, req.nh.nlmsg_len, 0);
.EX
.in
.SH SEE ALSO
.BR netlink (3),
.BR netlink (7),

View File

@ -70,8 +70,8 @@ by
to the power of
.IR exp ,
that is:
.PP
.nf
x * FLT_RADIX ** exp
.fi
.PP

View File

@ -77,8 +77,8 @@ by
to the power of
.IR exp ,
that is:
.PP
.nf
x * FLT_RADIX ** exp
.fi
.PP

View File

@ -165,12 +165,14 @@ For example, we can initialize the
field given to
.BR sigvec ()
using code such as the following:
.nf
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
/* Block SIGQUIT and SIGABRT during
handler execution */
.fi
.PP
.in +4n
.EX
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
/* Block SIGQUIT and SIGABRT during
handler execution */
.EE
.in
.PP
The
.BR sigblock ()