mirror of https://github.com/mkerrisk/man-pages
_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:
parent
0a92ddef8b
commit
207050fa9e
|
@ -140,7 +140,7 @@ passed by-value or by-pointer (for aggregates like structs).
|
||||||
.\" Otherwise, the use of a _syscall macro is required.
|
.\" Otherwise, the use of a _syscall macro is required.
|
||||||
.\"
|
.\"
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -169,9 +169,9 @@ main(void)
|
||||||
s_info.procs);
|
s_info.procs);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SS Sample output
|
.SS Sample output
|
||||||
.nf
|
.EX
|
||||||
code error = 0
|
code error = 0
|
||||||
uptime = 502034s
|
uptime = 502034s
|
||||||
Load: 1 min 13376 / 5 min 5504 / 15 min 1152
|
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
|
Memory in buffers = 5066752
|
||||||
Swap: total 27881472 / free 24698880
|
Swap: total 27881472 / free 24698880
|
||||||
Number of processes = 40
|
Number of processes = 40
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR intro (2),
|
.BR intro (2),
|
||||||
.BR syscall (2),
|
.BR syscall (2),
|
||||||
|
|
|
@ -126,6 +126,7 @@ Thus, the above two constants are defined as:
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
.in +4
|
.in +4
|
||||||
|
.EX
|
||||||
#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
|
#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
|
||||||
#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
|
#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
|
||||||
.EE
|
.EE
|
||||||
|
|
|
@ -629,8 +629,8 @@ The following program calls
|
||||||
and displays selected fields in the returned
|
and displays selected fields in the returned
|
||||||
.I stat
|
.I stat
|
||||||
structure.
|
structure.
|
||||||
.nf
|
.PP
|
||||||
|
.EX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -691,7 +691,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR ls (1),
|
.BR ls (1),
|
||||||
.BR stat (1),
|
.BR stat (1),
|
||||||
|
|
|
@ -301,7 +301,7 @@ arguments 5 through 8 on the user stack.
|
||||||
Note that these tables don't cover the entire calling convention\(emsome
|
Note that these tables don't cover the entire calling convention\(emsome
|
||||||
architectures may indiscriminately clobber other registers not listed here.
|
architectures may indiscriminately clobber other registers not listed here.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
@ -316,7 +316,7 @@ main(int argc, char *argv[])
|
||||||
tid = syscall(SYS_gettid);
|
tid = syscall(SYS_gettid);
|
||||||
syscall(SYS_tgkill, getpid(), tid, SIGHUP);
|
syscall(SYS_tgkill, getpid(), tid, SIGHUP);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR _syscall (2),
|
.BR _syscall (2),
|
||||||
.BR intro (2),
|
.BR intro (2),
|
||||||
|
|
|
@ -141,7 +141,7 @@ Not all available objects are properly documented.
|
||||||
It is not yet possible to change operating system by writing to
|
It is not yet possible to change operating system by writing to
|
||||||
.IR /proc/sys/kernel/ostype .
|
.IR /proc/sys/kernel/ostype .
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
@ -177,6 +177,6 @@ main(void)
|
||||||
printf("This machine is running %*s\\n", osnamelth, osname);
|
printf("This machine is running %*s\\n", osnamelth, osname);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR proc (5)
|
.BR proc (5)
|
||||||
|
|
|
@ -473,10 +473,12 @@ the file referred to by the file descriptor
|
||||||
Using this feature, the call
|
Using this feature, the call
|
||||||
.I "futimens(fd,\ times)"
|
.I "futimens(fd,\ times)"
|
||||||
is implemented as:
|
is implemented as:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
utimensat(fd, NULL, times, 0);
|
.EX
|
||||||
.fi
|
utimensat(fd, NULL, times, 0);
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
Note, however, that the glibc wrapper for
|
Note, however, that the glibc wrapper for
|
||||||
.BR utimensat ()
|
.BR utimensat ()
|
||||||
|
|
10
man2/wait.2
10
man2/wait.2
|
@ -114,10 +114,12 @@ children terminates.
|
||||||
The call
|
The call
|
||||||
.I wait(&wstatus)
|
.I wait(&wstatus)
|
||||||
is equivalent to:
|
is equivalent to:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
waitpid(\-1, &wstatus, 0);
|
.EX
|
||||||
.fi
|
waitpid(\-1, &wstatus, 0);
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
.BR waitpid ()
|
.BR waitpid ()
|
||||||
|
|
|
@ -316,7 +316,7 @@ These bugs are fixed in glibc 2.9.
|
||||||
The following program demonstrates the use of some of the macros
|
The following program demonstrates the use of some of the macros
|
||||||
used for dynamically allocated CPU sets.
|
used for dynamically allocated CPU sets.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -355,7 +355,7 @@ main(int argc, char *argv[])
|
||||||
CPU_FREE(cpusetp);
|
CPU_FREE(cpusetp);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR sched_setaffinity (2),
|
.BR sched_setaffinity (2),
|
||||||
.BR pthread_attr_setaffinity_np (3),
|
.BR pthread_attr_setaffinity_np (3),
|
||||||
|
|
|
@ -50,17 +50,17 @@ and
|
||||||
sign-extends its 32-bit result.
|
sign-extends its 32-bit result.
|
||||||
.PP
|
.PP
|
||||||
The 64 digits in the base-64 system are:
|
The 64 digits in the base-64 system are:
|
||||||
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
\&\(aq.\(aq represents a 0
|
\&\(aq.\(aq represents a 0
|
||||||
\&\(aq/\(aq represents a 1
|
\&\(aq/\(aq represents a 1
|
||||||
0-9 represent 2-11
|
0-9 represent 2-11
|
||||||
A-Z represent 12-37
|
A-Z represent 12-37
|
||||||
a-z represent 38-63
|
a-z represent 38-63
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
So 123 = 59*64^0 + 1*64^1 = "v/".
|
So 123 = 59*64^0 + 1*64^1 = "v/".
|
||||||
.SH ATTRIBUTES
|
.SH ATTRIBUTES
|
||||||
For an explanation of the terms used in this section, see
|
For an explanation of the terms used in this section, see
|
||||||
|
|
|
@ -133,13 +133,15 @@ Otherwise, (without an \-ansi or \-std=c* option) the glibc version of
|
||||||
includes
|
includes
|
||||||
.I <alloca.h>
|
.I <alloca.h>
|
||||||
and that contains the lines:
|
and that contains the lines:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
#ifdef __GNUC__
|
.EX
|
||||||
#define alloca(size) __builtin_alloca (size)
|
#ifdef __GNUC__
|
||||||
#endif
|
#define alloca(size) __builtin_alloca (size)
|
||||||
|
#endif
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
with messy consequences if one has a private version of this function.
|
with messy consequences if one has a private version of this function.
|
||||||
.PP
|
.PP
|
||||||
The fact that the code is inlined means that it is impossible
|
The fact that the code is inlined means that it is impossible
|
||||||
|
|
|
@ -144,7 +144,7 @@ Since glibc 2.2.3,
|
||||||
can be used within a shared library to establish functions
|
can be used within a shared library to establish functions
|
||||||
that are called when the shared library is unloaded.
|
that are called when the shared library is unloaded.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -172,7 +172,7 @@ main(void)
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR _exit (2),
|
.BR _exit (2),
|
||||||
.BR dlopen (3),
|
.BR dlopen (3),
|
||||||
|
|
|
@ -147,14 +147,14 @@ There are two different versions of
|
||||||
.BR basename ()
|
.BR basename ()
|
||||||
- the POSIX version described above, and the GNU version, which one gets
|
- the POSIX version described above, and the GNU version, which one gets
|
||||||
after
|
after
|
||||||
.br
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
|
.EX
|
||||||
.BR " #define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
.BR " #define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
||||||
.br
|
|
||||||
.B " #include <string.h>"
|
.B " #include <string.h>"
|
||||||
|
.EE
|
||||||
.fi
|
.in
|
||||||
|
.PP
|
||||||
The GNU version never modifies its argument, and returns the
|
The GNU version never modifies its argument, and returns the
|
||||||
empty string when
|
empty string when
|
||||||
.I path
|
.I path
|
||||||
|
|
|
@ -27,8 +27,8 @@ The real part of
|
||||||
is chosen in the interval [0,pi].
|
is chosen in the interval [0,pi].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
|
cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
@ -50,7 +50,7 @@ T} Thread safety MT-Safe
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
C99, POSIX.1-2001, POSIX.1-2008.
|
C99, POSIX.1-2001, POSIX.1-2008.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
/* Link with "\-lm" */
|
/* Link with "\-lm" */
|
||||||
|
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
@ -81,7 +81,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR ccos (3),
|
.BR ccos (3),
|
||||||
.BR clog (3),
|
.BR clog (3),
|
||||||
|
|
|
@ -30,8 +30,8 @@ The real part of
|
||||||
is chosen nonnegative.
|
is chosen nonnegative.
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
|
cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
@ -53,7 +53,7 @@ T} Thread safety MT-Safe
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
C99, POSIX.1-2001, POSIX.1-2008.
|
C99, POSIX.1-2001, POSIX.1-2008.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
/* Link with "\-lm" */
|
/* Link with "\-lm" */
|
||||||
|
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
@ -81,7 +81,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR acosh (3),
|
.BR acosh (3),
|
||||||
.BR cabs (3),
|
.BR cabs (3),
|
||||||
|
|
|
@ -35,11 +35,11 @@ and
|
||||||
.IR "y\ =\ cimag(z)" .
|
.IR "y\ =\ cimag(z)" .
|
||||||
.PP
|
.PP
|
||||||
Or one may use polar coordinates and gets
|
Or one may use polar coordinates and gets
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
z = r * cexp(I * a)
|
z = r * cexp(I * a)
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
where
|
where
|
||||||
.IR "r\ =\ cabs(z)"
|
.IR "r\ =\ cabs(z)"
|
||||||
is the "radius", the "modulus", the absolute value of
|
is the "radius", the "modulus", the absolute value of
|
||||||
|
@ -50,8 +50,8 @@ is the "phase angle", the argument of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
tan(carg(z)) = cimag(z) / creal(z)
|
tan(carg(z)) = cimag(z) / creal(z)
|
||||||
.fi
|
.fi
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
|
@ -26,8 +26,8 @@ The real part of
|
||||||
is chosen in the interval [\-pi/2,pi/2].
|
is chosen in the interval [\-pi/2,pi/2].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
casin(z) = \-i clog(iz + csqrt(1 \- z * z))
|
casin(z) = \-i clog(iz + csqrt(1 \- z * z))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -26,8 +26,8 @@ The imaginary part of
|
||||||
is chosen in the interval [\-pi/2,pi/2].
|
is chosen in the interval [\-pi/2,pi/2].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
casinh(z) = clog(z + csqrt(z * z + 1))
|
casinh(z) = clog(z + csqrt(z * z + 1))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -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].
|
The real part of y is chosen in the interval [\-pi/2,pi/2].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
|
catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
@ -48,7 +48,7 @@ T} Thread safety MT-Safe
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
C99, POSIX.1-2001, POSIX.1-2008.
|
C99, POSIX.1-2001, POSIX.1-2008.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
/* Link with "\-lm" */
|
/* Link with "\-lm" */
|
||||||
|
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
@ -77,7 +77,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR ccos (3),
|
.BR ccos (3),
|
||||||
.BR clog (3),
|
.BR clog (3),
|
||||||
|
|
|
@ -27,8 +27,8 @@ The imaginary part of
|
||||||
is chosen in the interval [\-pi/2,pi/2].
|
is chosen in the interval [\-pi/2,pi/2].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
catanh(z) = 0.5 * (clog(1 + z) \- clog(1 \- z))
|
catanh(z) = 0.5 * (clog(1 + z) \- clog(1 \- z))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
@ -50,7 +50,7 @@ T} Thread safety MT-Safe
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
C99, POSIX.1-2001, POSIX.1-2008.
|
C99, POSIX.1-2001, POSIX.1-2008.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
/* Link with "\-lm" */
|
/* Link with "\-lm" */
|
||||||
|
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
@ -78,7 +78,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR atanh (3),
|
.BR atanh (3),
|
||||||
.BR cabs (3),
|
.BR cabs (3),
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions calculate the complex cosine of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
The complex cosine function is defined as:
|
The complex cosine function is defined as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
ccos(z) = (exp(i * z) + exp(\-i * z)) / 2
|
ccos(z) = (exp(i * z) + exp(\-i * z)) / 2
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions calculate the complex hyperbolic cosine of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
The complex hyperbolic cosine function is defined as:
|
The complex hyperbolic cosine function is defined as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
ccosh(z) = (exp(z)+exp(\-z))/2
|
ccosh(z) = (exp(z)+exp(\-z))/2
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -23,8 +23,8 @@ raised to the power of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
cexp(I * z) = ccos(z) + I * csin(z)
|
cexp(I * z) = ccos(z) + I * csin(z)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions return the imaginary part of the complex number
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
z = creal(z) + I * cimag(z)
|
z = creal(z) + I * cimag(z)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -92,11 +92,13 @@ and rejected
|
||||||
On systems where
|
On systems where
|
||||||
.BR clearenv ()
|
.BR clearenv ()
|
||||||
is unavailable, the assignment
|
is unavailable, the assignment
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
environ = NULL;
|
.EX
|
||||||
|
environ = NULL;
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
will probably do.
|
will probably do.
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
|
|
|
@ -32,8 +32,8 @@ The imaginary part of
|
||||||
is chosen in the interval [\-pi,pi].
|
is chosen in the interval [\-pi,pi].
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
clog(z) = log(cabs(z)) + I * carg(z)
|
clog(z) = log(cabs(z)) + I * carg(z)
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -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.
|
That is the value obtained by changing the sign of the imaginary part.
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
cabs(z) = csqrt(z * conj(z))
|
cabs(z) = csqrt(z * conj(z))
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -67,8 +67,8 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
|
||||||
These functions return the hyperbolic cosine of
|
These functions return the hyperbolic cosine of
|
||||||
.IR x ,
|
.IR x ,
|
||||||
which is defined mathematically as:
|
which is defined mathematically as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
cosh(x) = (exp(x) + exp(\-x)) / 2
|
cosh(x) = (exp(x) + exp(\-x)) / 2
|
||||||
.fi
|
.fi
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions return the real part of the complex number
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
One has:
|
One has:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
z = creal(z) + I * cimag(z)
|
z = creal(z) + I * cimag(z)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions calculate the complex sine of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
The complex sine function is defined as:
|
The complex sine function is defined as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
csin(z) = (exp(i * z) \- exp(\-i * z)) / (2 * i)
|
csin(z) = (exp(i * z) \- exp(\-i * z)) / (2 * i)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions calculate the complex hyperbolic sine of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
The complex hyperbolic sine function is defined as:
|
The complex hyperbolic sine function is defined as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
csinh(z) = (exp(z)\-exp(\-z))/2
|
csinh(z) = (exp(z)\-exp(\-z))/2
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -22,8 +22,8 @@ These functions calculate the complex tangent of
|
||||||
.IR z .
|
.IR z .
|
||||||
.PP
|
.PP
|
||||||
The complex tangent function is defined as:
|
The complex tangent function is defined as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
ctan(z) = csin(z) / ccos(z)
|
ctan(z) = csin(z) / ccos(z)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -23,8 +23,8 @@ These functions calculate the complex hyperbolic tangent of
|
||||||
.PP
|
.PP
|
||||||
The complex hyperbolic tangent function is defined
|
The complex hyperbolic tangent function is defined
|
||||||
mathematically as:
|
mathematically as:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
ctanh(z) = csinh(z) / ccosh(z)
|
ctanh(z) = csinh(z) / ccosh(z)
|
||||||
.fi
|
.fi
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
|
|
|
@ -64,13 +64,13 @@ On a POSIX system,
|
||||||
.I time_t
|
.I time_t
|
||||||
is an arithmetic type, and one could just
|
is an arithmetic type, and one could just
|
||||||
define
|
define
|
||||||
.RS
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
|
.EX
|
||||||
#define difftime(t1,t0) (double)(t1 \- t0)
|
#define difftime(t1,t0) (double)(t1 \- t0)
|
||||||
|
.EX
|
||||||
.fi
|
.in
|
||||||
.RE
|
.PP
|
||||||
when the possible overflow in the subtraction is not a concern.
|
when the possible overflow in the subtraction is not a concern.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR date (1),
|
.BR date (1),
|
||||||
|
|
12
man3/div.3
12
man3/div.3
|
@ -108,11 +108,13 @@ and
|
||||||
were added in C99.
|
were added in C99.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
After
|
After
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
div_t q = div(\-5, 3);
|
.EX
|
||||||
|
div_t q = div(\-5, 3);
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
the values \fIq.quot\fP and \fIq.rem\fP are \-1 and \-2, respectively.
|
the values \fIq.quot\fP and \fIq.rem\fP are \-1 and \-2, respectively.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR abs (3),
|
.BR abs (3),
|
||||||
|
|
|
@ -166,9 +166,11 @@ Note that we can calculate the location of a particular program header,
|
||||||
.IR x ,
|
.IR x ,
|
||||||
in virtual memory using the formula:
|
in virtual memory using the formula:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
addr == info\->dlpi_addr + info\->dlpi_phdr[x].p_vaddr;
|
.EX
|
||||||
.fi
|
addr == info\->dlpi_addr + info\->dlpi_phdr[x].p_vaddr;
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
Possible values for
|
Possible values for
|
||||||
.I p_type
|
.I p_type
|
||||||
|
|
|
@ -151,7 +151,7 @@ are GNU extensions.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
In glibc 2.2, these functions use the DES algorithm.
|
In glibc 2.2, these functions use the DES algorithm.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#define _XOPEN_SOURCE
|
#define _XOPEN_SOURCE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -198,7 +198,7 @@ main(void)
|
||||||
printf("After decrypting: %s\\n", txt);
|
printf("After decrypting: %s\\n", txt);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR cbc_crypt (3),
|
.BR cbc_crypt (3),
|
||||||
.BR crypt (3),
|
.BR crypt (3),
|
||||||
|
|
|
@ -139,7 +139,7 @@ T} Thread safety MT-Safe
|
||||||
These functions are a GNU extension.
|
These functions are a GNU extension.
|
||||||
Handle with care.
|
Handle with care.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <envz.h>
|
#include <envz.h>
|
||||||
|
@ -159,6 +159,6 @@ main(int argc, char *argv[], char *envp[])
|
||||||
printf("%s\en", str);
|
printf("%s\en", str);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR argz_add (3)
|
.BR argz_add (3)
|
||||||
|
|
|
@ -68,11 +68,11 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
|
||||||
.ad b
|
.ad b
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions return a value equivalent to
|
These functions return a value equivalent to
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
exp(x) \- 1
|
exp(x) \- 1
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
The result is computed in a way that is accurate even if the value of
|
The result is computed in a way that is accurate even if the value of
|
||||||
.I x
|
.I x
|
||||||
is near
|
is near
|
||||||
|
|
|
@ -317,14 +317,12 @@ to set individual floating-point traps, and
|
||||||
to query the state.
|
to query the state.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
.EX
|
|
||||||
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
||||||
.B "#include <fenv.h>"
|
.B "#include <fenv.h>"
|
||||||
.PP
|
.PP
|
||||||
.BI "int feenableexcept(int " excepts );
|
.BI "int feenableexcept(int " excepts );
|
||||||
.BI "int fedisableexcept(int " excepts );
|
.BI "int fedisableexcept(int " excepts );
|
||||||
.B "int fegetexcept(void);"
|
.B "int fegetexcept(void);"
|
||||||
.EE
|
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
|
|
|
@ -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(),
|
have been replaced by "pfmt() and addsev()" or by "pfmt(),
|
||||||
vpfmt(), lfmt(), and vlfmt()", and will be removed later.
|
vpfmt(), lfmt(), and vlfmt()", and will be removed later.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fmtmsg.h>
|
#include <fmtmsg.h>
|
||||||
|
@ -300,27 +300,34 @@ main(void)
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.PP
|
.PP
|
||||||
The output should be:
|
The output should be:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
util\-linux:mount: ERROR: unknown mount option
|
.EX
|
||||||
TO FIX: See mount(8). util\-linux:mount:017
|
util\-linux:mount: ERROR: unknown mount option
|
||||||
|
TO FIX: See mount(8). util\-linux:mount:017
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
and after
|
and after
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
MSGVERB=text:action; export MSGVERB
|
.EX
|
||||||
|
MSGVERB=text:action; export MSGVERB
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
the output becomes:
|
the output becomes:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
unknown mount option
|
.EX
|
||||||
TO FIX: See mount(8).
|
unknown mount option
|
||||||
.fi
|
TO FIX: See mount(8).
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR addseverity (3),
|
.BR addseverity (3),
|
||||||
.BR perror (3)
|
.BR perror (3)
|
||||||
|
|
10
man3/fopen.3
10
man3/fopen.3
|
@ -143,10 +143,12 @@ Opening a file in append mode (\fBa\fP as the first character of
|
||||||
.IR mode )
|
.IR mode )
|
||||||
causes all subsequent write operations to this stream to occur
|
causes all subsequent write operations to this stream to occur
|
||||||
at end-of-file, as if preceded the call:
|
at end-of-file, as if preceded the call:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
fseek(stream, 0, SEEK_END);
|
.EX
|
||||||
.fi
|
fseek(stream, 0, SEEK_END);
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
The file descriptor associated with the stream is opened as if by a call to
|
The file descriptor associated with the stream is opened as if by a call to
|
||||||
.BR open (2)
|
.BR open (2)
|
||||||
|
|
|
@ -74,11 +74,13 @@ The following
|
||||||
.BR sysconf (3)
|
.BR sysconf (3)
|
||||||
calls make use of the functions documented on this page
|
calls make use of the functions documented on this page
|
||||||
to return the same information.
|
to return the same information.
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
|
.EX
|
||||||
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
|
np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */
|
||||||
.fi
|
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The following example shows how
|
The following example shows how
|
||||||
.BR get_nprocs ()
|
.BR get_nprocs ()
|
||||||
|
@ -86,7 +88,7 @@ and
|
||||||
.BR get_nprocs_conf ()
|
.BR get_nprocs_conf ()
|
||||||
can be used.
|
can be used.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
|
@ -99,5 +101,5 @@ main(int argc, char *argv[])
|
||||||
get_nprocs_conf(), get_nprocs());
|
get_nprocs_conf(), get_nprocs());
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -69,10 +69,12 @@ The following
|
||||||
calls provide a portable means of obtaining the same information as the
|
calls provide a portable means of obtaining the same information as the
|
||||||
functions described on this page.
|
functions described on this page.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
total_pages = sysconf(_SC_PHYS_PAGES); /* total pages */
|
.EX
|
||||||
avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
|
total_pages = sysconf(_SC_PHYS_PAGES); /* total pages */
|
||||||
.fi
|
avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The following example shows how
|
The following example shows how
|
||||||
.BR get_phys_pages ()
|
.BR get_phys_pages ()
|
||||||
|
@ -80,7 +82,7 @@ and
|
||||||
.BR get_avphys_pages ()
|
.BR get_avphys_pages ()
|
||||||
can be used.
|
can be used.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
|
@ -93,6 +95,6 @@ main(int argc, char *argv[])
|
||||||
get_phys_pages(), get_avphys_pages());
|
get_phys_pages(), get_avphys_pages());
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR sysconf (3)
|
.BR sysconf (3)
|
||||||
|
|
|
@ -653,7 +653,7 @@ and
|
||||||
The programs are an echo server and client for UDP datagrams.
|
The programs are an echo server and client for UDP datagrams.
|
||||||
.SS Server program
|
.SS Server program
|
||||||
\&
|
\&
|
||||||
.nf
|
.EX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -745,10 +745,10 @@ main(int argc, char *argv[])
|
||||||
fprintf(stderr, "Error sending response\\n");
|
fprintf(stderr, "Error sending response\\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SS Client program
|
.SS Client program
|
||||||
\&
|
\&
|
||||||
.nf
|
.EX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -841,7 +841,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.\" .BR getipnodebyaddr (3),
|
.\" .BR getipnodebyaddr (3),
|
||||||
.\" .BR getipnodebyname (3),
|
.\" .BR getipnodebyname (3),
|
||||||
|
|
|
@ -348,8 +348,8 @@ gnu.cz: 87.236.197.13
|
||||||
.in
|
.in
|
||||||
.PP
|
.PP
|
||||||
Here is the program source code
|
Here is the program source code
|
||||||
.nf
|
.PP
|
||||||
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -408,7 +408,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SS Asynchronous example
|
.SS Asynchronous example
|
||||||
This example shows a simple interactive
|
This example shows a simple interactive
|
||||||
.BR getaddrinfo_a ()
|
.BR getaddrinfo_a ()
|
||||||
|
@ -438,7 +438,7 @@ $ \fB./a.out\fP
|
||||||
.PP
|
.PP
|
||||||
The program source is as follows:
|
The program source is as follows:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -613,7 +613,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR getaddrinfo (3),
|
.BR getaddrinfo (3),
|
||||||
.BR inet (3),
|
.BR inet (3),
|
||||||
|
|
|
@ -54,9 +54,9 @@ The
|
||||||
.I ucontext_t
|
.I ucontext_t
|
||||||
type is a structure that has at least
|
type is a structure that has at least
|
||||||
the following fields:
|
the following fields:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.EX
|
||||||
|
|
||||||
typedef struct ucontext_t {
|
typedef struct ucontext_t {
|
||||||
struct ucontext_t *uc_link;
|
struct ucontext_t *uc_link;
|
||||||
sigset_t uc_sigmask;
|
sigset_t uc_sigmask;
|
||||||
|
|
|
@ -159,7 +159,7 @@ and
|
||||||
were originally GNU extensions.
|
were originally GNU extensions.
|
||||||
They were standardized in POSIX.1-2008.
|
They were standardized in POSIX.1-2008.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -192,7 +192,7 @@ main(int argc, char *argv[])
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR read (2),
|
.BR read (2),
|
||||||
.BR fgets (3),
|
.BR fgets (3),
|
||||||
|
|
12
man3/getpt.3
12
man3/getpt.3
|
@ -18,11 +18,13 @@ getpt \- open the pseudoterminal master (PTM)
|
||||||
.BR getpt ()
|
.BR getpt ()
|
||||||
opens a pseudoterminal master and returns its file descriptor.
|
opens a pseudoterminal master and returns its file descriptor.
|
||||||
It is equivalent to
|
It is equivalent to
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
open(/dev/ptmx, O_RDWR | O_NOCTTY);
|
.EX
|
||||||
|
open(/dev/ptmx, O_RDWR | O_NOCTTY);
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
on Linux systems, though the pseudoterminal master is located
|
on Linux systems, though the pseudoterminal master is located
|
||||||
elsewhere on some systems that use GNU Libc.
|
elsewhere on some systems that use GNU Libc.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
|
@ -281,7 +281,7 @@ The program below demonstrates the use of
|
||||||
to find the full username and user ID for the username
|
to find the full username and user ID for the username
|
||||||
supplied as a command-line argument.
|
supplied as a command-line argument.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.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);
|
printf("Name: %s; UID: %ld\\n", pwd.pw_gecos, (long) pwd.pw_uid);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR endpwent (3),
|
.BR endpwent (3),
|
||||||
.BR fgetpwent (3),
|
.BR fgetpwent (3),
|
||||||
|
|
|
@ -152,7 +152,7 @@ that string must be writable; it cannot be a string constant.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The following program expects suboptions following a "\-o" option.
|
The following program expects suboptions following a "\-o" option.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 500
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -237,6 +237,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR getopt (3)
|
.BR getopt (3)
|
||||||
|
|
|
@ -63,12 +63,13 @@ struct ttyent {
|
||||||
.PP
|
.PP
|
||||||
.I ty_status
|
.I ty_status
|
||||||
can be:
|
can be:
|
||||||
.br
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
|
.EX
|
||||||
#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
|
#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
|
||||||
#define TTY_SECURE 0x02 /* allow UID 0 to login */
|
#define TTY_SECURE 0x02 /* allow UID 0 to login */
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
.SH ATTRIBUTES
|
.SH ATTRIBUTES
|
||||||
For an explanation of the terms used in this section, see
|
For an explanation of the terms used in this section, see
|
||||||
.BR attributes (7).
|
.BR attributes (7).
|
||||||
|
|
|
@ -314,7 +314,7 @@ should check the return values of
|
||||||
and
|
and
|
||||||
.BR ttyname (3).
|
.BR ttyname (3).
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -354,7 +354,7 @@ main(int argc, char *argv[])
|
||||||
endutent();
|
endutent();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR getutmp (3),
|
.BR getutmp (3),
|
||||||
.BR utmp (5)
|
.BR utmp (5)
|
||||||
|
|
|
@ -125,9 +125,9 @@ and if successful returns a pointer to it.
|
||||||
.PP
|
.PP
|
||||||
The argument \fIitem\fP is of type \fIENTRY\fP, which is defined in
|
The argument \fIitem\fP is of type \fIENTRY\fP, which is defined in
|
||||||
\fI<search.h>\fP as follows:
|
\fI<search.h>\fP as follows:
|
||||||
.in +4n
|
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
|
.EX
|
||||||
typedef struct entry {
|
typedef struct entry {
|
||||||
char *key;
|
char *key;
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -302,8 +302,8 @@ Individual hash table entries can be added, but not deleted.
|
||||||
.PP
|
.PP
|
||||||
The following program inserts 24 items into a hash table, then prints
|
The following program inserts 24 items into a hash table, then prints
|
||||||
some of them.
|
some of them.
|
||||||
.nf
|
.PP
|
||||||
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <search.h>
|
#include <search.h>
|
||||||
|
@ -347,7 +347,7 @@ main(void)
|
||||||
hdestroy();
|
hdestroy();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR bsearch (3),
|
.BR bsearch (3),
|
||||||
.BR lsearch (3),
|
.BR lsearch (3),
|
||||||
|
|
|
@ -67,11 +67,11 @@ _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
|
||||||
.ad b
|
.ad b
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions return a value equivalent to
|
These functions return a value equivalent to
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
log (1 + \fIx\fP)
|
log (1 + \fIx\fP)
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
The result is computed in a way
|
The result is computed in a way
|
||||||
that is accurate even if the value of
|
that is accurate even if the value of
|
||||||
.I x
|
.I x
|
||||||
|
|
|
@ -47,11 +47,13 @@ points at a function that is called once when the malloc implementation
|
||||||
is initialized.
|
is initialized.
|
||||||
This is a weak variable, so it can be overridden in
|
This is a weak variable, so it can be overridden in
|
||||||
the application with a definition like the following:
|
the application with a definition like the following:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
void (*__malloc_initialize_hook)(void) = my_init_hook;
|
.EX
|
||||||
|
void (*__malloc_initialize_hook)(void) = my_init_hook;
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
Now the function
|
Now the function
|
||||||
.IR my_init_hook ()
|
.IR my_init_hook ()
|
||||||
can do the initialization of all hooks.
|
can do the initialization of all hooks.
|
||||||
|
|
|
@ -120,9 +120,9 @@ allocate 10000 blocks of memory.
|
||||||
After the blocks of memory have been allocated,
|
After the blocks of memory have been allocated,
|
||||||
.BR malloc_info ()
|
.BR malloc_info ()
|
||||||
shows the state of two allocation arenas.
|
shows the state of two allocation arenas.
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.EX
|
||||||
|
|
||||||
.RB "$ " "getconf GNU_LIBC_VERSION"
|
.RB "$ " "getconf GNU_LIBC_VERSION"
|
||||||
glibc 2.13
|
glibc 2.13
|
||||||
.RB "$ " "./a.out 1 10000 100"
|
.RB "$ " "./a.out 1 10000 100"
|
||||||
|
@ -179,7 +179,6 @@ glibc 2.13
|
||||||
.in
|
.in
|
||||||
.SS Program source
|
.SS Program source
|
||||||
.EX
|
.EX
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
|
@ -473,11 +473,13 @@ a call of the form:
|
||||||
.\" malloc requests are rounded up:
|
.\" malloc requests are rounded up:
|
||||||
.\" (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK
|
.\" (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK
|
||||||
.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129
|
.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
mallopt(M_MXFAST, n)
|
.EX
|
||||||
|
mallopt(M_MXFAST, n)
|
||||||
.fi
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
does not result in fastbins being employed for all allocations of size up to
|
does not result in fastbins being employed for all allocations of size up to
|
||||||
.IR n .
|
.IR n .
|
||||||
To ensure desired results,
|
To ensure desired results,
|
||||||
|
|
|
@ -208,9 +208,9 @@ If the "Msg?" columns contains "y",
|
||||||
then the system prints an error message on standard error.
|
then the system prints an error message on standard error.
|
||||||
.PP
|
.PP
|
||||||
The table uses the following notations and abbreviations:
|
The table uses the following notations and abbreviations:
|
||||||
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
x first argument to function
|
x first argument to function
|
||||||
y second argument to function
|
y second argument to function
|
||||||
fin finite value for argument
|
fin finite value for argument
|
||||||
|
|
|
@ -55,17 +55,21 @@ produce non-initial states when interrupted in the middle of a character.
|
||||||
One possible way to create an
|
One possible way to create an
|
||||||
.I mbstate_t
|
.I mbstate_t
|
||||||
in initial state is to set it to zero:
|
in initial state is to set it to zero:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
mbstate_t state;
|
.EX
|
||||||
memset(&state,0,sizeof(mbstate_t));
|
mbstate_t state;
|
||||||
.fi
|
memset(&state,0,sizeof(mbstate_t));
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
On Linux, the following works as well, but might generate compiler warnings:
|
On Linux, the following works as well, but might generate compiler warnings:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
mbstate_t state = { 0 };
|
.EX
|
||||||
.fi
|
mbstate_t state = { 0 };
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
The function
|
The function
|
||||||
.BR mbsinit ()
|
.BR mbsinit ()
|
||||||
|
|
|
@ -71,7 +71,7 @@ T} Thread safety MT-Safe
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
This function is a GNU extension.
|
This function is a GNU extension.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.EX
|
||||||
void *
|
void *
|
||||||
combine(void *o1, size_t s1, void *o2, size_t s2)
|
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);
|
mempcpy(mempcpy(result, o1, s1), o2, s2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR memccpy (3),
|
.BR memccpy (3),
|
||||||
.BR memcpy (3),
|
.BR memcpy (3),
|
||||||
|
|
|
@ -134,9 +134,9 @@ function and the
|
||||||
.BR mtrace (1)
|
.BR mtrace (1)
|
||||||
command in a program that has memory leaks at two different locations.
|
command in a program that has memory leaks at two different locations.
|
||||||
The demonstration uses the following program:
|
The demonstration uses the following program:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.EX
|
||||||
|
|
||||||
.RB "$ " "cat t_mtrace.c"
|
.RB "$ " "cat t_mtrace.c"
|
||||||
#include <mcheck.h>
|
#include <mcheck.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -45,8 +45,8 @@ quiet NaNs, these functions return zero.
|
||||||
The call
|
The call
|
||||||
.I nan("char-sequence")
|
.I nan("char-sequence")
|
||||||
is equivalent to:
|
is equivalent to:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
strtod("NAN(char-sequence)", NULL);
|
strtod("NAN(char-sequence)", NULL);
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -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
|
according to the environment and queries the terminal character set and
|
||||||
the radix character.
|
the radix character.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -211,12 +211,12 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR locale (1),
|
.BR locale (1),
|
||||||
.BR localeconv (3),
|
.BR localeconv (3),
|
||||||
.BR setlocale (3),
|
.BR setlocale (3),
|
||||||
.BR charsets (7),
|
.BR charsets (7),
|
||||||
.BR locale (7)
|
.BR locale (7)
|
||||||
.br
|
.PP
|
||||||
The GNU C Library Reference Manual
|
The GNU C Library Reference Manual
|
||||||
|
|
|
@ -1128,8 +1128,8 @@ one might obtain "Sonntag, 3. Juli, 10:02".
|
||||||
.PP
|
.PP
|
||||||
To allocate a sufficiently large string and print into it
|
To allocate a sufficiently large string and print into it
|
||||||
(code correct for both glibc 2.0 and glibc 2.1):
|
(code correct for both glibc 2.0 and glibc 2.1):
|
||||||
.nf
|
.PP
|
||||||
|
.EX
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -1166,7 +1166,7 @@ make_message(const char *fmt, ...)
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.PP
|
.PP
|
||||||
If truncation occurs in glibc versions prior to 2.0.6, this is treated as an
|
If truncation occurs in glibc versions prior to 2.0.6, this is treated as an
|
||||||
error instead of being handled gracefully.
|
error instead of being handled gracefully.
|
||||||
|
|
|
@ -169,7 +169,7 @@ and then calls
|
||||||
.BR pthread_getaffinity_np ()
|
.BR pthread_getaffinity_np ()
|
||||||
to check the resulting CPU affinity mask of the thread.
|
to check the resulting CPU affinity mask of the thread.
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.EX
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -211,7 +211,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR sched_setaffinity (2),
|
.BR sched_setaffinity (2),
|
||||||
.BR CPU_SET (3),
|
.BR CPU_SET (3),
|
||||||
|
|
|
@ -138,23 +138,25 @@ hence the suffix "_np" (nonportable) in the names.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The following code waits to join for up to 5 seconds:
|
The following code waits to join for up to 5 seconds:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.in +4n
|
||||||
struct timespec ts;
|
.EX
|
||||||
int s;
|
struct timespec ts;
|
||||||
|
int s;
|
||||||
|
|
||||||
...
|
\&...
|
||||||
|
|
||||||
if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
|
if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
|
||||||
/* Handle error */
|
/* Handle error */
|
||||||
}
|
}
|
||||||
|
|
||||||
ts.tv_sec += 5;
|
ts.tv_sec += 5;
|
||||||
|
|
||||||
s = pthread_timedjoin_np(thread, NULL, &ts);
|
s = pthread_timedjoin_np(thread, NULL, &ts);
|
||||||
if (s != 0) {
|
if (s != 0) {
|
||||||
/* Handle error */
|
/* Handle error */
|
||||||
}
|
}
|
||||||
.fi
|
.EX
|
||||||
|
.in
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR clock_gettime (2),
|
.BR clock_gettime (2),
|
||||||
.BR pthread_exit (3),
|
.BR pthread_exit (3),
|
||||||
|
|
|
@ -136,8 +136,8 @@ and
|
||||||
The following program displays the results when
|
The following program displays the results when
|
||||||
.BR rpmatch ()
|
.BR rpmatch ()
|
||||||
is applied to the string given in the program's command-line argument.
|
is applied to the string given in the program's command-line argument.
|
||||||
.nf
|
.PP
|
||||||
|
.EX
|
||||||
#define _SVID_SOURCE
|
#define _SVID_SOURCE
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -156,7 +156,7 @@ main(int argc, char *argv[])
|
||||||
printf("rpmatch() returns: %d\\n", rpmatch(argv[1]));
|
printf("rpmatch() returns: %d\\n", rpmatch(argv[1]));
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR fgets (3),
|
.BR fgets (3),
|
||||||
.BR getline (3),
|
.BR getline (3),
|
||||||
|
|
|
@ -77,11 +77,11 @@ Try the example program with
|
||||||
set to 1.
|
set to 1.
|
||||||
.PP
|
.PP
|
||||||
Libc5 uses the prototype
|
Libc5 uses the prototype
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
|
int rtime(struct sockaddr_in *, struct timeval *, struct timeval *);
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
and requires
|
and requires
|
||||||
.I <sys/time.h>
|
.I <sys/time.h>
|
||||||
instead of
|
instead of
|
||||||
|
|
|
@ -86,38 +86,41 @@ This manual page is incomplete.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.\" FIXME . ? would be better to use libnetlink in the EXAMPLE code here
|
.\" FIXME . ? would be better to use libnetlink in the EXAMPLE code here
|
||||||
Creating a rtnetlink message to set the MTU of a device:
|
Creating a rtnetlink message to set the MTU of a device:
|
||||||
.nf
|
.PP
|
||||||
#include <linux/rtnetlink.h>
|
.in +4n
|
||||||
|
.EX
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
|
|
||||||
...
|
\&...
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct nlmsghdr nh;
|
struct nlmsghdr nh;
|
||||||
struct ifinfomsg if;
|
struct ifinfomsg if;
|
||||||
char attrbuf[512];
|
char attrbuf[512];
|
||||||
} req;
|
} req;
|
||||||
|
|
||||||
struct rtattr *rta;
|
struct rtattr *rta;
|
||||||
unsigned int mtu = 1000;
|
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));
|
memset(&req, 0, sizeof(req));
|
||||||
req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
|
||||||
req.nh.nlmsg_flags = NLM_F_REQUEST;
|
req.nh.nlmsg_flags = NLM_F_REQUEST;
|
||||||
req.nh.nlmsg_type = RTM_NEWLINK;
|
req.nh.nlmsg_type = RTM_NEWLINK;
|
||||||
req.if.ifi_family = AF_UNSPEC;
|
req.if.ifi_family = AF_UNSPEC;
|
||||||
req.if.ifi_index = INTERFACE_INDEX;
|
req.if.ifi_index = INTERFACE_INDEX;
|
||||||
req.if.ifi_change = 0xffffffff; /* ??? */
|
req.if.ifi_change = 0xffffffff; /* ??? */
|
||||||
rta = (struct rtattr *)(((char *) &req) +
|
rta = (struct rtattr *)(((char *) &req) +
|
||||||
NLMSG_ALIGN(req.nh.nlmsg_len));
|
NLMSG_ALIGN(req.nh.nlmsg_len));
|
||||||
rta\->rta_type = IFLA_MTU;
|
rta\->rta_type = IFLA_MTU;
|
||||||
rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
|
rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
|
||||||
req.nh.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
|
req.nh.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
|
||||||
RTA_LENGTH(sizeof(mtu));
|
RTA_LENGTH(sizeof(mtu));
|
||||||
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
|
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
|
||||||
send(rtnetlink_sk, &req, req.nh.nlmsg_len, 0);
|
send(rtnetlink_sk, &req, req.nh.nlmsg_len, 0);
|
||||||
.fi
|
.EX
|
||||||
|
.in
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR netlink (3),
|
.BR netlink (3),
|
||||||
.BR netlink (7),
|
.BR netlink (7),
|
||||||
|
|
|
@ -70,8 +70,8 @@ by
|
||||||
to the power of
|
to the power of
|
||||||
.IR exp ,
|
.IR exp ,
|
||||||
that is:
|
that is:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
x * FLT_RADIX ** exp
|
x * FLT_RADIX ** exp
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -77,8 +77,8 @@ by
|
||||||
to the power of
|
to the power of
|
||||||
.IR exp ,
|
.IR exp ,
|
||||||
that is:
|
that is:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
x * FLT_RADIX ** exp
|
x * FLT_RADIX ** exp
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -165,12 +165,14 @@ For example, we can initialize the
|
||||||
field given to
|
field given to
|
||||||
.BR sigvec ()
|
.BR sigvec ()
|
||||||
using code such as the following:
|
using code such as the following:
|
||||||
.nf
|
.PP
|
||||||
|
.in +4n
|
||||||
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
|
.EX
|
||||||
/* Block SIGQUIT and SIGABRT during
|
vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT);
|
||||||
handler execution */
|
/* Block SIGQUIT and SIGABRT during
|
||||||
.fi
|
handler execution */
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
.BR sigblock ()
|
.BR sigblock ()
|
||||||
|
|
Loading…
Reference in New Issue