Usual system gconv module configuration cache.
.SH CONFORMING TO
POSIX.1-2001.
-.SH EXAMPLE
+.SH EXAMPLES
Convert text from the ISO 8859-15 character encoding to UTF-8:
.PP
.in +4n
Usual default path for locale definition files.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
$ \fBlocale\fP
LANG=en_US.UTF\-8
time values.
.SH CONFORMING TO
POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
Compile the locale files for Finnish in the UTF\-8 character set
and add it to the default locale archive with the name
.BR fi_FI.UTF\-8 :
To report bugs, see
.UR http://www.gnu.org/software/libc/bugs.html
.UE
-.SH EXAMPLE
+.SH EXAMPLES
Below is a simple program that reallocates a block of
memory in cycles that rise to a peak before then cyclically
reallocating the memory in smaller blocks that return to zero.
To report bugs, see
.UR http://www.gnu.org/software/libc/bugs.html
.UE
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR memusage (1).
.SH SEE ALSO
.\" glibc commit 1a4c27355e146b6d8cc6487b998462c7fdd1048f
This problem was fixed in glibc 2.30, and the fix has been backported
to earlier glibc versions in some distributions.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
$ \fBecho $$\fP # Display PID of shell
1143
The
.B sprof
command is a GNU extension, not present in POSIX.1.
-.SH EXAMPLE
+.SH EXAMPLES
The following example demonstrates the use of
.BR sprof .
The example consists of a main program that calls two functions
.\" header file contains the required SYS_foo definition.
.\" Otherwise, the use of a _syscall macro is required.
.\"
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>
.\" SunOS 5 has 'size_t *'
later POSIX standards and glibc 2.x have
.IR "socklen_t\ * ".
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR bind (2).
.SH SEE ALSO
package.
When employing the wrapper in that library, link with
.IR \-lkeyutils .
-.SH EXAMPLE
+.SH EXAMPLES
The program below creates a key with the type, description, and payload
specified in its command-line arguments,
and links that key into the session keyring.
.SH BUGS
The transparent proxy options are not described.
.\" FIXME Document transparent proxy options
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR bind ()
with Internet domain sockets can be found in
has got the same syscall number, and
.BR chown ()
got the newly introduced number.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The following program changes the ownership of the file named in
its second command-line argument to the value specified in its
.BR CLOCK_THREAD_CPUTIME_ID ,
on systems that provide such an implementation
(i.e., Linux 2.6.12 and later).
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR clock_gettime ()
and
Because of the stale-cache problem, as well as other problems noted in
.BR getpid (2),
the PID caching feature was removed in glibc 2.25.
-.SH EXAMPLE
+.SH EXAMPLES
The following program demonstrates the use of
.BR clone ()
to create a child process that executes in a separate UTS namespace.
fails, consider the state of the socket as unspecified.
Portable applications should close the socket and create a new one for
reconnecting.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR connect ()
is shown in
such as the use of reflinks (i.e., two or more inodes that share
pointers to the same copy-on-write disk blocks)
or server-side-copy (in the case of NFS).
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <fcntl.h>
eventfd file descriptor,
returning 0 if the correct number of bytes was transferred,
or \-1 otherwise.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The following program creates an eventfd file descriptor
and then forks to create a child process.
.\" .BR execve ()
.\" that could be exploited for denial of service by a suitably crafted
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
-.SH EXAMPLE
+.SH EXAMPLES
The following program is designed to be execed by the second program below.
It just echoes its command-line arguments, one per line.
.PP
established using
.BR pthread_atfork (3).
.\" and does some magic to ensure that getpid(2) returns the right value.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pipe (2)
and
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates use of futexes in a program where a parent
process and a child process use a pair of futexes located inside a
shared anonymous mapping to synchronize access to a shared resource:
.PP
These calls supersede
.BR readdir (2).
-.SH EXAMPLE
+.SH EXAMPLES
.\" FIXME The example program needs to be revised, since it uses the older
.\" getdents() system call and the structure with smaller field widths.
The program below demonstrates the use of
.BR getrlimit ()
as wrapper functions that call
.BR prlimit ().
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR prlimit ().
.PP
.\" and the SGI XFS development team,
.\" .RI < linux-xfs@oss.sgi.com >.
.\" Please send any bug reports or comments to these addresses.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR listxattr (2).
.SH SEE ALSO
Inotify was merged into the 2.6.13 Linux kernel.
.SH CONFORMING TO
This system call is Linux-specific.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR inotify (7).
.SH SEE ALSO
of the Linux kernel.
.SH CONFORMING TO
This API is Linux-specific.
-.SH EXAMPLE
+.SH EXAMPLES
.SS Toggling the archive flag
The following program demonstrates the usage of
.BR ioctl (2)
.SH CONFORMING TO
This API is Linux-specific.
Not all filesystems support it.
-.SH EXAMPLE
+.SH EXAMPLES
See
.I io/fsmap.c
in the
file.
.SH CONFORMING TO
Namespaces and the operations described on this page are a Linux-specific.
-.SH EXAMPLE
+.SH EXAMPLES
The example shown below uses the
.BR ioctl (2)
operations described above to perform simple
.TP
.B EPERM
Insufficient permission.
-.SH EXAMPLE
+.SH EXAMPLES
Check the condition of DTR on the serial port.
.PP
.EX
the second
.BR UFFDIO_API
operation that actually enables the desired features.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR userfaultfd (2).
.SH SEE ALSO
.BR clone (2)
for some background information on the shared resources
referred to on this page.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR kcmp ()
to test whether pairs of file descriptors refer to
However, rather than using this system call directly,
you probably want to use the various library functions
mentioned in the descriptions of individual operations above.
-.SH EXAMPLE
+.SH EXAMPLES
The program below provide subset of the functionality of the
.BR request-key (8)
program provided by the
.\" The following is now rather historic information (MTK, Jun 05)
.\" Don't rely on this value in portable applications since BSD
.\" (and some BSD-derived systems) limit the backlog to 5.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR bind (2).
.SH SEE ALSO
.BR listxattr (7).
If the total size of attribute names attached to a file exceeds this limit,
it is no longer possible to retrieve the list of attribute names.
-.SH EXAMPLE
+.SH EXAMPLES
The following program demonstrates the usage of
.BR listxattr ()
and
.BR membarrier ()
can be useful include implementations
of Read-Copy-Update libraries and garbage collectors.
-.SH EXAMPLE
+.SH EXAMPLES
Assuming a multithreaded application where "fast_path()" is executed
very frequently, and where "slow_path()" is executed infrequently, the
following code (x86) can be transformed using
to impose additional restrictions (so long as the
.BR F_SEAL_SEAL
seal has not yet been applied).
-.SH EXAMPLE
+.SH EXAMPLES
Below are shown two example programs that demonstrate the use of
.BR memfd_create ()
and the file sealing API.
.BR tmpfs (5)
(for example, when using the POSIX shared memory interface documented in
.BR shm_overview (7)).
-.SH EXAMPLE
+.SH EXAMPLES
.\" FIXME . Add an example here that uses an anonymous shared region for
.\" IPC between parent and child.
.PP
.BR pkey_mprotect ()
is equivalent to
.BR mprotect ().
-.SH EXAMPLE
+.SH EXAMPLES
.\" sigaction.2 refers to this example
.PP
The program below demonstrates the use of
This bug is fixed
.\" commit 4f87dac386cc43d5525da7a939d4b4e7edbea22c
in Linux 3.14.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR msgsnd ()
and
.IR mount_fd
argument used by
.BR open_by_handle_at ().
-.SH EXAMPLE
+.SH EXAMPLES
The two programs below demonstrate the use of
.BR name_to_handle_at ()
and
For example, retired branches measured
the wrong thing on AMD machines until Linux 2.6.35.
.\" commit f287d332ce835f77a4f5077d2c0ef1e3f9ea42d2
-.SH EXAMPLE
+.SH EXAMPLES
The following is a short example that measures the total
instruction count of a call to
.BR printf (3).
.I not
pollable and can't be waited on with
.BR waitid (2).
-.SH EXAMPLE
+.SH EXAMPLES
The program below opens a PID file descriptor for the
process whose PID is specified as its command-line argument.
It then uses
.BR pidfd_send_signal ()
fails with the error
.BR ESRCH .
-.SH EXAMPLE
+.SH EXAMPLES
.nf
#define _GNU_SOURCE
#include <limits.h>
See
.BR syscall (2)
for information regarding registers used for storing second file descriptor.
-.SH EXAMPLE
+.SH EXAMPLES
.\" fork.2 refers to this example program.
The following program creates a pipe, and then
.BR fork (2)s
However, the behavior stated in DESCRIPTION
has remained consistent since this system call
was first implemented and will not change now.
-.SH EXAMPLE
+.SH EXAMPLES
.\" FIXME
.\" Would it be better, because simpler, to use unshare(2)
.\" rather than clone(2) in the example below?
.BR pkey_free ()),
the kernel may make arbitrary changes to the parts of the
rights register affecting access to that key.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pkeys (7).
.SH SEE ALSO
See the discussion of spurious readiness notifications under the
BUGS section of
.BR select (2).
-.SH EXAMPLE
+.SH EXAMPLES
The program below opens each of the files named in its command-line
arguments and monitors the resulting file descriptors for readiness to read
.RB ( POLLIN ).
.\" Original user is MPI, http://www.mcs.anl.gov/research/projects/mpi/
.\" See also some benchmarks at http://lwn.net/Articles/405284/
.\" and http://marc.info/?l=linux-mm&m=130105930902915&w=2
-.SH EXAMPLE
+.SH EXAMPLES
The following code sample demonstrates the use of
.BR process_vm_readv ().
It reads 20 bytes at the address 0x10000 from the process with PID 10
that corresponds to the
.IR dirfd
argument.
-.SH EXAMPLE
+.SH EXAMPLES
The following program allocates the buffer needed by
.BR readlink ()
dynamically from the information provided by
And since glibc 2.20
(which requires a minimum Linux kernel version of 2.6.32),
the glibc wrapper functions always just directly invoke the system calls.
-.SH EXAMPLE
+.SH EXAMPLES
The following code sample demonstrates the use of
.BR writev ():
.PP
.BR recvmmsg (2)
for information about a Linux-specific system call
that can be used to receive multiple datagrams in a single call.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR recvfrom ()
is shown in
In the current implementation, however, the error code can be overwritten
in the meantime by an unrelated network event on a socket,
for example an incoming ICMP packet.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The following program uses
.BR recvmmsg ()
package.
When employing the wrapper in that library, link with
.IR \-lkeyutils .
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR request_key ().
The
.BR CPU_COUNT (3)
(rather than iterating over the number of bits
requested to be allocated).
-.SH EXAMPLE
+.SH EXAMPLES
The program below creates a child process.
The parent and child then each assign themselves to a specified CPU
and execute identical loops that consume some CPU time.
whose value is the size of the
.IR seccomp_data
buffer.
-.SH EXAMPLE
+.SH EXAMPLES
The program below accepts four or more arguments.
The first three arguments are a system call number,
a numeric architecture identifier, and an error number.
but the glibc wrapper hides this behavior by internally copying the
.I timeout
to a local variable and passing that variable to the system call.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>
and
.BR poll (2)
when monitoring large numbers of file descriptors.
-.SH EXAMPLE
+.SH EXAMPLES
Here is an example that better demonstrates the true utility of
.BR select ().
The listing below is a TCP forwarding program that forwards
This was rectified
.\" commit a5f4db877177d2a3d7ae62a7bac3a5a27e083d7f
in Linux 4.6.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR shmop (2).
.SH SEE ALSO
was perhaps unfortunate,
.B IPC_NEW
would more clearly show its function.
-.SH EXAMPLE
+.SH EXAMPLES
The program shown below uses
.BR semget ()
to create a new semaphore set or retrieve the ID of an existing set.
.\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2
.\" the fix:
.\" http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2
-.SH EXAMPLE
+.SH EXAMPLES
The following code segment uses
.BR semop ()
to atomically wait for the value of semaphore 0 to become zero,
.B EPIPE
instead of
.BR ENOTCONN .
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR sendto ()
is shown in
starting at the first failed message, but there is no guarantee that,
if an error is returned, it will be the same as the one that was lost
on the previous call.
-.SH EXAMPLE
+.SH EXAMPLES
The example below uses
.BR sendmmsg ()
to send
.BR clone (2)
can be changed using
.BR setns ().
-.SH EXAMPLE
+.SH EXAMPLES
The program below takes two or more arguments.
The first argument specifies the pathname of a namespace file in an existing
.I /proc/[pid]/ns/
was perhaps unfortunate,
.B IPC_NEW
would more clearly show its function.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR shmop (2).
.SH SEE ALSO
The implementation places no intrinsic per-process limit on the
number of shared memory segments
.RB ( SHMSEG ).
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The two programs shown below exchange a string using a shared memory segment.
Further details about the programs are given below.
execution of the handler, but also the signals specified in
.IR sa_mask .
This bug was fixed in kernel 2.6.14.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR mprotect (2).
.SH SEE ALSO
.B SS_ONSTACK
is specified in
.IR ss.ss_flags .
-.SH EXAMPLE
+.SH EXAMPLES
The following code segment demonstrates the use of
.BR sigaltstack ()
(and
fields are not filled in with the data accompanying a signal sent by
.BR sigqueue (3).
.\" The fix also was put into 2.6.24.5
-.SH EXAMPLE
+.SH EXAMPLES
The program below accepts the signals
.B SIGINT
and
However, already the BSD man page promises: "The protocol
family generally is the same as the address family", and subsequent
standards use AF_* everywhere.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR socket ()
is shown in
Since Linux 2.6.31,
.\" commit 7c77f0b3f9208c339a4b40737bb2cb0f0319bb8d
both arguments may refer to pipes.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR tee (2).
.SH SEE ALSO
.UR http://www.bsc.es\:/projects\:/deepcomputing\:/linuxoncell/
.UE
for the recommended libraries.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR spu_run (2)
for an example of the use of
.UR http://www.bsc.es\:/projects\:/deepcomputing\:/linuxoncell/
.UE
for the recommended libraries.
-.SH EXAMPLE
+.SH EXAMPLES
The following is an example of running a simple, one-instruction SPU
program with the
.BR spu_run ()
or, on some architectures,
.\" strace(1) shows the name "newfstatat" on x86-64
.BR newfstatat ().
-.SH EXAMPLE
+.SH EXAMPLES
The following program calls
.BR lstat ()
and displays selected fields in the returned
.PP
Note that these tables don't cover the entire calling convention\(emsome
architectures may indiscriminately clobber other registers not listed here.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <unistd.h>
.PP
It is not yet possible to change operating system by writing to
.IR /proc/sys/kernel/ostype .
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <unistd.h>
.BR tee ()
assigns data to the output by merely grabbing
a reference to the input.
-.SH EXAMPLE
+.SH EXAMPLES
The example below implements a basic
.BR tee (1)
program using the
.\" glibc commit 93a78ac437ba44f493333d7e2a4b0249839ce460
the implementation falls back to this technique on systems
running pre-2.6 Linux kernels.
-.SH EXAMPLE
+.SH EXAMPLES
The program below takes two arguments: a sleep period in seconds,
and a timer frequency in nanoseconds.
The program establishes a handler for the signal it uses for the timer,
the counter cycles, starting once more from low values.
.\" Bug filed: http://bugzilla.kernel.org/show_bug.cgi?id=12665
.\" http://thread.gmane.org/gmane.linux.kernel/113276/
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR timer_create (2).
.SH SEE ALSO
These system calls are available since Linux 2.6.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR timer_create (2).
.SH SEE ALSO
.BR timerfd_create ()
supports fewer types of clock IDs than
.BR timer_create (2).
-.SH EXAMPLE
+.SH EXAMPLES
The following program creates a timer and then monitors its progress.
The program accepts up to three command-line arguments.
The first argument specifies the number of seconds for
.\"be incrementally added to unshare without affecting legacy
.\"applications using unshare.
.\"
-.SH EXAMPLE
+.SH EXAMPLES
The program below provides a simple implementation of the
.BR unshare (1)
command, which unshares one or more namespaces and executes the
In this case, a spurious
.B UFFD_EVENT_FORK
will be delivered to the userfaultfd monitor.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of the userfaultfd mechanism.
The program creates two threads, one of which acts as the
page-fault handler for the process, for the pages in a demand-page zero
succeeds, and returns the process ID of the waited-for child.
Applications should avoid relying on this inconsistent,
nonstandard, and unnecessary feature.
-.SH EXAMPLE
+.SH EXAMPLES
.\" fork.2 refers to this example program.
The following program demonstrates the use of
.BR fork (2)
operate on dynamically allocated CPU sets.
These bugs are fixed in glibc 2.9.
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7029
-.SH EXAMPLE
+.SH EXAMPLES
The following program demonstrates the use of some of the macros
used for dynamically allocated CPU sets.
.PP
has been available since version 2.17.
.SH CONFORMING TO
Both functions are nonstandard GNU extensions.
-.SH EXAMPLE
+.SH EXAMPLES
The following program will calculate the time, in microseconds, spent
between two calls to
.BR __ppc_get_timebase ().
macros from
.I <fpu_control.h>
can be used.
-.SH EXAMPLE
+.SH EXAMPLES
.B __setfpucw(0x1372)
.PP
Set FPU control word on the i386 architecture to
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR aio (7).
.SH SEE ALSO
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR aio (7).
.SH SEE ALSO
Simultaneous I/O operations specifying the same
.I aiocb
structure produce undefined results.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR aio (7).
.SH SEE ALSO
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR aio (7).
.SH SEE ALSO
.BR on_exit (3))
can be used within a shared library to establish functions
that are called when the shared library is unloaded.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>
linker option.
Note that names of "static" functions are not exposed,
and won't be available in the backtrace.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR backtrace ()
and
.BR dirname ()
did not correctly handle pathnames with trailing \(aq/\(aq characters,
and generated a segfault if given a NULL argument.
-.SH EXAMPLE
+.SH EXAMPLES
The following code snippet demonstrates the use of
.BR basename ()
and
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD.
-.SH EXAMPLE
+.SH EXAMPLES
The example below first sorts an array of structures using
.BR qsort (3),
then retrieves desired elements using
These macros always succeed.
.SH CONFORMING TO
These macros are GNU extensions.
-.SH EXAMPLE
+.SH EXAMPLES
The program below swaps the bytes of the 8-byte integer supplied as
its command-line argument.
The following shell session demonstrates the use of the program:
.TE
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
/* Link with "\-lm" */
.TE
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
/* Link with "\-lm" */
.TE
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
/* Link with "\-lm" */
.TE
.SH CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
/* Link with "\-lm" */
of 0,
is the same as using the clock ID
.BR CLOCK_PROCESS_CPUTIME_ID .
-.SH EXAMPLE
+.SH EXAMPLES
The example program below obtains the
CPU-time clock ID of the process whose ID is given on the command line,
and then uses
are constant expressions (assuming their argument is constant),
meaning that these values can be used to declare the size of global variables.
This may not be portable, however.
-.SH EXAMPLE
+.SH EXAMPLES
This code looks for the
.B IP_TTL
option in a received ancillary buffer:
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
The following code fragment determines the path where to find
the POSIX.2 system utilities:
.PP
and
.BR imaxdiv ()
were added in C99.
-.SH EXAMPLE
+.SH EXAMPLES
After
.PP
.in +4n
For the main program, the
.I dlpi_name
field will be an empty string.
-.SH EXAMPLE
+.SH EXAMPLES
The following program displays a list of pathnames of the
shared objects it has loaded.
For each shared object, the program lists some information
.\" .in
.SS History
This function is part of the dlopen API, derived from SunOS.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR dlopen (3).
.SH SEE ALSO
and also appears on some other systems.
The sets of requests supported by the various implementations
overlaps only partially.
-.SH EXAMPLE
+.SH EXAMPLES
The program below opens a shared objects using
.BR dlopen (3)
and then uses the
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=18684
if the call is made from any object loaded in a
namespace other than the initial namespace.
-.SH EXAMPLE
+.SH EXAMPLES
The program below loads the (glibc) math library,
looks up the address of the
.BR cos (3)
function is part of the dlopen API, derived from SunOS.
That system does not have
.BR dlvsym ().
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR dlopen (3).
.SH SEE ALSO
.BR duplocale ()
should be deallocated using
.BR freelocale (3).
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR uselocale (3)
and
.BR crypt (3).
.SS Features in glibc
In glibc 2.2, these functions use the DES algorithm.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _XOPEN_SOURCE
#include <stdio.h>
Use
.BR sbrk (2)
with an argument of zero to find the current value of the program break.
-.SH EXAMPLE
+.SH EXAMPLES
When run, the program below produces output such as the following:
.PP
.in +4n
On the other hand, the fact that they were designed
for use in the context of TCP/IP means that
they lack the 64-bit and little-endian variants described in this page.
-.SH EXAMPLE
+.SH EXAMPLES
The program below display the results of converting an integer
from host byte order to both little-endian and big-endian byte order.
Since host byte order is either little-endian or big-endian,
.SH CONFORMING TO
These functions are a GNU extension.
Handle with care.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>
.\" .BR warn ()
.\" functions first appeared in
.\" 4.4BSD.
-.SH EXAMPLE
+.SH EXAMPLES
Display the current
.I errno
information string and exit:
.BR fmemopen ()
ignored \(aqb\(aq in
.IR mode .
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR fmemopen ()
to open an input buffer, and
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
+.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>
.TE
.SH CONFORMING TO
This function is a nonstandard GNU extension.
-.SH EXAMPLE
+.SH EXAMPLES
The program below implements a custom stream whose functionality
is similar (but not identical) to that available via
.BR fmemopen (3).
.I double
also conforms to
SVr4, 4.3BSD, C89.
-.SH EXAMPLE
+.SH EXAMPLES
The program below produces results such as the following:
.PP
.in +4n
.I /dev/hda1
and files on
.IR /dev/sda1 .
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR semget (2).
.SH SEE ALSO
.\" http://austingroupbugs.net/view.php?id=1121
.\" https://bugzilla.redhat.com/show_bug.cgi?id=1422736
so that the glibc implementation (once more) follows the POSIX specification.
-.SH EXAMPLE
+.SH EXAMPLES
The following program traverses the directory tree under the path named
in its first command-line argument, or under the current directory
if no argument is supplied.
np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */
.EE
.in
-.SH EXAMPLE
+.SH EXAMPLES
The following example shows how
.BR get_nprocs ()
and
avl_pages = sysconf(_SC_AVPHYS_PAGES); /* available pages */
.EE
.in
-.SH EXAMPLE
+.SH EXAMPLES
The following example shows how
.BR get_phys_pages ()
and
.BR "(AI_V4MAPPED\ |\ AI_ADDRCONFIG)"
for this case,
since this value is considered an improvement on the specification.
-.SH EXAMPLE
+.SH EXAMPLES
.\" getnameinfo.3 refers to this example
.\" socket.2 refers to this example
.\" bind.2 refers to this example
was modeled after the
.BR lio_listio (3)
interface.
-.SH EXAMPLE
+.SH EXAMPLES
Two examples are provided: a simple example that resolves
several requests in parallel synchronously, and a complex example
showing some of the asynchronous capabilities.
is implemented using
.BR strptime (3),
so that precisely the same conversions are supported by both.
-.SH EXAMPLE
+.SH EXAMPLES
The program below calls
.BR getdate ()
for each of its command-line arguments,
.BR getgrent_r ()
is not really reentrant since it shares the reading position
in the stream with all other threads.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <grp.h>
.IR groups ,
even when the number of groups exceeds
.IR *ngroups .
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The program below displays the group list for the user named in its
first command-line argument.
defined in
.IR <linux/netdevice.h> ),
which contains various interface attributes and statistics.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR getifaddrs (),
.BR freeifaddrs (),
.BR getdelim ()
were originally GNU extensions.
They were standardized in POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <stdio.h>
.I servlen
arguments were typed as
.IR size_t .
-.SH EXAMPLE
+.SH EXAMPLES
The following code tries to get the numeric hostname and service name,
for a given socket address.
Note that there is no hardcoded reference to
.B POSIXLY_CORRECT
and checks for GNU extensions in
.IR optstring .)
-.SH EXAMPLE
+.SH EXAMPLES
.SS getopt()
The following trivial example program uses
.BR getopt ()
These functions are GNU extensions.
Functions with similar names exist on some other systems,
though typically with different calling signatures.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR getprotobyname_r ()
to retrieve the protocol record for the protocol named
.BR getpwent_r ()
is not really reentrant since it shares the reading position
in the stream with all other threads.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <pwd.h>
it is necessary to use
.I getpwnam("username")\->pw_dir
or similar.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR getpwnam_r ()
to find the full username and user ID for the username
These functions are GNU extensions.
Functions with similar names exist on some other systems,
though typically with different calling signatures.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR getservbyport_r ()
to retrieve the service record for the port and protocol named
overwrites any commas it finds in the string
.IR *optionp ,
that string must be writable; it cannot be a string constant.
-.SH EXAMPLE
+.SH EXAMPLES
The following program expects suboptions following a "\-o" option.
.PP
.EX
On error, these functions return \-1.
There are no utmpx equivalents of the above functions.
(POSIX.1 does not specify such functions.)
-.SH EXAMPLE
+.SH EXAMPLES
The following example adds and removes a utmp record, assuming it is run
from within a pseudo terminal.
For usage in a real application, you
.BR opendir (3).
These will store their error code in
.IR errno .
-.SH EXAMPLE
+.SH EXAMPLES
One example of use is the following code, which simulates typing
.PP
.in +4n
.TE
.SH CONFORMING TO
These functions are glibc-specific.
-.SH EXAMPLE
+.SH EXAMPLES
When run, the program below will produce output such as the following:
.PP
.in +4n
updating the \fIdata\fP for the given \fIkey\fP in this case.
.PP
Individual hash table entries can be added, but not deleted.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The following program inserts 24 items into a hash table, then prints
some of them.
POSIX.1-2001, POSIX.1-2008, RFC\ 3493.
.PP
This function first appeared in BSDi.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of the functions described
on this page.
An example of the output this program might produce is the following:
having been superseded by Classless Inter-Domain Routing (CIDR),
which divides addresses into network and host components at
arbitrary bit (rather than byte) boundaries.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of
.BR inet_aton ()
and
then
.I bits
is set to 8 times the number of octets actually specified.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR inet_net_pton ()
and
.SH BUGS
.B AF_INET6
converts IPv4-mapped IPv6 addresses into an IPv6 format.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR inet_pton (3).
.SH SEE ALSO
An explicit IPv4-mapped IPv6 address must be supplied in
.I src
instead.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR inet_pton ()
and
Consequently, to build a linear list, the caller had to build a list
using an initial call that contained the first two elements of the list,
with the forward and backward pointers in each element suitably initialized.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR insque ().
Here is an example run of the program:
Nevertheless, starting with version 2.8, glibc makes some changes to
.BR makecontext (),
to permit this on some 64-bit architectures (e.g., x86-64).
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The example program below demonstrates the use of
.BR getcontext (3),
However, because some internal bookkeeping values may be of type
.IR long ,
the reported values may wrap around zero and thus be inaccurate.
-.SH EXAMPLE
+.SH EXAMPLES
The program below employs
.BR mallinfo ()
to retrieve memory allocation statistics before and after
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=9957
Programmers should instead preempt calls to the relevant functions
by defining and exporting functions such as "malloc" and "free".
-.SH EXAMPLE
+.SH EXAMPLES
Here is a short example of how to use these variables.
.PP
.EX
.BR malloc_stats (3)
and
.BR mallinfo (3).
-.SH EXAMPLE
+.SH EXAMPLES
The program below takes up to four command-line arguments,
of which the first three are mandatory.
The first argument specifies the number of threads that
the block starting at
.I p+sizeof(size_t)
is initialized.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR M_CHECK_ACTION .
If the program is supplied with an (integer) command-line argument,
.BR matherr ()
T} Thread safety MT-Safe
.TE
-.SH EXAMPLE
+.SH EXAMPLES
The example program demonstrates the use of
.BR matherr ()
when calling
.BR mbsrtowcs (3)
provides a better interface to the same
functionality.
-.SH EXAMPLE
+.SH EXAMPLES
The program below illustrates the use of
.BR mbstowcs (),
as well as some of the wide character classification functions.
.B MALLOC_CHECK_
does not require the application to be relinked.
.\" But is MALLOC_CHECK_ slower?
-.SH EXAMPLE
+.SH EXAMPLES
The program below calls
.BR mcheck ()
with a NULL argument and then frees the same block of memory twice.
.TE
.SH CONFORMING TO
This function is a GNU extension.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
void *
combine(void *o1, size_t s1, void *o2, size_t s2)
are library functions layered on top of the
.BR mq_getsetattr (2)
system call.
-.SH EXAMPLE
+.SH EXAMPLES
The program below can be used to show the default
.I mq_maxmsg
and
.BR netlink (7)
socket and creates a new thread for each notification that is
delivered to the process.
-.SH EXAMPLE
+.SH EXAMPLES
The following program registers a notification request for the
message queue named in its command-line argument.
Notification is performed by creating a thread.
is not always precise:
the line number references may refer to the previous or following (nonblank)
line of the source code.
-.SH EXAMPLE
+.SH EXAMPLES
The shell session below demonstrates the use of the
.BR mtrace ()
function and the
.BR newlocale ()
should be deallocated using
.BR freelocale ().
-.SH EXAMPLE
+.SH EXAMPLES
The program below takes up to two command-line arguments,
which each identify locales.
The first argument is required, and is used to set the
is the special locale object
.BR LC_GLOBAL_LOCALE
or is not a valid locale object handle.
-.SH EXAMPLE
+.SH EXAMPLES
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.
in units of bytes.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, C89, C99.
-.SH EXAMPLE
+.SH EXAMPLES
On a Linux/i386 system, when compiled using the default
.BR gcc (1)
options, the program below produces the following output:
.BR fseek (3)
call fails, returning \-1.
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=1996
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR fmemopen (3).
.SH SEE ALSO
.BR POSIX_SPAWN_SETSCHEDULER
was specified without also specifying
.BR POSIX_SPAWN_SETSCHEDPARAM .
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of various functions in the
POSIX spawn API.
The program accepts command-line attributes that can be used
.\" .PP
.\" Some floating-point conversions under early libc4
.\" caused memory leaks.
-.SH EXAMPLE
+.SH EXAMPLES
To print
.I Pi
to five decimal places:
type should be treated as opaque:
any access to the object other than via pthreads functions
is nonportable and produces undefined results.
-.SH EXAMPLE
+.SH EXAMPLES
The program below optionally makes use of
.BR pthread_attr_init ()
and various related functions to initialize a thread attributes
.BR pthread_detach (3)
or
.BR pthread_join (3).
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_attr_init (3).
.SH SEE ALSO
.\" Reportedly, LinuxThreads did the right thing, allocating
.\" extra space at the end of the stack:
.\" http://sourceware.org/ml/libc-alpha/2008-05/msg00086.html
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_getattr_np (3).
.SH SEE ALSO
.BR pthread_create (3).
.\" FIXME . Track status of the following bug:
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7007
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_setschedparam (3).
.SH SEE ALSO
See
.BR pthread_attr_setschedpolicy (3)
for a list of the thread scheduling policies supported on Linux.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_setschedparam (3).
.SH SEE ALSO
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_setschedparam (3).
.SH SEE ALSO
.BR pthread_create (3);
otherwise, the threads will attempt to use the same memory area
for their stacks, and chaos will ensue.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_attr_init (3).
.SH SEE ALSO
be at least
.I stacksize
bytes.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_create (3).
.SH SEE ALSO
if real-time signals are available, otherwise
.B SIGUSR2
is used.
-.SH EXAMPLE
+.SH EXAMPLES
The program below creates a thread and then cancels it.
The main thread joins with the canceled thread to check
that its exit status was
.BR pthread_cleanup_pop ()
is undefined.
Portable applications should avoid doing this.
-.SH EXAMPLE
+.SH EXAMPLES
The program below provides a simple example of the use of the functions
described in this page.
The program creates a thread that executes a loop bracketed by
This is in violation of the POSIX threads specification,
and is the source of many other nonconformances to the standard; see
.BR pthreads (7).
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR pthread_create (),
as well as a number of other functions in the pthreads API.
so that system resources for the thread can be released.
(But note that the resources of any threads for which one of these
actions has not been done will be freed when the process terminates.)
-.SH EXAMPLE
+.SH EXAMPLES
The following statement detaches the calling thread:
.PP
pthread_detach(pthread_self());
.SH CONFORMING TO
These functions are nonstandard GNU extensions;
hence the suffix "_np" (nonportable) in their names.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses
.BR pthread_getattr_default_np ()
to fetch the default thread-creation attributes and then displays
.SH CONFORMING TO
This function is a nonstandard GNU extension;
hence the suffix "_np" (nonportable) in the name.
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR pthread_getattr_np ().
The program creates a thread that then uses
.BR clock_settime (2)
when given the clock ID
.BR CLOCK_THREAD_CPUTIME_ID .
-.SH EXAMPLE
+.SH EXAMPLES
The program below creates a thread and then uses
.BR clock_gettime (2)
to retrieve the total process CPU time,
.PP
All of the threads in a process are peers:
any thread can join with any other thread in the process.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_create (3).
.SH SEE ALSO
.PP
This GNU-specific API, which first appeared in glibc 2.4,
is nowadays obsolete and should not be used in new programs.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_mutexattr_setrobust (3).
.SH SEE ALSO
.PP
These GNU-specific APIs, which first appeared in glibc 2.4,
are nowadays obsolete and should not be used in new programs.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The program below demonstrates the use of the robustness attribute of a
mutex attributes object.
A new thread created by
.BR pthread_create (3)
inherits a copy of its creator's CPU affinity mask.
-.SH EXAMPLE
+.SH EXAMPLES
In the following program, the main thread uses
.BR pthread_setaffinity_np ()
to set its CPU affinity mask to include CPUs 0 to 7
.I oldtype
argument of
.BR pthread_setcanceltype ().
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_cancel (3).
.SH SEE ALSO
.IR /proc/self/task/[tid]/comm .
.BR pthread_getname_np ()
retrieves it from the same location.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The program below demonstrates the use of
.BR pthread_setname_np ()
and details of the permitted ranges for priorities
in each scheduling policy, see
.BR sched (7).
-.SH EXAMPLE
+.SH EXAMPLES
The program below demonstrates the use of
.BR pthread_setschedparam ()
and
See
.BR nptl (7)
for details.
-.SH EXAMPLE
+.SH EXAMPLES
The program below blocks some signals in the main thread,
and then creates a dedicated thread to fetch those signals via
.BR sigwait (3).
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_cleanup_push (3).
.SH SEE ALSO
.SH CONFORMING TO
These functions are nonstandard GNU extensions;
hence the suffix "_np" (nonportable) in the names.
-.SH EXAMPLE
+.SH EXAMPLES
The following code waits to join for up to 5 seconds:
.PP
.in +4n
To compare C strings, the comparison function can call
.BR strcmp (3),
as shown in the example below.
-.SH EXAMPLE
+.SH EXAMPLES
For one example of use, see the example under
.BR bsearch (3).
.PP
(Use
.BR random (3)
instead.)
-.SH EXAMPLE
+.SH EXAMPLES
POSIX.1-2001 gives the following example of an implementation of
.BR rand ()
and
is an infinity and
.I y
is not a NaN.
-.SH EXAMPLE
+.SH EXAMPLES
The call "remainder(29.0, 3.0)" returns \-1.
.SH SEE ALSO
.BR div (3),
.B ^([yY]|yes|YES)$
and
.BR ^([nN]|no|NO)$ .
-.SH EXAMPLE
+.SH EXAMPLES
The following program displays the results when
.BR rpmatch ()
is applied to the string given in the program's command-line argument.
.SH BUGS
.BR rtime ()
in glibc 2.2.5 and earlier does not work properly on 64-bit machines.
-.SH EXAMPLE
+.SH EXAMPLES
This example requires that port 37 is up and open.
You may check
that the time entry within
These macros are nonstandard Linux extensions.
.SH BUGS
This manual page is incomplete.
-.SH EXAMPLE
+.SH EXAMPLES
.\" FIXME . ? would be better to use libnetlink in the EXAMPLE code here
Creating a rtnetlink message to set the MTU of a device:
.PP
(and the nonstandard
.BR versionsort ())
to match the standard.
-.SH EXAMPLE
+.SH EXAMPLES
The program below prints a list of the files in the current directory
in reverse order.
.\"
is not the same as on 4.4BSD,
as it may be used in float conversions equivalently to
.BR L .
-.SH EXAMPLE
+.SH EXAMPLES
To use the dynamic allocation conversion specifier, specify
.B m
as a length modifier (thus
be returned by a successful call to
.BR sem_init ().
POSIX.1-2008 rectifies this, specifying the zero return on success.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR shm_open (3)
and
.BR sem_post ()
is async-signal-safe:
it may be safely called within a signal handler.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR sem_wait (3)
and
.TE
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The (somewhat trivial) program shown below operates on an
unnamed semaphore.
alias_ent *alias_getbyname(char *name);
.EE
.in
-.SH EXAMPLE
+.SH EXAMPLES
The following example compiles with
.IR "gcc example.c \-o example" .
It will dump all names in the alias database.
.BR tmpfs (5)
filesystem that is normally mounted under
.IR /dev/shm .
-.SH EXAMPLE
+.SH EXAMPLES
The programs below employ POSIX shared memory and POSIX unnamed semaphores
to exchange a piece of data.
The "bounce" program (which must be run first) raises the case
See
.BR nptl (7)
for details.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pthread_sigmask (3).
.SH SEE ALSO
Prior to glibc 2.4,
.BR sockatmark ()
did not work.
-.SH EXAMPLE
+.SH EXAMPLES
The following code can be used after receipt of a
.B SIGURG
signal to read (and discard) all data up to the mark,
.I va_list
argument, such as
.BR vfprintf (3).
-.SH EXAMPLE
+.SH EXAMPLES
The function
.I foo
takes a string of format characters and prints out the argument associated
.SH BUGS
This function may overrun the buffer
.IR dest .
-.SH EXAMPLE
+.SH EXAMPLES
For example, this program uses
.BR stpcpy ()
to concatenate
.IR libbsd
library.
.\"
-.SH EXAMPLE
+.SH EXAMPLES
Because
.BR strcat ()
and
from the last compared byte in
.IR s1 .
(If the two characters are equal, this difference is 0.)
-.SH EXAMPLE
+.SH EXAMPLES
The program below can be used to demonstrate the operation of
.BR strcmp ()
(when given two arguments) and
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
The call
.PP
.in +4n
.IR \-Wno\-format\-y2k
option to prevent the warning,
so that the above workaround is no longer required.
-.SH EXAMPLE
+.SH EXAMPLES
.BR "RFC\ 2822-compliant date format"
(with an English locale for %a and %b)
.PP
.PP
The glibc implementation does not require whitespace between
two field descriptors.
-.SH EXAMPLE
+.SH EXAMPLES
The following example demonstrates the use of
.BR strptime ()
and
.\" something similar.
.\" C11 says: "An implementation may use the n-char sequence to determine
.\" extra information to be represented in the NaN's significant."
-.SH EXAMPLE
+.SH EXAMPLES
See the example on the
.BR strtol (3)
manual page;
Use
.BR strtok_r ()
if this matters to you.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses nested loops that employ
.BR strtok_r ()
to break a string into a two-level hierarchy of tokens.
.BR strtoll ()
or to
.BR strtol ().
-.SH EXAMPLE
+.SH EXAMPLES
The program shown below demonstrates the use of
.BR strtol ().
The first command-line argument specifies a string from which
silently converted to the equivalent
.I "unsigned long int"
value.
-.SH EXAMPLE
+.SH EXAMPLES
See the example on the
.BR strtol (3)
manual page;
.\" problem.
.SH CONFORMING TO
This function is a GNU extension.
-.SH EXAMPLE
+.SH EXAMPLES
The program below can be used to demonstrate the behavior of
.BR strverscmp ().
It uses
argument "endorder" or "leaf".
This works with the GNU library
implementation, but is not in the System V documentation.
-.SH EXAMPLE
+.SH EXAMPLES
The following program inserts twelve random numbers into a binary
tree, where duplicate numbers are collapsed, then prints the numbers
in order.
.BR newlocale (3)
to obtain a locale object equivalent to the current locale and
modify the desired categories in that object.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR newlocale (3)
and
.I wcs
wide-character string is destructively modified during
the operation.
-.SH EXAMPLE
+.SH EXAMPLES
The following code loops over the tokens contained in a wide-character string.
.PP
.EX
so we use race:utent to remind users.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
-.SH EXAMPLE
+.SH EXAMPLES
The output of the following example program
is approximately that of "ls [a-c]*.c".
.PP
.TP
.IR /dev/loop*
The loop block special device files.
-.SH EXAMPLE
+.SH EXAMPLES
The program below uses the
.I /dev/loop-control
device to find a free loop device, opens the loop device,
.\" Andries Brouwer <aeb@cwi.nl>
.SH VERSIONS
Introduced with version 1.1.92 of the Linux kernel.
-.SH EXAMPLE
+.SH EXAMPLES
You may do a screendump on vt3 by switching to vt1 and typing
.PP
.in +4n
Usual default character map path.
.SH CONFORMING TO
POSIX.2.
-.SH EXAMPLE
+.SH EXAMPLES
The Euro sign is defined as follows in the
.I UTF\-8
charmap:
.\" LinuxThreads continue appending the PID (the kernel has no easy
.\" way of telling which threading implementation the user-space
.\" application is using). -- mtk, April 2006
-.SH EXAMPLE
+.SH EXAMPLES
The program below can be used to demonstrate the use of the
pipe syntax in the
.I /proc/sys/kernel/core_pattern
.I gai.conf
.\" Added in 2006
file is supported by glibc since version 2.5.
-.SH EXAMPLE
+.SH EXAMPLES
The default table according to RFC\ 3484 would be specified with the
following configuration file:
.PP
historical hosts.txt files on the WWW.
I just found three, from 92,
94, and 95.
-.SH EXAMPLE
+.SH EXAMPLES
.EX
# The following lines are desirable for IPv4 capable hosts
127.0.0.1 localhost
is added to the auth component line in your PAM file for
the particular service
.RB "(e.g., " rlogin ).
-.SH EXAMPLE
+.SH EXAMPLES
Below are some example
.I /etc/host.equiv
or
the next entry.
.SH FILES
\fI/etc/default/nss\fR
-.SH EXAMPLE
+.SH EXAMPLES
The default configuration corresponds to the following configuration file:
.PP
.in +4n
POSIX.2.
.SH NOTES
Repertoire maps are deprecated in favor of Unicode code points.
-.SH EXAMPLE
+.SH EXAMPLES
A mnemonic for the Euro sign can be defined as follows:
.PP
.nf
disallow access to users with shells not included in this file.
.SH FILES
.I /etc/shells
-.SH EXAMPLE
+.SH EXAMPLES
.I /etc/shells
may contain the following paths:
.PP
.TP
.I /etc/ttytype
the tty definitions file.
-.SH EXAMPLE
+.SH EXAMPLES
A typical
.I /etc/ttytype
is:
.\" http://lse.sourceforge.net/io/aio.html
.\" http://lse.sourceforge.net/io/aionotes.txt
.\" http://lwn.net/Articles/148755/
-.SH EXAMPLE
+.SH EXAMPLES
The program below opens each of the files named in its command-line
arguments and queues a request on the resulting file descriptor using
.BR aio_read (3).
.PP
Nearly all math function have a complex counterpart but there are
some complex-only functions.
-.SH EXAMPLE
+.SH EXAMPLES
Your C-compiler can work with complex numbers if it supports the C99 standard.
Link with \fI\-lm\fP.
The imaginary unit is represented by I.
.BR open (2)
have no effect.
.\" ================== EXAMPLE ==================
-.SH EXAMPLE
+.SH EXAMPLES
The following examples demonstrate querying and setting cpuset
options using shell commands.
.SS Creating and attaching to a cpuset.
.I errno
will not be set.
Thus, the reading application has no way to detect the error.
-.SH EXAMPLE
+.SH EXAMPLES
The two example programs below demonstrate the usage of the fanotify API.
.SS Example program: fanotify_example.c
The first program is an example of fanotify being
define these macros directly:
instead, the appropriate feature test macro(s) from the
list above should be employed.
-.SH EXAMPLE
+.SH EXAMPLES
The program below can be used to explore how the various
feature test macros are set depending on the glibc version
and what feature test macros are explicitly set.
as of Linux 3.15,
.\" FIXME . https://bugzilla.kernel.org/show_bug.cgi?id=77111
no kernel changes have yet been made to eliminate this possible bug.
-.SH EXAMPLE
+.SH EXAMPLES
The following program demonstrates the usage of the inotify API.
It marks the directories passed as a command-line arguments
and waits for events of type
.BR wait (2)
and
.BR pipe (2).
-.SH EXAMPLE
+.SH EXAMPLES
For canonical examples of how man pages in the
.I man-pages
package should look, see
.RB ( MS_BIND ),
see
.IR Documentation/filesystems/sharedsubtree.txt .
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR pivot_root (2).
.SH SEE ALSO
(and earlier stable kernel series),
so that the count once more included just the bytes of user data
in messages in the queue.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of various message queue functions is shown in
.BR mq_notify (3).
.SH SEE ALSO
It is a PID namespace, and a corresponding mount of a
.BR proc (5)
filesystem refers to this namespace.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR clone (2)
and
than via the low-level kernel interface.
.SH BUGS
This manual page is not complete.
-.SH EXAMPLE
+.SH EXAMPLES
The following example creates a
.B NETLINK_ROUTE
netlink socket which will listen to the
Use of network namespaces requires a kernel that is configured with the
.B CONFIG_NET_NS
option.
-.\" FIXME .SH EXAMPLE
+.\" FIXME .SH EXAMPLES
.SH SEE ALSO
.BR nsenter (1),
.BR unshare (1),
the receiving process's PID namespace.
.SH CONFORMING TO
Namespaces are a Linux-specific feature.
-.SH EXAMPLE
+.SH EXAMPLES
See
.BR user_namespaces (7).
.SH SEE ALSO
configured and built with the
.BR CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
option.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The program below allocates a page of memory with read and write permissions.
It then writes some data to the memory and successfully reads it
.\" My simple tests on Solaris work okay, but not on Linux -- mtk, Jan 2009
.\" glibc bug filed: http://sourceware.org/bugzilla/show_bug.cgi?id=9733
.\" Reportedly, this is fixed on 16 Mar 2009 (i.e., for glibc 2.10)
-.SH EXAMPLE
+.SH EXAMPLES
.EX
#include <link.h>
#include <stdio.h>
System V semaphores;
on the other hand POSIX semaphores are less widely available
(especially on older systems) than System V semaphores.
-.SH EXAMPLE
+.SH EXAMPLES
An example of the use of various POSIX semaphore functions is shown in
.BR sem_wait (3).
.SH SEE ALSO
were introduced in Linux 3.6.
.SH CONFORMING TO
The NETLINK_SOCK_DIAG API is Linux-specific.
-.SH EXAMPLE
+.SH EXAMPLES
The following example program prints inode number, peer's inode number,
and name of all UNIX domain sockets in the current namespace.
.PP
Reading this file gives an ASCII hex string representing the object ID
for this SPU context.
.RE
-.SH EXAMPLE
+.SH EXAMPLES
.TP
.IR /etc/fstab " entry"
none /spu spufs gid=spu 0 0
The motivation for adding time namespaces was to allow
the monotonic and boot-time clocks to maintain consistent values
during container migration and checkpoint/restore.
-.SH EXAMPLE
+.SH EXAMPLES
.PP
The following shell session demonstrates the operation of time namespaces.
We begin by displaying the inode number of the time namespace
.I create
pathname sockets follow the rules outlined above under
.IR "Pathname sockets" .
-.SH EXAMPLE
+.SH EXAMPLES
The following code demonstrates the use of sequenced-packet
sockets for local interprocess communication.
It consists of two programs.
.\" commit d6970d4b726cea6d7a9bc4120814f95c09571fc3
XFS.
.\"
-.SH EXAMPLE
+.SH EXAMPLES
The program below is designed to allow experimenting with
user namespaces, as well as other types of namespaces.
It creates namespaces as specified by command-line options and then executes