mirror of https://github.com/mkerrisk/man-pages
_syscall.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, connect.2, copy_file_range.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, execveat.2, fallocate.2, flock.2, fork.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_mempolicy.2, get_robust_list.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpriority.2, getrandom.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, init_module.2, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, intro.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl_fat.2, ioctl_ficlonerange.2, ioctl_fideduperange.2, ioctl_tty.2, ioctl_userfaultfd.2, ioperm.2, iopl.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, kill.2, link.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, mbind.2, membarrier.2, memfd_create.2, migrate_pages.2, mincore.2, mkdir.2, mknod.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open_by_handle_at.2, outb.2, perf_event_open.2, perfmonctl.2, personality.2, pivot_root.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readv.2, reboot.2, recv.2, recvmmsg.2, remap_file_pages.2, rename.2, request_key.2, restart_syscall.2, rt_sigqueueinfo.2, s390_pci_mmio_write.2, s390_runtime_instr.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, seccomp.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, sendmmsg.2, set_mempolicy.2, set_thread_area.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setns.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, sgetmask.2, shmctl.2, shmget.2, shmop.2, sigaction.2, sigaltstack.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, spu_create.2, spu_run.2, stat.2, statfs.2, statx.2, subpage_prot.2, swapon.2, symlink.2, sync.2, sync_file_range.2, syscalls.2, sysctl.2, sysinfo.2, syslog.2, tee.2, time.2, timer_create.2, timer_getoverrun.2, timer_settime.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, unimplemented.2, unlink.2, unshare.2, uselib.2, userfaultfd.2, utime.2, utimensat.2, vfork.2, vmsplice.2, wait.2, wait4.2, write.2: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other than in code examples), since they create large vertical spaces between text blocks. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
e3ec129351
commit
efeece0465
|
@ -94,13 +94,13 @@ instead.
|
||||||
on those architectures,
|
on those architectures,
|
||||||
.BR syscall (2)
|
.BR syscall (2)
|
||||||
was always required.)
|
was always required.)
|
||||||
|
.PP
|
||||||
The _syscall() macros
|
The _syscall() macros
|
||||||
.I "do not"
|
.I "do not"
|
||||||
produce a prototype.
|
produce a prototype.
|
||||||
You may have to
|
You may have to
|
||||||
create one, especially for C++ users.
|
create one, especially for C++ users.
|
||||||
|
.PP
|
||||||
System calls are not required to return only positive or negative error
|
System calls are not required to return only positive or negative error
|
||||||
codes.
|
codes.
|
||||||
You need to read the source to be sure how it will return errors.
|
You need to read the source to be sure how it will return errors.
|
||||||
|
@ -121,7 +121,7 @@ when
|
||||||
is negative.
|
is negative.
|
||||||
For the error codes, see
|
For the error codes, see
|
||||||
.BR errno (3).
|
.BR errno (3).
|
||||||
|
.PP
|
||||||
When defining a system call, the argument types
|
When defining a system call, the argument types
|
||||||
.I must
|
.I must
|
||||||
be
|
be
|
||||||
|
|
|
@ -146,7 +146,7 @@ The
|
||||||
.I size
|
.I size
|
||||||
argument is the size of the union pointed to by
|
argument is the size of the union pointed to by
|
||||||
.IR attr .
|
.IR attr .
|
||||||
|
.PP
|
||||||
The value provided in
|
The value provided in
|
||||||
.IR cmd
|
.IR cmd
|
||||||
is one of the following:
|
is one of the following:
|
||||||
|
@ -919,7 +919,7 @@ to a perf event file descriptor,
|
||||||
.IR event_fd ,
|
.IR event_fd ,
|
||||||
that was created by a previous call to
|
that was created by a previous call to
|
||||||
.BR perf_event_open (2):
|
.BR perf_event_open (2):
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, prog_fd);
|
ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, prog_fd);
|
||||||
|
|
|
@ -93,7 +93,7 @@ and
|
||||||
.I nbytes
|
.I nbytes
|
||||||
arguments, making this function fairly expensive.
|
arguments, making this function fairly expensive.
|
||||||
Therefore, the whole cache is always flushed.
|
Therefore, the whole cache is always flushed.
|
||||||
|
.PP
|
||||||
This function always behaves as if
|
This function always behaves as if
|
||||||
.BR BCACHE
|
.BR BCACHE
|
||||||
has been passed for the
|
has been passed for the
|
||||||
|
|
|
@ -101,7 +101,7 @@ To define the structures for passing to the system call, you have to use the
|
||||||
and
|
and
|
||||||
.I struct __user_cap_data_struct
|
.I struct __user_cap_data_struct
|
||||||
names because the typedefs are only pointers.
|
names because the typedefs are only pointers.
|
||||||
|
.PP
|
||||||
Kernels prior to 2.6.25 prefer
|
Kernels prior to 2.6.25 prefer
|
||||||
32-bit capabilities with version
|
32-bit capabilities with version
|
||||||
.BR _LINUX_CAPABILITY_VERSION_1 .
|
.BR _LINUX_CAPABILITY_VERSION_1 .
|
||||||
|
@ -110,19 +110,19 @@ Linux 2.6.25 added 64-bit capability sets, with version
|
||||||
There was, however, an API glitch, and Linux 2.6.26 added
|
There was, however, an API glitch, and Linux 2.6.26 added
|
||||||
.BR _LINUX_CAPABILITY_VERSION_3
|
.BR _LINUX_CAPABILITY_VERSION_3
|
||||||
to fix the problem.
|
to fix the problem.
|
||||||
|
.PP
|
||||||
Note that 64-bit capabilities use
|
Note that 64-bit capabilities use
|
||||||
.IR datap [0]
|
.IR datap [0]
|
||||||
and
|
and
|
||||||
.IR datap [1],
|
.IR datap [1],
|
||||||
whereas 32-bit capabilities use only
|
whereas 32-bit capabilities use only
|
||||||
.IR datap [0].
|
.IR datap [0].
|
||||||
|
.PP
|
||||||
On kernels that support file capabilities (VFS capability support),
|
On kernels that support file capabilities (VFS capability support),
|
||||||
these system calls behave slightly differently.
|
these system calls behave slightly differently.
|
||||||
This support was added as an option in Linux 2.6.24,
|
This support was added as an option in Linux 2.6.24,
|
||||||
and became fixed (nonoptional) in Linux 2.6.33.
|
and became fixed (nonoptional) in Linux 2.6.33.
|
||||||
|
.PP
|
||||||
For
|
For
|
||||||
.BR capget ()
|
.BR capget ()
|
||||||
calls, one can probe the capabilities of any process by specifying its
|
calls, one can probe the capabilities of any process by specifying its
|
||||||
|
@ -167,7 +167,7 @@ caller and
|
||||||
.BR init (1);
|
.BR init (1);
|
||||||
or a value less than \-1, in which case the change is applied
|
or a value less than \-1, in which case the change is applied
|
||||||
to all members of the process group whose ID is \-\fIpid\fP.
|
to all members of the process group whose ID is \-\fIpid\fP.
|
||||||
|
.PP
|
||||||
For details on the data, see
|
For details on the data, see
|
||||||
.BR capabilities (7).
|
.BR capabilities (7).
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
@ -175,7 +175,7 @@ On success, zero is returned.
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
|
.PP
|
||||||
The calls will fail with the error
|
The calls will fail with the error
|
||||||
.BR EINVAL ,
|
.BR EINVAL ,
|
||||||
and set the
|
and set the
|
||||||
|
|
|
@ -129,7 +129,7 @@ POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The current working directory is the starting point for interpreting
|
The current working directory is the starting point for interpreting
|
||||||
relative pathnames (those not starting with \(aq/\(aq).
|
relative pathnames (those not starting with \(aq/\(aq).
|
||||||
|
.PP
|
||||||
A child process created via
|
A child process created via
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
inherits its parent's current working directory.
|
inherits its parent's current working directory.
|
||||||
|
|
18
man2/chmod.2
18
man2/chmod.2
|
@ -164,7 +164,7 @@ The effective UID of the calling process must match the owner of the file,
|
||||||
or the process must be privileged (Linux: it must have the
|
or the process must be privileged (Linux: it must have the
|
||||||
.B CAP_FOWNER
|
.B CAP_FOWNER
|
||||||
capability).
|
capability).
|
||||||
|
.PP
|
||||||
If the calling process is not privileged (Linux: does not have the
|
If the calling process is not privileged (Linux: does not have the
|
||||||
.B CAP_FSETID
|
.B CAP_FSETID
|
||||||
capability), and the group of the file does not match
|
capability), and the group of the file does not match
|
||||||
|
@ -173,7 +173,7 @@ supplementary group IDs, the
|
||||||
.B S_ISGID
|
.B S_ISGID
|
||||||
bit will be turned off,
|
bit will be turned off,
|
||||||
but this will not cause an error to be returned.
|
but this will not cause an error to be returned.
|
||||||
|
.PP
|
||||||
As a security measure, depending on the filesystem,
|
As a security measure, depending on the filesystem,
|
||||||
the set-user-ID and set-group-ID execution bits
|
the set-user-ID and set-group-ID execution bits
|
||||||
may be turned off if a file is written.
|
may be turned off if a file is written.
|
||||||
|
@ -185,7 +185,7 @@ which may have a special meaning.
|
||||||
For the sticky bit, and for set-user-ID and set-group-ID bits on
|
For the sticky bit, and for set-user-ID and set-group-ID bits on
|
||||||
directories, see
|
directories, see
|
||||||
.BR inode (7).
|
.BR inode (7).
|
||||||
|
.PP
|
||||||
On NFS filesystems, restricting the permissions will immediately influence
|
On NFS filesystems, restricting the permissions will immediately influence
|
||||||
already open files, because the access control is done on the server, but
|
already open files, because the access control is done on the server, but
|
||||||
open files are maintained by the client.
|
open files are maintained by the client.
|
||||||
|
@ -199,7 +199,7 @@ The
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR chmod (),
|
.BR chmod (),
|
||||||
except for the differences described here.
|
except for the differences described here.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -209,7 +209,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR chmod ()
|
.BR chmod ()
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -221,13 +221,13 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR chmod ()).
|
.BR chmod ()).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
.I dirfd
|
.I dirfd
|
||||||
is ignored.
|
is ignored.
|
||||||
|
.PP
|
||||||
.I flags
|
.I flags
|
||||||
can either be 0, or include the following flag:
|
can either be 0, or include the following flag:
|
||||||
.TP
|
.TP
|
||||||
|
@ -250,7 +250,7 @@ is set appropriately.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
Depending on the filesystem,
|
Depending on the filesystem,
|
||||||
errors other than those listed below can be returned.
|
errors other than those listed below can be returned.
|
||||||
|
.PP
|
||||||
The more general errors for
|
The more general errors for
|
||||||
.BR chmod ()
|
.BR chmod ()
|
||||||
are listed below:
|
are listed below:
|
||||||
|
@ -350,7 +350,7 @@ library support was added to glibc in version 2.4.
|
||||||
.BR chmod (),
|
.BR chmod (),
|
||||||
.BR fchmod ():
|
.BR fchmod ():
|
||||||
4.4BSD, SVr4, POSIX.1-2001i, POSIX.1-2008.
|
4.4BSD, SVr4, POSIX.1-2001i, POSIX.1-2008.
|
||||||
|
.PP
|
||||||
.BR fchmodat ():
|
.BR fchmodat ():
|
||||||
POSIX.1-2008.
|
POSIX.1-2008.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
|
|
@ -65,12 +65,12 @@ changes the root directory of the calling process to that specified in
|
||||||
.IR path .
|
.IR path .
|
||||||
This directory will be used for pathnames beginning with \fI/\fP.
|
This directory will be used for pathnames beginning with \fI/\fP.
|
||||||
The root directory is inherited by all children of the calling process.
|
The root directory is inherited by all children of the calling process.
|
||||||
|
.PP
|
||||||
Only a privileged process (Linux: one with the
|
Only a privileged process (Linux: one with the
|
||||||
.B CAP_SYS_CHROOT
|
.B CAP_SYS_CHROOT
|
||||||
capability in its user namespace) may call
|
capability in its user namespace) may call
|
||||||
.BR chroot ().
|
.BR chroot ().
|
||||||
|
.PP
|
||||||
This call changes an ingredient in the pathname resolution process
|
This call changes an ingredient in the pathname resolution process
|
||||||
and does nothing else.
|
and does nothing else.
|
||||||
In particular, it is not intended to be used
|
In particular, it is not intended to be used
|
||||||
|
@ -87,7 +87,7 @@ The easiest way to do that is to
|
||||||
.BR chdir (2)
|
.BR chdir (2)
|
||||||
to the to-be-moved directory, wait for it to be moved out, then open a
|
to the to-be-moved directory, wait for it to be moved out, then open a
|
||||||
path like ../../../etc/passwd.
|
path like ../../../etc/passwd.
|
||||||
|
.PP
|
||||||
.\" This is how the "slightly trickier variation" works:
|
.\" This is how the "slightly trickier variation" works:
|
||||||
.\" https://github.com/QubesOS/qubes-secpack/blob/master/QSBs/qsb-014-2015.txt#L142
|
.\" https://github.com/QubesOS/qubes-secpack/blob/master/QSBs/qsb-014-2015.txt#L142
|
||||||
A slightly
|
A slightly
|
||||||
|
@ -98,7 +98,7 @@ If a daemon allows a "chroot directory" to be specified,
|
||||||
that usually means that if you want to prevent remote users from accessing
|
that usually means that if you want to prevent remote users from accessing
|
||||||
files outside the chroot directory, you must ensure that folders are never
|
files outside the chroot directory, you must ensure that folders are never
|
||||||
moved out of it.
|
moved out of it.
|
||||||
|
.PP
|
||||||
This call does not change the current working directory,
|
This call does not change the current working directory,
|
||||||
so that after the call \(aq\fI.\fP\(aq can
|
so that after the call \(aq\fI.\fP\(aq can
|
||||||
be outside the tree rooted at \(aq\fI/\fP\(aq.
|
be outside the tree rooted at \(aq\fI/\fP\(aq.
|
||||||
|
@ -108,7 +108,7 @@ by doing:
|
||||||
|
|
||||||
mkdir foo; chroot foo; cd ..
|
mkdir foo; chroot foo; cd ..
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
This call does not close open file descriptors, and such file
|
This call does not close open file descriptors, and such file
|
||||||
descriptors may allow access to files outside the chroot tree.
|
descriptors may allow access to files outside the chroot tree.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
@ -166,7 +166,7 @@ A child process created via
|
||||||
inherits its parent's root directory.
|
inherits its parent's root directory.
|
||||||
The root directory is left unchanged by
|
The root directory is left unchanged by
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
FreeBSD has a stronger
|
FreeBSD has a stronger
|
||||||
.BR jail ()
|
.BR jail ()
|
||||||
system call.
|
system call.
|
||||||
|
|
|
@ -224,7 +224,7 @@ T{
|
||||||
.BR clock_settime ()
|
.BR clock_settime ()
|
||||||
T} Thread safety MT-Safe
|
T} Thread safety MT-Safe
|
||||||
.TE
|
.TE
|
||||||
|
.sp 1
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008, SUSv2.
|
POSIX.1-2001, POSIX.1-2008, SUSv2.
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
|
@ -289,7 +289,7 @@ Glibc contains no provisions to deal with these offsets (unlike the Linux
|
||||||
Kernel).
|
Kernel).
|
||||||
Typically these offsets are small and therefore the effects may be
|
Typically these offsets are small and therefore the effects may be
|
||||||
negligible in most cases.
|
negligible in most cases.
|
||||||
|
.PP
|
||||||
Since glibc 2.4,
|
Since glibc 2.4,
|
||||||
the wrapper functions for the system calls described in this page avoid
|
the wrapper functions for the system calls described in this page avoid
|
||||||
the abovementioned problems by employing the kernel implementation of
|
the abovementioned problems by employing the kernel implementation of
|
||||||
|
|
|
@ -58,7 +58,7 @@ It differs in allowing the caller to select the clock against
|
||||||
which the sleep interval is to be measured,
|
which the sleep interval is to be measured,
|
||||||
and in allowing the sleep interval to be specified as
|
and in allowing the sleep interval to be specified as
|
||||||
either an absolute or a relative value.
|
either an absolute or a relative value.
|
||||||
|
.PP
|
||||||
The time values passed to and returned by this call are specified using
|
The time values passed to and returned by this call are specified using
|
||||||
.I timespec
|
.I timespec
|
||||||
structures, defined as follows:
|
structures, defined as follows:
|
||||||
|
@ -71,7 +71,7 @@ struct timespec {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I clock_id
|
.I clock_id
|
||||||
argument specifies the clock against which the sleep interval
|
argument specifies the clock against which the sleep interval
|
||||||
|
@ -102,7 +102,7 @@ and
|
||||||
.BR pthread_getcpuclockid (3)
|
.BR pthread_getcpuclockid (3)
|
||||||
can also be passed in
|
can also be passed in
|
||||||
.IR clock_id .
|
.IR clock_id .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
is 0, then the value specified in
|
is 0, then the value specified in
|
||||||
|
@ -110,7 +110,7 @@ is 0, then the value specified in
|
||||||
is interpreted as an interval relative to the current
|
is interpreted as an interval relative to the current
|
||||||
value of the clock specified by
|
value of the clock specified by
|
||||||
.IR clock_id .
|
.IR clock_id .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
is
|
is
|
||||||
|
@ -125,7 +125,7 @@ is less than or equal to the current value of the clock,
|
||||||
then
|
then
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
returns immediately without suspending the calling thread.
|
returns immediately without suspending the calling thread.
|
||||||
|
.PP
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
suspends the execution of the calling thread
|
suspends the execution of the calling thread
|
||||||
until either at least the time specified by
|
until either at least the time specified by
|
||||||
|
@ -133,7 +133,7 @@ until either at least the time specified by
|
||||||
has elapsed,
|
has elapsed,
|
||||||
or a signal is delivered that causes a signal handler to be called or
|
or a signal is delivered that causes a signal handler to be called or
|
||||||
that terminates the process.
|
that terminates the process.
|
||||||
|
.PP
|
||||||
If the call is interrupted by a signal handler,
|
If the call is interrupted by a signal handler,
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
fails with the error
|
fails with the error
|
||||||
|
@ -195,7 +195,7 @@ is not an exact multiple of the granularity underlying clock (see
|
||||||
then the interval will be rounded up to the next multiple.
|
then the interval will be rounded up to the next multiple.
|
||||||
Furthermore, after the sleep completes, there may still be a delay before
|
Furthermore, after the sleep completes, there may still be a delay before
|
||||||
the CPU becomes free to once again execute the calling thread.
|
the CPU becomes free to once again execute the calling thread.
|
||||||
|
.PP
|
||||||
Using an absolute timer is useful for preventing
|
Using an absolute timer is useful for preventing
|
||||||
timer drift problems of the type described in
|
timer drift problems of the type described in
|
||||||
.BR nanosleep (2).
|
.BR nanosleep (2).
|
||||||
|
@ -210,14 +210,14 @@ and then call
|
||||||
with the
|
with the
|
||||||
.B TIMER_ABSTIME
|
.B TIMER_ABSTIME
|
||||||
flag.
|
flag.
|
||||||
|
.PP
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
is never restarted after being interrupted by a signal handler,
|
is never restarted after being interrupted by a signal handler,
|
||||||
regardless of the use of the
|
regardless of the use of the
|
||||||
.BR sigaction (2)
|
.BR sigaction (2)
|
||||||
.B SA_RESTART
|
.B SA_RESTART
|
||||||
flag.
|
flag.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I remain
|
.I remain
|
||||||
argument is unused, and unnecessary, when
|
argument is unused, and unnecessary, when
|
||||||
|
@ -227,11 +227,11 @@ is
|
||||||
(An absolute sleep can be restarted using the same
|
(An absolute sleep can be restarted using the same
|
||||||
.I request
|
.I request
|
||||||
argument.)
|
argument.)
|
||||||
|
.PP
|
||||||
POSIX.1 specifies that
|
POSIX.1 specifies that
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
has no effect on signals dispositions or the signal mask.
|
has no effect on signals dispositions or the signal mask.
|
||||||
|
.PP
|
||||||
POSIX.1 specifies that after changing the value of the
|
POSIX.1 specifies that after changing the value of the
|
||||||
.B CLOCK_REALTIME
|
.B CLOCK_REALTIME
|
||||||
clock via
|
clock via
|
||||||
|
@ -243,7 +243,7 @@ will wake up;
|
||||||
if the new clock value falls past the end of the sleep interval, then the
|
if the new clock value falls past the end of the sleep interval, then the
|
||||||
.BR clock_nanosleep ()
|
.BR clock_nanosleep ()
|
||||||
call will return immediately.
|
call will return immediately.
|
||||||
|
.PP
|
||||||
POSIX.1 specifies that
|
POSIX.1 specifies that
|
||||||
changing the value of the
|
changing the value of the
|
||||||
.B CLOCK_REALTIME
|
.B CLOCK_REALTIME
|
||||||
|
|
140
man2/clone.2
140
man2/clone.2
|
@ -60,14 +60,14 @@ clone, __clone2 \- create a child process
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
creates a new process, in a manner similar to
|
creates a new process, in a manner similar to
|
||||||
.BR fork (2).
|
.BR fork (2).
|
||||||
|
.PP
|
||||||
This page describes both the glibc
|
This page describes both the glibc
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
wrapper function and the underlying system call on which it is based.
|
wrapper function and the underlying system call on which it is based.
|
||||||
The main text describes the wrapper function;
|
The main text describes the wrapper function;
|
||||||
the differences for the raw system call
|
the differences for the raw system call
|
||||||
are described toward the end of this page.
|
are described toward the end of this page.
|
||||||
|
.PP
|
||||||
Unlike
|
Unlike
|
||||||
.BR fork (2),
|
.BR fork (2),
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
|
@ -79,12 +79,12 @@ page, "calling process" normally corresponds to "parent process".
|
||||||
But see the description of
|
But see the description of
|
||||||
.B CLONE_PARENT
|
.B CLONE_PARENT
|
||||||
below.)
|
below.)
|
||||||
|
.PP
|
||||||
One use of
|
One use of
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
is to implement threads: multiple threads of control in a program that
|
is to implement threads: multiple threads of control in a program that
|
||||||
run concurrently in a shared memory space.
|
run concurrently in a shared memory space.
|
||||||
|
.PP
|
||||||
When the child process is created with
|
When the child process is created with
|
||||||
.BR clone (),
|
.BR clone (),
|
||||||
it executes the function
|
it executes the function
|
||||||
|
@ -104,7 +104,7 @@ The
|
||||||
argument is passed to the
|
argument is passed to the
|
||||||
.I fn
|
.I fn
|
||||||
function.
|
function.
|
||||||
|
.PP
|
||||||
When the
|
When the
|
||||||
.IR fn ( arg )
|
.IR fn ( arg )
|
||||||
function application returns, the child process terminates.
|
function application returns, the child process terminates.
|
||||||
|
@ -114,7 +114,7 @@ is the exit code for the child process.
|
||||||
The child process may also terminate explicitly by calling
|
The child process may also terminate explicitly by calling
|
||||||
.BR exit (2)
|
.BR exit (2)
|
||||||
or after receiving a fatal signal.
|
or after receiving a fatal signal.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I child_stack
|
.I child_stack
|
||||||
argument specifies the location of the stack used by the child process.
|
argument specifies the location of the stack used by the child process.
|
||||||
|
@ -130,7 +130,7 @@ Stacks grow downward on all processors that run Linux
|
||||||
.I child_stack
|
.I child_stack
|
||||||
usually points to the topmost address of the memory space set up for
|
usually points to the topmost address of the memory space set up for
|
||||||
the child stack.
|
the child stack.
|
||||||
|
.PP
|
||||||
The low byte of
|
The low byte of
|
||||||
.I flags
|
.I flags
|
||||||
contains the number of the
|
contains the number of the
|
||||||
|
@ -146,7 +146,7 @@ options when waiting for the child with
|
||||||
.BR wait (2).
|
.BR wait (2).
|
||||||
If no signal is specified, then the parent process is not signaled
|
If no signal is specified, then the parent process is not signaled
|
||||||
when the child terminates.
|
when the child terminates.
|
||||||
|
.PP
|
||||||
.I flags
|
.I flags
|
||||||
may also be bitwise-or'ed with zero or more of the following constants,
|
may also be bitwise-or'ed with zero or more of the following constants,
|
||||||
in order to specify what is shared between the calling process
|
in order to specify what is shared between the calling process
|
||||||
|
@ -185,7 +185,7 @@ operation), the other process is also affected.
|
||||||
If a process sharing a file descriptor table calls
|
If a process sharing a file descriptor table calls
|
||||||
.BR execve (2),
|
.BR execve (2),
|
||||||
its file descriptor table is duplicated (unshared).
|
its file descriptor table is duplicated (unshared).
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_FILES
|
.B CLONE_FILES
|
||||||
is not set, the child process inherits a copy of all file descriptors
|
is not set, the child process inherits a copy of all file descriptors
|
||||||
|
@ -215,7 +215,7 @@ or
|
||||||
.BR umask (2)
|
.BR umask (2)
|
||||||
performed by the calling process or the child process also affects the
|
performed by the calling process or the child process also affects the
|
||||||
other process.
|
other process.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_FS
|
.B CLONE_FS
|
||||||
is not set, the child process works on a copy of the filesystem
|
is not set, the child process works on a copy of the filesystem
|
||||||
|
@ -236,7 +236,7 @@ the calling process.
|
||||||
If this flag is not set, then (as with
|
If this flag is not set, then (as with
|
||||||
.BR fork (2))
|
.BR fork (2))
|
||||||
the new process has its own I/O context.
|
the new process has its own I/O context.
|
||||||
|
.IP
|
||||||
.\" The following based on text from Jens Axboe
|
.\" The following based on text from Jens Axboe
|
||||||
The I/O context is the I/O scope of the disk scheduler (i.e.,
|
The I/O context is the I/O scope of the disk scheduler (i.e.,
|
||||||
what the I/O scheduler uses to model scheduling of a process's I/O).
|
what the I/O scheduler uses to model scheduling of a process's I/O).
|
||||||
|
@ -253,7 +253,7 @@ for instance), they should employ
|
||||||
.BR CLONE_IO
|
.BR CLONE_IO
|
||||||
to get better I/O performance.
|
to get better I/O performance.
|
||||||
.\" with CFQ and AS.
|
.\" with CFQ and AS.
|
||||||
|
.IP
|
||||||
If the kernel is not configured with the
|
If the kernel is not configured with the
|
||||||
.B CONFIG_BLOCK
|
.B CONFIG_BLOCK
|
||||||
option, this flag is a no-op.
|
option, this flag is a no-op.
|
||||||
|
@ -264,10 +264,10 @@ If this flag is not set, then (as with
|
||||||
.BR fork (2))
|
.BR fork (2))
|
||||||
the process is created in the same cgroup namespaces as the calling process.
|
the process is created in the same cgroup namespaces as the calling process.
|
||||||
This flag is intended for the implementation of containers.
|
This flag is intended for the implementation of containers.
|
||||||
|
.IP
|
||||||
For further information on cgroup namespaces, see
|
For further information on cgroup namespaces, see
|
||||||
.BR cgroup_namespaces (7).
|
.BR cgroup_namespaces (7).
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
|
@ -283,7 +283,7 @@ If this flag is not set, then (as with
|
||||||
the process is created in the same IPC namespace as
|
the process is created in the same IPC namespace as
|
||||||
the calling process.
|
the calling process.
|
||||||
This flag is intended for the implementation of containers.
|
This flag is intended for the implementation of containers.
|
||||||
|
.IP
|
||||||
An IPC namespace provides an isolated view of System\ V IPC objects (see
|
An IPC namespace provides an isolated view of System\ V IPC objects (see
|
||||||
.BR svipc (7))
|
.BR svipc (7))
|
||||||
and (since Linux 2.6.30)
|
and (since Linux 2.6.30)
|
||||||
|
@ -295,29 +295,29 @@ POSIX message queues
|
||||||
The common characteristic of these IPC mechanisms is that IPC
|
The common characteristic of these IPC mechanisms is that IPC
|
||||||
objects are identified by mechanisms other than filesystem
|
objects are identified by mechanisms other than filesystem
|
||||||
pathnames.
|
pathnames.
|
||||||
|
.IP
|
||||||
Objects created in an IPC namespace are visible to all other processes
|
Objects created in an IPC namespace are visible to all other processes
|
||||||
that are members of that namespace,
|
that are members of that namespace,
|
||||||
but are not visible to processes in other IPC namespaces.
|
but are not visible to processes in other IPC namespaces.
|
||||||
|
.IP
|
||||||
When an IPC namespace is destroyed
|
When an IPC namespace is destroyed
|
||||||
(i.e., when the last process that is a member of the namespace terminates),
|
(i.e., when the last process that is a member of the namespace terminates),
|
||||||
all IPC objects in the namespace are automatically destroyed.
|
all IPC objects in the namespace are automatically destroyed.
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
.BR CLONE_NEWIPC .
|
.BR CLONE_NEWIPC .
|
||||||
This flag can't be specified in conjunction with
|
This flag can't be specified in conjunction with
|
||||||
.BR CLONE_SYSVSEM .
|
.BR CLONE_SYSVSEM .
|
||||||
|
.IP
|
||||||
For further information on IPC namespaces, see
|
For further information on IPC namespaces, see
|
||||||
.BR namespaces (7).
|
.BR namespaces (7).
|
||||||
.TP
|
.TP
|
||||||
.BR CLONE_NEWNET " (since Linux 2.6.24)"
|
.BR CLONE_NEWNET " (since Linux 2.6.24)"
|
||||||
(The implementation of this flag was completed only
|
(The implementation of this flag was completed only
|
||||||
by about kernel version 2.6.29.)
|
by about kernel version 2.6.29.)
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_NEWNET
|
.B CLONE_NEWNET
|
||||||
is set, then create the process in a new network namespace.
|
is set, then create the process in a new network namespace.
|
||||||
|
@ -326,7 +326,7 @@ If this flag is not set, then (as with
|
||||||
the process is created in the same network namespace as
|
the process is created in the same network namespace as
|
||||||
the calling process.
|
the calling process.
|
||||||
This flag is intended for the implementation of containers.
|
This flag is intended for the implementation of containers.
|
||||||
|
.IP
|
||||||
A network namespace provides an isolated view of the networking stack
|
A network namespace provides an isolated view of the networking stack
|
||||||
(network device interfaces, IPv4 and IPv6 protocol stacks,
|
(network device interfaces, IPv4 and IPv6 protocol stacks,
|
||||||
IP routing tables, firewall rules, the
|
IP routing tables, firewall rules, the
|
||||||
|
@ -341,14 +341,14 @@ A virtual network device ("veth") pair provides a pipe-like abstraction
|
||||||
that can be used to create tunnels between network namespaces,
|
that can be used to create tunnels between network namespaces,
|
||||||
and can be used to create a bridge to a physical network device
|
and can be used to create a bridge to a physical network device
|
||||||
in another namespace.
|
in another namespace.
|
||||||
|
.IP
|
||||||
When a network namespace is freed
|
When a network namespace is freed
|
||||||
(i.e., when the last process in the namespace terminates),
|
(i.e., when the last process in the namespace terminates),
|
||||||
its physical network devices are moved back to the
|
its physical network devices are moved back to the
|
||||||
initial network namespace (not to the parent of the process).
|
initial network namespace (not to the parent of the process).
|
||||||
For further information on network namespaces, see
|
For further information on network namespaces, see
|
||||||
.BR namespaces (7).
|
.BR namespaces (7).
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
|
@ -363,7 +363,7 @@ If
|
||||||
.B CLONE_NEWNS
|
.B CLONE_NEWNS
|
||||||
is not set, the child lives in the same mount
|
is not set, the child lives in the same mount
|
||||||
namespace as the parent.
|
namespace as the parent.
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
|
@ -376,7 +376,7 @@ and
|
||||||
in the same
|
in the same
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
call.
|
call.
|
||||||
|
.IP
|
||||||
For further information on mount namespaces, see
|
For further information on mount namespaces, see
|
||||||
.BR namespaces (7)
|
.BR namespaces (7)
|
||||||
and
|
and
|
||||||
|
@ -398,12 +398,12 @@ If this flag is not set, then (as with
|
||||||
the process is created in the same PID namespace as
|
the process is created in the same PID namespace as
|
||||||
the calling process.
|
the calling process.
|
||||||
This flag is intended for the implementation of containers.
|
This flag is intended for the implementation of containers.
|
||||||
|
.IP
|
||||||
For further information on PID namespaces, see
|
For further information on PID namespaces, see
|
||||||
.BR namespaces (7)
|
.BR namespaces (7)
|
||||||
and
|
and
|
||||||
.BR pid_namespaces (7).
|
.BR pid_namespaces (7).
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
|
@ -422,19 +422,19 @@ the current
|
||||||
semantics were merged in Linux 3.5,
|
semantics were merged in Linux 3.5,
|
||||||
and the final pieces to make the user namespaces completely usable were
|
and the final pieces to make the user namespaces completely usable were
|
||||||
merged in Linux 3.8.)
|
merged in Linux 3.8.)
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_NEWUSER
|
.B CLONE_NEWUSER
|
||||||
is set, then create the process in a new user namespace.
|
is set, then create the process in a new user namespace.
|
||||||
If this flag is not set, then (as with
|
If this flag is not set, then (as with
|
||||||
.BR fork (2))
|
.BR fork (2))
|
||||||
the process is created in the same user namespace as the calling process.
|
the process is created in the same user namespace as the calling process.
|
||||||
|
.IP
|
||||||
For further information on user namespaces, see
|
For further information on user namespaces, see
|
||||||
.BR namespaces (7)
|
.BR namespaces (7)
|
||||||
and
|
and
|
||||||
.BR user_namespaces (7)
|
.BR user_namespaces (7)
|
||||||
|
.IP
|
||||||
Before Linux 3.8, use of
|
Before Linux 3.8, use of
|
||||||
.BR CLONE_NEWUSER
|
.BR CLONE_NEWUSER
|
||||||
required that the caller have three capabilities:
|
required that the caller have three capabilities:
|
||||||
|
@ -445,7 +445,7 @@ and
|
||||||
.\" Before Linux 2.6.29, it appears that only CAP_SYS_ADMIN was needed
|
.\" Before Linux 2.6.29, it appears that only CAP_SYS_ADMIN was needed
|
||||||
Starting with Linux 3.8,
|
Starting with Linux 3.8,
|
||||||
no privileges are needed to create a user namespace.
|
no privileges are needed to create a user namespace.
|
||||||
|
.IP
|
||||||
This flag can't be specified in conjunction with
|
This flag can't be specified in conjunction with
|
||||||
.BR CLONE_THREAD
|
.BR CLONE_THREAD
|
||||||
or
|
or
|
||||||
|
@ -459,7 +459,7 @@ For security reasons,
|
||||||
.BR CLONE_NEWUSER
|
.BR CLONE_NEWUSER
|
||||||
cannot be specified in conjunction with
|
cannot be specified in conjunction with
|
||||||
.BR CLONE_FS .
|
.BR CLONE_FS .
|
||||||
|
.IP
|
||||||
For further information on user namespaces, see
|
For further information on user namespaces, see
|
||||||
.BR user_namespaces (7).
|
.BR user_namespaces (7).
|
||||||
.TP
|
.TP
|
||||||
|
@ -474,7 +474,7 @@ If this flag is not set, then (as with
|
||||||
the process is created in the same UTS namespace as
|
the process is created in the same UTS namespace as
|
||||||
the calling process.
|
the calling process.
|
||||||
This flag is intended for the implementation of containers.
|
This flag is intended for the implementation of containers.
|
||||||
|
.IP
|
||||||
A UTS namespace is the set of identifiers returned by
|
A UTS namespace is the set of identifiers returned by
|
||||||
.BR uname (2);
|
.BR uname (2);
|
||||||
among these, the domain name and the hostname can be modified by
|
among these, the domain name and the hostname can be modified by
|
||||||
|
@ -485,12 +485,12 @@ respectively.
|
||||||
Changes made to the identifiers in a UTS namespace
|
Changes made to the identifiers in a UTS namespace
|
||||||
are visible to all other processes in the same namespace,
|
are visible to all other processes in the same namespace,
|
||||||
but are not visible to processes in other UTS namespaces.
|
but are not visible to processes in other UTS namespaces.
|
||||||
|
.IP
|
||||||
Only a privileged process
|
Only a privileged process
|
||||||
.RB ( CAP_SYS_ADMIN )
|
.RB ( CAP_SYS_ADMIN )
|
||||||
can employ
|
can employ
|
||||||
.BR CLONE_NEWUTS .
|
.BR CLONE_NEWUTS .
|
||||||
|
.IP
|
||||||
For further information on UTS namespaces, see
|
For further information on UTS namespaces, see
|
||||||
.BR namespaces (7).
|
.BR namespaces (7).
|
||||||
.TP
|
.TP
|
||||||
|
@ -500,13 +500,13 @@ If
|
||||||
is set, then the parent of the new child (as returned by
|
is set, then the parent of the new child (as returned by
|
||||||
.BR getppid (2))
|
.BR getppid (2))
|
||||||
will be the same as that of the calling process.
|
will be the same as that of the calling process.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_PARENT
|
.B CLONE_PARENT
|
||||||
is not set, then (as with
|
is not set, then (as with
|
||||||
.BR fork (2))
|
.BR fork (2))
|
||||||
the child's parent is the calling process.
|
the child's parent is the calling process.
|
||||||
|
.IP
|
||||||
Note that it is the parent process, as returned by
|
Note that it is the parent process, as returned by
|
||||||
.BR getppid (2),
|
.BR getppid (2),
|
||||||
which is signaled when the child terminates, so that
|
which is signaled when the child terminates, so that
|
||||||
|
@ -548,7 +548,7 @@ then trace the child also (see
|
||||||
.BR CLONE_SETTLS " (since Linux 2.5.32)"
|
.BR CLONE_SETTLS " (since Linux 2.5.32)"
|
||||||
The TLS (Thread Local Storage) descriptor is set to
|
The TLS (Thread Local Storage) descriptor is set to
|
||||||
.I newtls.
|
.I newtls.
|
||||||
|
.IP
|
||||||
The interpretation of
|
The interpretation of
|
||||||
.I newtls
|
.I newtls
|
||||||
and the resulting effect is architecture dependent.
|
and the resulting effect is architecture dependent.
|
||||||
|
@ -581,7 +581,7 @@ signals.
|
||||||
So, one of them may block or unblock some signals using
|
So, one of them may block or unblock some signals using
|
||||||
.BR sigprocmask (2)
|
.BR sigprocmask (2)
|
||||||
without affecting the other process.
|
without affecting the other process.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_SIGHAND
|
.B CLONE_SIGHAND
|
||||||
is not set, the child process inherits a copy of the signal handlers
|
is not set, the child process inherits a copy of the signal handlers
|
||||||
|
@ -592,7 +592,7 @@ Calls to
|
||||||
.BR sigaction (2)
|
.BR sigaction (2)
|
||||||
performed later by one of the processes have no effect on the other
|
performed later by one of the processes have no effect on the other
|
||||||
process.
|
process.
|
||||||
|
.IP
|
||||||
Since Linux 2.6.0-test6,
|
Since Linux 2.6.0-test6,
|
||||||
.I flags
|
.I flags
|
||||||
must also include
|
must also include
|
||||||
|
@ -609,7 +609,7 @@ is set, then the child is initially stopped (as though it was sent a
|
||||||
signal), and must be resumed by sending it a
|
signal), and must be resumed by sending it a
|
||||||
.B SIGCONT
|
.B SIGCONT
|
||||||
signal.
|
signal.
|
||||||
|
.IP
|
||||||
This flag was
|
This flag was
|
||||||
.I deprecated
|
.I deprecated
|
||||||
from Linux 2.6.25 onward,
|
from Linux 2.6.25 onward,
|
||||||
|
@ -648,7 +648,7 @@ To make the remainder of the discussion of
|
||||||
.B CLONE_THREAD
|
.B CLONE_THREAD
|
||||||
more readable, the term "thread" is used to refer to the
|
more readable, the term "thread" is used to refer to the
|
||||||
processes within a thread group.
|
processes within a thread group.
|
||||||
|
.IP
|
||||||
Thread groups were a feature added in Linux 2.4 to support the
|
Thread groups were a feature added in Linux 2.4 to support the
|
||||||
POSIX threads notion of a set of threads that share a single PID.
|
POSIX threads notion of a set of threads that share a single PID.
|
||||||
Internally, this shared PID is the so-called
|
Internally, this shared PID is the so-called
|
||||||
|
@ -656,7 +656,7 @@ thread group identifier (TGID) for the thread group.
|
||||||
Since Linux 2.4, calls to
|
Since Linux 2.4, calls to
|
||||||
.BR getpid (2)
|
.BR getpid (2)
|
||||||
return the TGID of the caller.
|
return the TGID of the caller.
|
||||||
|
.IP
|
||||||
The threads within a group can be distinguished by their (system-wide)
|
The threads within a group can be distinguished by their (system-wide)
|
||||||
unique thread IDs (TID).
|
unique thread IDs (TID).
|
||||||
A new thread's TID is available as the function result
|
A new thread's TID is available as the function result
|
||||||
|
@ -665,7 +665,7 @@ returned to the caller of
|
||||||
and a thread can obtain
|
and a thread can obtain
|
||||||
its own TID using
|
its own TID using
|
||||||
.BR gettid (2).
|
.BR gettid (2).
|
||||||
|
.IP
|
||||||
When a call is made to
|
When a call is made to
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
without specifying
|
without specifying
|
||||||
|
@ -675,7 +675,7 @@ whose TGID is the same as the thread's TID.
|
||||||
This thread is the
|
This thread is the
|
||||||
.I leader
|
.I leader
|
||||||
of the new thread group.
|
of the new thread group.
|
||||||
|
.IP
|
||||||
A new thread created with
|
A new thread created with
|
||||||
.B CLONE_THREAD
|
.B CLONE_THREAD
|
||||||
has the same parent process as the caller of
|
has the same parent process as the caller of
|
||||||
|
@ -697,23 +697,23 @@ using
|
||||||
.BR wait (2).
|
.BR wait (2).
|
||||||
(The thread is said to be
|
(The thread is said to be
|
||||||
.IR detached .)
|
.IR detached .)
|
||||||
|
.IP
|
||||||
After all of the threads in a thread group terminate
|
After all of the threads in a thread group terminate
|
||||||
the parent process of the thread group is sent a
|
the parent process of the thread group is sent a
|
||||||
.B SIGCHLD
|
.B SIGCHLD
|
||||||
(or other termination) signal.
|
(or other termination) signal.
|
||||||
|
.IP
|
||||||
If any of the threads in a thread group performs an
|
If any of the threads in a thread group performs an
|
||||||
.BR execve (2),
|
.BR execve (2),
|
||||||
then all threads other than the thread group leader are terminated,
|
then all threads other than the thread group leader are terminated,
|
||||||
and the new program is executed in the thread group leader.
|
and the new program is executed in the thread group leader.
|
||||||
|
.IP
|
||||||
If one of the threads in a thread group creates a child using
|
If one of the threads in a thread group creates a child using
|
||||||
.BR fork (2),
|
.BR fork (2),
|
||||||
then any thread in the group can
|
then any thread in the group can
|
||||||
.BR wait (2)
|
.BR wait (2)
|
||||||
for that child.
|
for that child.
|
||||||
|
.IP
|
||||||
Since Linux 2.5.35,
|
Since Linux 2.5.35,
|
||||||
.I flags
|
.I flags
|
||||||
must also include
|
must also include
|
||||||
|
@ -726,17 +726,17 @@ is specified
|
||||||
also requires
|
also requires
|
||||||
.BR CLONE_VM
|
.BR CLONE_VM
|
||||||
to be included).
|
to be included).
|
||||||
|
.IP
|
||||||
Signals may be sent to a thread group as a whole (i.e., a TGID) using
|
Signals may be sent to a thread group as a whole (i.e., a TGID) using
|
||||||
.BR kill (2),
|
.BR kill (2),
|
||||||
or to a specific thread (i.e., TID) using
|
or to a specific thread (i.e., TID) using
|
||||||
.BR tgkill (2).
|
.BR tgkill (2).
|
||||||
|
.IP
|
||||||
Signal dispositions and actions are process-wide:
|
Signal dispositions and actions are process-wide:
|
||||||
if an unhandled signal is delivered to a thread, then
|
if an unhandled signal is delivered to a thread, then
|
||||||
it will affect (terminate, stop, continue, be ignored in)
|
it will affect (terminate, stop, continue, be ignored in)
|
||||||
all members of the thread group.
|
all members of the thread group.
|
||||||
|
.IP
|
||||||
Each thread has its own signal mask, as set by
|
Each thread has its own signal mask, as set by
|
||||||
.BR sigprocmask (2),
|
.BR sigprocmask (2),
|
||||||
but signals can be pending either: for the whole process
|
but signals can be pending either: for the whole process
|
||||||
|
@ -749,7 +749,7 @@ A call to
|
||||||
.BR sigpending (2)
|
.BR sigpending (2)
|
||||||
returns a signal set that is the union of the signals pending for the
|
returns a signal set that is the union of the signals pending for the
|
||||||
whole process and the signals that are pending for the calling thread.
|
whole process and the signals that are pending for the calling thread.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.BR kill (2)
|
.BR kill (2)
|
||||||
is used to send a signal to a thread group,
|
is used to send a signal to a thread group,
|
||||||
|
@ -780,7 +780,7 @@ or
|
||||||
.BR _exit (2)
|
.BR _exit (2)
|
||||||
(as with
|
(as with
|
||||||
.BR vfork (2)).
|
.BR vfork (2)).
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_VFORK
|
.B CLONE_VFORK
|
||||||
is not set, then both the calling process and the child are schedulable
|
is not set, then both the calling process and the child are schedulable
|
||||||
|
@ -799,7 +799,7 @@ Moreover, any memory mapping or unmapping performed with
|
||||||
or
|
or
|
||||||
.BR munmap (2)
|
.BR munmap (2)
|
||||||
by the child or calling process also affects the other process.
|
by the child or calling process also affects the other process.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.B CLONE_VM
|
.B CLONE_VM
|
||||||
is not set, the child process runs in a separate copy of the memory
|
is not set, the child process runs in a separate copy of the memory
|
||||||
|
@ -824,10 +824,10 @@ arguments of the
|
||||||
wrapper function are omitted.
|
wrapper function are omitted.
|
||||||
Furthermore, the argument order changes.
|
Furthermore, the argument order changes.
|
||||||
In addition, there are variations across architectures.
|
In addition, there are variations across architectures.
|
||||||
|
.PP
|
||||||
The raw system call interface on x86-64 and some other architectures
|
The raw system call interface on x86-64 and some other architectures
|
||||||
(including sh, tile, and alpha) is roughly:
|
(including sh, tile, and alpha) is roughly:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.nf
|
||||||
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
||||||
|
@ -835,13 +835,13 @@ The raw system call interface on x86-64 and some other architectures
|
||||||
.BI " unsigned long " newtls );
|
.BI " unsigned long " newtls );
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
On x86-32, and several other common architectures
|
On x86-32, and several other common architectures
|
||||||
(including score, ARM, ARM 64, PA-RISC, arc, Power PC, xtensa,
|
(including score, ARM, ARM 64, PA-RISC, arc, Power PC, xtensa,
|
||||||
and MIPS),
|
and MIPS),
|
||||||
.\" CONFIG_CLONE_BACKWARDS
|
.\" CONFIG_CLONE_BACKWARDS
|
||||||
the order of the last two arguments is reversed:
|
the order of the last two arguments is reversed:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.nf
|
||||||
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
||||||
|
@ -849,11 +849,11 @@ the order of the last two arguments is reversed:
|
||||||
.BI " int *" ctid );
|
.BI " int *" ctid );
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
On the cris and s390 architectures,
|
On the cris and s390 architectures,
|
||||||
.\" CONFIG_CLONE_BACKWARDS2
|
.\" CONFIG_CLONE_BACKWARDS2
|
||||||
the order of the first two arguments is reversed:
|
the order of the first two arguments is reversed:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.nf
|
||||||
.BI "long clone(void *" child_stack ", unsigned long " flags ,
|
.BI "long clone(void *" child_stack ", unsigned long " flags ,
|
||||||
|
@ -861,11 +861,11 @@ the order of the first two arguments is reversed:
|
||||||
.BI " unsigned long " newtls );
|
.BI " unsigned long " newtls );
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
On the microblaze architecture,
|
On the microblaze architecture,
|
||||||
.\" CONFIG_CLONE_BACKWARDS3
|
.\" CONFIG_CLONE_BACKWARDS3
|
||||||
an additional argument is supplied:
|
an additional argument is supplied:
|
||||||
|
.PP
|
||||||
.in +4
|
.in +4
|
||||||
.nf
|
.nf
|
||||||
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
.BI "long clone(unsigned long " flags ", void *" child_stack ,
|
||||||
|
@ -874,7 +874,7 @@ an additional argument is supplied:
|
||||||
.BI " unsigned long " newtls );
|
.BI " unsigned long " newtls );
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
Another difference for the raw system call is that the
|
Another difference for the raw system call is that the
|
||||||
.I child_stack
|
.I child_stack
|
||||||
argument may be zero, in which case copy-on-write semantics ensure that the
|
argument may be zero, in which case copy-on-write semantics ensure that the
|
||||||
|
@ -1076,7 +1076,7 @@ and the call would cause the limit on the number of
|
||||||
nested user namespaces to be exceeded.
|
nested user namespaces to be exceeded.
|
||||||
See
|
See
|
||||||
.BR user_namespaces (7).
|
.BR user_namespaces (7).
|
||||||
|
.IP
|
||||||
From Linux 3.11 to Linux 4.8, the error diagnosed in this case was
|
From Linux 3.11 to Linux 4.8, the error diagnosed in this case was
|
||||||
.BR EUSERS .
|
.BR EUSERS .
|
||||||
.TP
|
.TP
|
||||||
|
@ -1152,13 +1152,13 @@ The
|
||||||
system call can be used to test whether two processes share various
|
system call can be used to test whether two processes share various
|
||||||
resources such as a file descriptor table,
|
resources such as a file descriptor table,
|
||||||
System V semaphore undo operations, or a virtual address space.
|
System V semaphore undo operations, or a virtual address space.
|
||||||
|
.PP
|
||||||
|
.PP
|
||||||
Handlers registered using
|
Handlers registered using
|
||||||
.BR pthread_atfork (3)
|
.BR pthread_atfork (3)
|
||||||
are not executed during a call to
|
are not executed during a call to
|
||||||
.BR clone ().
|
.BR clone ().
|
||||||
|
.PP
|
||||||
In the Linux 2.4.x series,
|
In the Linux 2.4.x series,
|
||||||
.B CLONE_THREAD
|
.B CLONE_THREAD
|
||||||
generally does not make the parent of the new thread the same
|
generally does not make the parent of the new thread the same
|
||||||
|
@ -1168,7 +1168,7 @@ However, for kernel versions 2.4.7 to 2.4.18 the
|
||||||
flag implied the
|
flag implied the
|
||||||
.B CLONE_PARENT
|
.B CLONE_PARENT
|
||||||
flag (as in Linux 2.6.0 and later).
|
flag (as in Linux 2.6.0 and later).
|
||||||
|
.PP
|
||||||
For a while there was
|
For a while there was
|
||||||
.B CLONE_DETACHED
|
.B CLONE_DETACHED
|
||||||
(introduced in 2.5.32):
|
(introduced in 2.5.32):
|
||||||
|
@ -1177,7 +1177,7 @@ In Linux 2.6.2, the need to give this flag together with
|
||||||
.B CLONE_THREAD
|
.B CLONE_THREAD
|
||||||
disappeared.
|
disappeared.
|
||||||
This flag is still defined, but has no effect.
|
This flag is still defined, but has no effect.
|
||||||
|
.PP
|
||||||
On i386,
|
On i386,
|
||||||
.BR clone ()
|
.BR clone ()
|
||||||
should not be called through vsyscall, but directly through
|
should not be called through vsyscall, but directly through
|
||||||
|
|
14
man2/close.2
14
man2/close.2
|
@ -132,13 +132,13 @@ Failing to check the return value when closing a file may lead to
|
||||||
.I silent
|
.I silent
|
||||||
loss of data.
|
loss of data.
|
||||||
This can especially be observed with NFS and with disk quota.
|
This can especially be observed with NFS and with disk quota.
|
||||||
|
.PP
|
||||||
Note, however, that a failure return should be used only for
|
Note, however, that a failure return should be used only for
|
||||||
diagnostic purposes (i.e., a warning to the application that there
|
diagnostic purposes (i.e., a warning to the application that there
|
||||||
may still be I/O pending or there may have been failed I/O)
|
may still be I/O pending or there may have been failed I/O)
|
||||||
or remedial purposes
|
or remedial purposes
|
||||||
(e.g., writing the file once more or creating a backup).
|
(e.g., writing the file once more or creating a backup).
|
||||||
|
.PP
|
||||||
Retrying the
|
Retrying the
|
||||||
.BR close ()
|
.BR close ()
|
||||||
after a failure return is the wrong thing to do,
|
after a failure return is the wrong thing to do,
|
||||||
|
@ -159,7 +159,7 @@ the steps that may return an error,
|
||||||
.\" filp_close()
|
.\" filp_close()
|
||||||
such as flushing data to the filesystem or device,
|
such as flushing data to the filesystem or device,
|
||||||
occur only later in the close operation.
|
occur only later in the close operation.
|
||||||
|
.PP
|
||||||
Many other implementations similarly always close the file descriptor
|
Many other implementations similarly always close the file descriptor
|
||||||
.\" FreeBSD documents this explicitly. From the look of the source code
|
.\" FreeBSD documents this explicitly. From the look of the source code
|
||||||
.\" SVR4, ancient SunOS, later Solaris, and AIX all do this.
|
.\" SVR4, ancient SunOS, later Solaris, and AIX all do this.
|
||||||
|
@ -172,19 +172,19 @@ POSIX.1 is currently silent on this point,
|
||||||
but there are plans to mandate this behavior in the next major release
|
but there are plans to mandate this behavior in the next major release
|
||||||
.\" Issue 8
|
.\" Issue 8
|
||||||
of the standard
|
of the standard
|
||||||
|
.PP
|
||||||
A careful programmer who wants to know about I/O errors may precede
|
A careful programmer who wants to know about I/O errors may precede
|
||||||
.BR close ()
|
.BR close ()
|
||||||
with a call to
|
with a call to
|
||||||
.BR fsync (2).
|
.BR fsync (2).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B EINTR
|
.B EINTR
|
||||||
error is a somewhat special case.
|
error is a somewhat special case.
|
||||||
Regarding the
|
Regarding the
|
||||||
.B EINTR
|
.B EINTR
|
||||||
error, POSIX.1-2013 says:
|
error, POSIX.1-2013 says:
|
||||||
|
.PP
|
||||||
.RS
|
.RS
|
||||||
If
|
If
|
||||||
.BR close ()
|
.BR close ()
|
||||||
|
@ -196,7 +196,7 @@ and the state of
|
||||||
.I fildes
|
.I fildes
|
||||||
is unspecified.
|
is unspecified.
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
This permits the behavior that occurs on Linux and
|
This permits the behavior that occurs on Linux and
|
||||||
many other implementations, where,
|
many other implementations, where,
|
||||||
as with other errors that may be reported by
|
as with other errors that may be reported by
|
||||||
|
|
|
@ -94,7 +94,7 @@ is determined by the address space of the socket
|
||||||
see
|
see
|
||||||
.BR socket (2)
|
.BR socket (2)
|
||||||
for further details.
|
for further details.
|
||||||
|
.PP
|
||||||
If the socket
|
If the socket
|
||||||
.I sockfd
|
.I sockfd
|
||||||
is of type
|
is of type
|
||||||
|
@ -259,12 +259,12 @@ POSIX.1 does not require the inclusion of
|
||||||
and this header file is not required on Linux.
|
and this header file is not required on Linux.
|
||||||
However, some historical (BSD) implementations required this header
|
However, some historical (BSD) implementations required this header
|
||||||
file, and portable applications are probably wise to include it.
|
file, and portable applications are probably wise to include it.
|
||||||
|
.PP
|
||||||
For background on the
|
For background on the
|
||||||
.I socklen_t
|
.I socklen_t
|
||||||
type, see
|
type, see
|
||||||
.BR accept (2).
|
.BR accept (2).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.BR connect ()
|
.BR connect ()
|
||||||
fails, consider the state of the socket as unspecified.
|
fails, consider the state of the socket as unspecified.
|
||||||
|
|
|
@ -47,7 +47,7 @@ bytes of data from file descriptor
|
||||||
to file descriptor
|
to file descriptor
|
||||||
.IR fd_out ,
|
.IR fd_out ,
|
||||||
overwriting any data that exists within the requested range of the target file.
|
overwriting any data that exists within the requested range of the target file.
|
||||||
|
.PP
|
||||||
The following semantics apply for
|
The following semantics apply for
|
||||||
.IR off_in ,
|
.IR off_in ,
|
||||||
and similar statements apply to
|
and similar statements apply to
|
||||||
|
@ -74,7 +74,7 @@ is not changed, but
|
||||||
.I off_in
|
.I off_in
|
||||||
is adjusted appropriately.
|
is adjusted appropriately.
|
||||||
.PP
|
.PP
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument is provided to allow for future extensions
|
argument is provided to allow for future extensions
|
||||||
|
@ -84,7 +84,7 @@ Upon successful completion,
|
||||||
.BR copy_file_range ()
|
.BR copy_file_range ()
|
||||||
will return the number of bytes copied between files.
|
will return the number of bytes copied between files.
|
||||||
This could be less than the length originally requested.
|
This could be less than the length originally requested.
|
||||||
|
.PP
|
||||||
On error,
|
On error,
|
||||||
.BR copy_file_range ()
|
.BR copy_file_range ()
|
||||||
returns \-1 and
|
returns \-1 and
|
||||||
|
@ -143,7 +143,7 @@ in a loop, and using the
|
||||||
and
|
and
|
||||||
.BR SEEK_HOLE
|
.BR SEEK_HOLE
|
||||||
operations to find the locations of data segments.
|
operations to find the locations of data segments.
|
||||||
|
.PP
|
||||||
.BR copy_file_range ()
|
.BR copy_file_range ()
|
||||||
gives filesystems an opportunity to implement "copy acceleration" techniques,
|
gives filesystems an opportunity to implement "copy acceleration" techniques,
|
||||||
such as the use of reflinks (i.e., two or more i-nodes that share
|
such as the use of reflinks (i.e., two or more i-nodes that share
|
||||||
|
|
|
@ -22,7 +22,7 @@ No declaration of this system call is provided in glibc headers; see NOTES.
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.IR Note :
|
.IR Note :
|
||||||
This system call is present only in kernels before Linux 2.6.
|
This system call is present only in kernels before Linux 2.6.
|
||||||
|
.PP
|
||||||
.BR create_module ()
|
.BR create_module ()
|
||||||
attempts to create a loadable module entry and reserve the kernel memory
|
attempts to create a loadable module entry and reserve the kernel memory
|
||||||
that will be needed to hold the module.
|
that will be needed to hold the module.
|
||||||
|
|
|
@ -46,7 +46,7 @@ The
|
||||||
argument is used to modify the behavior of the system call,
|
argument is used to modify the behavior of the system call,
|
||||||
as described below.
|
as described below.
|
||||||
This system call requires privilege.
|
This system call requires privilege.
|
||||||
|
.PP
|
||||||
Module removal is attempted according to the following rules:
|
Module removal is attempted according to the following rules:
|
||||||
.IP 1. 4
|
.IP 1. 4
|
||||||
If there are other loaded modules that depend on
|
If there are other loaded modules that depend on
|
||||||
|
@ -67,7 +67,7 @@ flag is always specified, and the
|
||||||
flag may additionally be specified.
|
flag may additionally be specified.
|
||||||
.\" O_TRUNC == KMOD_REMOVE_FORCE in kmod library
|
.\" O_TRUNC == KMOD_REMOVE_FORCE in kmod library
|
||||||
.\" O_NONBLOCK == KMOD_REMOVE_NOWAIT in kmod library
|
.\" O_NONBLOCK == KMOD_REMOVE_NOWAIT in kmod library
|
||||||
|
.IP
|
||||||
The various combinations for
|
The various combinations for
|
||||||
.I flags
|
.I flags
|
||||||
have the following effect:
|
have the following effect:
|
||||||
|
@ -183,7 +183,7 @@ it is (before glibc 2.23) sufficient to
|
||||||
manually declare the interface in your code;
|
manually declare the interface in your code;
|
||||||
alternatively, you can invoke the system call using
|
alternatively, you can invoke the system call using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
The uninterruptible sleep that may occur if
|
The uninterruptible sleep that may occur if
|
||||||
.BR O_NONBLOCK
|
.BR O_NONBLOCK
|
||||||
is omitted from
|
is omitted from
|
||||||
|
@ -195,13 +195,13 @@ As at Linux 3.7, specifying
|
||||||
is optional, but in future kernels it is likely to become mandatory.
|
is optional, but in future kernels it is likely to become mandatory.
|
||||||
.SS Linux 2.4 and earlier
|
.SS Linux 2.4 and earlier
|
||||||
In Linux 2.4 and earlier, the system call took only one argument:
|
In Linux 2.4 and earlier, the system call took only one argument:
|
||||||
|
.PP
|
||||||
.BI " int delete_module(const char *" name );
|
.BI " int delete_module(const char *" name );
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I name
|
.I name
|
||||||
is NULL, all unused modules marked auto-clean are removed.
|
is NULL, all unused modules marked auto-clean are removed.
|
||||||
|
.PP
|
||||||
Some further details of differences in the behavior of
|
Some further details of differences in the behavior of
|
||||||
.BR delete_module ()
|
.BR delete_module ()
|
||||||
in Linux 2.4 and earlier are
|
in Linux 2.4 and earlier are
|
||||||
|
|
14
man2/dup.2
14
man2/dup.2
|
@ -56,7 +56,7 @@ The
|
||||||
system call creates a copy of the file descriptor
|
system call creates a copy of the file descriptor
|
||||||
.IR oldfd ,
|
.IR oldfd ,
|
||||||
using the lowest-numbered unused file descriptor for the new descriptor.
|
using the lowest-numbered unused file descriptor for the new descriptor.
|
||||||
|
.PP
|
||||||
After a successful return,
|
After a successful return,
|
||||||
the old and new file descriptors may be used interchangeably.
|
the old and new file descriptors may be used interchangeably.
|
||||||
They refer to the same open file description (see
|
They refer to the same open file description (see
|
||||||
|
@ -65,7 +65,7 @@ and thus share file offset and file status flags;
|
||||||
for example, if the file offset is modified by using
|
for example, if the file offset is modified by using
|
||||||
.BR lseek (2)
|
.BR lseek (2)
|
||||||
on one of the file descriptors, the offset is also changed for the other.
|
on one of the file descriptors, the offset is also changed for the other.
|
||||||
|
.PP
|
||||||
The two file descriptors do not share file descriptor flags
|
The two file descriptors do not share file descriptor flags
|
||||||
(the close-on-exec flag).
|
(the close-on-exec flag).
|
||||||
The close-on-exec flag
|
The close-on-exec flag
|
||||||
|
@ -85,7 +85,7 @@ it uses the file descriptor number specified in
|
||||||
If the file descriptor
|
If the file descriptor
|
||||||
.IR newfd
|
.IR newfd
|
||||||
was previously open, it is silently closed before being reused.
|
was previously open, it is silently closed before being reused.
|
||||||
|
.PP
|
||||||
The steps of closing and reusing the file descriptor
|
The steps of closing and reusing the file descriptor
|
||||||
.IR newfd
|
.IR newfd
|
||||||
are performed
|
are performed
|
||||||
|
@ -101,7 +101,7 @@ might be reused between the two steps.
|
||||||
Such reuse could happen because the main program is interrupted
|
Such reuse could happen because the main program is interrupted
|
||||||
by a signal handler that allocates a file descriptor,
|
by a signal handler that allocates a file descriptor,
|
||||||
or because a parallel thread allocates a file descriptor.
|
or because a parallel thread allocates a file descriptor.
|
||||||
|
.PP
|
||||||
Note the following points:
|
Note the following points:
|
||||||
.IP * 3
|
.IP * 3
|
||||||
If
|
If
|
||||||
|
@ -210,7 +210,7 @@ version 2.9.
|
||||||
.BR dup (),
|
.BR dup (),
|
||||||
.BR dup2 ():
|
.BR dup2 ():
|
||||||
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
||||||
|
.PP
|
||||||
.BR dup3 ()
|
.BR dup3 ()
|
||||||
is Linux-specific.
|
is Linux-specific.
|
||||||
.\" SVr4 documents additional
|
.\" SVr4 documents additional
|
||||||
|
@ -230,7 +230,7 @@ also sometimes returns
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
like
|
like
|
||||||
.BR F_DUPFD .
|
.BR F_DUPFD .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I newfd
|
.I newfd
|
||||||
was open, any errors that would have been reported at
|
was open, any errors that would have been reported at
|
||||||
|
@ -246,7 +246,7 @@ before calling
|
||||||
.BR dup2 (),
|
.BR dup2 (),
|
||||||
because of the race condition described above.
|
because of the race condition described above.
|
||||||
Instead, code something like the following could be used:
|
Instead, code something like the following could be used:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
/* Obtain a duplicate of 'newfd' that can subsequently
|
/* Obtain a duplicate of 'newfd' that can subsequently
|
||||||
be used to check for close() errors; an EBADF error
|
be used to check for close() errors; an EBADF error
|
||||||
|
|
|
@ -39,7 +39,7 @@ instance.
|
||||||
Since Linux 2.6.8, the
|
Since Linux 2.6.8, the
|
||||||
.I size
|
.I size
|
||||||
argument is ignored, but must be greater than zero; see NOTES below.
|
argument is ignored, but must be greater than zero; see NOTES below.
|
||||||
|
.PP
|
||||||
.BR epoll_create ()
|
.BR epoll_create ()
|
||||||
returns a file descriptor referring to the new epoll instance.
|
returns a file descriptor referring to the new epoll instance.
|
||||||
This file descriptor is used for all the subsequent calls to the
|
This file descriptor is used for all the subsequent calls to the
|
||||||
|
@ -112,7 +112,7 @@ There was insufficient memory to create the kernel object.
|
||||||
.BR epoll_create ()
|
.BR epoll_create ()
|
||||||
was added to the kernel in version 2.6.
|
was added to the kernel in version 2.6.
|
||||||
Library support is provided in glibc starting with version 2.3.2.
|
Library support is provided in glibc starting with version 2.3.2.
|
||||||
|
.PP
|
||||||
.\" To be precise: kernel 2.5.44.
|
.\" To be precise: kernel 2.5.44.
|
||||||
.\" The interface should be finalized by Linux kernel 2.5.66.
|
.\" The interface should be finalized by Linux kernel 2.5.66.
|
||||||
.BR epoll_create1 ()
|
.BR epoll_create1 ()
|
||||||
|
|
|
@ -35,7 +35,7 @@ It requests that the operation
|
||||||
.I op
|
.I op
|
||||||
be performed for the target file descriptor,
|
be performed for the target file descriptor,
|
||||||
.IR fd .
|
.IR fd .
|
||||||
|
.PP
|
||||||
Valid values for the
|
Valid values for the
|
||||||
.I op
|
.I op
|
||||||
argument are:
|
argument are:
|
||||||
|
@ -92,7 +92,7 @@ struct epoll_event {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I events
|
.I events
|
||||||
member is a bit mask composed by ORing together zero or more of
|
member is a bit mask composed by ORing together zero or more of
|
||||||
|
@ -134,7 +134,7 @@ Hang up happened on the associated file descriptor.
|
||||||
.BR epoll_wait (2)
|
.BR epoll_wait (2)
|
||||||
will always wait for this event; it is not necessary to set it in
|
will always wait for this event; it is not necessary to set it in
|
||||||
.IR events .
|
.IR events .
|
||||||
|
.IP
|
||||||
Note that when reading from a channel such as a pipe or a stream socket,
|
Note that when reading from a channel such as a pipe or a stream socket,
|
||||||
this event merely indicates that the peer closed its end of the channel.
|
this event merely indicates that the peer closed its end of the channel.
|
||||||
Subsequent reads from the channel will return 0 (end of file)
|
Subsequent reads from the channel will return 0 (end of file)
|
||||||
|
@ -206,7 +206,7 @@ The default in this scenario (when
|
||||||
is not set) is for all epoll file descriptors to receive an event.
|
is not set) is for all epoll file descriptors to receive an event.
|
||||||
.BR EPOLLEXCLUSIVE
|
.BR EPOLLEXCLUSIVE
|
||||||
is thus useful for avoiding thundering herd problems in certain scenarios.
|
is thus useful for avoiding thundering herd problems in certain scenarios.
|
||||||
|
.IP
|
||||||
If the same file descriptor is in multiple epoll instances,
|
If the same file descriptor is in multiple epoll instances,
|
||||||
some with the
|
some with the
|
||||||
.BR EPOLLEXCLUSIVE
|
.BR EPOLLEXCLUSIVE
|
||||||
|
@ -215,7 +215,7 @@ instances that did not specify
|
||||||
.BR EPOLLEXCLUSIVE ,
|
.BR EPOLLEXCLUSIVE ,
|
||||||
and at least one of the epoll instances that did specify
|
and at least one of the epoll instances that did specify
|
||||||
.BR EPOLLEXCLUSIVE .
|
.BR EPOLLEXCLUSIVE .
|
||||||
|
.IP
|
||||||
The following values may be specified in conjunction with
|
The following values may be specified in conjunction with
|
||||||
.BR EPOLLEXCLUSIVE :
|
.BR EPOLLEXCLUSIVE :
|
||||||
.BR EPOLLIN ,
|
.BR EPOLLIN ,
|
||||||
|
@ -398,7 +398,7 @@ when using
|
||||||
Applications that need to be portable to kernels before 2.6.9
|
Applications that need to be portable to kernels before 2.6.9
|
||||||
should specify a non-null pointer in
|
should specify a non-null pointer in
|
||||||
.IR event .
|
.IR event .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.B EPOLLWAKEUP
|
.B EPOLLWAKEUP
|
||||||
is specified in
|
is specified in
|
||||||
|
|
|
@ -100,7 +100,7 @@ struct epoll_event {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I data
|
.I data
|
||||||
field of each returned structure contains the same data as was specified
|
field of each returned structure contains the same data as was specified
|
||||||
|
|
|
@ -36,7 +36,7 @@ The object contains an unsigned 64-bit integer
|
||||||
counter that is maintained by the kernel.
|
counter that is maintained by the kernel.
|
||||||
This counter is initialized with the value specified in the argument
|
This counter is initialized with the value specified in the argument
|
||||||
.IR initval .
|
.IR initval .
|
||||||
|
.PP
|
||||||
The following values may be bitwise ORed in
|
The following values may be bitwise ORed in
|
||||||
.IR flags
|
.IR flags
|
||||||
to change the behavior of
|
to change the behavior of
|
||||||
|
@ -67,7 +67,7 @@ See below.
|
||||||
In Linux up to version 2.6.26, the
|
In Linux up to version 2.6.26, the
|
||||||
.I flags
|
.I flags
|
||||||
argument is unused, and must be specified as zero.
|
argument is unused, and must be specified as zero.
|
||||||
|
.PP
|
||||||
As its return value,
|
As its return value,
|
||||||
.BR eventfd ()
|
.BR eventfd ()
|
||||||
returns a new file descriptor that can be used to refer to the
|
returns a new file descriptor that can be used to refer to the
|
||||||
|
@ -275,7 +275,7 @@ T{
|
||||||
.BR eventfd ()
|
.BR eventfd ()
|
||||||
T} Thread safety MT-Safe
|
T} Thread safety MT-Safe
|
||||||
.TE
|
.TE
|
||||||
|
.sp 1
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
.BR eventfd ()
|
.BR eventfd ()
|
||||||
and
|
and
|
||||||
|
@ -289,13 +289,13 @@ The kernel overhead of an eventfd file descriptor
|
||||||
is much lower than that of a pipe,
|
is much lower than that of a pipe,
|
||||||
and only one file descriptor is
|
and only one file descriptor is
|
||||||
required (versus the two required for a pipe).
|
required (versus the two required for a pipe).
|
||||||
|
.PP
|
||||||
When used in the kernel, an eventfd
|
When used in the kernel, an eventfd
|
||||||
file descriptor can provide a bridge from kernel to user space, allowing,
|
file descriptor can provide a bridge from kernel to user space, allowing,
|
||||||
for example, functionalities like KAIO (kernel AIO)
|
for example, functionalities like KAIO (kernel AIO)
|
||||||
.\" or eventually syslets/threadlets
|
.\" or eventually syslets/threadlets
|
||||||
to signal to a file descriptor that some operation is complete.
|
to signal to a file descriptor that some operation is complete.
|
||||||
|
.PP
|
||||||
A key point about an eventfd file descriptor is that it can be
|
A key point about an eventfd file descriptor is that it can be
|
||||||
monitored just like any other file descriptor using
|
monitored just like any other file descriptor using
|
||||||
.BR select (2),
|
.BR select (2),
|
||||||
|
@ -312,7 +312,7 @@ interface, these mechanisms could not be multiplexed via
|
||||||
.BR poll (2),
|
.BR poll (2),
|
||||||
or
|
or
|
||||||
.BR epoll (7).)
|
.BR epoll (7).)
|
||||||
|
.PP
|
||||||
The current value of an eventfd counter can be viewed
|
The current value of an eventfd counter can be viewed
|
||||||
via the entry for the corresponding file descriptor in the process's
|
via the entry for the corresponding file descriptor in the process's
|
||||||
.IR /proc/[pid]/fdinfo
|
.IR /proc/[pid]/fdinfo
|
||||||
|
@ -348,7 +348,7 @@ int eventfd_read(int fd, eventfd_t *value);
|
||||||
int eventfd_write(int fd, eventfd_t value);
|
int eventfd_write(int fd, eventfd_t value);
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The functions perform the read and write operations on an
|
The functions perform the read and write operations on an
|
||||||
eventfd file descriptor,
|
eventfd file descriptor,
|
||||||
returning 0 if the correct number of bytes was transferred,
|
returning 0 if the correct number of bytes was transferred,
|
||||||
|
@ -362,7 +362,7 @@ the child writes each of the integers supplied in the program's
|
||||||
command-line arguments to the eventfd file descriptor.
|
command-line arguments to the eventfd file descriptor.
|
||||||
When the parent has finished sleeping,
|
When the parent has finished sleeping,
|
||||||
it reads from the eventfd file descriptor.
|
it reads from the eventfd file descriptor.
|
||||||
|
.PP
|
||||||
The following shell session shows a sample run of the program:
|
The following shell session shows a sample run of the program:
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
|
|
|
@ -48,15 +48,15 @@ execve \- execute program
|
||||||
executes the program pointed to by \fIfilename\fP.
|
executes the program pointed to by \fIfilename\fP.
|
||||||
\fIfilename\fP must be either a binary executable, or a script
|
\fIfilename\fP must be either a binary executable, or a script
|
||||||
starting with a line of the form:
|
starting with a line of the form:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
\fB#!\fP \fIinterpreter \fP[optional-arg]
|
\fB#!\fP \fIinterpreter \fP[optional-arg]
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
For details of the latter case, see "Interpreter scripts" below.
|
For details of the latter case, see "Interpreter scripts" below.
|
||||||
|
.PP
|
||||||
\fIargv\fP is an array of argument strings passed to the new program.
|
\fIargv\fP is an array of argument strings passed to the new program.
|
||||||
By convention, the first of these strings (i.e.,
|
By convention, the first of these strings (i.e.,
|
||||||
.IR argv[0] )
|
.IR argv[0] )
|
||||||
|
@ -65,31 +65,31 @@ should contain the filename associated with the file being executed.
|
||||||
\fBkey=value\fP, which are passed as environment to the new program.
|
\fBkey=value\fP, which are passed as environment to the new program.
|
||||||
The \fIargv\fP and \fIenvp\fP arrays must each include a null pointer
|
The \fIargv\fP and \fIenvp\fP arrays must each include a null pointer
|
||||||
at the end of the array.
|
at the end of the array.
|
||||||
|
.PP
|
||||||
The argument vector and environment can be accessed by the
|
The argument vector and environment can be accessed by the
|
||||||
called program's main function, when it is defined as:
|
called program's main function, when it is defined as:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
int main(int argc, char *argv[], char *envp[])
|
int main(int argc, char *argv[], char *envp[])
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
Note, however, that the use of a third argument to the main function
|
Note, however, that the use of a third argument to the main function
|
||||||
is not specified in POSIX.1;
|
is not specified in POSIX.1;
|
||||||
according to POSIX.1,
|
according to POSIX.1,
|
||||||
the environment should be accessed via the external variable
|
the environment should be accessed via the external variable
|
||||||
.BR environ (7).
|
.BR environ (7).
|
||||||
|
.PP
|
||||||
.BR execve ()
|
.BR execve ()
|
||||||
does not return on success, and the text, initialized data,
|
does not return on success, and the text, initialized data,
|
||||||
uninitialized data (bss), and stack of the calling process are overwritten
|
uninitialized data (bss), and stack of the calling process are overwritten
|
||||||
according to the contents of the newly loaded program.
|
according to the contents of the newly loaded program.
|
||||||
|
.PP
|
||||||
If the current program is being ptraced, a \fBSIGTRAP\fP signal is sent to it
|
If the current program is being ptraced, a \fBSIGTRAP\fP signal is sent to it
|
||||||
after a successful
|
after a successful
|
||||||
.BR execve ().
|
.BR execve ().
|
||||||
|
.PP
|
||||||
If the set-user-ID bit is set on the program file pointed to by
|
If the set-user-ID bit is set on the program file pointed to by
|
||||||
\fIfilename\fP,
|
\fIfilename\fP,
|
||||||
then the effective user ID of the calling process is changed
|
then the effective user ID of the calling process is changed
|
||||||
|
@ -97,7 +97,7 @@ to that of the owner of the program file.
|
||||||
Similarly, when the set-group-ID
|
Similarly, when the set-group-ID
|
||||||
bit of the program file is set the effective group ID of the calling
|
bit of the program file is set the effective group ID of the calling
|
||||||
process is set to the group of the program file.
|
process is set to the group of the program file.
|
||||||
|
.PP
|
||||||
The aforementioned transformations of the effective IDs are
|
The aforementioned transformations of the effective IDs are
|
||||||
.I not
|
.I not
|
||||||
performed (i.e., the set-user-ID and set-group-ID bits are ignored)
|
performed (i.e., the set-user-ID and set-group-ID bits are ignored)
|
||||||
|
@ -126,11 +126,11 @@ The effective user ID of the process is copied to the saved set-user-ID;
|
||||||
similarly, the effective group ID is copied to the saved set-group-ID.
|
similarly, the effective group ID is copied to the saved set-group-ID.
|
||||||
This copying takes place after any effective ID changes that occur
|
This copying takes place after any effective ID changes that occur
|
||||||
because of the set-user-ID and set-group-ID mode bits.
|
because of the set-user-ID and set-group-ID mode bits.
|
||||||
|
.PP
|
||||||
The process's real UID and real GID, as well its supplementary group IDs,
|
The process's real UID and real GID, as well its supplementary group IDs,
|
||||||
are unchanged by a call to
|
are unchanged by a call to
|
||||||
.BR execve ().
|
.BR execve ().
|
||||||
|
.PP
|
||||||
If the executable is an a.out dynamically linked
|
If the executable is an a.out dynamically linked
|
||||||
binary executable containing
|
binary executable containing
|
||||||
shared-library stubs, the Linux dynamic linker
|
shared-library stubs, the Linux dynamic linker
|
||||||
|
@ -138,7 +138,7 @@ shared-library stubs, the Linux dynamic linker
|
||||||
is called at the start of execution to bring
|
is called at the start of execution to bring
|
||||||
needed shared objects into memory
|
needed shared objects into memory
|
||||||
and link the executable with them.
|
and link the executable with them.
|
||||||
|
.PP
|
||||||
If the executable is a dynamically linked ELF executable, the
|
If the executable is a dynamically linked ELF executable, the
|
||||||
interpreter named in the PT_INTERP segment is used to load the needed
|
interpreter named in the PT_INTERP segment is used to load the needed
|
||||||
shared objects.
|
shared objects.
|
||||||
|
@ -146,7 +146,7 @@ This interpreter is typically
|
||||||
.I /lib/ld-linux.so.2
|
.I /lib/ld-linux.so.2
|
||||||
for binaries linked with glibc (see
|
for binaries linked with glibc (see
|
||||||
.BR ld-linux.so (8)).
|
.BR ld-linux.so (8)).
|
||||||
|
.PP
|
||||||
All process attributes are preserved during an
|
All process attributes are preserved during an
|
||||||
.BR execve (),
|
.BR execve (),
|
||||||
except the following:
|
except the following:
|
||||||
|
@ -294,13 +294,13 @@ closed across an
|
||||||
.SS Interpreter scripts
|
.SS Interpreter scripts
|
||||||
An interpreter script is a text file that has execute
|
An interpreter script is a text file that has execute
|
||||||
permission enabled and whose first line is of the form:
|
permission enabled and whose first line is of the form:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
\fB#!\fP \fIinterpreter \fP[optional-arg]
|
\fB#!\fP \fIinterpreter \fP[optional-arg]
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I interpreter
|
.I interpreter
|
||||||
must be a valid pathname for an executable file.
|
must be a valid pathname for an executable file.
|
||||||
|
@ -311,13 +311,13 @@ argument of
|
||||||
specifies an interpreter script, then
|
specifies an interpreter script, then
|
||||||
.I interpreter
|
.I interpreter
|
||||||
will be invoked with the following arguments:
|
will be invoked with the following arguments:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
\fIinterpreter\fP [optional-arg] \fIfilename\fP arg...
|
\fIinterpreter\fP [optional-arg] \fIfilename\fP arg...
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
where
|
where
|
||||||
.I arg...
|
.I arg...
|
||||||
is the series of words pointed to by the
|
is the series of words pointed to by the
|
||||||
|
@ -326,12 +326,12 @@ argument of
|
||||||
.BR execve (),
|
.BR execve (),
|
||||||
starting at
|
starting at
|
||||||
.IR argv [1].
|
.IR argv [1].
|
||||||
|
.PP
|
||||||
For portable use,
|
For portable use,
|
||||||
.I optional-arg
|
.I optional-arg
|
||||||
should either be absent, or be specified as a single word (i.e., it
|
should either be absent, or be specified as a single word (i.e., it
|
||||||
should not contain white space); see NOTES below.
|
should not contain white space); see NOTES below.
|
||||||
|
.PP
|
||||||
Since Linux 2.6.28,
|
Since Linux 2.6.28,
|
||||||
.\" commit bf2a9a39639b8b51377905397a5005f444e9a892
|
.\" commit bf2a9a39639b8b51377905397a5005f444e9a892
|
||||||
the kernel permits the interpreter of a script to itself be a script.
|
the kernel permits the interpreter of a script to itself be a script.
|
||||||
|
@ -351,14 +351,14 @@ constant (either defined in
|
||||||
.I <limits.h>
|
.I <limits.h>
|
||||||
or available at run time using the call
|
or available at run time using the call
|
||||||
.IR "sysconf(_SC_ARG_MAX)" ).
|
.IR "sysconf(_SC_ARG_MAX)" ).
|
||||||
|
.PP
|
||||||
On Linux prior to kernel 2.6.23, the memory used to store the
|
On Linux prior to kernel 2.6.23, the memory used to store the
|
||||||
environment and argument strings was limited to 32 pages
|
environment and argument strings was limited to 32 pages
|
||||||
(defined by the kernel constant
|
(defined by the kernel constant
|
||||||
.BR MAX_ARG_PAGES ).
|
.BR MAX_ARG_PAGES ).
|
||||||
On architectures with a 4-kB page size,
|
On architectures with a 4-kB page size,
|
||||||
this yields a maximum size of 128 kB.
|
this yields a maximum size of 128 kB.
|
||||||
|
.PP
|
||||||
On kernel 2.6.23 and later, most architectures support a size limit
|
On kernel 2.6.23 and later, most architectures support a size limit
|
||||||
derived from the soft
|
derived from the soft
|
||||||
.B RLIMIT_STACK
|
.B RLIMIT_STACK
|
||||||
|
@ -529,7 +529,7 @@ POSIX does not document the #! behavior, but it exists
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Set-user-ID and set-group-ID processes can not be
|
Set-user-ID and set-group-ID processes can not be
|
||||||
.BR ptrace (2)d.
|
.BR ptrace (2)d.
|
||||||
|
.PP
|
||||||
The result of mounting a filesystem
|
The result of mounting a filesystem
|
||||||
.I nosuid
|
.I nosuid
|
||||||
varies across Linux kernel versions:
|
varies across Linux kernel versions:
|
||||||
|
@ -540,7 +540,7 @@ give the user powers she did not have already (and return
|
||||||
some will just ignore the set-user-ID and set-group-ID bits and
|
some will just ignore the set-user-ID and set-group-ID bits and
|
||||||
.BR exec ()
|
.BR exec ()
|
||||||
successfully.
|
successfully.
|
||||||
|
.PP
|
||||||
On Linux,
|
On Linux,
|
||||||
.I argv
|
.I argv
|
||||||
and
|
and
|
||||||
|
@ -562,7 +562,7 @@ case the same as Linux.
|
||||||
.\" Bug filed 30 Apr 2007: http://bugzilla.kernel.org/show_bug.cgi?id=8408
|
.\" Bug filed 30 Apr 2007: http://bugzilla.kernel.org/show_bug.cgi?id=8408
|
||||||
.\" Bug rejected (because fix would constitute an ABI change).
|
.\" Bug rejected (because fix would constitute an ABI change).
|
||||||
.\"
|
.\"
|
||||||
|
.PP
|
||||||
POSIX.1 says that values returned by
|
POSIX.1 says that values returned by
|
||||||
.BR sysconf (3)
|
.BR sysconf (3)
|
||||||
should be invariant over the lifetime of a process.
|
should be invariant over the lifetime of a process.
|
||||||
|
@ -573,7 +573,7 @@ resource limit changes, then the value reported by
|
||||||
will also change,
|
will also change,
|
||||||
to reflect the fact that the limit on space for holding
|
to reflect the fact that the limit on space for holding
|
||||||
command-line arguments and environment variables has changed.
|
command-line arguments and environment variables has changed.
|
||||||
|
.PP
|
||||||
In most cases where
|
In most cases where
|
||||||
.BR execve ()
|
.BR execve ()
|
||||||
fails, control returns to the original executable image,
|
fails, control returns to the original executable image,
|
||||||
|
@ -591,7 +591,7 @@ signal.
|
||||||
.SS Interpreter scripts
|
.SS Interpreter scripts
|
||||||
A maximum line length of 127 characters is allowed for the first line in
|
A maximum line length of 127 characters is allowed for the first line in
|
||||||
an interpreter script.
|
an interpreter script.
|
||||||
|
.PP
|
||||||
The semantics of the
|
The semantics of the
|
||||||
.I optional-arg
|
.I optional-arg
|
||||||
argument of an interpreter script vary across implementations.
|
argument of an interpreter script vary across implementations.
|
||||||
|
@ -610,7 +610,7 @@ an interpreter script can have multiple arguments,
|
||||||
and white spaces in
|
and white spaces in
|
||||||
.I optional-arg
|
.I optional-arg
|
||||||
are used to delimit the arguments.
|
are used to delimit the arguments.
|
||||||
|
.PP
|
||||||
Linux ignores the set-user-ID and set-group-ID bits on scripts.
|
Linux ignores the set-user-ID and set-group-ID bits on scripts.
|
||||||
.\"
|
.\"
|
||||||
.\" .SH BUGS
|
.\" .SH BUGS
|
||||||
|
@ -627,7 +627,7 @@ A more detailed explanation of the
|
||||||
error that can occur (since Linux 3.1) when calling
|
error that can occur (since Linux 3.1) when calling
|
||||||
.BR execve ()
|
.BR execve ()
|
||||||
is as follows.
|
is as follows.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR EAGAIN
|
.BR EAGAIN
|
||||||
error can occur when a
|
error can occur when a
|
||||||
|
@ -649,7 +649,7 @@ call to fail.
|
||||||
.\" commit 909cc4ae86f3380152a18e2a3c44523893ee11c4
|
.\" commit 909cc4ae86f3380152a18e2a3c44523893ee11c4
|
||||||
the resource limit was not imposed on processes that
|
the resource limit was not imposed on processes that
|
||||||
changed their user IDs.)
|
changed their user IDs.)
|
||||||
|
.PP
|
||||||
Since Linux 3.1, the scenario just described no longer causes the
|
Since Linux 3.1, the scenario just described no longer causes the
|
||||||
.BR set*uid ()
|
.BR set*uid ()
|
||||||
call to fail,
|
call to fail,
|
||||||
|
@ -680,7 +680,7 @@ common privileged daemon workflow\(emnamely,
|
||||||
.BR set*uid ()
|
.BR set*uid ()
|
||||||
+
|
+
|
||||||
.BR execve ().
|
.BR execve ().
|
||||||
|
.PP
|
||||||
If the resource limit was not still exceeded at the time of the
|
If the resource limit was not still exceeded at the time of the
|
||||||
.BR execve ()
|
.BR execve ()
|
||||||
call
|
call
|
||||||
|
@ -719,7 +719,7 @@ Since UNIX\ V7, both are NULL.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The following program is designed to be execed by the second program below.
|
The following program is designed to be execed by the second program below.
|
||||||
It just echoes its command-line arguments, one per line.
|
It just echoes its command-line arguments, one per line.
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
/* myecho.c */
|
/* myecho.c */
|
||||||
|
@ -739,7 +739,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
This program can be used to exec the program named in its command-line
|
This program can be used to exec the program named in its command-line
|
||||||
argument:
|
argument:
|
||||||
.in +4n
|
.in +4n
|
||||||
|
@ -770,9 +770,9 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
We can use the second program to exec the first as follows:
|
We can use the second program to exec the first as follows:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
.RB "$" " cc myecho.c \-o myecho"
|
.RB "$" " cc myecho.c \-o myecho"
|
||||||
|
@ -783,13 +783,13 @@ argv[1]: hello
|
||||||
argv[2]: world
|
argv[2]: world
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
We can also use these programs to demonstrate the use of a script
|
We can also use these programs to demonstrate the use of a script
|
||||||
interpreter.
|
interpreter.
|
||||||
To do this we create a script whose "interpreter" is our
|
To do this we create a script whose "interpreter" is our
|
||||||
.I myecho
|
.I myecho
|
||||||
program:
|
program:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
.RB "$" " cat > script"
|
.RB "$" " cat > script"
|
||||||
|
@ -798,9 +798,9 @@ program:
|
||||||
.RB "$" " chmod +x script"
|
.RB "$" " chmod +x script"
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
We can then use our program to exec the script:
|
We can then use our program to exec the script:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
.RB "$" " ./execve ./script"
|
.RB "$" " ./execve ./script"
|
||||||
|
|
|
@ -45,7 +45,7 @@ and
|
||||||
It operates in exactly the same way as
|
It operates in exactly the same way as
|
||||||
.BR execve (2),
|
.BR execve (2),
|
||||||
except for the differences described in this manual page.
|
except for the differences described in this manual page.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -55,7 +55,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR execve (2)
|
.BR execve (2)
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -67,13 +67,13 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR execve (2)).
|
.BR execve (2)).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
.I dirfd
|
.I dirfd
|
||||||
is ignored.
|
is ignored.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is an empty string and the
|
is an empty string and the
|
||||||
|
@ -83,7 +83,7 @@ flag is specified, then the file descriptor
|
||||||
specifies the file to be executed (i.e.,
|
specifies the file to be executed (i.e.,
|
||||||
.IR dirfd
|
.IR dirfd
|
||||||
refers to an executable file, rather than a directory).
|
refers to an executable file, rather than a directory).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument is a bit mask that can include zero or more of the following flags:
|
argument is a bit mask that can include zero or more of the following flags:
|
||||||
|
@ -176,7 +176,7 @@ system call is also needed to allow
|
||||||
to be implemented on systems that do not have the
|
to be implemented on systems that do not have the
|
||||||
.I /proc
|
.I /proc
|
||||||
filesystem mounted.
|
filesystem mounted.
|
||||||
|
.PP
|
||||||
When asked to execute a script file, the
|
When asked to execute a script file, the
|
||||||
.IR argv[0]
|
.IR argv[0]
|
||||||
that is passed to the script interpreter is a string of the form
|
that is passed to the script interpreter is a string of the form
|
||||||
|
@ -199,7 +199,7 @@ in this case,
|
||||||
.IR P
|
.IR P
|
||||||
is the value given in
|
is the value given in
|
||||||
.IR pathname .
|
.IR pathname .
|
||||||
|
.PP
|
||||||
For the same reasons described in
|
For the same reasons described in
|
||||||
.BR fexecve (3),
|
.BR fexecve (3),
|
||||||
the natural idiom when using
|
the natural idiom when using
|
||||||
|
@ -212,9 +212,9 @@ The
|
||||||
.B ENOENT
|
.B ENOENT
|
||||||
error described above means that it is not possible to set the
|
error described above means that it is not possible to set the
|
||||||
close-on-exec flag on the file descriptor given to a call of the form:
|
close-on-exec flag on the file descriptor given to a call of the form:
|
||||||
|
.PP
|
||||||
execveat(fd, "", argv, envp, AT_EMPTY_PATH);
|
execveat(fd, "", argv, envp, AT_EMPTY_PATH);
|
||||||
|
.PP
|
||||||
However, the inability to set the close-on-exec flag means that a file
|
However, the inability to set the close-on-exec flag means that a file
|
||||||
descriptor referring to the script leaks through to the script itself.
|
descriptor referring to the script leaks through to the script itself.
|
||||||
As well as wasting a file descriptor,
|
As well as wasting a file descriptor,
|
||||||
|
|
|
@ -24,7 +24,7 @@ This is a nonportable, Linux-specific system call.
|
||||||
For the portable, POSIX.1-specified method of ensuring that space
|
For the portable, POSIX.1-specified method of ensuring that space
|
||||||
is allocated for a file, see
|
is allocated for a file, see
|
||||||
.BR posix_fallocate (3).
|
.BR posix_fallocate (3).
|
||||||
|
.PP
|
||||||
.BR fallocate ()
|
.BR fallocate ()
|
||||||
allows the caller to directly manipulate the allocated disk space
|
allows the caller to directly manipulate the allocated disk space
|
||||||
for the file referred to by
|
for the file referred to by
|
||||||
|
@ -34,7 +34,7 @@ for the byte range starting at
|
||||||
and continuing for
|
and continuing for
|
||||||
.I len
|
.I len
|
||||||
bytes.
|
bytes.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument determines the operation to be performed on the given range.
|
argument determines the operation to be performed on the given range.
|
||||||
|
@ -62,13 +62,13 @@ This default behavior closely resembles the behavior of the
|
||||||
.BR posix_fallocate (3)
|
.BR posix_fallocate (3)
|
||||||
library function,
|
library function,
|
||||||
and is intended as a method of optimally implementing that function.
|
and is intended as a method of optimally implementing that function.
|
||||||
|
.PP
|
||||||
After a successful call, subsequent writes into the range specified by
|
After a successful call, subsequent writes into the range specified by
|
||||||
.IR offset
|
.IR offset
|
||||||
and
|
and
|
||||||
.IR len
|
.IR len
|
||||||
are guaranteed not to fail because of lack of disk space.
|
are guaranteed not to fail because of lack of disk space.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.B FALLOC_FL_KEEP_SIZE
|
.B FALLOC_FL_KEEP_SIZE
|
||||||
flag is specified in
|
flag is specified in
|
||||||
|
@ -79,7 +79,7 @@ but the file size will not be changed even if
|
||||||
is greater than the file size.
|
is greater than the file size.
|
||||||
Preallocating zeroed blocks beyond the end of the file in this manner
|
Preallocating zeroed blocks beyond the end of the file in this manner
|
||||||
is useful for optimizing append workloads.
|
is useful for optimizing append workloads.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.B FALLOC_FL_UNSHARE
|
.B FALLOC_FL_UNSHARE
|
||||||
flag is specified in
|
flag is specified in
|
||||||
|
@ -108,7 +108,7 @@ Within the specified range, partial filesystem blocks are zeroed,
|
||||||
and whole filesystem blocks are removed from the file.
|
and whole filesystem blocks are removed from the file.
|
||||||
After a successful call,
|
After a successful call,
|
||||||
subsequent reads from this range will return zeroes.
|
subsequent reads from this range will return zeroes.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR FALLOC_FL_PUNCH_HOLE
|
.BR FALLOC_FL_PUNCH_HOLE
|
||||||
flag must be ORed with
|
flag must be ORed with
|
||||||
|
@ -119,7 +119,7 @@ in other words, even when punching off the end of the file, the file size
|
||||||
(as reported by
|
(as reported by
|
||||||
.BR stat (2))
|
.BR stat (2))
|
||||||
does not change.
|
does not change.
|
||||||
|
.PP
|
||||||
Not all filesystems support
|
Not all filesystems support
|
||||||
.BR FALLOC_FL_PUNCH_HOLE ;
|
.BR FALLOC_FL_PUNCH_HOLE ;
|
||||||
if a filesystem doesn't support the operation, an error is returned.
|
if a filesystem doesn't support the operation, an error is returned.
|
||||||
|
@ -154,7 +154,7 @@ will be appended at the location
|
||||||
and the file will be
|
and the file will be
|
||||||
.I len
|
.I len
|
||||||
bytes smaller.
|
bytes smaller.
|
||||||
|
.PP
|
||||||
A filesystem may place limitations on the granularity of the operation,
|
A filesystem may place limitations on the granularity of the operation,
|
||||||
in order to ensure efficient implementation.
|
in order to ensure efficient implementation.
|
||||||
Typically,
|
Typically,
|
||||||
|
@ -168,7 +168,7 @@ If a filesystem has such a requirement,
|
||||||
will fail with the error
|
will fail with the error
|
||||||
.BR EINVAL
|
.BR EINVAL
|
||||||
if this requirement is violated.
|
if this requirement is violated.
|
||||||
|
.PP
|
||||||
If the region specified by
|
If the region specified by
|
||||||
.I offset
|
.I offset
|
||||||
plus
|
plus
|
||||||
|
@ -177,12 +177,12 @@ reaches or passes the end of file, an error is returned;
|
||||||
instead, use
|
instead, use
|
||||||
.BR ftruncate (2)
|
.BR ftruncate (2)
|
||||||
to truncate a file.
|
to truncate a file.
|
||||||
|
.PP
|
||||||
No other flags may be specified in
|
No other flags may be specified in
|
||||||
.IR mode
|
.IR mode
|
||||||
in conjunction with
|
in conjunction with
|
||||||
.BR FALLOC_FL_COLLAPSE_RANGE .
|
.BR FALLOC_FL_COLLAPSE_RANGE .
|
||||||
|
.PP
|
||||||
As at Linux 3.15,
|
As at Linux 3.15,
|
||||||
.B FALLOC_FL_COLLAPSE_RANGE
|
.B FALLOC_FL_COLLAPSE_RANGE
|
||||||
is supported by
|
is supported by
|
||||||
|
@ -206,13 +206,13 @@ Within the specified range, blocks are preallocated for the regions
|
||||||
that span the holes in the file.
|
that span the holes in the file.
|
||||||
After a successful call, subsequent
|
After a successful call, subsequent
|
||||||
reads from this range will return zeroes.
|
reads from this range will return zeroes.
|
||||||
|
.PP
|
||||||
Zeroing is done within the filesystem preferably by converting the range into
|
Zeroing is done within the filesystem preferably by converting the range into
|
||||||
unwritten extents.
|
unwritten extents.
|
||||||
This approach means that the specified range will not be physically zeroed
|
This approach means that the specified range will not be physically zeroed
|
||||||
out on the device (except for partial blocks at the either end of the range),
|
out on the device (except for partial blocks at the either end of the range),
|
||||||
and I/O is (otherwise) required only to update metadata.
|
and I/O is (otherwise) required only to update metadata.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.B FALLOC_FL_KEEP_SIZE
|
.B FALLOC_FL_KEEP_SIZE
|
||||||
flag is additionally specified in
|
flag is additionally specified in
|
||||||
|
@ -224,7 +224,7 @@ is greater than the file size.
|
||||||
This behavior is the same as when preallocating space with
|
This behavior is the same as when preallocating space with
|
||||||
.B FALLOC_FL_KEEP_SIZE
|
.B FALLOC_FL_KEEP_SIZE
|
||||||
specified.
|
specified.
|
||||||
|
.PP
|
||||||
Not all filesystems support
|
Not all filesystems support
|
||||||
.BR FALLOC_FL_ZERO_RANGE ;
|
.BR FALLOC_FL_ZERO_RANGE ;
|
||||||
if a filesystem doesn't support the operation, an error is returned.
|
if a filesystem doesn't support the operation, an error is returned.
|
||||||
|
@ -261,7 +261,7 @@ bytes.
|
||||||
Inserting a hole inside a file increases the file size by
|
Inserting a hole inside a file increases the file size by
|
||||||
.I len
|
.I len
|
||||||
bytes.
|
bytes.
|
||||||
|
.PP
|
||||||
This mode has the same limitations as
|
This mode has the same limitations as
|
||||||
.BR FALLOC_FL_COLLAPSE_RANGE
|
.BR FALLOC_FL_COLLAPSE_RANGE
|
||||||
regarding the granularity of the operation.
|
regarding the granularity of the operation.
|
||||||
|
@ -275,12 +275,12 @@ is equal to or greater than the end of file, an error is returned.
|
||||||
For such operations (i.e., inserting a hole at the end of file),
|
For such operations (i.e., inserting a hole at the end of file),
|
||||||
.BR ftruncate (2)
|
.BR ftruncate (2)
|
||||||
should be used.
|
should be used.
|
||||||
|
.PP
|
||||||
No other flags may be specified in
|
No other flags may be specified in
|
||||||
.IR mode
|
.IR mode
|
||||||
in conjunction with
|
in conjunction with
|
||||||
.BR FALLOC_FL_INSERT_RANGE .
|
.BR FALLOC_FL_INSERT_RANGE .
|
||||||
|
.PP
|
||||||
.B FALLOC_FL_INSERT_RANGE
|
.B FALLOC_FL_INSERT_RANGE
|
||||||
requires filesystem support.
|
requires filesystem support.
|
||||||
Filesystems that support this operation include
|
Filesystems that support this operation include
|
||||||
|
|
14
man2/flock.2
14
man2/flock.2
|
@ -68,9 +68,9 @@ To make a nonblocking request, include
|
||||||
.B LOCK_NB
|
.B LOCK_NB
|
||||||
(by ORing)
|
(by ORing)
|
||||||
with any of the above operations.
|
with any of the above operations.
|
||||||
|
.PP
|
||||||
A single file may not simultaneously have both shared and exclusive locks.
|
A single file may not simultaneously have both shared and exclusive locks.
|
||||||
|
.PP
|
||||||
Locks created by
|
Locks created by
|
||||||
.BR flock ()
|
.BR flock ()
|
||||||
are associated with an open file description (see
|
are associated with an open file description (see
|
||||||
|
@ -85,7 +85,7 @@ Furthermore, the lock is released either by an explicit
|
||||||
.B LOCK_UN
|
.B LOCK_UN
|
||||||
operation on any of these duplicate file descriptors, or when all
|
operation on any of these duplicate file descriptors, or when all
|
||||||
such file descriptors have been closed.
|
such file descriptors have been closed.
|
||||||
|
.PP
|
||||||
If a process uses
|
If a process uses
|
||||||
.BR open (2)
|
.BR open (2)
|
||||||
(or similar) to obtain more than one file descriptor for the same file,
|
(or similar) to obtain more than one file descriptor for the same file,
|
||||||
|
@ -94,19 +94,19 @@ these file descriptors are treated independently by
|
||||||
An attempt to lock the file using one of these file descriptors
|
An attempt to lock the file using one of these file descriptors
|
||||||
may be denied by a lock that the calling process has
|
may be denied by a lock that the calling process has
|
||||||
already placed via another file descriptor.
|
already placed via another file descriptor.
|
||||||
|
.PP
|
||||||
A process may hold only one type of lock (shared or exclusive)
|
A process may hold only one type of lock (shared or exclusive)
|
||||||
on a file.
|
on a file.
|
||||||
Subsequent
|
Subsequent
|
||||||
.BR flock ()
|
.BR flock ()
|
||||||
calls on an already locked file will convert an existing lock to the new
|
calls on an already locked file will convert an existing lock to the new
|
||||||
lock mode.
|
lock mode.
|
||||||
|
.PP
|
||||||
Locks created by
|
Locks created by
|
||||||
.BR flock ()
|
.BR flock ()
|
||||||
are preserved across an
|
are preserved across an
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
A shared or exclusive lock can be placed on a file regardless of the
|
A shared or exclusive lock can be placed on a file regardless of the
|
||||||
mode in which the file was opened.
|
mode in which the file was opened.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
@ -241,7 +241,7 @@ and occurs on many other implementations.)
|
||||||
.BR open (2),
|
.BR open (2),
|
||||||
.BR lockf (3),
|
.BR lockf (3),
|
||||||
.BR lslocks (8)
|
.BR lslocks (8)
|
||||||
|
.PP
|
||||||
.I Documentation/filesystems/locks.txt
|
.I Documentation/filesystems/locks.txt
|
||||||
in the Linux kernel source tree
|
in the Linux kernel source tree
|
||||||
.RI ( Documentation/locks.txt
|
.RI ( Documentation/locks.txt
|
||||||
|
|
|
@ -52,7 +52,7 @@ process.
|
||||||
The calling process is referred to as the
|
The calling process is referred to as the
|
||||||
.I parent
|
.I parent
|
||||||
process.
|
process.
|
||||||
|
.PP
|
||||||
The child process and the parent process run in separate memory spaces.
|
The child process and the parent process run in separate memory spaces.
|
||||||
At the time of
|
At the time of
|
||||||
.BR fork ()
|
.BR fork ()
|
||||||
|
@ -62,7 +62,7 @@ Memory writes, file mappings
|
||||||
and unmappings
|
and unmappings
|
||||||
.RB ( munmap (2))
|
.RB ( munmap (2))
|
||||||
performed by one of the processes do not affect the other.
|
performed by one of the processes do not affect the other.
|
||||||
|
.PP
|
||||||
The child process is an exact duplicate of the parent
|
The child process is an exact duplicate of the parent
|
||||||
process except for the following points:
|
process except for the following points:
|
||||||
.IP * 3
|
.IP * 3
|
||||||
|
|
10
man2/fsync.2
10
man2/fsync.2
|
@ -72,7 +72,7 @@ This includes writing through or flushing a disk cache if present.
|
||||||
The call blocks until the device reports that the transfer has completed.
|
The call blocks until the device reports that the transfer has completed.
|
||||||
It also flushes metadata information associated with the file (see
|
It also flushes metadata information associated with the file (see
|
||||||
.BR inode (7)).
|
.BR inode (7)).
|
||||||
|
.PP
|
||||||
Calling
|
Calling
|
||||||
.BR fsync ()
|
.BR fsync ()
|
||||||
does not necessarily ensure
|
does not necessarily ensure
|
||||||
|
@ -80,7 +80,7 @@ that the entry in the directory containing the file has also reached disk.
|
||||||
For that an explicit
|
For that an explicit
|
||||||
.BR fsync ()
|
.BR fsync ()
|
||||||
on a file descriptor for the directory is also needed.
|
on a file descriptor for the directory is also needed.
|
||||||
|
.PP
|
||||||
.BR fdatasync ()
|
.BR fdatasync ()
|
||||||
is similar to
|
is similar to
|
||||||
.BR fsync (),
|
.BR fsync (),
|
||||||
|
@ -101,7 +101,7 @@ On the other hand, a change to the file size
|
||||||
as made by say
|
as made by say
|
||||||
.BR ftruncate (2)),
|
.BR ftruncate (2)),
|
||||||
would require a metadata flush.
|
would require a metadata flush.
|
||||||
|
.PP
|
||||||
The aim of
|
The aim of
|
||||||
.BR fdatasync ()
|
.BR fdatasync ()
|
||||||
is to reduce disk activity for applications that do not
|
is to reduce disk activity for applications that do not
|
||||||
|
@ -145,13 +145,13 @@ On some UNIX systems (but not Linux),
|
||||||
must be a
|
must be a
|
||||||
.I writable
|
.I writable
|
||||||
file descriptor.
|
file descriptor.
|
||||||
|
.PP
|
||||||
In Linux 2.2 and earlier,
|
In Linux 2.2 and earlier,
|
||||||
.BR fdatasync ()
|
.BR fdatasync ()
|
||||||
is equivalent to
|
is equivalent to
|
||||||
.BR fsync (),
|
.BR fsync (),
|
||||||
and so has no performance advantage.
|
and so has no performance advantage.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR fsync ()
|
.BR fsync ()
|
||||||
implementations in older kernels and lesser used filesystems
|
implementations in older kernels and lesser used filesystems
|
||||||
|
|
152
man2/futex.2
152
man2/futex.2
|
@ -54,7 +54,7 @@ Other
|
||||||
.BR futex ()
|
.BR futex ()
|
||||||
operations can be used to wake any processes or threads waiting
|
operations can be used to wake any processes or threads waiting
|
||||||
for a particular condition.
|
for a particular condition.
|
||||||
|
.PP
|
||||||
A futex is a 32-bit value\(emreferred to below as a
|
A futex is a 32-bit value\(emreferred to below as a
|
||||||
.IR "futex word" \(emwhose
|
.IR "futex word" \(emwhose
|
||||||
address is supplied to the
|
address is supplied to the
|
||||||
|
@ -73,7 +73,7 @@ virtual addresses in different processes,
|
||||||
but these addresses all refer to the same location in physical memory.)
|
but these addresses all refer to the same location in physical memory.)
|
||||||
In a multithreaded program, it is sufficient to place the futex word
|
In a multithreaded program, it is sufficient to place the futex word
|
||||||
in a global variable shared by all threads.
|
in a global variable shared by all threads.
|
||||||
|
.PP
|
||||||
When executing a futex operation that requests to block a thread,
|
When executing a futex operation that requests to block a thread,
|
||||||
the kernel will block only if the futex word has the value that the
|
the kernel will block only if the futex word has the value that the
|
||||||
calling thread supplied (as one of the arguments of the
|
calling thread supplied (as one of the arguments of the
|
||||||
|
@ -106,7 +106,7 @@ blocking via a futex is an atomic compare-and-block operation.
|
||||||
.\" the reference in the following sentence
|
.\" the reference in the following sentence
|
||||||
.\" See NOTES for a detailed specification of
|
.\" See NOTES for a detailed specification of
|
||||||
.\" the synchronization semantics.
|
.\" the synchronization semantics.
|
||||||
|
.PP
|
||||||
One use of futexes is for implementing locks.
|
One use of futexes is for implementing locks.
|
||||||
The state of the lock (i.e., acquired or not acquired)
|
The state of the lock (i.e., acquired or not acquired)
|
||||||
can be represented as an atomically accessed flag in shared memory.
|
can be represented as an atomically accessed flag in shared memory.
|
||||||
|
@ -133,10 +133,10 @@ operation that wakes threads blocked on the lock flag used as a futex word
|
||||||
See
|
See
|
||||||
.BR futex (7)
|
.BR futex (7)
|
||||||
for more detail on how to use futexes.
|
for more detail on how to use futexes.
|
||||||
|
.PP
|
||||||
Besides the basic wait and wake-up futex functionality, there are further
|
Besides the basic wait and wake-up futex functionality, there are further
|
||||||
futex operations aimed at supporting more complex use cases.
|
futex operations aimed at supporting more complex use cases.
|
||||||
|
.PP
|
||||||
Note that
|
Note that
|
||||||
no explicit initialization or destruction is necessary to use futexes;
|
no explicit initialization or destruction is necessary to use futexes;
|
||||||
the kernel maintains a futex
|
the kernel maintains a futex
|
||||||
|
@ -157,7 +157,7 @@ argument;
|
||||||
.IR val
|
.IR val
|
||||||
is a value whose meaning and purpose depends on
|
is a value whose meaning and purpose depends on
|
||||||
.IR futex_op .
|
.IR futex_op .
|
||||||
|
.PP
|
||||||
The remaining arguments
|
The remaining arguments
|
||||||
.RI ( timeout ,
|
.RI ( timeout ,
|
||||||
.IR uaddr2 ,
|
.IR uaddr2 ,
|
||||||
|
@ -165,7 +165,7 @@ and
|
||||||
.IR val3 )
|
.IR val3 )
|
||||||
are required only for certain of the futex operations described below.
|
are required only for certain of the futex operations described below.
|
||||||
Where one of these arguments is not required, it is ignored.
|
Where one of these arguments is not required, it is ignored.
|
||||||
|
.PP
|
||||||
For several blocking operations, the
|
For several blocking operations, the
|
||||||
.I timeout
|
.I timeout
|
||||||
argument is a pointer to a
|
argument is a pointer to a
|
||||||
|
@ -183,12 +183,12 @@ then to
|
||||||
and in the remainder of this page, this argument is referred to as
|
and in the remainder of this page, this argument is referred to as
|
||||||
.I val2
|
.I val2
|
||||||
when interpreted in this fashion.
|
when interpreted in this fashion.
|
||||||
|
.PP
|
||||||
Where it is required, the
|
Where it is required, the
|
||||||
.IR uaddr2
|
.IR uaddr2
|
||||||
argument is a pointer to a second futex word that is employed
|
argument is a pointer to a second futex word that is employed
|
||||||
by the operation.
|
by the operation.
|
||||||
|
.PP
|
||||||
The interpretation of the final integer argument,
|
The interpretation of the final integer argument,
|
||||||
.IR val3 ,
|
.IR val3 ,
|
||||||
depends on the operation.
|
depends on the operation.
|
||||||
|
@ -216,7 +216,7 @@ This allows the kernel to make some additional performance optimizations.
|
||||||
.\" I.e., It allows the kernel choose the fast path for validating
|
.\" I.e., It allows the kernel choose the fast path for validating
|
||||||
.\" the user-space address and avoids expensive VMA lookups,
|
.\" the user-space address and avoids expensive VMA lookups,
|
||||||
.\" taking reference counts on file backing store, and so on.
|
.\" taking reference counts on file backing store, and so on.
|
||||||
|
.IP
|
||||||
As a convenience,
|
As a convenience,
|
||||||
.IR <linux/futex.h>
|
.IR <linux/futex.h>
|
||||||
defines a set of constants with the suffix
|
defines a set of constants with the suffix
|
||||||
|
@ -242,13 +242,13 @@ and
|
||||||
.\" commit 337f13046ff03717a9e99675284a817527440a49
|
.\" commit 337f13046ff03717a9e99675284a817527440a49
|
||||||
.BR FUTEX_WAIT
|
.BR FUTEX_WAIT
|
||||||
operations.
|
operations.
|
||||||
|
.IP
|
||||||
If this option is set, the kernel measures the
|
If this option is set, the kernel measures the
|
||||||
.I timeout
|
.I timeout
|
||||||
against the
|
against the
|
||||||
.BR CLOCK_REALTIME
|
.BR CLOCK_REALTIME
|
||||||
clock.
|
clock.
|
||||||
|
.IP
|
||||||
If this option is not set, the kernel measures the
|
If this option is not set, the kernel measures the
|
||||||
.I timeout
|
.I timeout
|
||||||
against the
|
against the
|
||||||
|
@ -287,7 +287,7 @@ If the futex value does not match
|
||||||
.IR val ,
|
.IR val ,
|
||||||
then the call fails immediately with the error
|
then the call fails immediately with the error
|
||||||
.BR EAGAIN .
|
.BR EAGAIN .
|
||||||
|
.IP
|
||||||
The purpose of the comparison with the expected value is to prevent lost
|
The purpose of the comparison with the expected value is to prevent lost
|
||||||
wake-ups.
|
wake-ups.
|
||||||
If another thread changed the value of the futex word after the
|
If another thread changed the value of the futex word after the
|
||||||
|
@ -298,7 +298,7 @@ operation (or similar wake-up) after the value change and before this
|
||||||
.BR FUTEX_WAIT
|
.BR FUTEX_WAIT
|
||||||
operation, then the calling thread will observe the
|
operation, then the calling thread will observe the
|
||||||
value change and will not start to sleep.
|
value change and will not start to sleep.
|
||||||
|
.IP
|
||||||
If the
|
If the
|
||||||
.I timeout
|
.I timeout
|
||||||
is not NULL, the structure it points to specifies a
|
is not NULL, the structure it points to specifies a
|
||||||
|
@ -316,7 +316,7 @@ in
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is NULL, the call blocks indefinitely.
|
is NULL, the call blocks indefinitely.
|
||||||
|
.IP
|
||||||
.IR Note :
|
.IR Note :
|
||||||
for
|
for
|
||||||
.BR FUTEX_WAIT ,
|
.BR FUTEX_WAIT ,
|
||||||
|
@ -335,7 +335,7 @@ with
|
||||||
.IR val3
|
.IR val3
|
||||||
specified as
|
specified as
|
||||||
.BR FUTEX_BITSET_MATCH_ANY .
|
.BR FUTEX_BITSET_MATCH_ANY .
|
||||||
|
.IP
|
||||||
The arguments
|
The arguments
|
||||||
.I uaddr2
|
.I uaddr2
|
||||||
and
|
and
|
||||||
|
@ -372,7 +372,7 @@ is specified as either 1 (wake up a single waiter) or
|
||||||
No guarantee is provided about which waiters are awoken
|
No guarantee is provided about which waiters are awoken
|
||||||
(e.g., a waiter with a higher scheduling priority is not guaranteed
|
(e.g., a waiter with a higher scheduling priority is not guaranteed
|
||||||
to be awoken in preference to a waiter with a lower priority).
|
to be awoken in preference to a waiter with a lower priority).
|
||||||
|
.IP
|
||||||
The arguments
|
The arguments
|
||||||
.IR timeout ,
|
.IR timeout ,
|
||||||
.IR uaddr2 ,
|
.IR uaddr2 ,
|
||||||
|
@ -407,21 +407,21 @@ on the futex word, the file descriptor indicates as being readable with
|
||||||
.BR poll (2),
|
.BR poll (2),
|
||||||
and
|
and
|
||||||
.BR epoll (7)
|
.BR epoll (7)
|
||||||
|
.IP
|
||||||
The file descriptor can be used to obtain asynchronous notifications: if
|
The file descriptor can be used to obtain asynchronous notifications: if
|
||||||
.I val
|
.I val
|
||||||
is nonzero, then, when another process or thread executes a
|
is nonzero, then, when another process or thread executes a
|
||||||
.BR FUTEX_WAKE ,
|
.BR FUTEX_WAKE ,
|
||||||
the caller will receive the signal number that was passed in
|
the caller will receive the signal number that was passed in
|
||||||
.IR val .
|
.IR val .
|
||||||
|
.IP
|
||||||
The arguments
|
The arguments
|
||||||
.IR timeout ,
|
.IR timeout ,
|
||||||
.I uaddr2
|
.I uaddr2
|
||||||
and
|
and
|
||||||
.I val3
|
.I val3
|
||||||
are ignored.
|
are ignored.
|
||||||
|
.IP
|
||||||
Because it was inherently racy,
|
Because it was inherently racy,
|
||||||
.B FUTEX_FD
|
.B FUTEX_FD
|
||||||
has been removed
|
has been removed
|
||||||
|
@ -466,7 +466,7 @@ The
|
||||||
argument specifies an upper limit on the number of waiters
|
argument specifies an upper limit on the number of waiters
|
||||||
that are requeued to the futex at
|
that are requeued to the futex at
|
||||||
.IR uaddr2 .
|
.IR uaddr2 .
|
||||||
|
.IP
|
||||||
.\" FIXME(Torvald) Is the following correct? Or is just the decision
|
.\" FIXME(Torvald) Is the following correct? Or is just the decision
|
||||||
.\" which threads to wake or requeue part of the atomic operation?
|
.\" which threads to wake or requeue part of the atomic operation?
|
||||||
The load from
|
The load from
|
||||||
|
@ -482,7 +482,7 @@ ordered with respect to other operations on the same futex word.
|
||||||
.\" source and target futex. No other waiter can enqueue itself
|
.\" source and target futex. No other waiter can enqueue itself
|
||||||
.\" for waiting and no other waiter can dequeue itself because of
|
.\" for waiting and no other waiter can dequeue itself because of
|
||||||
.\" a timeout or signal.
|
.\" a timeout or signal.
|
||||||
|
.IP
|
||||||
Typical values to specify for
|
Typical values to specify for
|
||||||
.I val
|
.I val
|
||||||
are 0 or 1.
|
are 0 or 1.
|
||||||
|
@ -500,7 +500,7 @@ is typically either 1 or
|
||||||
.BR FUTEX_CMP_REQUEUE
|
.BR FUTEX_CMP_REQUEUE
|
||||||
operation equivalent to
|
operation equivalent to
|
||||||
.BR FUTEX_WAIT .)
|
.BR FUTEX_WAIT .)
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.B FUTEX_CMP_REQUEUE
|
.B FUTEX_CMP_REQUEUE
|
||||||
operation was added as a replacement for the earlier
|
operation was added as a replacement for the earlier
|
||||||
|
@ -517,7 +517,7 @@ conditions, which allows race conditions to be avoided in certain use cases.
|
||||||
.\" To: Darren Hart <dvhart@infradead.org>
|
.\" To: Darren Hart <dvhart@infradead.org>
|
||||||
.\" CC: libc-alpha@sourceware.org, ...
|
.\" CC: libc-alpha@sourceware.org, ...
|
||||||
.\" Subject: Re: Add futex wrapper to glibc?
|
.\" Subject: Re: Add futex wrapper to glibc?
|
||||||
|
.IP
|
||||||
Both
|
Both
|
||||||
.BR FUTEX_REQUEUE
|
.BR FUTEX_REQUEUE
|
||||||
and
|
and
|
||||||
|
@ -529,7 +529,7 @@ another futex.
|
||||||
Consider the following scenario,
|
Consider the following scenario,
|
||||||
where multiple waiter threads are waiting on B,
|
where multiple waiter threads are waiting on B,
|
||||||
a wait queue implemented using a futex:
|
a wait queue implemented using a futex:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
lock(A)
|
lock(A)
|
||||||
|
@ -541,7 +541,7 @@ while (!check_value(V)) {
|
||||||
unlock(A);
|
unlock(A);
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
If a waker thread used
|
If a waker thread used
|
||||||
.BR FUTEX_WAKE ,
|
.BR FUTEX_WAKE ,
|
||||||
then all waiters waiting on B would be woken up,
|
then all waiters waiting on B would be woken up,
|
||||||
|
@ -573,13 +573,13 @@ of the wait queue associated with the condition variable.
|
||||||
.BR FUTEX_WAKE_OP
|
.BR FUTEX_WAKE_OP
|
||||||
allows such cases to be implemented without leading to
|
allows such cases to be implemented without leading to
|
||||||
high rates of contention and context switching.
|
high rates of contention and context switching.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.BR FUTEX_WAKE_OP
|
.BR FUTEX_WAKE_OP
|
||||||
operation is equivalent to executing the following code atomically
|
operation is equivalent to executing the following code atomically
|
||||||
and totally ordered with respect to other futex operations on
|
and totally ordered with respect to other futex operations on
|
||||||
any of the two supplied futex words:
|
any of the two supplied futex words:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
int oldval = *(int *) uaddr2;
|
int oldval = *(int *) uaddr2;
|
||||||
|
@ -589,7 +589,7 @@ if (oldval \fIcmp\fP \fIcmparg\fP)
|
||||||
futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);
|
futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
In other words,
|
In other words,
|
||||||
.BR FUTEX_WAKE_OP
|
.BR FUTEX_WAKE_OP
|
||||||
does the following:
|
does the following:
|
||||||
|
@ -621,7 +621,7 @@ The operation and comparison that are to be performed are encoded
|
||||||
in the bits of the argument
|
in the bits of the argument
|
||||||
.IR val3 .
|
.IR val3 .
|
||||||
Pictorially, the encoding is:
|
Pictorially, the encoding is:
|
||||||
|
.IP
|
||||||
.in +8n
|
.in +8n
|
||||||
.nf
|
.nf
|
||||||
+---+---+-----------+-----------+
|
+---+---+-----------+-----------+
|
||||||
|
@ -630,9 +630,9 @@ Pictorially, the encoding is:
|
||||||
4 4 12 12 <== # of bits
|
4 4 12 12 <== # of bits
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
Expressed in code, the encoding is:
|
Expressed in code, the encoding is:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
#define FUTEX_OP(op, oparg, cmp, cmparg) \\
|
#define FUTEX_OP(op, oparg, cmp, cmparg) \\
|
||||||
|
@ -642,7 +642,7 @@ Expressed in code, the encoding is:
|
||||||
(cmparg & 0xfff))
|
(cmparg & 0xfff))
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
In the above,
|
In the above,
|
||||||
.I op
|
.I op
|
||||||
and
|
and
|
||||||
|
@ -653,11 +653,11 @@ The
|
||||||
and
|
and
|
||||||
.I cmparg
|
.I cmparg
|
||||||
components are literal numeric values, except as noted below.
|
components are literal numeric values, except as noted below.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I op
|
.I op
|
||||||
component has one of the following values:
|
component has one of the following values:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
FUTEX_OP_SET 0 /* uaddr2 = oparg; */
|
FUTEX_OP_SET 0 /* uaddr2 = oparg; */
|
||||||
|
@ -667,23 +667,23 @@ FUTEX_OP_ANDN 3 /* uaddr2 &= ~oparg; */
|
||||||
FUTEX_OP_XOR 4 /* uaddr2 ^= oparg; */
|
FUTEX_OP_XOR 4 /* uaddr2 ^= oparg; */
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
In addition, bit-wise ORing the following value into
|
In addition, bit-wise ORing the following value into
|
||||||
.I op
|
.I op
|
||||||
causes
|
causes
|
||||||
.IR "(1\ <<\ oparg)"
|
.IR "(1\ <<\ oparg)"
|
||||||
to be used as the operand:
|
to be used as the operand:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
FUTEX_OP_ARG_SHIFT 8 /* Use (1 << oparg) as operand */
|
FUTEX_OP_ARG_SHIFT 8 /* Use (1 << oparg) as operand */
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I cmp
|
.I cmp
|
||||||
field is one of the following:
|
field is one of the following:
|
||||||
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
FUTEX_OP_CMP_EQ 0 /* if (oldval == cmparg) wake */
|
FUTEX_OP_CMP_EQ 0 /* if (oldval == cmparg) wake */
|
||||||
|
@ -694,7 +694,7 @@ FUTEX_OP_CMP_GT 4 /* if (oldval > cmparg) wake */
|
||||||
FUTEX_OP_CMP_GE 5 /* if (oldval >= cmparg) wake */
|
FUTEX_OP_CMP_GE 5 /* if (oldval >= cmparg) wake */
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.IP
|
||||||
The return value of
|
The return value of
|
||||||
.BR FUTEX_WAKE_OP
|
.BR FUTEX_WAKE_OP
|
||||||
is the sum of the number of waiters woken on the futex
|
is the sum of the number of waiters woken on the futex
|
||||||
|
@ -717,7 +717,7 @@ is stored in the kernel-internal state of the waiter.
|
||||||
See the description of
|
See the description of
|
||||||
.BR FUTEX_WAKE_BITSET
|
.BR FUTEX_WAKE_BITSET
|
||||||
for further details.
|
for further details.
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is not NULL, the structure it points to specifies
|
is not NULL, the structure it points to specifies
|
||||||
|
@ -725,8 +725,8 @@ an absolute timeout for the wait operation.
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is NULL, the operation can block indefinitely.
|
is NULL, the operation can block indefinitely.
|
||||||
|
.IP
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I uaddr2
|
.I uaddr2
|
||||||
argument is ignored.
|
argument is ignored.
|
||||||
|
@ -751,7 +751,7 @@ state of the waiter (the "wait" bit mask that is set using
|
||||||
.BR FUTEX_WAIT_BITSET ).
|
.BR FUTEX_WAIT_BITSET ).
|
||||||
All of the waiters for which the result of the AND is nonzero are woken up;
|
All of the waiters for which the result of the AND is nonzero are woken up;
|
||||||
the remaining waiters are left sleeping.
|
the remaining waiters are left sleeping.
|
||||||
|
.IP
|
||||||
The effect of
|
The effect of
|
||||||
.BR FUTEX_WAIT_BITSET
|
.BR FUTEX_WAIT_BITSET
|
||||||
and
|
and
|
||||||
|
@ -778,7 +778,7 @@ including those that are not interested in being woken up
|
||||||
.\" obtain the absolute timeout functionality that is useful
|
.\" obtain the absolute timeout functionality that is useful
|
||||||
.\" for efficiently implementing Pthreads APIs (which use absolute
|
.\" for efficiently implementing Pthreads APIs (which use absolute
|
||||||
.\" timeouts); FUTEX_WAIT provides only relative timeouts.
|
.\" timeouts); FUTEX_WAIT provides only relative timeouts.
|
||||||
|
.IP
|
||||||
The constant
|
The constant
|
||||||
.BR FUTEX_BITSET_MATCH_ANY ,
|
.BR FUTEX_BITSET_MATCH_ANY ,
|
||||||
which corresponds to all 32 bits set in the bit mask, can be used as the
|
which corresponds to all 32 bits set in the bit mask, can be used as the
|
||||||
|
@ -807,7 +807,7 @@ with
|
||||||
specified as
|
specified as
|
||||||
.BR FUTEX_BITSET_MATCH_ANY ;
|
.BR FUTEX_BITSET_MATCH_ANY ;
|
||||||
that is, wake up any waiter(s).
|
that is, wake up any waiter(s).
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I uaddr2
|
.I uaddr2
|
||||||
and
|
and
|
||||||
|
@ -826,7 +826,7 @@ while tasks at an intermediate priority continuously preempt
|
||||||
the low-priority task from the CPU.
|
the low-priority task from the CPU.
|
||||||
Consequently, the low-priority task makes no progress toward
|
Consequently, the low-priority task makes no progress toward
|
||||||
releasing the lock, and the high-priority task remains blocked.
|
releasing the lock, and the high-priority task remains blocked.
|
||||||
|
.PP
|
||||||
Priority inheritance is a mechanism for dealing with
|
Priority inheritance is a mechanism for dealing with
|
||||||
the priority-inversion problem.
|
the priority-inversion problem.
|
||||||
With this mechanism, when a high-priority task becomes blocked
|
With this mechanism, when a high-priority task becomes blocked
|
||||||
|
@ -843,7 +843,7 @@ held by another intermediate-priority task
|
||||||
then both of those tasks
|
then both of those tasks
|
||||||
(or more generally, all of the tasks in a lock chain)
|
(or more generally, all of the tasks in a lock chain)
|
||||||
have their priorities raised to be the same as the high-priority task.
|
have their priorities raised to be the same as the high-priority task.
|
||||||
|
.PP
|
||||||
From a user-space perspective,
|
From a user-space perspective,
|
||||||
what makes a futex PI-aware is a policy agreement (described below)
|
what makes a futex PI-aware is a policy agreement (described below)
|
||||||
between user space and the kernel about the value of the futex word,
|
between user space and the kernel about the value of the futex word,
|
||||||
|
@ -859,7 +859,7 @@ for the implementation of very specific IPC mechanisms.)
|
||||||
.\" talk about a PI aware pthread_mutex, than a PI aware futex, since
|
.\" talk about a PI aware pthread_mutex, than a PI aware futex, since
|
||||||
.\" there is a lot of policy and scaffolding that has to be built up
|
.\" there is a lot of policy and scaffolding that has to be built up
|
||||||
.\" around it to use it properly (this is what a PI pthread_mutex is).
|
.\" around it to use it properly (this is what a PI pthread_mutex is).
|
||||||
|
.PP
|
||||||
.\" mtk: The following text is drawn from the Hart/Guniguntala paper
|
.\" mtk: The following text is drawn from the Hart/Guniguntala paper
|
||||||
.\" (listed in SEE ALSO), but I have reworded some pieces
|
.\" (listed in SEE ALSO), but I have reworded some pieces
|
||||||
.\" significantly.
|
.\" significantly.
|
||||||
|
@ -880,7 +880,7 @@ If the lock is owned and there are threads contending for the lock,
|
||||||
then the
|
then the
|
||||||
.B FUTEX_WAITERS
|
.B FUTEX_WAITERS
|
||||||
bit shall be set in the futex word's value; in other words, this value is:
|
bit shall be set in the futex word's value; in other words, this value is:
|
||||||
|
.IP
|
||||||
FUTEX_WAITERS | TID
|
FUTEX_WAITERS | TID
|
||||||
.IP
|
.IP
|
||||||
(Note that is invalid for a PI futex word to have no owner and
|
(Note that is invalid for a PI futex word to have no owner and
|
||||||
|
@ -897,7 +897,7 @@ Acquiring a lock simply consists of using compare-and-swap to atomically
|
||||||
set the futex word's value to the caller's TID if its previous value was 0.
|
set the futex word's value to the caller's TID if its previous value was 0.
|
||||||
Releasing a lock requires using compare-and-swap to set the futex word's
|
Releasing a lock requires using compare-and-swap to set the futex word's
|
||||||
value to 0 if the previous value was the expected TID.
|
value to 0 if the previous value was the expected TID.
|
||||||
|
.PP
|
||||||
If a futex is already acquired (i.e., has a nonzero value),
|
If a futex is already acquired (i.e., has a nonzero value),
|
||||||
waiters must employ the
|
waiters must employ the
|
||||||
.B FUTEX_LOCK_PI
|
.B FUTEX_LOCK_PI
|
||||||
|
@ -908,7 +908,7 @@ bit is set in the futex value;
|
||||||
in this case, the lock owner must employ the
|
in this case, the lock owner must employ the
|
||||||
.B FUTEX_UNLOCK_PI
|
.B FUTEX_UNLOCK_PI
|
||||||
operation to release the lock.
|
operation to release the lock.
|
||||||
|
.PP
|
||||||
In the cases where callers are forced into the kernel
|
In the cases where callers are forced into the kernel
|
||||||
(i.e., required to perform a
|
(i.e., required to perform a
|
||||||
.BR futex ()
|
.BR futex ()
|
||||||
|
@ -918,7 +918,7 @@ a kernel locking mechanism which implements the required
|
||||||
priority-inheritance semantics.
|
priority-inheritance semantics.
|
||||||
After the RT-mutex is acquired, the futex value is updated accordingly,
|
After the RT-mutex is acquired, the futex value is updated accordingly,
|
||||||
before the calling thread returns to user space.
|
before the calling thread returns to user space.
|
||||||
|
.PP
|
||||||
It is important to note
|
It is important to note
|
||||||
.\" tglx (July 2015):
|
.\" tglx (July 2015):
|
||||||
.\" If there are multiple waiters on a pi futex then a wake pi operation
|
.\" If there are multiple waiters on a pi futex then a wake pi operation
|
||||||
|
@ -935,7 +935,7 @@ up in an invalid state, such as having an owner but the value being 0,
|
||||||
or having waiters but not having the
|
or having waiters but not having the
|
||||||
.B FUTEX_WAITERS
|
.B FUTEX_WAITERS
|
||||||
bit set.)
|
bit set.)
|
||||||
|
.PP
|
||||||
If a futex has an associated RT-mutex in the kernel
|
If a futex has an associated RT-mutex in the kernel
|
||||||
(i.e., there are blocked waiters)
|
(i.e., there are blocked waiters)
|
||||||
and the owner of the futex/RT-mutex dies unexpectedly,
|
and the owner of the futex/RT-mutex dies unexpectedly,
|
||||||
|
@ -954,7 +954,7 @@ the dead owner.
|
||||||
.\" mechanism. In that case the futex value will be set to
|
.\" mechanism. In that case the futex value will be set to
|
||||||
.\" FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
|
.\" FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
|
||||||
.\" PI futexes.
|
.\" PI futexes.
|
||||||
|
.PP
|
||||||
PI futexes are operated on by specifying one of the values listed below in
|
PI futexes are operated on by specifying one of the values listed below in
|
||||||
.IR futex_op .
|
.IR futex_op .
|
||||||
Note that the PI futex operations must be used as paired operations
|
Note that the PI futex operations must be used as paired operations
|
||||||
|
@ -996,7 +996,7 @@ This operation is used after an attempt to acquire
|
||||||
the lock via an atomic user-mode instruction failed
|
the lock via an atomic user-mode instruction failed
|
||||||
because the futex word has a nonzero value\(emspecifically,
|
because the futex word has a nonzero value\(emspecifically,
|
||||||
because it contained the (PID-namespace-specific) TID of the lock owner.
|
because it contained the (PID-namespace-specific) TID of the lock owner.
|
||||||
|
.IP
|
||||||
The operation checks the value of the futex word at the address
|
The operation checks the value of the futex word at the address
|
||||||
.IR uaddr .
|
.IR uaddr .
|
||||||
If the value is 0, then the kernel tries to atomically set
|
If the value is 0, then the kernel tries to atomically set
|
||||||
|
@ -1079,7 +1079,7 @@ This inheritance follows the lock chain in the case of nested locking
|
||||||
.\" (i.e., task 1 blocks on lock A, held by task 2,
|
.\" (i.e., task 1 blocks on lock A, held by task 2,
|
||||||
.\" while task 2 blocks on lock B, held by task 3)
|
.\" while task 2 blocks on lock B, held by task 3)
|
||||||
and performs deadlock detection.
|
and performs deadlock detection.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I timeout
|
.I timeout
|
||||||
argument provides a timeout for the lock attempt.
|
argument provides a timeout for the lock attempt.
|
||||||
|
@ -1108,7 +1108,7 @@ clock.
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is NULL, the operation will block indefinitely.
|
is NULL, the operation will block indefinitely.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.IR uaddr2 ,
|
.IR uaddr2 ,
|
||||||
.IR val ,
|
.IR val ,
|
||||||
|
@ -1125,7 +1125,7 @@ This operation tries to acquire the lock at
|
||||||
.IR uaddr .
|
.IR uaddr .
|
||||||
It is invoked when a user-space atomic acquire did not
|
It is invoked when a user-space atomic acquire did not
|
||||||
succeed because the futex word was not 0.
|
succeed because the futex word was not 0.
|
||||||
|
.IP
|
||||||
Because the kernel has access to more state information than user space,
|
Because the kernel has access to more state information than user space,
|
||||||
acquisition of the lock might succeed if performed by the
|
acquisition of the lock might succeed if performed by the
|
||||||
kernel in cases where the futex word
|
kernel in cases where the futex word
|
||||||
|
@ -1149,7 +1149,7 @@ but the kernel can fix this up and acquire the futex.
|
||||||
.\" Darren Hart (Oct 2015):
|
.\" Darren Hart (Oct 2015):
|
||||||
.\" The trylock in the kernel has more state, so it can independently
|
.\" The trylock in the kernel has more state, so it can independently
|
||||||
.\" verify the flags that userspace must trust implicitly.
|
.\" verify the flags that userspace must trust implicitly.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.IR uaddr2 ,
|
.IR uaddr2 ,
|
||||||
.IR val ,
|
.IR val ,
|
||||||
|
@ -1168,11 +1168,11 @@ This operation wakes the top priority waiter that is waiting in
|
||||||
on the futex address provided by the
|
on the futex address provided by the
|
||||||
.I uaddr
|
.I uaddr
|
||||||
argument.
|
argument.
|
||||||
|
.IP
|
||||||
This is called when the user-space value at
|
This is called when the user-space value at
|
||||||
.I uaddr
|
.I uaddr
|
||||||
cannot be changed atomically from a TID (of the owner) to 0.
|
cannot be changed atomically from a TID (of the owner) to 0.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.IR uaddr2 ,
|
.IR uaddr2 ,
|
||||||
.IR val ,
|
.IR val ,
|
||||||
|
@ -1196,7 +1196,7 @@ from a non-PI source futex
|
||||||
.RI ( uaddr )
|
.RI ( uaddr )
|
||||||
to a PI target futex
|
to a PI target futex
|
||||||
.RI ( uaddr2 ).
|
.RI ( uaddr2 ).
|
||||||
|
.IP
|
||||||
As with
|
As with
|
||||||
.BR FUTEX_CMP_REQUEUE ,
|
.BR FUTEX_CMP_REQUEUE ,
|
||||||
this operation wakes up a maximum of
|
this operation wakes up a maximum of
|
||||||
|
@ -1212,7 +1212,7 @@ The remaining waiters are removed from the wait queue of the source futex at
|
||||||
.I uaddr
|
.I uaddr
|
||||||
and added to the wait queue of the target futex at
|
and added to the wait queue of the target futex at
|
||||||
.IR uaddr2 .
|
.IR uaddr2 .
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I val2
|
.I val2
|
||||||
.\" val2 is the cap on the number of requeued waiters.
|
.\" val2 is the cap on the number of requeued waiters.
|
||||||
|
@ -1246,7 +1246,7 @@ The wait operation on
|
||||||
.I uaddr
|
.I uaddr
|
||||||
is the same as for
|
is the same as for
|
||||||
.BR FUTEX_WAIT .
|
.BR FUTEX_WAIT .
|
||||||
|
.IP
|
||||||
The waiter can be removed from the wait on
|
The waiter can be removed from the wait on
|
||||||
.I uaddr
|
.I uaddr
|
||||||
without requeueing on
|
without requeueing on
|
||||||
|
@ -1258,7 +1258,7 @@ In this case, the
|
||||||
.BR FUTEX_WAIT_REQUEUE_PI
|
.BR FUTEX_WAIT_REQUEUE_PI
|
||||||
operation fails with the error
|
operation fails with the error
|
||||||
.BR EAGAIN .
|
.BR EAGAIN .
|
||||||
|
.IP
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is not NULL, the structure it points to specifies
|
is not NULL, the structure it points to specifies
|
||||||
|
@ -1266,11 +1266,11 @@ an absolute timeout for the wait operation.
|
||||||
If
|
If
|
||||||
.I timeout
|
.I timeout
|
||||||
is NULL, the operation can block indefinitely.
|
is NULL, the operation can block indefinitely.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.I val3
|
.I val3
|
||||||
argument is ignored.
|
argument is ignored.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.BR FUTEX_WAIT_REQUEUE_PI
|
.BR FUTEX_WAIT_REQUEUE_PI
|
||||||
and
|
and
|
||||||
|
@ -1323,7 +1323,7 @@ was invoked via
|
||||||
all operations return \-1 and set
|
all operations return \-1 and set
|
||||||
.I errno
|
.I errno
|
||||||
to indicate the cause of the error.
|
to indicate the cause of the error.
|
||||||
|
.PP
|
||||||
The return value on success depends on the operation,
|
The return value on success depends on the operation,
|
||||||
as described in the following list:
|
as described in the following list:
|
||||||
.TP
|
.TP
|
||||||
|
@ -1414,7 +1414,7 @@ The value pointed to by
|
||||||
was not equal to the expected value
|
was not equal to the expected value
|
||||||
.I val
|
.I val
|
||||||
at the time of the call.
|
at the time of the call.
|
||||||
|
.IP
|
||||||
.BR Note :
|
.BR Note :
|
||||||
on Linux, the symbolic names
|
on Linux, the symbolic names
|
||||||
.B EAGAIN
|
.B EAGAIN
|
||||||
|
@ -1688,7 +1688,7 @@ and the timeout expired before the operation completed.
|
||||||
.PP
|
.PP
|
||||||
Futexes were first made available in a stable kernel release
|
Futexes were first made available in a stable kernel release
|
||||||
with Linux 2.6.0.
|
with Linux 2.6.0.
|
||||||
|
.PP
|
||||||
Initial futex support was merged in Linux 2.5.7 but with different
|
Initial futex support was merged in Linux 2.5.7 but with different
|
||||||
semantics from what was described above.
|
semantics from what was described above.
|
||||||
A four-argument system call with the semantics
|
A four-argument system call with the semantics
|
||||||
|
@ -1700,7 +1700,7 @@ This system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Glibc does not provide a wrapper for this system call; call it using
|
Glibc does not provide a wrapper for this system call; call it using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
Several higher-level programming abstractions are implemented via futexes,
|
Several higher-level programming abstractions are implemented via futexes,
|
||||||
including POSIX semaphores and
|
including POSIX semaphores and
|
||||||
various POSIX threads synchronization mechanisms
|
various POSIX threads synchronization mechanisms
|
||||||
|
@ -1722,7 +1722,7 @@ The two processes each write
|
||||||
messages to the terminal and employ a synchronization protocol
|
messages to the terminal and employ a synchronization protocol
|
||||||
that ensures that they alternate in writing messages.
|
that ensures that they alternate in writing messages.
|
||||||
Upon running this program we see output such as the following:
|
Upon running this program we see output such as the following:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
$ \fB./futex_demo\fP
|
$ \fB./futex_demo\fP
|
||||||
|
@ -1912,17 +1912,17 @@ Franke, H., Russell, R., and Kirwood, M., 2002.
|
||||||
.br
|
.br
|
||||||
.UR http://kernel.org\:/doc\:/ols\:/2002\:/ols2002\-pages\-479\-495.pdf
|
.UR http://kernel.org\:/doc\:/ols\:/2002\:/ols2002\-pages\-479\-495.pdf
|
||||||
.UE
|
.UE
|
||||||
|
.PP
|
||||||
Hart, D., 2009. \fIA futex overview and update\fP,
|
Hart, D., 2009. \fIA futex overview and update\fP,
|
||||||
.UR http://lwn.net/Articles/360699/
|
.UR http://lwn.net/Articles/360699/
|
||||||
.UE
|
.UE
|
||||||
|
.PP
|
||||||
Hart, D. and Guniguntala, D., 2009.
|
Hart, D. and Guniguntala, D., 2009.
|
||||||
\fIRequeue-PI: Making Glibc Condvars PI-Aware\fP
|
\fIRequeue-PI: Making Glibc Condvars PI-Aware\fP
|
||||||
(from proceedings of the 2009 Real-Time Linux Workshop),
|
(from proceedings of the 2009 Real-Time Linux Workshop),
|
||||||
.UR http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf
|
.UR http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf
|
||||||
.UE
|
.UE
|
||||||
|
.PP
|
||||||
Drepper, U., 2011. \fIFutexes Are Tricky\fP,
|
Drepper, U., 2011. \fIFutexes Are Tricky\fP,
|
||||||
.UR http://www.akkadia.org/drepper/futex.pdf
|
.UR http://www.akkadia.org/drepper/futex.pdf
|
||||||
.UE
|
.UE
|
||||||
|
|
|
@ -47,13 +47,13 @@ This system call is obsolete.
|
||||||
Use
|
Use
|
||||||
.BR utimensat (2)
|
.BR utimensat (2)
|
||||||
instead.
|
instead.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR futimesat ()
|
.BR futimesat ()
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR utimes (2),
|
.BR utimes (2),
|
||||||
except for the differences described in this manual page.
|
except for the differences described in this manual page.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -63,7 +63,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR utimes (2)
|
.BR utimes (2)
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -75,7 +75,7 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR utimes (2)).
|
.BR utimes (2)).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
|
@ -114,7 +114,7 @@ This system call is nonstandard.
|
||||||
It was implemented from a specification that was proposed for POSIX.1,
|
It was implemented from a specification that was proposed for POSIX.1,
|
||||||
but that specification was replaced by the one for
|
but that specification was replaced by the one for
|
||||||
.BR utimensat (2).
|
.BR utimensat (2).
|
||||||
|
.PP
|
||||||
A similar system call exists on Solaris.
|
A similar system call exists on Solaris.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
.SS Glibc notes
|
.SS Glibc notes
|
||||||
|
|
|
@ -22,7 +22,7 @@ No declaration of this system call is provided in glibc headers; see NOTES.
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR Note :
|
.BR Note :
|
||||||
This system call is present only in kernels before Linux 2.6.
|
This system call is present only in kernels before Linux 2.6.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I table
|
.I table
|
||||||
is NULL,
|
is NULL,
|
||||||
|
|
|
@ -42,12 +42,12 @@ Link with \fI\-lnuma\fP.
|
||||||
retrieves the NUMA policy of the calling thread or of a memory address,
|
retrieves the NUMA policy of the calling thread or of a memory address,
|
||||||
depending on the setting of
|
depending on the setting of
|
||||||
.IR flags .
|
.IR flags .
|
||||||
|
.PP
|
||||||
A NUMA machine has different
|
A NUMA machine has different
|
||||||
memory controllers with different distances to specific CPUs.
|
memory controllers with different distances to specific CPUs.
|
||||||
The memory policy defines from which node memory is allocated for
|
The memory policy defines from which node memory is allocated for
|
||||||
the thread.
|
the thread.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
is specified as 0,
|
is specified as 0,
|
||||||
|
@ -69,7 +69,7 @@ When
|
||||||
is 0,
|
is 0,
|
||||||
.I addr
|
.I addr
|
||||||
must be specified as NULL.
|
must be specified as NULL.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
specifies
|
specifies
|
||||||
|
@ -91,7 +91,7 @@ with either
|
||||||
.B MPOL_F_ADDR
|
.B MPOL_F_ADDR
|
||||||
or
|
or
|
||||||
.BR MPOL_F_NODE .
|
.BR MPOL_F_NODE .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
specifies
|
specifies
|
||||||
|
@ -105,7 +105,7 @@ or one of the helper functions described in
|
||||||
.BR numa (3)
|
.BR numa (3)
|
||||||
has been used to establish a policy for the memory range containing
|
has been used to establish a policy for the memory range containing
|
||||||
.IR addr .
|
.IR addr .
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.I mode
|
.I mode
|
||||||
argument is not NULL, then
|
argument is not NULL, then
|
||||||
|
@ -126,7 +126,7 @@ The value specified by
|
||||||
.I maxnode
|
.I maxnode
|
||||||
is always rounded to a multiple of
|
is always rounded to a multiple of
|
||||||
.IR "sizeof(unsigned\ long)*8" .
|
.IR "sizeof(unsigned\ long)*8" .
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
specifies both
|
specifies both
|
||||||
|
@ -143,7 +143,7 @@ If no page has yet been allocated for the specified address,
|
||||||
will allocate a page as if the thread had performed a read
|
will allocate a page as if the thread had performed a read
|
||||||
(load) access to that address, and return the ID of the node
|
(load) access to that address, and return the ID of the node
|
||||||
where that page was allocated.
|
where that page was allocated.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
specifies
|
specifies
|
||||||
|
@ -168,9 +168,9 @@ call with the
|
||||||
flag for read accesses, and in memory ranges mapped with the
|
flag for read accesses, and in memory ranges mapped with the
|
||||||
.B MAP_SHARED
|
.B MAP_SHARED
|
||||||
flag for all accesses.
|
flag for all accesses.
|
||||||
|
.PP
|
||||||
Other flag values are reserved.
|
Other flag values are reserved.
|
||||||
|
.PP
|
||||||
For an overview of the possible policies see
|
For an overview of the possible policies see
|
||||||
.BR set_mempolicy (2).
|
.BR set_mempolicy (2).
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
|
@ -47,7 +47,7 @@ The robust futex implementation needs to maintain per-thread lists of
|
||||||
the robust futexes which are to be unlocked when the thread exits.
|
the robust futexes which are to be unlocked when the thread exits.
|
||||||
These lists are managed in user space; the kernel is notified about only
|
These lists are managed in user space; the kernel is notified about only
|
||||||
the location of the head of the list.
|
the location of the head of the list.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR get_robust_list ()
|
.BR get_robust_list ()
|
||||||
system call returns the head of the robust futex list of the thread
|
system call returns the head of the robust futex list of the thread
|
||||||
|
@ -63,14 +63,14 @@ The size of the object pointed to by
|
||||||
.I **head_ptr
|
.I **head_ptr
|
||||||
is stored in
|
is stored in
|
||||||
.IR len_ptr .
|
.IR len_ptr .
|
||||||
|
.PP
|
||||||
Permission to employ
|
Permission to employ
|
||||||
.BR get_robust_list ()
|
.BR get_robust_list ()
|
||||||
is governed by a ptrace access mode
|
is governed by a ptrace access mode
|
||||||
.B PTRACE_MODE_READ_REALCREDS
|
.B PTRACE_MODE_READ_REALCREDS
|
||||||
check; see
|
check; see
|
||||||
.BR ptrace (2).
|
.BR ptrace (2).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR set_robust_list ()
|
.BR set_robust_list ()
|
||||||
system call requests the kernel to record the head of the list of
|
system call requests the kernel to record the head of the list of
|
||||||
|
@ -126,14 +126,14 @@ These system calls are not needed by normal applications.
|
||||||
No support for them is provided in glibc.
|
No support for them is provided in glibc.
|
||||||
In the unlikely event that you want to call them directly, use
|
In the unlikely event that you want to call them directly, use
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
A thread can have only one robust futex list;
|
A thread can have only one robust futex list;
|
||||||
therefore applications that wish
|
therefore applications that wish
|
||||||
to use this functionality should use the robust mutexes provided by glibc.
|
to use this functionality should use the robust mutexes provided by glibc.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR futex (2)
|
.BR futex (2)
|
||||||
.\" .BR pthread_mutexattr_setrobust_np (3)
|
.\" .BR pthread_mutexattr_setrobust_np (3)
|
||||||
|
.PP
|
||||||
.IR Documentation/robust-futexes.txt
|
.IR Documentation/robust-futexes.txt
|
||||||
and
|
and
|
||||||
.IR Documentation/robust-futex-ABI.txt
|
.IR Documentation/robust-futex-ABI.txt
|
||||||
|
|
|
@ -39,11 +39,11 @@ When either
|
||||||
or
|
or
|
||||||
.I node
|
.I node
|
||||||
is NULL nothing is written to the respective pointer.
|
is NULL nothing is written to the respective pointer.
|
||||||
|
.PP
|
||||||
The third argument to this system call is nowadays unused,
|
The third argument to this system call is nowadays unused,
|
||||||
and should be specified as NULL
|
and should be specified as NULL
|
||||||
unless portability to Linux 2.6.23 or earlier is required (see NOTES).
|
unless portability to Linux 2.6.23 or earlier is required (see NOTES).
|
||||||
|
.PP
|
||||||
The information placed in
|
The information placed in
|
||||||
.I cpu
|
.I cpu
|
||||||
is guaranteed to be current only at the time of the call:
|
is guaranteed to be current only at the time of the call:
|
||||||
|
@ -79,13 +79,13 @@ The intention of
|
||||||
.BR getcpu ()
|
.BR getcpu ()
|
||||||
is to allow programs to make optimizations with per-CPU data
|
is to allow programs to make optimizations with per-CPU data
|
||||||
or for NUMA optimization.
|
or for NUMA optimization.
|
||||||
|
.PP
|
||||||
Glibc does not provide a wrapper for this system call; call it using
|
Glibc does not provide a wrapper for this system call; call it using
|
||||||
.BR syscall (2);
|
.BR syscall (2);
|
||||||
or use
|
or use
|
||||||
.BR sched_getcpu (3)
|
.BR sched_getcpu (3)
|
||||||
instead.
|
instead.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I tcache
|
.I tcache
|
||||||
argument is unused since Linux 2.6.24.
|
argument is unused since Linux 2.6.24.
|
||||||
|
|
|
@ -93,7 +93,7 @@ is the size of this entire
|
||||||
.IR linux_dirent .
|
.IR linux_dirent .
|
||||||
.I d_name
|
.I d_name
|
||||||
is a null-terminated filename.
|
is a null-terminated filename.
|
||||||
|
.PP
|
||||||
.I d_type
|
.I d_type
|
||||||
is a byte at the end of the structure that indicates the file type.
|
is a byte at the end of the structure that indicates the file type.
|
||||||
It contains one of the following values (defined in
|
It contains one of the following values (defined in
|
||||||
|
@ -157,14 +157,14 @@ In addition,
|
||||||
supports an explicit
|
supports an explicit
|
||||||
.I d_type
|
.I d_type
|
||||||
field.
|
field.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR getdents64 ()
|
.BR getdents64 ()
|
||||||
system call is like
|
system call is like
|
||||||
.BR getdents (),
|
.BR getdents (),
|
||||||
except that its second argument is a pointer to a buffer containing
|
except that its second argument is a pointer to a buffer containing
|
||||||
structures of the following type:
|
structures of the following type:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
struct linux_dirent64 {
|
struct linux_dirent64 {
|
||||||
|
@ -213,7 +213,7 @@ structure yourself.
|
||||||
However, you probably want to use
|
However, you probably want to use
|
||||||
.BR readdir (3)
|
.BR readdir (3)
|
||||||
instead.
|
instead.
|
||||||
|
.PP
|
||||||
These calls supersede
|
These calls supersede
|
||||||
.BR readdir (2).
|
.BR readdir (2).
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
@ -223,7 +223,7 @@ The program below demonstrates the use of
|
||||||
.BR getdents ().
|
.BR getdents ().
|
||||||
The following output shows an example of what we see when running this
|
The following output shows an example of what we see when running this
|
||||||
program on an ext2 directory:
|
program on an ext2 directory:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
.RB "$" " ./a.out /testfs/"
|
.RB "$" " ./a.out /testfs/"
|
||||||
|
|
|
@ -57,7 +57,7 @@ Feature Test Macro Requirements for glibc (see
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These functions are used to access or to change the NIS domain name of the
|
These functions are used to access or to change the NIS domain name of the
|
||||||
host system.
|
host system.
|
||||||
|
.PP
|
||||||
.BR setdomainname ()
|
.BR setdomainname ()
|
||||||
sets the domain name to the value given in the character array
|
sets the domain name to the value given in the character array
|
||||||
.IR name .
|
.IR name .
|
||||||
|
@ -68,7 +68,7 @@ argument specifies the number of bytes in
|
||||||
(Thus,
|
(Thus,
|
||||||
.I name
|
.I name
|
||||||
does not require a terminating null byte.)
|
does not require a terminating null byte.)
|
||||||
|
.PP
|
||||||
.BR getdomainname ()
|
.BR getdomainname ()
|
||||||
returns the null-terminated domain name in the character array
|
returns the null-terminated domain name in the character array
|
||||||
.IR name ,
|
.IR name ,
|
||||||
|
@ -121,7 +121,7 @@ POSIX does not specify these calls.
|
||||||
Since Linux 1.0, the limit on the length of a domain name,
|
Since Linux 1.0, the limit on the length of a domain name,
|
||||||
including the terminating null byte, is 64 bytes.
|
including the terminating null byte, is 64 bytes.
|
||||||
In older kernels, it was 8 bytes.
|
In older kernels, it was 8 bytes.
|
||||||
|
.PP
|
||||||
On most Linux architectures (including x86),
|
On most Linux architectures (including x86),
|
||||||
there is no
|
there is no
|
||||||
.BR getdomainname ()
|
.BR getdomainname ()
|
||||||
|
|
|
@ -36,7 +36,7 @@ getgid, getegid \- get group identity
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR getgid ()
|
.BR getgid ()
|
||||||
returns the real group ID of the calling process.
|
returns the real group ID of the calling process.
|
||||||
|
.PP
|
||||||
.BR getegid ()
|
.BR getegid ()
|
||||||
returns the effective group ID of the calling process.
|
returns the effective group ID of the calling process.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
|
|
|
@ -71,7 +71,7 @@ is included in the returned list.
|
||||||
(Thus, an application should also call
|
(Thus, an application should also call
|
||||||
.BR getegid (2)
|
.BR getegid (2)
|
||||||
and add or remove the resulting value.)
|
and add or remove the resulting value.)
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I size
|
.I size
|
||||||
is zero,
|
is zero,
|
||||||
|
@ -100,7 +100,7 @@ returns the number of supplementary group IDs.
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
|
.PP
|
||||||
On success,
|
On success,
|
||||||
.BR setgroups ()
|
.BR setgroups ()
|
||||||
returns 0.
|
returns 0.
|
||||||
|
@ -166,7 +166,7 @@ is defined in
|
||||||
The set of supplementary group IDs
|
The set of supplementary group IDs
|
||||||
is inherited from the parent process, and preserved across an
|
is inherited from the parent process, and preserved across an
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
The maximum number of supplementary group IDs can be found at run time using
|
The maximum number of supplementary group IDs can be found at run time using
|
||||||
.BR sysconf (3):
|
.BR sysconf (3):
|
||||||
.nf
|
.nf
|
||||||
|
@ -181,7 +181,7 @@ cannot be larger than one more than this value.
|
||||||
Since Linux 2.6.4, the maximum number of supplementary group IDs is also
|
Since Linux 2.6.4, the maximum number of supplementary group IDs is also
|
||||||
exposed via the Linux-specific read-only file,
|
exposed via the Linux-specific read-only file,
|
||||||
.IR /proc/sys/kernel/ngroups_max .
|
.IR /proc/sys/kernel/ngroups_max .
|
||||||
|
.PP
|
||||||
The original Linux
|
The original Linux
|
||||||
.BR getgroups ()
|
.BR getgroups ()
|
||||||
system call supported only 16-bit group IDs.
|
system call supported only 16-bit group IDs.
|
||||||
|
|
|
@ -69,7 +69,7 @@ _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These system calls are used to access or to change the hostname of the
|
These system calls are used to access or to change the hostname of the
|
||||||
current processor.
|
current processor.
|
||||||
|
.PP
|
||||||
.BR sethostname ()
|
.BR sethostname ()
|
||||||
sets the hostname to the value given in the character array
|
sets the hostname to the value given in the character array
|
||||||
.IR name .
|
.IR name .
|
||||||
|
@ -80,7 +80,7 @@ argument specifies the number of bytes in
|
||||||
(Thus,
|
(Thus,
|
||||||
.I name
|
.I name
|
||||||
does not require a terminating null byte.)
|
does not require a terminating null byte.)
|
||||||
|
.PP
|
||||||
.BR gethostname ()
|
.BR gethostname ()
|
||||||
returns the null-terminated hostname in the character array
|
returns the null-terminated hostname in the character array
|
||||||
.IR name ,
|
.IR name ,
|
||||||
|
@ -167,7 +167,7 @@ set to
|
||||||
.BR ENAMETOOLONG ;
|
.BR ENAMETOOLONG ;
|
||||||
in this case, a terminating null byte is not included in the returned
|
in this case, a terminating null byte is not included in the returned
|
||||||
.IR name .
|
.IR name .
|
||||||
|
.PP
|
||||||
Versions of glibc before 2.2
|
Versions of glibc before 2.2
|
||||||
.\" At least glibc 2.0 and 2.1, older versions not checked
|
.\" At least glibc 2.0 and 2.1, older versions not checked
|
||||||
handle the case where the length of the
|
handle the case where the length of the
|
||||||
|
|
|
@ -29,7 +29,7 @@ and (optionally) at regular intervals after that.
|
||||||
When a timer expires, a signal is generated for the calling process,
|
When a timer expires, a signal is generated for the calling process,
|
||||||
and the timer is reset to the specified interval
|
and the timer is reset to the specified interval
|
||||||
(if the interval is nonzero).
|
(if the interval is nonzero).
|
||||||
|
.PP
|
||||||
Three types of timers\(emspecified via the
|
Three types of timers\(emspecified via the
|
||||||
.IR which
|
.IR which
|
||||||
argument\(emare provided,
|
argument\(emare provided,
|
||||||
|
@ -56,14 +56,14 @@ CPU time consumed by the process.
|
||||||
At each expiration, a
|
At each expiration, a
|
||||||
.B SIGPROF
|
.B SIGPROF
|
||||||
signal is generated.
|
signal is generated.
|
||||||
|
.IP
|
||||||
In conjunction with
|
In conjunction with
|
||||||
.BR ITIMER_VIRTUAL ,
|
.BR ITIMER_VIRTUAL ,
|
||||||
this timer can be used to profile user and system CPU time
|
this timer can be used to profile user and system CPU time
|
||||||
consumed by the process.
|
consumed by the process.
|
||||||
.LP
|
.LP
|
||||||
A process has only one of each of the three types of timers.
|
A process has only one of each of the three types of timers.
|
||||||
|
.PP
|
||||||
Timer values are defined by the following structures:
|
Timer values are defined by the following structures:
|
||||||
.PD 0
|
.PD 0
|
||||||
.in +4n
|
.in +4n
|
||||||
|
@ -88,7 +88,7 @@ places the current value of the timer specified by
|
||||||
.IR which
|
.IR which
|
||||||
in the buffer pointed to by
|
in the buffer pointed to by
|
||||||
.IR curr_value .
|
.IR curr_value .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.IR it_value
|
.IR it_value
|
||||||
substructure is populated with the amount of time remaining until
|
substructure is populated with the amount of time remaining until
|
||||||
|
@ -99,7 +99,7 @@ when the timer expires.
|
||||||
If both fields of
|
If both fields of
|
||||||
.IR it_value
|
.IR it_value
|
||||||
are zero, then this timer is currently disarmed (inactive).
|
are zero, then this timer is currently disarmed (inactive).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.IR it_interval
|
.IR it_interval
|
||||||
substructure is populated with the timer interval.
|
substructure is populated with the timer interval.
|
||||||
|
@ -119,7 +119,7 @@ is non-NULL,
|
||||||
the buffer it points to is used to return the previous value of the timer
|
the buffer it points to is used to return the previous value of the timer
|
||||||
(i.e., the same information that is returned by
|
(i.e., the same information that is returned by
|
||||||
.BR getitimer ()).
|
.BR getitimer ()).
|
||||||
|
.PP
|
||||||
If either field in
|
If either field in
|
||||||
.IR new_value.it_value
|
.IR new_value.it_value
|
||||||
is nonzero,
|
is nonzero,
|
||||||
|
@ -127,7 +127,7 @@ then the timer is armed to initially expire at the specified time.
|
||||||
If both fields in
|
If both fields in
|
||||||
.IR new_value.it_value
|
.IR new_value.it_value
|
||||||
are zero, then the timer is disarmed.
|
are zero, then the timer is disarmed.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.IR new_value.it_interval
|
.IR new_value.it_interval
|
||||||
field specifies the new interval for the timer;
|
field specifies the new interval for the timer;
|
||||||
|
@ -177,13 +177,13 @@ on the system timer resolution and on the system load; see
|
||||||
If the timer expires while the process is active (always true for
|
If the timer expires while the process is active (always true for
|
||||||
.BR ITIMER_VIRTUAL ),
|
.BR ITIMER_VIRTUAL ),
|
||||||
the signal will be delivered immediately when generated.
|
the signal will be delivered immediately when generated.
|
||||||
|
.PP
|
||||||
A child created via
|
A child created via
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
does not inherit its parent's interval timers.
|
does not inherit its parent's interval timers.
|
||||||
Interval timers are preserved across an
|
Interval timers are preserved across an
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
POSIX.1 leaves the
|
POSIX.1 leaves the
|
||||||
interaction between
|
interaction between
|
||||||
.BR setitimer ()
|
.BR setitimer ()
|
||||||
|
@ -193,16 +193,16 @@ and the three interfaces
|
||||||
and
|
and
|
||||||
.BR usleep (3)
|
.BR usleep (3)
|
||||||
unspecified.
|
unspecified.
|
||||||
|
.PP
|
||||||
The standards are silent on the meaning of the call:
|
The standards are silent on the meaning of the call:
|
||||||
|
.PP
|
||||||
setitimer(which, NULL, &old_value);
|
setitimer(which, NULL, &old_value);
|
||||||
|
.PP
|
||||||
Many systems (Solaris, the BSDs, and perhaps others)
|
Many systems (Solaris, the BSDs, and perhaps others)
|
||||||
treat this as equivalent to:
|
treat this as equivalent to:
|
||||||
|
.PP
|
||||||
getitimer(which, &old_value);
|
getitimer(which, &old_value);
|
||||||
|
.PP
|
||||||
In Linux, this is treated as being equivalent to a call in which the
|
In Linux, this is treated as being equivalent to a call in which the
|
||||||
.I new_value
|
.I new_value
|
||||||
fields are zero; that is, the timer is disabled.
|
fields are zero; that is, the timer is disabled.
|
||||||
|
@ -217,7 +217,7 @@ Under very heavy loading, an
|
||||||
timer may expire before the signal from a previous expiration
|
timer may expire before the signal from a previous expiration
|
||||||
has been delivered.
|
has been delivered.
|
||||||
The second signal in such an event will be lost.
|
The second signal in such an event will be lost.
|
||||||
|
.PP
|
||||||
On Linux kernels before 2.6.16, timer values are represented in jiffies.
|
On Linux kernels before 2.6.16, timer values are represented in jiffies.
|
||||||
If a request is made set a timer with a value whose jiffies
|
If a request is made set a timer with a value whose jiffies
|
||||||
representation exceeds
|
representation exceeds
|
||||||
|
@ -232,14 +232,14 @@ approximately 99.42 days.
|
||||||
Since Linux 2.6.16,
|
Since Linux 2.6.16,
|
||||||
the kernel uses a different internal representation for times,
|
the kernel uses a different internal representation for times,
|
||||||
and this ceiling is removed.
|
and this ceiling is removed.
|
||||||
|
.PP
|
||||||
On certain systems (including i386),
|
On certain systems (including i386),
|
||||||
Linux kernels before version 2.6.12 have a bug which will produce
|
Linux kernels before version 2.6.12 have a bug which will produce
|
||||||
premature timer expirations of up to one jiffy under some circumstances.
|
premature timer expirations of up to one jiffy under some circumstances.
|
||||||
This bug is fixed in kernel 2.6.12.
|
This bug is fixed in kernel 2.6.12.
|
||||||
.\" 4 Jul 2005: It looks like this bug may remain in 2.4.x.
|
.\" 4 Jul 2005: It looks like this bug may remain in 2.4.x.
|
||||||
.\" http://lkml.org/lkml/2005/7/1/165
|
.\" http://lkml.org/lkml/2005/7/1/165
|
||||||
|
.PP
|
||||||
POSIX.1-2001 says that
|
POSIX.1-2001 says that
|
||||||
.BR setitimer ()
|
.BR setitimer ()
|
||||||
should fail if a
|
should fail if a
|
||||||
|
|
|
@ -84,12 +84,12 @@ instead of
|
||||||
long sz = sysconf(_SC_PAGESIZE);
|
long sz = sysconf(_SC_PAGESIZE);
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
(Most systems allow the synonym
|
(Most systems allow the synonym
|
||||||
.B _SC_PAGE_SIZE
|
.B _SC_PAGE_SIZE
|
||||||
for
|
for
|
||||||
.BR _SC_PAGESIZE .)
|
.BR _SC_PAGESIZE .)
|
||||||
|
.PP
|
||||||
Whether
|
Whether
|
||||||
.BR getpagesize ()
|
.BR getpagesize ()
|
||||||
is present as a Linux system call depends on the architecture.
|
is present as a Linux system call depends on the architecture.
|
||||||
|
|
|
@ -60,7 +60,7 @@ by
|
||||||
.IR addr .
|
.IR addr .
|
||||||
On return it contains the actual size of the name returned (in bytes).
|
On return it contains the actual size of the name returned (in bytes).
|
||||||
The name is truncated if the buffer provided is too small.
|
The name is truncated if the buffer provided is too small.
|
||||||
|
.PP
|
||||||
The returned address is truncated if the buffer provided is too small;
|
The returned address is truncated if the buffer provided is too small;
|
||||||
in this case,
|
in this case,
|
||||||
.I addrlen
|
.I addrlen
|
||||||
|
@ -107,7 +107,7 @@ For background on the
|
||||||
.I socklen_t
|
.I socklen_t
|
||||||
type, see
|
type, see
|
||||||
.BR accept (2).
|
.BR accept (2).
|
||||||
|
.PP
|
||||||
For stream sockets, once a
|
For stream sockets, once a
|
||||||
.BR connect (2)
|
.BR connect (2)
|
||||||
has been performed, either socket can call
|
has been performed, either socket can call
|
||||||
|
|
|
@ -67,7 +67,7 @@ call.
|
||||||
The process attribute dealt with by these system calls is
|
The process attribute dealt with by these system calls is
|
||||||
the same attribute (also known as the "nice" value) that is dealt with by
|
the same attribute (also known as the "nice" value) that is dealt with by
|
||||||
.BR nice (2).
|
.BR nice (2).
|
||||||
|
.PP
|
||||||
The value
|
The value
|
||||||
.I which
|
.I which
|
||||||
is one of
|
is one of
|
||||||
|
@ -90,7 +90,7 @@ A zero value for
|
||||||
.I who
|
.I who
|
||||||
denotes (respectively) the calling process, the process group of the
|
denotes (respectively) the calling process, the process group of the
|
||||||
calling process, or the real user ID of the calling process.
|
calling process, or the real user ID of the calling process.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I prio
|
.I prio
|
||||||
argument is a value in the range \-20 to 19 (but see NOTES below).
|
argument is a value in the range \-20 to 19 (but see NOTES below).
|
||||||
|
@ -99,7 +99,7 @@ Attempts to set a priority outside this range
|
||||||
are silently clamped to the range.
|
are silently clamped to the range.
|
||||||
The default priority is 0;
|
The default priority is 0;
|
||||||
lower values give a process a higher scheduling priority.
|
lower values give a process a higher scheduling priority.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR getpriority ()
|
.BR getpriority ()
|
||||||
call returns the highest priority (lowest numerical value)
|
call returns the highest priority (lowest numerical value)
|
||||||
|
@ -108,7 +108,7 @@ The
|
||||||
.BR setpriority ()
|
.BR setpriority ()
|
||||||
call sets the priorities of all of the specified processes
|
call sets the priorities of all of the specified processes
|
||||||
to the specified value.
|
to the specified value.
|
||||||
|
.PP
|
||||||
Traditionally, only a privileged process could lower the nice value
|
Traditionally, only a privileged process could lower the nice value
|
||||||
(i.e., set a higher priority).
|
(i.e., set a higher priority).
|
||||||
However, since Linux 2.6.12, an unprivileged process can decrease
|
However, since Linux 2.6.12, an unprivileged process can decrease
|
||||||
|
@ -132,7 +132,7 @@ to clear the external variable
|
||||||
prior to the
|
prior to the
|
||||||
call, then check it afterward to determine
|
call, then check it afterward to determine
|
||||||
if \-1 is an error or a legitimate value.
|
if \-1 is an error or a legitimate value.
|
||||||
|
.PP
|
||||||
.BR setpriority ()
|
.BR setpriority ()
|
||||||
returns 0 on success.
|
returns 0 on success.
|
||||||
On error, it returns \-1 and sets
|
On error, it returns \-1 and sets
|
||||||
|
@ -179,19 +179,19 @@ SVr4, 4.4BSD (these interfaces first appeared in 4.2BSD).
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
For further details on the nice value, see
|
For further details on the nice value, see
|
||||||
.BR sched (7).
|
.BR sched (7).
|
||||||
|
.PP
|
||||||
.IR Note :
|
.IR Note :
|
||||||
the addition of the "autogroup" feature in Linux 2.6.38 means that
|
the addition of the "autogroup" feature in Linux 2.6.38 means that
|
||||||
the nice value no longer has its traditional effect in many circumstances.
|
the nice value no longer has its traditional effect in many circumstances.
|
||||||
For details, see
|
For details, see
|
||||||
.BR sched (7).
|
.BR sched (7).
|
||||||
|
.PP
|
||||||
A child created by
|
A child created by
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
inherits its parent's nice value.
|
inherits its parent's nice value.
|
||||||
The nice value is preserved across
|
The nice value is preserved across
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
The details on the condition for
|
The details on the condition for
|
||||||
.B EPERM
|
.B EPERM
|
||||||
depend on the system.
|
depend on the system.
|
||||||
|
@ -206,7 +206,7 @@ the real or effective user ID of the process \fIwho\fP.
|
||||||
All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
|
All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
|
||||||
4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same
|
4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same
|
||||||
manner as Linux 2.6.12 and later.
|
manner as Linux 2.6.12 and later.
|
||||||
|
.PP
|
||||||
Including
|
Including
|
||||||
.I <sys/time.h>
|
.I <sys/time.h>
|
||||||
is not required these days, but increases portability.
|
is not required these days, but increases portability.
|
||||||
|
@ -247,6 +247,6 @@ which may be made standards conformant in the future.
|
||||||
.BR fork (2),
|
.BR fork (2),
|
||||||
.BR capabilities (7),
|
.BR capabilities (7),
|
||||||
.BR sched (7)
|
.BR sched (7)
|
||||||
|
.PP
|
||||||
.I Documentation/scheduler/sched-nice-design.txt
|
.I Documentation/scheduler/sched-nice-design.txt
|
||||||
in the Linux kernel source tree (since Linux 2.6.23)
|
in the Linux kernel source tree (since Linux 2.6.23)
|
||||||
|
|
|
@ -41,7 +41,7 @@ with up to
|
||||||
random bytes.
|
random bytes.
|
||||||
These bytes can be used to seed user-space random number generators
|
These bytes can be used to seed user-space random number generators
|
||||||
or for cryptographic purposes.
|
or for cryptographic purposes.
|
||||||
|
.PP
|
||||||
By default,
|
By default,
|
||||||
.BR getrandom ()
|
.BR getrandom ()
|
||||||
draws entropy from the
|
draws entropy from the
|
||||||
|
@ -52,7 +52,7 @@ device).
|
||||||
This behavior can be changed via the
|
This behavior can be changed via the
|
||||||
.I flags
|
.I flags
|
||||||
argument.
|
argument.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.I urandom
|
.I urandom
|
||||||
source has been initialized,
|
source has been initialized,
|
||||||
|
@ -62,7 +62,7 @@ No such guarantees apply for larger buffer sizes.
|
||||||
For example, if the call is interrupted by a signal handler,
|
For example, if the call is interrupted by a signal handler,
|
||||||
it may return a partially filled buffer, or fail with the error
|
it may return a partially filled buffer, or fail with the error
|
||||||
.BR EINTR .
|
.BR EINTR .
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.I urandom
|
.I urandom
|
||||||
source has not yet been initialized, then
|
source has not yet been initialized, then
|
||||||
|
@ -71,7 +71,7 @@ will block, unless
|
||||||
.B GRND_NONBLOCK
|
.B GRND_NONBLOCK
|
||||||
is specified in
|
is specified in
|
||||||
.IR flags .
|
.IR flags .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument is a bit mask that can contain zero or more of the following values
|
argument is a bit mask that can contain zero or more of the following values
|
||||||
|
@ -174,7 +174,7 @@ This system call is Linux-specific.
|
||||||
For an overview and comparison of the various interfaces that
|
For an overview and comparison of the various interfaces that
|
||||||
can be used to obtain randomness, see
|
can be used to obtain randomness, see
|
||||||
.BR random (7).
|
.BR random (7).
|
||||||
|
.PP
|
||||||
Unlike
|
Unlike
|
||||||
.IR /dev/random
|
.IR /dev/random
|
||||||
and
|
and
|
||||||
|
@ -232,7 +232,7 @@ will block until some random bytes become available
|
||||||
(unless the
|
(unless the
|
||||||
.BR GRND_NONBLOCK
|
.BR GRND_NONBLOCK
|
||||||
flag was specified).
|
flag was specified).
|
||||||
|
.PP
|
||||||
The behavior when a call to
|
The behavior when a call to
|
||||||
.BR getrandom ()
|
.BR getrandom ()
|
||||||
that is blocked while reading from the
|
that is blocked while reading from the
|
||||||
|
@ -257,19 +257,19 @@ then
|
||||||
will not fail with
|
will not fail with
|
||||||
.BR EINTR .
|
.BR EINTR .
|
||||||
Instead, it will return all of the bytes that have been requested.
|
Instead, it will return all of the bytes that have been requested.
|
||||||
|
.PP
|
||||||
When reading from the
|
When reading from the
|
||||||
.IR random
|
.IR random
|
||||||
source, blocking requests of any size can be interrupted by a signal handler
|
source, blocking requests of any size can be interrupted by a signal handler
|
||||||
(the call fails with the error
|
(the call fails with the error
|
||||||
.BR EINTR ).
|
.BR EINTR ).
|
||||||
|
.PP
|
||||||
Using
|
Using
|
||||||
.BR getrandom ()
|
.BR getrandom ()
|
||||||
to read small buffers (<=\ 256 bytes) from the
|
to read small buffers (<=\ 256 bytes) from the
|
||||||
.I urandom
|
.I urandom
|
||||||
source is the preferred mode of usage.
|
source is the preferred mode of usage.
|
||||||
|
.PP
|
||||||
The special treatment of small values of
|
The special treatment of small values of
|
||||||
.I buflen
|
.I buflen
|
||||||
was designed for compatibility with
|
was designed for compatibility with
|
||||||
|
|
|
@ -59,7 +59,7 @@ One of the arguments specified an address outside the calling program's
|
||||||
address space.
|
address space.
|
||||||
.SH VERSIONS
|
.SH VERSIONS
|
||||||
These system calls appeared on Linux starting with kernel 2.1.44.
|
These system calls appeared on Linux starting with kernel 2.1.44.
|
||||||
|
.PP
|
||||||
The prototypes are given by glibc since version 2.3.2,
|
The prototypes are given by glibc since version 2.3.2,
|
||||||
provided
|
provided
|
||||||
.B _GNU_SOURCE
|
.B _GNU_SOURCE
|
||||||
|
|
|
@ -237,7 +237,7 @@ and
|
||||||
.BR MAP_LOCKED ;
|
.BR MAP_LOCKED ;
|
||||||
a process can lock bytes up to this limit in each of these
|
a process can lock bytes up to this limit in each of these
|
||||||
two categories.
|
two categories.
|
||||||
|
.IP
|
||||||
In Linux kernels before 2.6.9, this limit controlled the amount of
|
In Linux kernels before 2.6.9, this limit controlled the amount of
|
||||||
memory that could be locked by a privileged process.
|
memory that could be locked by a privileged process.
|
||||||
Since Linux 2.6.9, no limits are placed on the amount of memory
|
Since Linux 2.6.9, no limits are placed on the amount of memory
|
||||||
|
@ -281,7 +281,7 @@ and the
|
||||||
and
|
and
|
||||||
.I posix_msg_tree_node
|
.I posix_msg_tree_node
|
||||||
structures are kernel-internal structures.
|
structures are kernel-internal structures.
|
||||||
|
.IP
|
||||||
The "overhead" addend in the formula accounts for overhead
|
The "overhead" addend in the formula accounts for overhead
|
||||||
bytes required by the implementation
|
bytes required by the implementation
|
||||||
and ensures that the user cannot
|
and ensures that the user cannot
|
||||||
|
@ -320,7 +320,7 @@ to exceed this limit yield the error
|
||||||
(Historically, this limit was named
|
(Historically, this limit was named
|
||||||
.B RLIMIT_OFILE
|
.B RLIMIT_OFILE
|
||||||
on BSD.)
|
on BSD.)
|
||||||
|
.IP
|
||||||
Since Linux 4.5,
|
Since Linux 4.5,
|
||||||
this limit also defines the maximum number of file descriptors that
|
this limit also defines the maximum number of file descriptors that
|
||||||
an unprivileged process (one without the
|
an unprivileged process (one without the
|
||||||
|
@ -365,7 +365,7 @@ this process using
|
||||||
.BR sched_setscheduler (2)
|
.BR sched_setscheduler (2)
|
||||||
and
|
and
|
||||||
.BR sched_setparam (2).
|
.BR sched_setparam (2).
|
||||||
|
.IP
|
||||||
For further details on real-time scheduling policies, see
|
For further details on real-time scheduling policies, see
|
||||||
.BR sched (7)
|
.BR sched (7)
|
||||||
.TP
|
.TP
|
||||||
|
@ -380,7 +380,7 @@ the count of its consumed CPU time is reset to zero.
|
||||||
The CPU time count is not reset if the process continues trying to
|
The CPU time count is not reset if the process continues trying to
|
||||||
use the CPU but is preempted, its time slice expires, or it calls
|
use the CPU but is preempted, its time slice expires, or it calls
|
||||||
.BR sched_yield (2).
|
.BR sched_yield (2).
|
||||||
|
.IP
|
||||||
Upon reaching the soft limit, the process is sent a
|
Upon reaching the soft limit, the process is sent a
|
||||||
.B SIGXCPU
|
.B SIGXCPU
|
||||||
signal.
|
signal.
|
||||||
|
@ -391,10 +391,10 @@ will be generated once each second until the hard limit is reached,
|
||||||
at which point the process is sent a
|
at which point the process is sent a
|
||||||
.B SIGKILL
|
.B SIGKILL
|
||||||
signal.
|
signal.
|
||||||
|
.IP
|
||||||
The intended use of this limit is to stop a runaway
|
The intended use of this limit is to stop a runaway
|
||||||
real-time process from locking up the system.
|
real-time process from locking up the system.
|
||||||
|
.IP
|
||||||
For further details on real-time scheduling policies, see
|
For further details on real-time scheduling policies, see
|
||||||
.BR sched (7)
|
.BR sched (7)
|
||||||
.TP
|
.TP
|
||||||
|
@ -419,7 +419,7 @@ Upon reaching this limit, a
|
||||||
signal is generated.
|
signal is generated.
|
||||||
To handle this signal, a process must employ an alternate signal stack
|
To handle this signal, a process must employ an alternate signal stack
|
||||||
.RB ( sigaltstack (2)).
|
.RB ( sigaltstack (2)).
|
||||||
|
.IP
|
||||||
Since Linux 2.6.23,
|
Since Linux 2.6.23,
|
||||||
this limit also determines the amount of space used for the process's
|
this limit also determines the amount of space used for the process's
|
||||||
command-line arguments and environment variables; for details, see
|
command-line arguments and environment variables; for details, see
|
||||||
|
@ -444,14 +444,14 @@ system call combines and extends the functionality of
|
||||||
and
|
and
|
||||||
.BR getrlimit ().
|
.BR getrlimit ().
|
||||||
It can be used to both set and get the resource limits of an arbitrary process.
|
It can be used to both set and get the resource limits of an arbitrary process.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I resource
|
.I resource
|
||||||
argument has the same meaning as for
|
argument has the same meaning as for
|
||||||
.BR setrlimit ()
|
.BR setrlimit ()
|
||||||
and
|
and
|
||||||
.BR getrlimit ().
|
.BR getrlimit ().
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.IR new_limit
|
.IR new_limit
|
||||||
argument is a not NULL, then the
|
argument is a not NULL, then the
|
||||||
|
@ -469,7 +469,7 @@ in the
|
||||||
.I rlimit
|
.I rlimit
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.IR old_limit .
|
.IR old_limit .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I pid
|
.I pid
|
||||||
argument specifies the ID of the process on which the call is to operate.
|
argument specifies the ID of the process on which the call is to operate.
|
||||||
|
@ -553,7 +553,7 @@ T{
|
||||||
.BR prlimit ()
|
.BR prlimit ()
|
||||||
T} Thread safety MT-Safe
|
T} Thread safety MT-Safe
|
||||||
.TE
|
.TE
|
||||||
|
.sp 1
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
.BR getrlimit (),
|
.BR getrlimit (),
|
||||||
.BR setrlimit ():
|
.BR setrlimit ():
|
||||||
|
@ -561,7 +561,7 @@ POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
||||||
.br
|
.br
|
||||||
.BR prlimit ():
|
.BR prlimit ():
|
||||||
Linux-specific.
|
Linux-specific.
|
||||||
|
.PP
|
||||||
.B RLIMIT_MEMLOCK
|
.B RLIMIT_MEMLOCK
|
||||||
and
|
and
|
||||||
.B RLIMIT_NPROC
|
.B RLIMIT_NPROC
|
||||||
|
@ -583,12 +583,12 @@ A child process created via
|
||||||
inherits its parent's resource limits.
|
inherits its parent's resource limits.
|
||||||
Resource limits are preserved across
|
Resource limits are preserved across
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
Lowering the soft limit for a resource below the process's
|
Lowering the soft limit for a resource below the process's
|
||||||
current consumption of that resource will succeed
|
current consumption of that resource will succeed
|
||||||
(but will prevent the process from further increasing
|
(but will prevent the process from further increasing
|
||||||
its consumption of the resource).
|
its consumption of the resource).
|
||||||
|
.PP
|
||||||
One can set the resource limits of the shell using the built-in
|
One can set the resource limits of the shell using the built-in
|
||||||
.IR ulimit
|
.IR ulimit
|
||||||
command
|
command
|
||||||
|
@ -597,12 +597,12 @@ in
|
||||||
.BR csh (1)).
|
.BR csh (1)).
|
||||||
The shell's resource limits are inherited by the processes that
|
The shell's resource limits are inherited by the processes that
|
||||||
it creates to execute commands.
|
it creates to execute commands.
|
||||||
|
.PP
|
||||||
Since Linux 2.6.24, the resource limits of any process can be inspected via
|
Since Linux 2.6.24, the resource limits of any process can be inspected via
|
||||||
.IR /proc/[pid]/limits ;
|
.IR /proc/[pid]/limits ;
|
||||||
see
|
see
|
||||||
.BR proc (5).
|
.BR proc (5).
|
||||||
|
.PP
|
||||||
Ancient systems provided a
|
Ancient systems provided a
|
||||||
.BR vlimit ()
|
.BR vlimit ()
|
||||||
function with a similar purpose to
|
function with a similar purpose to
|
||||||
|
@ -620,7 +620,7 @@ wrapper functions no longer invoke the corresponding system calls,
|
||||||
but instead employ
|
but instead employ
|
||||||
.BR prlimit (),
|
.BR prlimit (),
|
||||||
for the reasons described in BUGS.
|
for the reasons described in BUGS.
|
||||||
|
.PP
|
||||||
The name of the glibc wrapper function is
|
The name of the glibc wrapper function is
|
||||||
.BR prlimit ();
|
.BR prlimit ();
|
||||||
the underlying system call is
|
the underlying system call is
|
||||||
|
@ -634,7 +634,7 @@ signals delivered when a process encountered the soft and hard
|
||||||
.B RLIMIT_CPU
|
.B RLIMIT_CPU
|
||||||
limits were delivered one (CPU) second later than they should have been.
|
limits were delivered one (CPU) second later than they should have been.
|
||||||
This was fixed in kernel 2.6.8.
|
This was fixed in kernel 2.6.8.
|
||||||
|
.PP
|
||||||
In 2.6.x kernels before 2.6.17, a
|
In 2.6.x kernels before 2.6.17, a
|
||||||
.B RLIMIT_CPU
|
.B RLIMIT_CPU
|
||||||
limit of 0 is wrongly treated as "no limit" (like
|
limit of 0 is wrongly treated as "no limit" (like
|
||||||
|
@ -642,12 +642,12 @@ limit of 0 is wrongly treated as "no limit" (like
|
||||||
Since Linux 2.6.17, setting a limit of 0 does have an effect,
|
Since Linux 2.6.17, setting a limit of 0 does have an effect,
|
||||||
but is actually treated as a limit of 1 second.
|
but is actually treated as a limit of 1 second.
|
||||||
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
|
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
|
||||||
|
.PP
|
||||||
A kernel bug means that
|
A kernel bug means that
|
||||||
.\" See https://lwn.net/Articles/145008/
|
.\" See https://lwn.net/Articles/145008/
|
||||||
.B RLIMIT_RTPRIO
|
.B RLIMIT_RTPRIO
|
||||||
does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13.
|
does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13.
|
||||||
|
.PP
|
||||||
In kernel 2.6.12, there was an off-by-one mismatch
|
In kernel 2.6.12, there was an off-by-one mismatch
|
||||||
between the priority ranges returned by
|
between the priority ranges returned by
|
||||||
.BR getpriority (2)
|
.BR getpriority (2)
|
||||||
|
@ -658,7 +658,7 @@ was calculated as
|
||||||
.IR "19\ \-\ rlim_cur" .
|
.IR "19\ \-\ rlim_cur" .
|
||||||
This was fixed in kernel 2.6.13.
|
This was fixed in kernel 2.6.13.
|
||||||
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
|
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
|
||||||
|
.PP
|
||||||
Since Linux 2.6.12,
|
Since Linux 2.6.12,
|
||||||
.\" The relevant patch, sent to LKML, seems to be
|
.\" The relevant patch, sent to LKML, seems to be
|
||||||
.\" http://thread.gmane.org/gmane.linux.kernel/273462
|
.\" http://thread.gmane.org/gmane.linux.kernel/273462
|
||||||
|
@ -685,7 +685,7 @@ portable applications should avoid relying on this Linux-specific behavior.
|
||||||
The Linux-specific
|
The Linux-specific
|
||||||
.BR RLIMIT_RTTIME
|
.BR RLIMIT_RTTIME
|
||||||
limit exhibits the same behavior when the soft limit is encountered.
|
limit exhibits the same behavior when the soft limit is encountered.
|
||||||
|
.PP
|
||||||
Kernels before 2.4.22 did not diagnose the error
|
Kernels before 2.4.22 did not diagnose the error
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
for
|
for
|
||||||
|
@ -726,7 +726,7 @@ represent file offsets\(emthat is, as wide as a 64-bit
|
||||||
.BR off_t
|
.BR off_t
|
||||||
(assuming a program compiled with
|
(assuming a program compiled with
|
||||||
.IR _FILE_OFFSET_BITS=64 ).
|
.IR _FILE_OFFSET_BITS=64 ).
|
||||||
|
.PP
|
||||||
To work around this kernel limitation,
|
To work around this kernel limitation,
|
||||||
if a program tried to set a resource limit to a value larger than
|
if a program tried to set a resource limit to a value larger than
|
||||||
can be represented in a 32-bit
|
can be represented in a 32-bit
|
||||||
|
@ -736,7 +736,7 @@ then the glibc
|
||||||
wrapper function silently converted the limit value to
|
wrapper function silently converted the limit value to
|
||||||
.BR RLIM_INFINITY .
|
.BR RLIM_INFINITY .
|
||||||
In other words, the requested resource limit setting was silently ignored.
|
In other words, the requested resource limit setting was silently ignored.
|
||||||
|
.PP
|
||||||
This problem was addressed in Linux 2.6.36 with two principal changes:
|
This problem was addressed in Linux 2.6.36 with two principal changes:
|
||||||
.IP * 3
|
.IP * 3
|
||||||
the addition of a new kernel representation of resource limits that
|
the addition of a new kernel representation of resource limits that
|
||||||
|
|
|
@ -211,7 +211,7 @@ T{
|
||||||
.BR getrusage ()
|
.BR getrusage ()
|
||||||
T} Thread safety MT-Safe
|
T} Thread safety MT-Safe
|
||||||
.TE
|
.TE
|
||||||
|
.sp 1
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
||||||
POSIX.1 specifies
|
POSIX.1 specifies
|
||||||
|
@ -220,13 +220,13 @@ but specifies only the fields
|
||||||
.I ru_utime
|
.I ru_utime
|
||||||
and
|
and
|
||||||
.IR ru_stime .
|
.IR ru_stime .
|
||||||
|
.PP
|
||||||
.B RUSAGE_THREAD
|
.B RUSAGE_THREAD
|
||||||
is Linux-specific.
|
is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Resource usage metrics are preserved across an
|
Resource usage metrics are preserved across an
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
Including
|
Including
|
||||||
.I <sys/time.h>
|
.I <sys/time.h>
|
||||||
is not required these days, but increases portability.
|
is not required these days, but increases portability.
|
||||||
|
@ -249,7 +249,7 @@ This nonconformance is rectified in Linux 2.6.9 and later.
|
||||||
.LP
|
.LP
|
||||||
The structure definition shown at the start of this page
|
The structure definition shown at the start of this page
|
||||||
was taken from 4.3BSD Reno.
|
was taken from 4.3BSD Reno.
|
||||||
|
.PP
|
||||||
Ancient systems provided a
|
Ancient systems provided a
|
||||||
.BR vtimes ()
|
.BR vtimes ()
|
||||||
function with a similar purpose to
|
function with a similar purpose to
|
||||||
|
@ -258,7 +258,7 @@ For backward compatibility, glibc also provides
|
||||||
.BR vtimes ().
|
.BR vtimes ().
|
||||||
All new applications should be written using
|
All new applications should be written using
|
||||||
.BR getrusage ().
|
.BR getrusage ().
|
||||||
|
.PP
|
||||||
See also the description of
|
See also the description of
|
||||||
.IR /proc/[pid]/stat
|
.IR /proc/[pid]/stat
|
||||||
in
|
in
|
||||||
|
|
|
@ -85,7 +85,7 @@ POSIX.1-2001, POSIX.1-2008, SVr4.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Linux does not return
|
Linux does not return
|
||||||
.BR EPERM .
|
.BR EPERM .
|
||||||
|
.PP
|
||||||
See
|
See
|
||||||
.BR credentials (7)
|
.BR credentials (7)
|
||||||
for a description of sessions and session IDs.
|
for a description of sessions and session IDs.
|
||||||
|
|
|
@ -59,7 +59,7 @@ argument should be initialized to indicate
|
||||||
the amount of space (in bytes) pointed to by
|
the amount of space (in bytes) pointed to by
|
||||||
.IR addr .
|
.IR addr .
|
||||||
On return it contains the actual size of the socket address.
|
On return it contains the actual size of the socket address.
|
||||||
|
.PP
|
||||||
The returned address is truncated if the buffer provided is too small;
|
The returned address is truncated if the buffer provided is too small;
|
||||||
in this case,
|
in this case,
|
||||||
.I addrlen
|
.I addrlen
|
||||||
|
|
|
@ -64,7 +64,7 @@ manipulate options for the socket referred to by the file descriptor
|
||||||
Options may exist at multiple
|
Options may exist at multiple
|
||||||
protocol levels; they are always present at the uppermost
|
protocol levels; they are always present at the uppermost
|
||||||
socket level.
|
socket level.
|
||||||
|
.PP
|
||||||
When manipulating socket options, the level at which the
|
When manipulating socket options, the level at which the
|
||||||
option resides and the name of the option must be specified.
|
option resides and the name of the option must be specified.
|
||||||
To manipulate options at the sockets API level,
|
To manipulate options at the sockets API level,
|
||||||
|
@ -83,7 +83,7 @@ should be set to the protocol number of
|
||||||
.BR TCP ;
|
.BR TCP ;
|
||||||
see
|
see
|
||||||
.BR getprotoent (3).
|
.BR getprotoent (3).
|
||||||
|
.PP
|
||||||
The arguments
|
The arguments
|
||||||
.I optval
|
.I optval
|
||||||
and
|
and
|
||||||
|
@ -105,7 +105,7 @@ the value returned.
|
||||||
If no option value is to be supplied or returned,
|
If no option value is to be supplied or returned,
|
||||||
.I optval
|
.I optval
|
||||||
may be NULL.
|
may be NULL.
|
||||||
|
.PP
|
||||||
.I Optname
|
.I Optname
|
||||||
and any specified options are passed uninterpreted to the appropriate
|
and any specified options are passed uninterpreted to the appropriate
|
||||||
protocol module for interpretation.
|
protocol module for interpretation.
|
||||||
|
@ -115,7 +115,7 @@ contains definitions for socket level options, described below.
|
||||||
Options at
|
Options at
|
||||||
other protocol levels vary in format and name; consult the appropriate
|
other protocol levels vary in format and name; consult the appropriate
|
||||||
entries in section 4 of the manual.
|
entries in section 4 of the manual.
|
||||||
|
.PP
|
||||||
Most socket-level options utilize an
|
Most socket-level options utilize an
|
||||||
.I int
|
.I int
|
||||||
argument for
|
argument for
|
||||||
|
@ -133,7 +133,7 @@ On success, zero is returned for the standard options.
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
|
.PP
|
||||||
Netfilter allows the programmer
|
Netfilter allows the programmer
|
||||||
to define custom socket options with associated handlers; for such
|
to define custom socket options with associated handlers; for such
|
||||||
options, the return value on success is the value returned by the handler.
|
options, the return value on success is the value returned by the handler.
|
||||||
|
@ -185,7 +185,7 @@ POSIX.1 does not require the inclusion of
|
||||||
and this header file is not required on Linux.
|
and this header file is not required on Linux.
|
||||||
However, some historical (BSD) implementations required this header
|
However, some historical (BSD) implementations required this header
|
||||||
file, and portable applications are probably wise to include it.
|
file, and portable applications are probably wise to include it.
|
||||||
|
.PP
|
||||||
For background on the
|
For background on the
|
||||||
.I socklen_t
|
.I socklen_t
|
||||||
type, see
|
type, see
|
||||||
|
|
|
@ -64,11 +64,11 @@ Glibc does not provide a wrapper for this system call; call it using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
.\" FIXME . See http://sourceware.org/bugzilla/show_bug.cgi?id=6399
|
.\" FIXME . See http://sourceware.org/bugzilla/show_bug.cgi?id=6399
|
||||||
.\" "gettid() should have a wrapper"
|
.\" "gettid() should have a wrapper"
|
||||||
|
.PP
|
||||||
The thread ID returned by this call is not the same thing as a
|
The thread ID returned by this call is not the same thing as a
|
||||||
POSIX thread ID (i.e., the opaque value returned by
|
POSIX thread ID (i.e., the opaque value returned by
|
||||||
.BR pthread_self (3)).
|
.BR pthread_self (3)).
|
||||||
|
.PP
|
||||||
In a new thread group created by a
|
In a new thread group created by a
|
||||||
.BR clone (2)
|
.BR clone (2)
|
||||||
call that does not specify the
|
call that does not specify the
|
||||||
|
|
|
@ -119,7 +119,7 @@ structure is obsolete; the
|
||||||
.I tz
|
.I tz
|
||||||
argument should normally be specified as NULL.
|
argument should normally be specified as NULL.
|
||||||
(See NOTES below.)
|
(See NOTES below.)
|
||||||
|
.PP
|
||||||
Under Linux, there are some peculiar "warp clock" semantics associated
|
Under Linux, there are some peculiar "warp clock" semantics associated
|
||||||
with the
|
with the
|
||||||
.BR settimeofday ()
|
.BR settimeofday ()
|
||||||
|
@ -182,12 +182,12 @@ affected by discontinuous jumps in the system time
|
||||||
(e.g., if the system administrator manually changes the system time).
|
(e.g., if the system administrator manually changes the system time).
|
||||||
If you need a monotonically increasing clock, see
|
If you need a monotonically increasing clock, see
|
||||||
.BR clock_gettime (2).
|
.BR clock_gettime (2).
|
||||||
|
.PP
|
||||||
Macros for operating on
|
Macros for operating on
|
||||||
.I timeval
|
.I timeval
|
||||||
structures are described in
|
structures are described in
|
||||||
.BR timeradd (3).
|
.BR timeradd (3).
|
||||||
|
.PP
|
||||||
Traditionally, the fields of
|
Traditionally, the fields of
|
||||||
.I struct timeval
|
.I struct timeval
|
||||||
were of type
|
were of type
|
||||||
|
@ -218,7 +218,7 @@ or
|
||||||
.\" Each and every occurrence of this field in the kernel source
|
.\" Each and every occurrence of this field in the kernel source
|
||||||
.\" (other than the declaration) is a bug.
|
.\" (other than the declaration) is a bug.
|
||||||
Thus, the following is purely of historical interest.
|
Thus, the following is purely of historical interest.
|
||||||
|
.PP
|
||||||
On old systems, the field
|
On old systems, the field
|
||||||
.I tz_dsttime
|
.I tz_dsttime
|
||||||
contains a symbolic constant (values are given below)
|
contains a symbolic constant (values are given below)
|
||||||
|
|
|
@ -37,7 +37,7 @@ getuid, geteuid \- get user identity
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR getuid ()
|
.BR getuid ()
|
||||||
returns the real user ID of the calling process.
|
returns the real user ID of the calling process.
|
||||||
|
.PP
|
||||||
.BR geteuid ()
|
.BR geteuid ()
|
||||||
returns the effective user ID of the calling process.
|
returns the effective user ID of the calling process.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
|
@ -54,7 +54,7 @@ UNIX\ V7 introduced separate calls
|
||||||
.BR getuid ()
|
.BR getuid ()
|
||||||
and
|
and
|
||||||
.BR geteuid ().
|
.BR geteuid ().
|
||||||
|
.PP
|
||||||
The original Linux
|
The original Linux
|
||||||
.BR getuid ()
|
.BR getuid ()
|
||||||
and
|
and
|
||||||
|
|
|
@ -39,7 +39,7 @@ getunwind \- copy the unwind data to caller's buffer
|
||||||
There is no glibc wrapper for this system call; see NOTES.
|
There is no glibc wrapper for this system call; see NOTES.
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.I Note: this function is obsolete.
|
.I Note: this function is obsolete.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
IA-64-specific
|
IA-64-specific
|
||||||
.BR getunwind ()
|
.BR getunwind ()
|
||||||
|
@ -49,7 +49,7 @@ unwind data into the buffer pointed to by
|
||||||
and returns the size of the unwind data;
|
and returns the size of the unwind data;
|
||||||
this data describes the gate page (kernel code that
|
this data describes the gate page (kernel code that
|
||||||
is mapped into user space).
|
is mapped into user space).
|
||||||
|
.PP
|
||||||
The size of the buffer
|
The size of the buffer
|
||||||
.I buf
|
.I buf
|
||||||
is specified in
|
is specified in
|
||||||
|
@ -61,17 +61,17 @@ is greater than or equal to the size of the unwind data and
|
||||||
is not NULL;
|
is not NULL;
|
||||||
otherwise, no data is copied, and the call succeeds,
|
otherwise, no data is copied, and the call succeeds,
|
||||||
returning the size that would be needed to store the unwind data.
|
returning the size that would be needed to store the unwind data.
|
||||||
|
.PP
|
||||||
The first part of the unwind data contains an unwind table.
|
The first part of the unwind data contains an unwind table.
|
||||||
The rest contains the associated unwind information, in no particular order.
|
The rest contains the associated unwind information, in no particular order.
|
||||||
The unwind table contains entries of the following form:
|
The unwind table contains entries of the following form:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
u64 start; (64-bit address of start of function)
|
u64 start; (64-bit address of start of function)
|
||||||
u64 end; (64-bit address of end of function)
|
u64 end; (64-bit address of end of function)
|
||||||
u64 info; (BUF-relative offset to unwind info)
|
u64 info; (BUF-relative offset to unwind info)
|
||||||
.fi
|
.fi
|
||||||
|
.PP
|
||||||
An entry whose
|
An entry whose
|
||||||
.I start
|
.I start
|
||||||
value is zero indicates the end of the table.
|
value is zero indicates the end of the table.
|
||||||
|
@ -100,7 +100,7 @@ and is available only on the IA-64 architecture.
|
||||||
This system call has been deprecated.
|
This system call has been deprecated.
|
||||||
The modern way to obtain the kernel's unwind data is via the
|
The modern way to obtain the kernel's unwind data is via the
|
||||||
.BR vdso (7).
|
.BR vdso (7).
|
||||||
|
.PP
|
||||||
Glibc does not provide a wrapper for this system call;
|
Glibc does not provide a wrapper for this system call;
|
||||||
in the unlikely event that you want to call it, use
|
in the unlikely event that you want to call it, use
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
|
|
@ -51,7 +51,7 @@ and then runs the module's
|
||||||
.I init
|
.I init
|
||||||
function.
|
function.
|
||||||
This system call requires privilege.
|
This system call requires privilege.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I module_image
|
.I module_image
|
||||||
argument points to a buffer containing the binary image
|
argument points to a buffer containing the binary image
|
||||||
|
@ -59,7 +59,7 @@ to be loaded;
|
||||||
.I len
|
.I len
|
||||||
specifies the size of that buffer.
|
specifies the size of that buffer.
|
||||||
The module image should be a valid ELF image, built for the running kernel.
|
The module image should be a valid ELF image, built for the running kernel.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I param_values
|
.I param_values
|
||||||
argument is a string containing space-delimited specifications of the
|
argument is a string containing space-delimited specifications of the
|
||||||
|
@ -70,12 +70,12 @@ and
|
||||||
The kernel parses this string and initializes the specified
|
The kernel parses this string and initializes the specified
|
||||||
parameters.
|
parameters.
|
||||||
Each of the parameter specifications has the form:
|
Each of the parameter specifications has the form:
|
||||||
|
.PP
|
||||||
.RI " " name [\c
|
.RI " " name [\c
|
||||||
.BI = value\c
|
.BI = value\c
|
||||||
.RB [ ,\c
|
.RB [ ,\c
|
||||||
.IR value ...]]
|
.IR value ...]]
|
||||||
|
.PP
|
||||||
The parameter
|
The parameter
|
||||||
.I name
|
.I name
|
||||||
is one of those defined within the module using
|
is one of those defined within the module using
|
||||||
|
@ -108,7 +108,7 @@ The
|
||||||
.I param_values
|
.I param_values
|
||||||
argument is as for
|
argument is as for
|
||||||
.BR init_module ().
|
.BR init_module ().
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument modifies the operation of
|
argument modifies the operation of
|
||||||
|
@ -140,7 +140,7 @@ for the function named by the symbol.
|
||||||
In this case, the kernel version number within the
|
In this case, the kernel version number within the
|
||||||
"vermagic" string is ignored,
|
"vermagic" string is ignored,
|
||||||
as the symbol version hashes are assumed to be sufficiently reliable.
|
as the symbol version hashes are assumed to be sufficiently reliable.
|
||||||
|
.PP
|
||||||
Using the
|
Using the
|
||||||
.B MODULE_INIT_IGNORE_VERMAGIC
|
.B MODULE_INIT_IGNORE_VERMAGIC
|
||||||
flag indicates that the "vermagic" string is to be ignored, and the
|
flag indicates that the "vermagic" string is to be ignored, and the
|
||||||
|
@ -272,17 +272,17 @@ it is (before glibc 2.23) sufficient to
|
||||||
manually declare the interface in your code;
|
manually declare the interface in your code;
|
||||||
alternatively, you can invoke the system call using
|
alternatively, you can invoke the system call using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
Glibc does not provide a wrapper for
|
Glibc does not provide a wrapper for
|
||||||
.BR finit_module ();
|
.BR finit_module ();
|
||||||
call it using
|
call it using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
Information about currently loaded modules can be found in
|
Information about currently loaded modules can be found in
|
||||||
.IR /proc/modules
|
.IR /proc/modules
|
||||||
and in the file trees under the per-module subdirectories under
|
and in the file trees under the per-module subdirectories under
|
||||||
.IR /sys/module .
|
.IR /sys/module .
|
||||||
|
.PP
|
||||||
See the Linux kernel source file
|
See the Linux kernel source file
|
||||||
.I include/linux/module.h
|
.I include/linux/module.h
|
||||||
for some useful background information.
|
for some useful background information.
|
||||||
|
@ -291,11 +291,11 @@ for some useful background information.
|
||||||
In Linux 2.4 and earlier, the
|
In Linux 2.4 and earlier, the
|
||||||
.BR init_module ()
|
.BR init_module ()
|
||||||
system call was rather different:
|
system call was rather different:
|
||||||
|
.PP
|
||||||
.B " #include <linux/module.h>"
|
.B " #include <linux/module.h>"
|
||||||
|
.PP
|
||||||
.BI " int init_module(const char *" name ", struct module *" image );
|
.BI " int init_module(const char *" name ", struct module *" image );
|
||||||
|
.PP
|
||||||
(User-space applications can detect which version of
|
(User-space applications can detect which version of
|
||||||
.BR init_module ()
|
.BR init_module ()
|
||||||
is available by calling
|
is available by calling
|
||||||
|
@ -303,7 +303,7 @@ is available by calling
|
||||||
the latter call fails with the error
|
the latter call fails with the error
|
||||||
.BR ENOSYS
|
.BR ENOSYS
|
||||||
on Linux 2.6 and later.)
|
on Linux 2.6 and later.)
|
||||||
|
.PP
|
||||||
The older version of the system call
|
The older version of the system call
|
||||||
loads the relocated module image pointed to by
|
loads the relocated module image pointed to by
|
||||||
.I image
|
.I image
|
||||||
|
|
|
@ -51,7 +51,7 @@ See
|
||||||
.BR inotify (7)
|
.BR inotify (7)
|
||||||
for a description of the bits that can be set in
|
for a description of the bits that can be set in
|
||||||
.IR mask .
|
.IR mask .
|
||||||
|
.PP
|
||||||
A successful call to
|
A successful call to
|
||||||
.BR inotify_add_watch ()
|
.BR inotify_add_watch ()
|
||||||
returns a unique watch descriptor for this inotify instance,
|
returns a unique watch descriptor for this inotify instance,
|
||||||
|
@ -63,7 +63,7 @@ then the watch descriptor is newly allocated.
|
||||||
If the filesystem object was already being watched
|
If the filesystem object was already being watched
|
||||||
(perhaps via a different link to the same object), then the descriptor
|
(perhaps via a different link to the same object), then the descriptor
|
||||||
for the existing watch is returned.
|
for the existing watch is returned.
|
||||||
|
.PP
|
||||||
The watch descriptor is returned by later
|
The watch descriptor is returned by later
|
||||||
.BR read (2)s
|
.BR read (2)s
|
||||||
from the inotify file descriptor.
|
from the inotify file descriptor.
|
||||||
|
|
|
@ -39,11 +39,11 @@ inotify_init, inotify_init1 \- initialize an inotify instance
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
For an overview of the inotify API, see
|
For an overview of the inotify API, see
|
||||||
.BR inotify (7).
|
.BR inotify (7).
|
||||||
|
.PP
|
||||||
.BR inotify_init ()
|
.BR inotify_init ()
|
||||||
initializes a new inotify instance and returns a file descriptor associated
|
initializes a new inotify instance and returns a file descriptor associated
|
||||||
with a new inotify event queue.
|
with a new inotify event queue.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
is 0, then
|
is 0, then
|
||||||
|
|
|
@ -39,7 +39,7 @@ removes the watch associated with the watch descriptor
|
||||||
.I wd
|
.I wd
|
||||||
from the inotify instance associated with the file descriptor
|
from the inotify instance associated with the file descriptor
|
||||||
.IR fd .
|
.IR fd .
|
||||||
|
.PP
|
||||||
Removing a watch causes an
|
Removing a watch causes an
|
||||||
.B IN_IGNORED
|
.B IN_IGNORED
|
||||||
event to be generated for this watch descriptor.
|
event to be generated for this watch descriptor.
|
||||||
|
|
|
@ -39,7 +39,7 @@ wrapper functions which perform the steps required
|
||||||
the system call.
|
the system call.
|
||||||
Thus, making a system call looks the same as invoking a normal
|
Thus, making a system call looks the same as invoking a normal
|
||||||
library function.
|
library function.
|
||||||
|
.PP
|
||||||
In many cases, the C library wrapper function does nothing more than:
|
In many cases, the C library wrapper function does nothing more than:
|
||||||
.IP * 3
|
.IP * 3
|
||||||
copying arguments and the unique system call number to the
|
copying arguments and the unique system call number to the
|
||||||
|
@ -62,7 +62,7 @@ try to note the details of both the (usually GNU) C library API
|
||||||
interface and the raw system call.
|
interface and the raw system call.
|
||||||
Most commonly, the main DESCRIPTION will focus on the C library interface,
|
Most commonly, the main DESCRIPTION will focus on the C library interface,
|
||||||
and differences for the system call are covered in the NOTES section.
|
and differences for the system call are covered in the NOTES section.
|
||||||
|
.PP
|
||||||
For a list of the Linux system calls, see
|
For a list of the Linux system calls, see
|
||||||
.BR syscalls (2).
|
.BR syscalls (2).
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
@ -74,12 +74,12 @@ system call returns a negative value, the wrapper copies the
|
||||||
absolute value into the
|
absolute value into the
|
||||||
.I errno
|
.I errno
|
||||||
variable, and returns \-1 as the return value of the wrapper.
|
variable, and returns \-1 as the return value of the wrapper.
|
||||||
|
.PP
|
||||||
The value returned by a successful system call depends on the call.
|
The value returned by a successful system call depends on the call.
|
||||||
Many system calls return 0 on success, but some can return nonzero
|
Many system calls return 0 on success, but some can return nonzero
|
||||||
values from a successful call.
|
values from a successful call.
|
||||||
The details are described in the individual manual pages.
|
The details are described in the individual manual pages.
|
||||||
|
.PP
|
||||||
In some cases,
|
In some cases,
|
||||||
the programmer must define a feature test macro in order to obtain
|
the programmer must define a feature test macro in order to obtain
|
||||||
the declaration of a system call from the header file specified
|
the declaration of a system call from the header file specified
|
||||||
|
|
|
@ -70,7 +70,7 @@ But instead, you probably want to use the
|
||||||
wrapper function provided by
|
wrapper function provided by
|
||||||
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
||||||
.IR libaio .
|
.IR libaio .
|
||||||
|
.PP
|
||||||
Note that the
|
Note that the
|
||||||
.I libaio
|
.I libaio
|
||||||
wrapper function uses a different type
|
wrapper function uses a different type
|
||||||
|
|
|
@ -59,7 +59,7 @@ But instead, you probably want to use the
|
||||||
wrapper function provided by
|
wrapper function provided by
|
||||||
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
||||||
.IR libaio .
|
.IR libaio .
|
||||||
|
.PP
|
||||||
Note that the
|
Note that the
|
||||||
.I libaio
|
.I libaio
|
||||||
wrapper function uses a different type
|
wrapper function uses a different type
|
||||||
|
|
|
@ -27,10 +27,10 @@ system call
|
||||||
attempts to read at least \fImin_nr\fP events and
|
attempts to read at least \fImin_nr\fP events and
|
||||||
up to \fInr\fP events from the completion queue of the AIO context
|
up to \fInr\fP events from the completion queue of the AIO context
|
||||||
specified by \fIctx_id\fP.
|
specified by \fIctx_id\fP.
|
||||||
|
.PP
|
||||||
The \fItimeout\fP argument specifies the amount of time to wait for events,
|
The \fItimeout\fP argument specifies the amount of time to wait for events,
|
||||||
and is specified as a relative timeout in a structure of the following form:
|
and is specified as a relative timeout in a structure of the following form:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct timespec {
|
struct timespec {
|
||||||
|
@ -39,10 +39,10 @@ struct timespec {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The specified time will be rounded up to the system clock granularity
|
The specified time will be rounded up to the system clock granularity
|
||||||
and is guaranteed not to expire early.
|
and is guaranteed not to expire early.
|
||||||
|
.PP
|
||||||
Specifying
|
Specifying
|
||||||
.I timeout
|
.I timeout
|
||||||
as NULL means block indefinitely until at least
|
as NULL means block indefinitely until at least
|
||||||
|
@ -60,7 +60,7 @@ expired.
|
||||||
It may also be a nonzero value less than
|
It may also be a nonzero value less than
|
||||||
.IR min_nr ,
|
.IR min_nr ,
|
||||||
if the call was interrupted by a signal handler.
|
if the call was interrupted by a signal handler.
|
||||||
|
.PP
|
||||||
For the failure return, see NOTES.
|
For the failure return, see NOTES.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
.TP
|
.TP
|
||||||
|
@ -96,7 +96,7 @@ But instead, you probably want to use the
|
||||||
wrapper function provided by
|
wrapper function provided by
|
||||||
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
||||||
.IR libaio .
|
.IR libaio .
|
||||||
|
.PP
|
||||||
Note that the
|
Note that the
|
||||||
.I libaio
|
.I libaio
|
||||||
wrapper function uses a different type
|
wrapper function uses a different type
|
||||||
|
|
|
@ -72,7 +72,7 @@ But instead, you probably want to use the
|
||||||
wrapper function provided by
|
wrapper function provided by
|
||||||
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
||||||
.IR libaio .
|
.IR libaio .
|
||||||
|
.PP
|
||||||
Note that the
|
Note that the
|
||||||
.I libaio
|
.I libaio
|
||||||
wrapper function uses a different type
|
wrapper function uses a different type
|
||||||
|
|
|
@ -74,7 +74,7 @@ But instead, you probably want to use the
|
||||||
wrapper function provided by
|
wrapper function provided by
|
||||||
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
.\" http://git.fedorahosted.org/git/?p=libaio.git
|
||||||
.IR libaio .
|
.IR libaio .
|
||||||
|
.PP
|
||||||
Note that the
|
Note that the
|
||||||
.I libaio
|
.I libaio
|
||||||
wrapper function uses a different type
|
wrapper function uses a different type
|
||||||
|
|
|
@ -142,7 +142,7 @@ repeatedly.
|
||||||
The
|
The
|
||||||
.I entry
|
.I entry
|
||||||
argument is a two-element array of the following structures:
|
argument is a two-element array of the following structures:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct __fat_dirent {
|
struct __fat_dirent {
|
||||||
|
@ -229,14 +229,14 @@ For further error values, see
|
||||||
and
|
and
|
||||||
.B VFAT_IOCTL_READDIR_SHORT
|
.B VFAT_IOCTL_READDIR_SHORT
|
||||||
first appeared in Linux 2.0.
|
first appeared in Linux 2.0.
|
||||||
|
.PP
|
||||||
.BR FAT_IOCTL_GET_ATTRIBUTES
|
.BR FAT_IOCTL_GET_ATTRIBUTES
|
||||||
and
|
and
|
||||||
.BR FAT_IOCTL_SET_ATTRIBUTES
|
.BR FAT_IOCTL_SET_ATTRIBUTES
|
||||||
first appeared
|
first appeared
|
||||||
.\" just before we got Git history
|
.\" just before we got Git history
|
||||||
in Linux 2.6.12.
|
in Linux 2.6.12.
|
||||||
|
.PP
|
||||||
.B FAT_IOCTL_GET_VOLUME_ID
|
.B FAT_IOCTL_GET_VOLUME_ID
|
||||||
was introduced in version 3.11
|
was introduced in version 3.11
|
||||||
.\" commit 6e5b93ee55d401f1619092fb675b57c28c9ed7ec
|
.\" commit 6e5b93ee55d401f1619092fb675b57c28c9ed7ec
|
||||||
|
@ -254,7 +254,7 @@ the program reads and displays the attribute again.
|
||||||
.PP
|
.PP
|
||||||
The following was recorded when applying the program for the file
|
The following was recorded when applying the program for the file
|
||||||
.IR /mnt/user/foo :
|
.IR /mnt/user/foo :
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
# ./toggle_fat_archive_flag /mnt/user/foo
|
# ./toggle_fat_archive_flag /mnt/user/foo
|
||||||
|
@ -355,7 +355,7 @@ to display the volume ID of a FAT filesystem.
|
||||||
The following output was recorded when applying the program for
|
The following output was recorded when applying the program for
|
||||||
directory
|
directory
|
||||||
.IR /mnt/user :
|
.IR /mnt/user :
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
$ ./display_fat_volume_id /mnt/user
|
$ ./display_fat_volume_id /mnt/user
|
||||||
|
@ -418,7 +418,7 @@ to list a directory.
|
||||||
.PP
|
.PP
|
||||||
The following was recorded when applying the program to the directory
|
The following was recorded when applying the program to the directory
|
||||||
.IR /mnt/user :
|
.IR /mnt/user :
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
$ ./fat_dir /mnt/user
|
$ ./fat_dir /mnt/user
|
||||||
|
|
|
@ -47,7 +47,7 @@ If a file write should occur to a shared region,
|
||||||
the filesystem must ensure that the changes remain private to the file being
|
the filesystem must ensure that the changes remain private to the file being
|
||||||
written.
|
written.
|
||||||
This behavior is commonly referred to as "copy on write".
|
This behavior is commonly referred to as "copy on write".
|
||||||
|
.PP
|
||||||
This ioctl reflinks up to
|
This ioctl reflinks up to
|
||||||
.IR src_length
|
.IR src_length
|
||||||
bytes from file descriptor
|
bytes from file descriptor
|
||||||
|
@ -78,7 +78,7 @@ struct file_clone_range {
|
||||||
.in
|
.in
|
||||||
Clones are atomic with regards to concurrent writes, so no locks need to be
|
Clones are atomic with regards to concurrent writes, so no locks need to be
|
||||||
taken to obtain a consistent cloned copy.
|
taken to obtain a consistent cloned copy.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B FICLONE
|
.B FICLONE
|
||||||
ioctl clones entire files.
|
ioctl clones entire files.
|
||||||
|
|
|
@ -47,7 +47,7 @@ If a file write should occur to a shared
|
||||||
region, the filesystem must ensure that the changes remain private to the file
|
region, the filesystem must ensure that the changes remain private to the file
|
||||||
being written.
|
being written.
|
||||||
This behavior is commonly referred to as "copy on write".
|
This behavior is commonly referred to as "copy on write".
|
||||||
|
.PP
|
||||||
This ioctl performs the "compare and share if identical" operation on up to
|
This ioctl performs the "compare and share if identical" operation on up to
|
||||||
.IR src_length
|
.IR src_length
|
||||||
bytes from file descriptor
|
bytes from file descriptor
|
||||||
|
@ -68,20 +68,20 @@ struct file_dedupe_range {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
Deduplication is atomic with regards to concurrent writes, so no locks need to
|
Deduplication is atomic with regards to concurrent writes, so no locks need to
|
||||||
be taken to obtain a consistent deduplicated copy.
|
be taken to obtain a consistent deduplicated copy.
|
||||||
|
.PP
|
||||||
The fields
|
The fields
|
||||||
.IR reserved1 " and " reserved2
|
.IR reserved1 " and " reserved2
|
||||||
must be zero.
|
must be zero.
|
||||||
|
.PP
|
||||||
Destinations for the deduplication operation are conveyed in the array at the
|
Destinations for the deduplication operation are conveyed in the array at the
|
||||||
end of the structure.
|
end of the structure.
|
||||||
The number of destinations is given in
|
The number of destinations is given in
|
||||||
.IR dest_count ",
|
.IR dest_count ",
|
||||||
and the destination information is conveyed in the following form:
|
and the destination information is conveyed in the following form:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct file_dedupe_range_info {
|
struct file_dedupe_range_info {
|
||||||
|
@ -94,7 +94,7 @@ struct file_dedupe_range_info {
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
Each deduplication operation targets
|
Each deduplication operation targets
|
||||||
.IR src_length
|
.IR src_length
|
||||||
bytes in file descriptor
|
bytes in file descriptor
|
||||||
|
@ -125,7 +125,7 @@ is mapped into
|
||||||
and the previous contents in
|
and the previous contents in
|
||||||
.IR dest_fd
|
.IR dest_fd
|
||||||
are freed.
|
are freed.
|
||||||
|
.PP
|
||||||
Upon successful completion of this ioctl, the number of bytes successfully
|
Upon successful completion of this ioctl, the number of bytes successfully
|
||||||
deduplicated is returned in
|
deduplicated is returned in
|
||||||
.IR bytes_deduped
|
.IR bytes_deduped
|
||||||
|
@ -143,7 +143,7 @@ code is set to
|
||||||
for success, a negative error code in case of error, or
|
for success, a negative error code in case of error, or
|
||||||
.B FILE_DEDUPE_RANGE_DIFFERS
|
.B FILE_DEDUPE_RANGE_DIFFERS
|
||||||
if the data did not match.
|
if the data did not match.
|
||||||
|
.PP
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
|
@ -208,7 +208,7 @@ Because a copy-on-write operation requires the allocation of new storage, the
|
||||||
.BR fallocate (2)
|
.BR fallocate (2)
|
||||||
operation may unshare shared blocks to guarantee that subsequent writes will
|
operation may unshare shared blocks to guarantee that subsequent writes will
|
||||||
not fail because of lack of disk space.
|
not fail because of lack of disk space.
|
||||||
|
.PP
|
||||||
Some filesystems may limit the amount of data that can be deduplicated in a
|
Some filesystems may limit the amount of data that can be deduplicated in a
|
||||||
single call.
|
single call.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
|
|
@ -98,7 +98,7 @@ Window sizes are kept in the kernel, but not used by the kernel
|
||||||
(except in the case of virtual consoles, where the kernel will
|
(except in the case of virtual consoles, where the kernel will
|
||||||
update the window size when the size of the virtual console changes,
|
update the window size when the size of the virtual console changes,
|
||||||
for example, by loading a new font).
|
for example, by loading a new font).
|
||||||
|
.PP
|
||||||
The following constants and structure are defined in
|
The following constants and structure are defined in
|
||||||
.IR <sys/ioctl.h> .
|
.IR <sys/ioctl.h> .
|
||||||
.TP
|
.TP
|
||||||
|
@ -109,7 +109,7 @@ Get window size.
|
||||||
Set window size.
|
Set window size.
|
||||||
.LP
|
.LP
|
||||||
The struct used by these ioctls is defined as
|
The struct used by these ioctls is defined as
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct winsize {
|
struct winsize {
|
||||||
|
@ -120,7 +120,7 @@ struct winsize {
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
When the window size changes, a
|
When the window size changes, a
|
||||||
.B SIGWINCH
|
.B SIGWINCH
|
||||||
signal is sent to the
|
signal is sent to the
|
||||||
|
@ -141,7 +141,7 @@ returns without doing anything.
|
||||||
When
|
When
|
||||||
.I arg
|
.I arg
|
||||||
is nonzero, nobody knows what will happen.
|
is nonzero, nobody knows what will happen.
|
||||||
|
.IP
|
||||||
(SVr4, UnixWare, Solaris, Linux treat
|
(SVr4, UnixWare, Solaris, Linux treat
|
||||||
.I "tcsendbreak(fd,arg)"
|
.I "tcsendbreak(fd,arg)"
|
||||||
with nonzero
|
with nonzero
|
||||||
|
@ -244,7 +244,7 @@ controlling terminal already.
|
||||||
For this case,
|
For this case,
|
||||||
.I arg
|
.I arg
|
||||||
should be specified as zero.
|
should be specified as zero.
|
||||||
|
.IP
|
||||||
If this terminal is already the controlling terminal
|
If this terminal is already the controlling terminal
|
||||||
of a different session group, then the ioctl fails with
|
of a different session group, then the ioctl fails with
|
||||||
.BR EPERM ,
|
.BR EPERM ,
|
||||||
|
@ -334,7 +334,7 @@ If the first byte is not
|
||||||
.B TIOCPKT_DATA
|
.B TIOCPKT_DATA
|
||||||
(0), it is an OR of one
|
(0), it is an OR of one
|
||||||
or more of the following bits:
|
or more of the following bits:
|
||||||
|
.IP
|
||||||
.nf
|
.nf
|
||||||
TIOCPKT_FLUSHREAD The read queue for the terminal is flushed.
|
TIOCPKT_FLUSHREAD The read queue for the terminal is flushed.
|
||||||
TIOCPKT_FLUSHWRITE The write queue for the terminal is flushed.
|
TIOCPKT_FLUSHWRITE The write queue for the terminal is flushed.
|
||||||
|
@ -343,7 +343,7 @@ TIOCPKT_START Output to the terminal is restarted.
|
||||||
TIOCPKT_DOSTOP The start and stop characters are \fB^S\fP/\fB^Q\fP.
|
TIOCPKT_DOSTOP The start and stop characters are \fB^S\fP/\fB^Q\fP.
|
||||||
TIOCPKT_NOSTOP The start and stop characters are not \fB^S\fP/\fB^Q\fP.
|
TIOCPKT_NOSTOP The start and stop characters are not \fB^S\fP/\fB^Q\fP.
|
||||||
.fi
|
.fi
|
||||||
|
.IP
|
||||||
While this mode is in use, the presence
|
While this mode is in use, the presence
|
||||||
of control status information to be read
|
of control status information to be read
|
||||||
from the master side may be detected by a
|
from the master side may be detected by a
|
||||||
|
@ -353,7 +353,7 @@ for exceptional conditions or a
|
||||||
for the
|
for the
|
||||||
.I POLLPRI
|
.I POLLPRI
|
||||||
event.
|
event.
|
||||||
|
.IP
|
||||||
This mode is used by
|
This mode is used by
|
||||||
.BR rlogin (1)
|
.BR rlogin (1)
|
||||||
and
|
and
|
||||||
|
@ -395,7 +395,7 @@ pseudoterminal slave device.
|
||||||
This operation can be performed
|
This operation can be performed
|
||||||
regardless of whether the pathname of the slave device
|
regardless of whether the pathname of the slave device
|
||||||
is accessible through the calling process's mount namespaces.
|
is accessible through the calling process's mount namespaces.
|
||||||
|
.IP
|
||||||
Security-conscious programs interacting with namespaces may wish to use this
|
Security-conscious programs interacting with namespaces may wish to use this
|
||||||
operation rather than
|
operation rather than
|
||||||
.BR open (2)
|
.BR open (2)
|
||||||
|
@ -424,7 +424,7 @@ Clear the indicated modem bits.
|
||||||
Set the indicated modem bits.
|
Set the indicated modem bits.
|
||||||
.LP
|
.LP
|
||||||
The following bits are used by the above ioctls:
|
The following bits are used by the above ioctls:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
TIOCM_LE DSR (data set ready/line enable)
|
TIOCM_LE DSR (data set ready/line enable)
|
||||||
TIOCM_DTR DTR (data terminal ready)
|
TIOCM_DTR DTR (data terminal ready)
|
||||||
|
@ -459,7 +459,7 @@ The counts are written to the
|
||||||
.I serial_icounter_struct
|
.I serial_icounter_struct
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.IR argp .
|
.IR argp .
|
||||||
|
.IP
|
||||||
Note: both 1->0 and 0->1 transitions are counted, except for
|
Note: both 1->0 and 0->1 transitions are counted, except for
|
||||||
RI, where only 0->1 transitions are counted.
|
RI, where only 0->1 transitions are counted.
|
||||||
.SS Marking a line as local
|
.SS Marking a line as local
|
||||||
|
@ -547,7 +547,7 @@ Inappropriate
|
||||||
Insufficient permission.
|
Insufficient permission.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
Check the condition of DTR on the serial port.
|
Check the condition of DTR on the serial port.
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
|
@ -55,7 +55,7 @@ is one of the commands listed below, and
|
||||||
.I argp
|
.I argp
|
||||||
is a pointer to a data structure that is specific to
|
is a pointer to a data structure that is specific to
|
||||||
.IR cmd .
|
.IR cmd .
|
||||||
|
.PP
|
||||||
The various
|
The various
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operations are described below.
|
operations are described below.
|
||||||
|
@ -78,7 +78,7 @@ events.
|
||||||
.SS UFFDIO_API
|
.SS UFFDIO_API
|
||||||
(Since Linux 4.3.)
|
(Since Linux 4.3.)
|
||||||
Enable operation of the userfaultfd and perform API handshake.
|
Enable operation of the userfaultfd and perform API handshake.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I argp
|
.I argp
|
||||||
argument is a pointer to a
|
argument is a pointer to a
|
||||||
|
@ -98,7 +98,7 @@ struct uffdio_api {
|
||||||
The
|
The
|
||||||
.I api
|
.I api
|
||||||
field denotes the API version requested by the application.
|
field denotes the API version requested by the application.
|
||||||
|
.PP
|
||||||
The kernel verifies that it can support the requested API version,
|
The kernel verifies that it can support the requested API version,
|
||||||
and sets the
|
and sets the
|
||||||
.I features
|
.I features
|
||||||
|
@ -107,7 +107,7 @@ and
|
||||||
fields to bit masks representing all the available features and the generic
|
fields to bit masks representing all the available features and the generic
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operations available.
|
operations available.
|
||||||
|
.PP
|
||||||
For Linux kernel versions before 4.11, the
|
For Linux kernel versions before 4.11, the
|
||||||
.I features
|
.I features
|
||||||
field must be initialized to zero before the call to
|
field must be initialized to zero before the call to
|
||||||
|
@ -116,7 +116,7 @@ and zero (i.e., no feature bits) is placed in the
|
||||||
.I features
|
.I features
|
||||||
field by the kernel upon return from
|
field by the kernel upon return from
|
||||||
.BR ioctl (2).
|
.BR ioctl (2).
|
||||||
|
.PP
|
||||||
Starting from Linux 4.11, the
|
Starting from Linux 4.11, the
|
||||||
.I features
|
.I features
|
||||||
field can be used to ask whether particular features are supported
|
field can be used to ask whether particular features are supported
|
||||||
|
@ -124,7 +124,7 @@ and explicitly enable userfaultfd features that are disabled by default.
|
||||||
The kernel always reports all the available features in the
|
The kernel always reports all the available features in the
|
||||||
.I features
|
.I features
|
||||||
field.
|
field.
|
||||||
|
.PP
|
||||||
To enable userfaultfd features the application should set
|
To enable userfaultfd features the application should set
|
||||||
a bit corresponding to each feature it wants to enable in the
|
a bit corresponding to each feature it wants to enable in the
|
||||||
.I features
|
.I features
|
||||||
|
@ -135,7 +135,7 @@ Otherwise it will zero out the returned
|
||||||
structure and return
|
structure and return
|
||||||
.BR EINVAL .
|
.BR EINVAL .
|
||||||
.\" FIXME add more details about feature negotiation and enablement
|
.\" FIXME add more details about feature negotiation and enablement
|
||||||
|
.PP
|
||||||
Since Linux 4.11, the following feature bits may be set:
|
Since Linux 4.11, the following feature bits may be set:
|
||||||
.TP
|
.TP
|
||||||
.B UFFD_FEATURE_EVENT_FORK
|
.B UFFD_FEATURE_EVENT_FORK
|
||||||
|
@ -196,7 +196,7 @@ with the
|
||||||
flag set,
|
flag set,
|
||||||
.BR memfd_create (2),
|
.BR memfd_create (2),
|
||||||
and so on.
|
and so on.
|
||||||
|
.IP
|
||||||
The returned
|
The returned
|
||||||
.I ioctls
|
.I ioctls
|
||||||
field can contain the following bits:
|
field can contain the following bits:
|
||||||
|
@ -255,15 +255,15 @@ by the current kernel version.
|
||||||
(Since Linux 4.3.)
|
(Since Linux 4.3.)
|
||||||
Register a memory address range with the userfaultfd object.
|
Register a memory address range with the userfaultfd object.
|
||||||
The pages in the range must be "compatible".
|
The pages in the range must be "compatible".
|
||||||
|
.PP
|
||||||
Up to Linux kernel 4.11,
|
Up to Linux kernel 4.11,
|
||||||
only private anonymous ranges are compatible for registering with
|
only private anonymous ranges are compatible for registering with
|
||||||
.BR UFFDIO_REGISTER .
|
.BR UFFDIO_REGISTER .
|
||||||
|
.PP
|
||||||
Since Linux 4.11,
|
Since Linux 4.11,
|
||||||
hugetlbfs and shared memory ranges are also compatible with
|
hugetlbfs and shared memory ranges are also compatible with
|
||||||
.BR UFFDIO_REGISTER .
|
.BR UFFDIO_REGISTER .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I argp
|
.I argp
|
||||||
argument is a pointer to a
|
argument is a pointer to a
|
||||||
|
@ -285,7 +285,7 @@ struct uffdio_register {
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I range
|
.I range
|
||||||
field defines a memory range starting at
|
field defines a memory range starting at
|
||||||
|
@ -293,7 +293,7 @@ field defines a memory range starting at
|
||||||
and continuing for
|
and continuing for
|
||||||
.I len
|
.I len
|
||||||
bytes that should be handled by the userfaultfd.
|
bytes that should be handled by the userfaultfd.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
field defines the mode of operation desired for this memory region.
|
field defines the mode of operation desired for this memory region.
|
||||||
|
@ -316,7 +316,7 @@ bit-mask field to indicate which
|
||||||
operations are available for the specified range.
|
operations are available for the specified range.
|
||||||
This returned bit mask is as for
|
This returned bit mask is as for
|
||||||
.BR UFFDIO_API .
|
.BR UFFDIO_API .
|
||||||
|
.PP
|
||||||
This
|
This
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operation returns 0 on success.
|
operation returns 0 on success.
|
||||||
|
@ -364,12 +364,12 @@ There as an incompatible mapping in the specified address range.
|
||||||
Unregister a memory address range from userfaultfd.
|
Unregister a memory address range from userfaultfd.
|
||||||
The pages in the range must be "compatible" (see the description of
|
The pages in the range must be "compatible" (see the description of
|
||||||
.BR UFFDIO_REGISTER .)
|
.BR UFFDIO_REGISTER .)
|
||||||
|
.PP
|
||||||
The address range to unregister is specified in the
|
The address range to unregister is specified in the
|
||||||
.IR uffdio_range
|
.IR uffdio_range
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.IR argp .
|
.IR argp .
|
||||||
|
.PP
|
||||||
This
|
This
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operation returns 0 on success.
|
operation returns 0 on success.
|
||||||
|
@ -406,7 +406,7 @@ fields of the
|
||||||
.I uffdio_copy
|
.I uffdio_copy
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.IR argp :
|
.IR argp :
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct uffdio_copy {
|
struct uffdio_copy {
|
||||||
|
@ -448,7 +448,7 @@ field is output-only;
|
||||||
it is not read by the
|
it is not read by the
|
||||||
.B UFFDIO_COPY
|
.B UFFDIO_COPY
|
||||||
operation.
|
operation.
|
||||||
|
.PP
|
||||||
This
|
This
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operation returns 0 on success.
|
operation returns 0 on success.
|
||||||
|
@ -505,14 +505,14 @@ operation.
|
||||||
.SS UFFDIO_ZEROPAGE
|
.SS UFFDIO_ZEROPAGE
|
||||||
(Since Linux 4.3.)
|
(Since Linux 4.3.)
|
||||||
Zero out a memory range registered with userfaultfd.
|
Zero out a memory range registered with userfaultfd.
|
||||||
|
.PP
|
||||||
The requested range is specified by the
|
The requested range is specified by the
|
||||||
.I range
|
.I range
|
||||||
field of the
|
field of the
|
||||||
.I uffdio_zeropage
|
.I uffdio_zeropage
|
||||||
structure pointed to by
|
structure pointed to by
|
||||||
.IR argp :
|
.IR argp :
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct uffdio_zeropage {
|
struct uffdio_zeropage {
|
||||||
|
@ -552,7 +552,7 @@ field is output-only;
|
||||||
it is not read by the
|
it is not read by the
|
||||||
.B UFFDIO_ZERO
|
.B UFFDIO_ZERO
|
||||||
operation.
|
operation.
|
||||||
|
.PP
|
||||||
This
|
This
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operation returns 0 on success.
|
operation returns 0 on success.
|
||||||
|
@ -593,7 +593,7 @@ operation.
|
||||||
(Since Linux 4.3.)
|
(Since Linux 4.3.)
|
||||||
Wake up the thread waiting for page-fault resolution on
|
Wake up the thread waiting for page-fault resolution on
|
||||||
a specified memory address range.
|
a specified memory address range.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B UFFDIO_WAKE
|
.B UFFDIO_WAKE
|
||||||
operation is used in conjunction with
|
operation is used in conjunction with
|
||||||
|
@ -613,13 +613,13 @@ and
|
||||||
.BR UFFDIO_ZEROPAGE
|
.BR UFFDIO_ZEROPAGE
|
||||||
operations in a batch and then explicitly wake up the faulting thread using
|
operations in a batch and then explicitly wake up the faulting thread using
|
||||||
.BR UFFDIO_WAKE .
|
.BR UFFDIO_WAKE .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I argp
|
.I argp
|
||||||
argument is a pointer to a
|
argument is a pointer to a
|
||||||
.I uffdio_range
|
.I uffdio_range
|
||||||
structure (shown above) that specifies the address range.
|
structure (shown above) that specifies the address range.
|
||||||
|
.PP
|
||||||
This
|
This
|
||||||
.BR ioctl (2)
|
.BR ioctl (2)
|
||||||
operation returns 0 on success.
|
operation returns 0 on success.
|
||||||
|
@ -675,6 +675,6 @@ operation that actually enables the desired features.
|
||||||
.BR ioctl (2),
|
.BR ioctl (2),
|
||||||
.BR mmap (2),
|
.BR mmap (2),
|
||||||
.BR userfaultfd (2)
|
.BR userfaultfd (2)
|
||||||
|
.PP
|
||||||
.IR Documentation/vm/userfaultfd.txt
|
.IR Documentation/vm/userfaultfd.txt
|
||||||
in the Linux kernel source tree
|
in the Linux kernel source tree
|
||||||
|
|
|
@ -53,7 +53,7 @@ If
|
||||||
.I turn_on
|
.I turn_on
|
||||||
is nonzero, the calling thread must be privileged
|
is nonzero, the calling thread must be privileged
|
||||||
.RB ( CAP_SYS_RAWIO ).
|
.RB ( CAP_SYS_RAWIO ).
|
||||||
|
.PP
|
||||||
Before Linux 2.6.8,
|
Before Linux 2.6.8,
|
||||||
only the first 0x3ff I/O ports could be specified in this manner.
|
only the first 0x3ff I/O ports could be specified in this manner.
|
||||||
For more ports, the
|
For more ports, the
|
||||||
|
@ -62,7 +62,7 @@ system call had to be used (with a
|
||||||
.I level
|
.I level
|
||||||
argument of 3).
|
argument of 3).
|
||||||
Since Linux 2.6.8, 65,536 I/O ports can be specified.
|
Since Linux 2.6.8, 65,536 I/O ports can be specified.
|
||||||
|
.PP
|
||||||
Permissions are inherited by the child created by
|
Permissions are inherited by the child created by
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
(but see NOTES).
|
(but see NOTES).
|
||||||
|
@ -70,7 +70,7 @@ Permissions are preserved across
|
||||||
.BR execve (2);
|
.BR execve (2);
|
||||||
this is useful for giving port access permissions to unprivileged
|
this is useful for giving port access permissions to unprivileged
|
||||||
programs.
|
programs.
|
||||||
|
.PP
|
||||||
This call is mostly for the i386 architecture.
|
This call is mostly for the i386 architecture.
|
||||||
On many other architectures it does not exist or will always
|
On many other architectures it does not exist or will always
|
||||||
return an error.
|
return an error.
|
||||||
|
@ -104,11 +104,11 @@ intended to be portable.
|
||||||
The
|
The
|
||||||
.I /proc/ioports
|
.I /proc/ioports
|
||||||
file shows the I/O ports that are currently allocated on the system.
|
file shows the I/O ports that are currently allocated on the system.
|
||||||
|
.PP
|
||||||
Before Linux 2.4,
|
Before Linux 2.4,
|
||||||
permissions were not inherited by a child created by
|
permissions were not inherited by a child created by
|
||||||
.BR fork (2).
|
.BR fork (2).
|
||||||
|
.PP
|
||||||
Glibc has an
|
Glibc has an
|
||||||
.BR ioperm ()
|
.BR ioperm ()
|
||||||
prototype both in
|
prototype both in
|
||||||
|
|
12
man2/iopl.2
12
man2/iopl.2
|
@ -42,25 +42,25 @@ iopl \- change I/O privilege level
|
||||||
changes the I/O privilege level of the calling process,
|
changes the I/O privilege level of the calling process,
|
||||||
as specified by the two least significant bits in
|
as specified by the two least significant bits in
|
||||||
.IR level .
|
.IR level .
|
||||||
|
.PP
|
||||||
This call is necessary to allow 8514-compatible X servers to run under
|
This call is necessary to allow 8514-compatible X servers to run under
|
||||||
Linux.
|
Linux.
|
||||||
Since these X servers require access to all 65536 I/O ports, the
|
Since these X servers require access to all 65536 I/O ports, the
|
||||||
.BR ioperm (2)
|
.BR ioperm (2)
|
||||||
call is not sufficient.
|
call is not sufficient.
|
||||||
|
.PP
|
||||||
In addition to granting unrestricted I/O port access, running at a higher
|
In addition to granting unrestricted I/O port access, running at a higher
|
||||||
I/O privilege level also allows the process to disable interrupts.
|
I/O privilege level also allows the process to disable interrupts.
|
||||||
This will probably crash the system, and is not recommended.
|
This will probably crash the system, and is not recommended.
|
||||||
|
.PP
|
||||||
Permissions are not inherited by the child process created by
|
Permissions are not inherited by the child process created by
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
and are not preserved across
|
and are not preserved across
|
||||||
.BR execve (2)
|
.BR execve (2)
|
||||||
(but see NOTES).
|
(but see NOTES).
|
||||||
|
.PP
|
||||||
The I/O privilege level for a normal process is 0.
|
The I/O privilege level for a normal process is 0.
|
||||||
|
.PP
|
||||||
This call is mostly for the i386 architecture.
|
This call is mostly for the i386 architecture.
|
||||||
On many other architectures it does not exist or will always
|
On many other architectures it does not exist or will always
|
||||||
return an error.
|
return an error.
|
||||||
|
@ -98,7 +98,7 @@ Glibc2 has a prototype both in
|
||||||
and in
|
and in
|
||||||
.IR <sys/perm.h> .
|
.IR <sys/perm.h> .
|
||||||
Avoid the latter, it is available on i386 only.
|
Avoid the latter, it is available on i386 only.
|
||||||
|
.PP
|
||||||
Prior to Linux 3.7,
|
Prior to Linux 3.7,
|
||||||
on some architectures (such as i386), permissions
|
on some architectures (such as i386), permissions
|
||||||
.I were
|
.I were
|
||||||
|
|
|
@ -39,7 +39,7 @@ and
|
||||||
.BR ioprio_set ()
|
.BR ioprio_set ()
|
||||||
system calls respectively get and set the I/O scheduling class and
|
system calls respectively get and set the I/O scheduling class and
|
||||||
priority of one or more threads.
|
priority of one or more threads.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I which
|
.I which
|
||||||
and
|
and
|
||||||
|
@ -95,7 +95,7 @@ is the lowest)
|
||||||
or if it belongs to the same priority class as the other process but
|
or if it belongs to the same priority class as the other process but
|
||||||
has a higher priority level (a lower priority number means a
|
has a higher priority level (a lower priority number means a
|
||||||
higher priority level).
|
higher priority level).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I ioprio
|
.I ioprio
|
||||||
argument given to
|
argument given to
|
||||||
|
@ -141,7 +141,7 @@ information on scheduling classes and priorities,
|
||||||
as well as the meaning of specifying
|
as well as the meaning of specifying
|
||||||
.I ioprio
|
.I ioprio
|
||||||
as 0.
|
as 0.
|
||||||
|
.PP
|
||||||
I/O priorities are supported for reads and for synchronous
|
I/O priorities are supported for reads and for synchronous
|
||||||
.RB ( O_DIRECT ,
|
.RB ( O_DIRECT ,
|
||||||
.BR O_SYNC )
|
.BR O_SYNC )
|
||||||
|
@ -201,7 +201,7 @@ These system calls are Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Glibc does not provide a wrapper for these system calls; call them using
|
Glibc does not provide a wrapper for these system calls; call them using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
Two or more processes or threads can share an I/O context.
|
Two or more processes or threads can share an I/O context.
|
||||||
This will be the case when
|
This will be the case when
|
||||||
.BR clone (2)
|
.BR clone (2)
|
||||||
|
@ -220,12 +220,12 @@ is the one that is returned by
|
||||||
.BR gettid (2)
|
.BR gettid (2)
|
||||||
or
|
or
|
||||||
.BR clone (2).
|
.BR clone (2).
|
||||||
|
.PP
|
||||||
These system calls have an effect only when used
|
These system calls have an effect only when used
|
||||||
in conjunction with an I/O scheduler that supports I/O priorities.
|
in conjunction with an I/O scheduler that supports I/O priorities.
|
||||||
As at kernel 2.6.17 the only such scheduler is the Completely Fair Queuing
|
As at kernel 2.6.17 the only such scheduler is the Completely Fair Queuing
|
||||||
(CFQ) I/O scheduler.
|
(CFQ) I/O scheduler.
|
||||||
|
.PP
|
||||||
If no I/O scheduler has been set for a thread,
|
If no I/O scheduler has been set for a thread,
|
||||||
then by default the I/O priority will follow the CPU nice value
|
then by default the I/O priority will follow the CPU nice value
|
||||||
.RB ( setpriority (2)).
|
.RB ( setpriority (2)).
|
||||||
|
@ -242,7 +242,7 @@ as 0 can be used to reset to the default I/O scheduling behavior.
|
||||||
I/O schedulers are selected on a per-device basis via the special
|
I/O schedulers are selected on a per-device basis via the special
|
||||||
file
|
file
|
||||||
.IR /sys/block/<device>/queue/scheduler .
|
.IR /sys/block/<device>/queue/scheduler .
|
||||||
|
.PP
|
||||||
One can view the current I/O scheduler via the
|
One can view the current I/O scheduler via the
|
||||||
.I /sys
|
.I /sys
|
||||||
filesystem.
|
filesystem.
|
||||||
|
@ -365,6 +365,6 @@ Suitable definitions can be found in
|
||||||
.BR open (2),
|
.BR open (2),
|
||||||
.BR capabilities (7),
|
.BR capabilities (7),
|
||||||
.BR cgroups (7)
|
.BR cgroups (7)
|
||||||
|
.PP
|
||||||
.I Documentation/block/ioprio.txt
|
.I Documentation/block/ioprio.txt
|
||||||
in the Linux kernel source tree
|
in the Linux kernel source tree
|
||||||
|
|
14
man2/kcmp.2
14
man2/kcmp.2
|
@ -47,7 +47,7 @@ and
|
||||||
.I pid2
|
.I pid2
|
||||||
share a kernel resource such as virtual memory, file descriptors,
|
share a kernel resource such as virtual memory, file descriptors,
|
||||||
and so on.
|
and so on.
|
||||||
|
.PP
|
||||||
Permission to employ
|
Permission to employ
|
||||||
.BR kcmp ()
|
.BR kcmp ()
|
||||||
is governed by ptrace access mode
|
is governed by ptrace access mode
|
||||||
|
@ -58,7 +58,7 @@ and
|
||||||
.IR pid2 ;
|
.IR pid2 ;
|
||||||
see
|
see
|
||||||
.BR ptrace (2).
|
.BR ptrace (2).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I type
|
.I type
|
||||||
argument specifies which resource is to be compared in the two processes.
|
argument specifies which resource is to be compared in the two processes.
|
||||||
|
@ -210,7 +210,7 @@ The return value of a successful call to
|
||||||
is simply the result of arithmetic comparison
|
is simply the result of arithmetic comparison
|
||||||
of kernel pointers (when the kernel compares resources, it uses their
|
of kernel pointers (when the kernel compares resources, it uses their
|
||||||
memory addresses).
|
memory addresses).
|
||||||
|
.PP
|
||||||
The easiest way to explain is to consider an example.
|
The easiest way to explain is to consider an example.
|
||||||
Suppose that
|
Suppose that
|
||||||
.I v1
|
.I v1
|
||||||
|
@ -242,7 +242,7 @@ but ordering information is unavailable.
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
|
.PP
|
||||||
.BR kcmp ()
|
.BR kcmp ()
|
||||||
was designed to return values suitable for sorting.
|
was designed to return values suitable for sorting.
|
||||||
This is particularly handy if one needs to compare
|
This is particularly handy if one needs to compare
|
||||||
|
@ -304,7 +304,7 @@ is Linux-specific and should not be used in programs intended to be portable.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Glibc does not provide a wrapper for this system call; call it using
|
Glibc does not provide a wrapper for this system call; call it using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
This system call is available only if the kernel was configured with
|
This system call is available only if the kernel was configured with
|
||||||
.BR CONFIG_CHECKPOINT_RESTORE .
|
.BR CONFIG_CHECKPOINT_RESTORE .
|
||||||
The main use of the system call is for the
|
The main use of the system call is for the
|
||||||
|
@ -313,7 +313,7 @@ The alternative to this system call would have been to expose suitable
|
||||||
process information via the
|
process information via the
|
||||||
.BR proc (5)
|
.BR proc (5)
|
||||||
filesystem; this was deemed to be unsuitable for security reasons.
|
filesystem; this was deemed to be unsuitable for security reasons.
|
||||||
|
.PP
|
||||||
See
|
See
|
||||||
.BR clone (2)
|
.BR clone (2)
|
||||||
for some background information on the shared resources
|
for some background information on the shared resources
|
||||||
|
@ -326,7 +326,7 @@ the same open file description.
|
||||||
The program tests different cases for the file descriptor pairs,
|
The program tests different cases for the file descriptor pairs,
|
||||||
as described in the program output.
|
as described in the program output.
|
||||||
An example run of the program is as follows:
|
An example run of the program is as follows:
|
||||||
|
.PP
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
$ \fB./a.out\fP
|
$ \fB./a.out\fP
|
||||||
|
|
|
@ -102,7 +102,7 @@ or one of the following architecture constants
|
||||||
and
|
and
|
||||||
.BR KEXEC_ARCH_MIPS_LE .
|
.BR KEXEC_ARCH_MIPS_LE .
|
||||||
The architecture must be executable on the CPU of the system.
|
The architecture must be executable on the CPU of the system.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I entry
|
.I entry
|
||||||
argument is the physical entry address in the kernel image.
|
argument is the physical entry address in the kernel image.
|
||||||
|
@ -178,13 +178,13 @@ and is moved to the final destination at kexec reboot time (e.g., when the
|
||||||
command is executed with the
|
command is executed with the
|
||||||
.I \-e
|
.I \-e
|
||||||
option).
|
option).
|
||||||
|
.PP
|
||||||
In case of kexec on panic (i.e., the
|
In case of kexec on panic (i.e., the
|
||||||
.BR KEXEC_ON_CRASH
|
.BR KEXEC_ON_CRASH
|
||||||
flag is set), the segment data is
|
flag is set), the segment data is
|
||||||
loaded to reserved memory at the time of the call, and, after a crash,
|
loaded to reserved memory at the time of the call, and, after a crash,
|
||||||
the kexec mechanism simply passes control to that kernel.
|
the kexec mechanism simply passes control to that kernel.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR kexec_load ()
|
.BR kexec_load ()
|
||||||
system call is available only if the kernel was configured with
|
system call is available only if the kernel was configured with
|
||||||
|
@ -209,7 +209,7 @@ The
|
||||||
.IR cmdline_len
|
.IR cmdline_len
|
||||||
argument specifies size of the buffer.
|
argument specifies size of the buffer.
|
||||||
The last byte in the buffer must be a null byte (\(aq\\0\(aq).
|
The last byte in the buffer must be a null byte (\(aq\\0\(aq).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.IR flags
|
.IR flags
|
||||||
argument is a bit mask which modifies the behavior of the call.
|
argument is a bit mask which modifies the behavior of the call.
|
||||||
|
@ -343,7 +343,7 @@ Call them using
|
||||||
.BR reboot (2),
|
.BR reboot (2),
|
||||||
.BR syscall (2),
|
.BR syscall (2),
|
||||||
.BR kexec (8)
|
.BR kexec (8)
|
||||||
|
.PP
|
||||||
The kernel source files
|
The kernel source files
|
||||||
.IR Documentation/kdump/kdump.txt
|
.IR Documentation/kdump/kdump.txt
|
||||||
and
|
and
|
||||||
|
|
342
man2/keyctl.2
342
man2/keyctl.2
File diff suppressed because it is too large
Load Diff
|
@ -85,7 +85,7 @@ If \fIsig\fP is 0, then no signal is sent,
|
||||||
but existence and permission checks are still performed;
|
but existence and permission checks are still performed;
|
||||||
this can be used to check for the existence of a process ID or
|
this can be used to check for the existence of a process ID or
|
||||||
process group ID that the caller is permitted to signal.
|
process group ID that the caller is permitted to signal.
|
||||||
|
.PP
|
||||||
For a process to have permission to send a signal,
|
For a process to have permission to send a signal,
|
||||||
it must either be privileged (under Linux: have the
|
it must either be privileged (under Linux: have the
|
||||||
.B CAP_KILL
|
.B CAP_KILL
|
||||||
|
|
24
man2/link.2
24
man2/link.2
|
@ -66,13 +66,13 @@ _ATFILE_SOURCE
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR link ()
|
.BR link ()
|
||||||
creates a new link (also known as a hard link) to an existing file.
|
creates a new link (also known as a hard link) to an existing file.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I newpath
|
.I newpath
|
||||||
exists, it will
|
exists, it will
|
||||||
.I not
|
.I not
|
||||||
be overwritten.
|
be overwritten.
|
||||||
|
.PP
|
||||||
This new name may be used exactly as the old one for any operation;
|
This new name may be used exactly as the old one for any operation;
|
||||||
both names refer to the same file (and so have the same permissions
|
both names refer to the same file (and so have the same permissions
|
||||||
and ownership) and it is impossible to tell which name was the
|
and ownership) and it is impossible to tell which name was the
|
||||||
|
@ -83,7 +83,7 @@ The
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR link (),
|
.BR link (),
|
||||||
except for the differences described here.
|
except for the differences described here.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I oldpath
|
.I oldpath
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -93,7 +93,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR link ()
|
.BR link ()
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I oldpath
|
.I oldpath
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -105,13 +105,13 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR link ()).
|
.BR link ()).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I oldpath
|
.I oldpath
|
||||||
is absolute, then
|
is absolute, then
|
||||||
.I olddirfd
|
.I olddirfd
|
||||||
is ignored.
|
is ignored.
|
||||||
|
.PP
|
||||||
The interpretation of
|
The interpretation of
|
||||||
.I newpath
|
.I newpath
|
||||||
is as for
|
is as for
|
||||||
|
@ -119,7 +119,7 @@ is as for
|
||||||
except that a relative pathname is interpreted relative
|
except that a relative pathname is interpreted relative
|
||||||
to the directory referred to by the file descriptor
|
to the directory referred to by the file descriptor
|
||||||
.IR newdirfd .
|
.IR newdirfd .
|
||||||
|
.PP
|
||||||
The following values can be bitwise ORed in
|
The following values can be bitwise ORed in
|
||||||
.IR flags :
|
.IR flags :
|
||||||
.TP
|
.TP
|
||||||
|
@ -168,7 +168,7 @@ If procfs is mounted,
|
||||||
this can be used as an alternative to
|
this can be used as an alternative to
|
||||||
.BR AT_EMPTY_PATH ,
|
.BR AT_EMPTY_PATH ,
|
||||||
like this:
|
like this:
|
||||||
|
.IP
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
linkat(AT_FDCWD, "/proc/self/fd/<fd>", newdirfd,
|
linkat(AT_FDCWD, "/proc/self/fd/<fd>", newdirfd,
|
||||||
|
@ -309,9 +309,9 @@ capability.
|
||||||
An attempt was made to link to the
|
An attempt was made to link to the
|
||||||
.I /proc/self/fd/NN
|
.I /proc/self/fd/NN
|
||||||
file corresponding to a file descriptor created with
|
file corresponding to a file descriptor created with
|
||||||
|
.IP
|
||||||
open(path, O_TMPFILE | O_EXCL, mode);
|
open(path, O_TMPFILE | O_EXCL, mode);
|
||||||
|
.IP
|
||||||
See
|
See
|
||||||
.BR open (2).
|
.BR open (2).
|
||||||
.TP
|
.TP
|
||||||
|
@ -354,7 +354,7 @@ SVr4, 4.3BSD, POSIX.1-2001 (but see NOTES), POSIX.1-2008.
|
||||||
.\" SVr4 documents additional ENOLINK and
|
.\" SVr4 documents additional ENOLINK and
|
||||||
.\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
|
.\" EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
|
||||||
.\" X/OPEN does not document EFAULT, ENOMEM or EIO.
|
.\" X/OPEN does not document EFAULT, ENOMEM or EIO.
|
||||||
|
.PP
|
||||||
.BR linkat ():
|
.BR linkat ():
|
||||||
POSIX.1-2008.
|
POSIX.1-2008.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
@ -364,7 +364,7 @@ cannot span filesystems.
|
||||||
Use
|
Use
|
||||||
.BR symlink (2)
|
.BR symlink (2)
|
||||||
if this is required.
|
if this is required.
|
||||||
|
.PP
|
||||||
POSIX.1-2001 says that
|
POSIX.1-2001 says that
|
||||||
.BR link ()
|
.BR link ()
|
||||||
should dereference
|
should dereference
|
||||||
|
|
|
@ -60,14 +60,14 @@ marks the socket referred to by
|
||||||
as a passive socket, that is, as a socket that will
|
as a passive socket, that is, as a socket that will
|
||||||
be used to accept incoming connection requests using
|
be used to accept incoming connection requests using
|
||||||
.BR accept (2).
|
.BR accept (2).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I sockfd
|
.I sockfd
|
||||||
argument is a file descriptor that refers to a socket of type
|
argument is a file descriptor that refers to a socket of type
|
||||||
.B SOCK_STREAM
|
.B SOCK_STREAM
|
||||||
or
|
or
|
||||||
.BR SOCK_SEQPACKET .
|
.BR SOCK_SEQPACKET .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I backlog
|
.I backlog
|
||||||
argument defines the maximum length
|
argument defines the maximum length
|
||||||
|
@ -146,7 +146,7 @@ POSIX.1 does not require the inclusion of
|
||||||
and this header file is not required on Linux.
|
and this header file is not required on Linux.
|
||||||
However, some historical (BSD) implementations required this header
|
However, some historical (BSD) implementations required this header
|
||||||
file, and portable applications are probably wise to include it.
|
file, and portable applications are probably wise to include it.
|
||||||
|
.PP
|
||||||
The behavior of the
|
The behavior of the
|
||||||
.I backlog
|
.I backlog
|
||||||
argument on TCP sockets changed with Linux 2.2.
|
argument on TCP sockets changed with Linux 2.2.
|
||||||
|
@ -162,7 +162,7 @@ length and this setting is ignored.
|
||||||
See
|
See
|
||||||
.BR tcp (7)
|
.BR tcp (7)
|
||||||
for more information.
|
for more information.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.I backlog
|
.I backlog
|
||||||
argument is greater than the value in
|
argument is greater than the value in
|
||||||
|
|
|
@ -88,7 +88,7 @@ A single extended attribute
|
||||||
is a null-terminated string.
|
is a null-terminated string.
|
||||||
The name includes a namespace prefix; there may be several, disjoint
|
The name includes a namespace prefix; there may be several, disjoint
|
||||||
namespaces associated with an individual inode.
|
namespaces associated with an individual inode.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I size
|
.I size
|
||||||
is specified as zero, these calls return the current size of the
|
is specified as zero, these calls return the current size of the
|
||||||
|
@ -182,7 +182,7 @@ and
|
||||||
.BR getxattr (2).
|
.BR getxattr (2).
|
||||||
For the file whose pathname is provided as a command-line argument,
|
For the file whose pathname is provided as a command-line argument,
|
||||||
it lists all extended file attributes and their values.
|
it lists all extended file attributes and their values.
|
||||||
|
.PP
|
||||||
To keep the code simple, the program assumes that attribute keys and
|
To keep the code simple, the program assumes that attribute keys and
|
||||||
values are constant during the execution of the program.
|
values are constant during the execution of the program.
|
||||||
A production program should expect and handle changes during
|
A production program should expect and handle changes during
|
||||||
|
@ -199,7 +199,7 @@ with a larger buffer each time it fails with the error
|
||||||
Calls to
|
Calls to
|
||||||
.BR getxattr (2)
|
.BR getxattr (2)
|
||||||
could be handled similarly.
|
could be handled similarly.
|
||||||
|
.PP
|
||||||
The following output was recorded by first creating a file, setting
|
The following output was recorded by first creating a file, setting
|
||||||
some extended file attributes,
|
some extended file attributes,
|
||||||
and then listing the attributes with the example program.
|
and then listing the attributes with the example program.
|
||||||
|
|
|
@ -59,7 +59,7 @@ or
|
||||||
respectively.
|
respectively.
|
||||||
It returns the resulting file position in the argument
|
It returns the resulting file position in the argument
|
||||||
.IR result .
|
.IR result .
|
||||||
|
.PP
|
||||||
This system call exists on various 32-bit platforms to support
|
This system call exists on various 32-bit platforms to support
|
||||||
seeking to large file offsets.
|
seeking to large file offsets.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|
|
@ -35,7 +35,7 @@ Look up the full path of the directory entry specified by the value
|
||||||
The cookie is an opaque identifier uniquely identifying a particular
|
The cookie is an opaque identifier uniquely identifying a particular
|
||||||
directory entry.
|
directory entry.
|
||||||
The buffer given is filled in with the full path of the directory entry.
|
The buffer given is filled in with the full path of the directory entry.
|
||||||
|
.PP
|
||||||
For
|
For
|
||||||
.BR lookup_dcookie ()
|
.BR lookup_dcookie ()
|
||||||
to return successfully,
|
to return successfully,
|
||||||
|
@ -84,7 +84,7 @@ is a special-purpose system call, currently used only by the
|
||||||
.BR oprofile (1)
|
.BR oprofile (1)
|
||||||
profiler.
|
profiler.
|
||||||
It relies on a kernel driver to register cookies for directory entries.
|
It relies on a kernel driver to register cookies for directory entries.
|
||||||
|
.PP
|
||||||
The path returned may be suffixed by the string " (deleted)" if the directory
|
The path returned may be suffixed by the string " (deleted)" if the directory
|
||||||
entry has been removed.
|
entry has been removed.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
|
18
man2/lseek.2
18
man2/lseek.2
|
@ -121,13 +121,13 @@ In both of the above cases,
|
||||||
fails if
|
fails if
|
||||||
.I offset
|
.I offset
|
||||||
points past the end of the file.
|
points past the end of the file.
|
||||||
|
.PP
|
||||||
These operations allow applications to map holes in a sparsely
|
These operations allow applications to map holes in a sparsely
|
||||||
allocated file.
|
allocated file.
|
||||||
This can be useful for applications such as file backup tools,
|
This can be useful for applications such as file backup tools,
|
||||||
which can save space when creating backups and preserve holes,
|
which can save space when creating backups and preserve holes,
|
||||||
if they have a mechanism for discovering holes.
|
if they have a mechanism for discovering holes.
|
||||||
|
.PP
|
||||||
For the purposes of these operations, a hole is a sequence of zeros that
|
For the purposes of these operations, a hole is a sequence of zeros that
|
||||||
(normally) has not been allocated in the underlying file storage.
|
(normally) has not been allocated in the underlying file storage.
|
||||||
However, a filesystem is not obliged to report holes,
|
However, a filesystem is not obliged to report holes,
|
||||||
|
@ -150,7 +150,7 @@ it can be considered to consist of data that is a sequence of zeros).
|
||||||
.\" https://lkml.org/lkml/2011/4/22/79
|
.\" https://lkml.org/lkml/2011/4/22/79
|
||||||
.\" http://lwn.net/Articles/440255/
|
.\" http://lwn.net/Articles/440255/
|
||||||
.\" http://blogs.oracle.com/bonwick/entry/seek_hole_and_seek_data
|
.\" http://blogs.oracle.com/bonwick/entry/seek_hole_and_seek_data
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR _GNU_SOURCE
|
.BR _GNU_SOURCE
|
||||||
feature test macro must be defined in order to obtain the definitions of
|
feature test macro must be defined in order to obtain the definitions of
|
||||||
|
@ -159,7 +159,7 @@ and
|
||||||
.BR SEEK_HOLE
|
.BR SEEK_HOLE
|
||||||
from
|
from
|
||||||
.IR <unistd.h> .
|
.IR <unistd.h> .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR SEEK_HOLE
|
.BR SEEK_HOLE
|
||||||
and
|
and
|
||||||
|
@ -223,7 +223,7 @@ The resulting file offset cannot be represented in an
|
||||||
is associated with a pipe, socket, or FIFO.
|
is associated with a pipe, socket, or FIFO.
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
||||||
|
.PP
|
||||||
.BR SEEK_DATA
|
.BR SEEK_DATA
|
||||||
and
|
and
|
||||||
.BR SEEK_HOLE
|
.BR SEEK_HOLE
|
||||||
|
@ -236,7 +236,7 @@ See
|
||||||
.BR open (2)
|
.BR open (2)
|
||||||
for a discussion of the relationship between file descriptors,
|
for a discussion of the relationship between file descriptors,
|
||||||
open file descriptions, and files.
|
open file descriptions, and files.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.B O_APPEND
|
.B O_APPEND
|
||||||
file status flag is set on the open file description,
|
file status flag is set on the open file description,
|
||||||
|
@ -245,15 +245,15 @@ then a
|
||||||
.I always
|
.I always
|
||||||
moves the file offset to the end of the file, regardless of the use of
|
moves the file offset to the end of the file, regardless of the use of
|
||||||
.BR lseek ().
|
.BR lseek ().
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I off_t
|
.I off_t
|
||||||
data type is a signed integer data type specified by POSIX.1.
|
data type is a signed integer data type specified by POSIX.1.
|
||||||
|
.PP
|
||||||
Some devices are incapable of seeking and POSIX does not specify which
|
Some devices are incapable of seeking and POSIX does not specify which
|
||||||
devices must support
|
devices must support
|
||||||
.BR lseek ().
|
.BR lseek ().
|
||||||
|
.PP
|
||||||
On Linux, using
|
On Linux, using
|
||||||
.BR lseek ()
|
.BR lseek ()
|
||||||
on a terminal device fails with the error
|
on a terminal device fails with the error
|
||||||
|
|
|
@ -67,7 +67,7 @@ and with size
|
||||||
bytes
|
bytes
|
||||||
In most cases,
|
In most cases,
|
||||||
the goal of such advice is to improve system or application performance.
|
the goal of such advice is to improve system or application performance.
|
||||||
|
.PP
|
||||||
Initially, the system call supported a set of "conventional"
|
Initially, the system call supported a set of "conventional"
|
||||||
.I advice
|
.I advice
|
||||||
values, which are also available on several other implementations.
|
values, which are also available on several other implementations.
|
||||||
|
@ -125,7 +125,7 @@ Expect access in the near future.
|
||||||
Do not expect access in the near future.
|
Do not expect access in the near future.
|
||||||
(For the time being, the application is finished with the given range,
|
(For the time being, the application is finished with the given range,
|
||||||
so the kernel can free resources associated with it.)
|
so the kernel can free resources associated with it.)
|
||||||
|
.IP
|
||||||
After a successful
|
After a successful
|
||||||
.B MADV_DONTNEED
|
.B MADV_DONTNEED
|
||||||
operation,
|
operation,
|
||||||
|
@ -136,14 +136,14 @@ up-to-date contents of the underlying mapped file
|
||||||
(for shared file mappings, shared anonymous mappings,
|
(for shared file mappings, shared anonymous mappings,
|
||||||
and shmem-based techniques such as System V shared memory segments)
|
and shmem-based techniques such as System V shared memory segments)
|
||||||
or zero-fill-on-demand pages for anonymous private mappings.
|
or zero-fill-on-demand pages for anonymous private mappings.
|
||||||
|
.IP
|
||||||
Note that, when applied to shared mappings,
|
Note that, when applied to shared mappings,
|
||||||
.BR MADV_DONTNEED
|
.BR MADV_DONTNEED
|
||||||
might not lead to immediate freeing of the pages in the range.
|
might not lead to immediate freeing of the pages in the range.
|
||||||
The kernel is free to delay freeing the pages until an appropriate moment.
|
The kernel is free to delay freeing the pages until an appropriate moment.
|
||||||
The resident set size (RSS) of the calling process will be immediately
|
The resident set size (RSS) of the calling process will be immediately
|
||||||
reduced however.
|
reduced however.
|
||||||
|
.IP
|
||||||
.B MADV_DONTNEED
|
.B MADV_DONTNEED
|
||||||
cannot be applied to locked pages, Huge TLB pages, or
|
cannot be applied to locked pages, Huge TLB pages, or
|
||||||
.BR VM_PFNMAP
|
.BR VM_PFNMAP
|
||||||
|
@ -181,12 +181,12 @@ bytes containing zero.
|
||||||
.\" bufferpool (shared memory segments) - without writing back to
|
.\" bufferpool (shared memory segments) - without writing back to
|
||||||
.\" disk/swap space. This feature is also useful for supporting
|
.\" disk/swap space. This feature is also useful for supporting
|
||||||
.\" hot-plug memory on UML.
|
.\" hot-plug memory on UML.
|
||||||
|
.IP
|
||||||
The specified address range must be mapped shared and writable.
|
The specified address range must be mapped shared and writable.
|
||||||
This flag cannot be applied to locked pages, Huge TLB pages, or
|
This flag cannot be applied to locked pages, Huge TLB pages, or
|
||||||
.BR VM_PFNMAP
|
.BR VM_PFNMAP
|
||||||
pages.
|
pages.
|
||||||
|
.IP
|
||||||
In the initial implementation, only
|
In the initial implementation, only
|
||||||
.BR tmpfs (5)
|
.BR tmpfs (5)
|
||||||
is supported
|
is supported
|
||||||
|
@ -255,7 +255,7 @@ processes.
|
||||||
This operation may result in the calling process receiving a
|
This operation may result in the calling process receiving a
|
||||||
.B SIGBUS
|
.B SIGBUS
|
||||||
and the page being unmapped.
|
and the page being unmapped.
|
||||||
|
.IP
|
||||||
This feature is intended for testing of memory error-handling code;
|
This feature is intended for testing of memory error-handling code;
|
||||||
it is available only if the kernel was configured with
|
it is available only if the kernel was configured with
|
||||||
.BR CONFIG_MEMORY_FAILURE .
|
.BR CONFIG_MEMORY_FAILURE .
|
||||||
|
@ -273,14 +273,14 @@ These are replaced by a single write-protected page (which is automatically
|
||||||
copied if a process later wants to update the content of the page).
|
copied if a process later wants to update the content of the page).
|
||||||
KSM merges only private anonymous pages (see
|
KSM merges only private anonymous pages (see
|
||||||
.BR mmap (2)).
|
.BR mmap (2)).
|
||||||
|
.IP
|
||||||
The KSM feature is intended for applications that generate many
|
The KSM feature is intended for applications that generate many
|
||||||
instances of the same data (e.g., virtualization systems such as KVM).
|
instances of the same data (e.g., virtualization systems such as KVM).
|
||||||
It can consume a lot of processing power; use with care.
|
It can consume a lot of processing power; use with care.
|
||||||
See the Linux kernel source file
|
See the Linux kernel source file
|
||||||
.I Documentation/vm/ksm.txt
|
.I Documentation/vm/ksm.txt
|
||||||
for more details.
|
for more details.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.BR MADV_MERGEABLE
|
.BR MADV_MERGEABLE
|
||||||
and
|
and
|
||||||
|
@ -312,7 +312,7 @@ The effect of the
|
||||||
.B MADV_SOFT_OFFLINE
|
.B MADV_SOFT_OFFLINE
|
||||||
operation is invisible to (i.e., does not change the semantics of)
|
operation is invisible to (i.e., does not change the semantics of)
|
||||||
the calling process.
|
the calling process.
|
||||||
|
.IP
|
||||||
This feature is intended for testing of memory error-handling code;
|
This feature is intended for testing of memory error-handling code;
|
||||||
it is available only if the kernel was configured with
|
it is available only if the kernel was configured with
|
||||||
.BR CONFIG_MEMORY_FAILURE .
|
.BR CONFIG_MEMORY_FAILURE .
|
||||||
|
@ -332,7 +332,7 @@ to replace them with huge pages.
|
||||||
The kernel will also allocate huge pages directly when the region is
|
The kernel will also allocate huge pages directly when the region is
|
||||||
naturally aligned to the huge page size (see
|
naturally aligned to the huge page size (see
|
||||||
.BR posix_memalign (2)).
|
.BR posix_memalign (2)).
|
||||||
|
.IP
|
||||||
This feature is primarily aimed at applications that use large mappings of
|
This feature is primarily aimed at applications that use large mappings of
|
||||||
data and access large regions of that memory at a time (e.g., virtualization
|
data and access large regions of that memory at a time (e.g., virtualization
|
||||||
systems such as QEMU).
|
systems such as QEMU).
|
||||||
|
@ -341,7 +341,7 @@ It can very easily waste memory (e.g., a 2MB mapping that only ever accesses
|
||||||
See the Linux kernel source file
|
See the Linux kernel source file
|
||||||
.I Documentation/vm/transhuge.txt
|
.I Documentation/vm/transhuge.txt
|
||||||
for more details.
|
for more details.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.BR MADV_HUGEPAGE
|
.BR MADV_HUGEPAGE
|
||||||
and
|
and
|
||||||
|
@ -397,7 +397,7 @@ If there is no subsequent write,
|
||||||
the kernel can free the pages at any time.
|
the kernel can free the pages at any time.
|
||||||
Once pages in the range have been freed, the caller will
|
Once pages in the range have been freed, the caller will
|
||||||
see zero-fill-on-demand pages upon subsequent page references.
|
see zero-fill-on-demand pages upon subsequent page references.
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.B MADV_FREE
|
.B MADV_FREE
|
||||||
operation
|
operation
|
||||||
|
@ -496,7 +496,7 @@ Other implementations typically implement at least the flags listed
|
||||||
above under
|
above under
|
||||||
.IR "Conventional advice flags" ,
|
.IR "Conventional advice flags" ,
|
||||||
albeit with some variation in semantics.
|
albeit with some variation in semantics.
|
||||||
|
.PP
|
||||||
POSIX.1-2001 describes
|
POSIX.1-2001 describes
|
||||||
.BR posix_madvise (3)
|
.BR posix_madvise (3)
|
||||||
with constants
|
with constants
|
||||||
|
|
28
man2/mbind.2
28
man2/mbind.2
|
@ -55,7 +55,7 @@ and continuing for
|
||||||
.I len
|
.I len
|
||||||
bytes.
|
bytes.
|
||||||
The memory policy defines from which node memory is allocated.
|
The memory policy defines from which node memory is allocated.
|
||||||
|
.PP
|
||||||
If the memory range specified by the
|
If the memory range specified by the
|
||||||
.IR addr " and " len
|
.IR addr " and " len
|
||||||
arguments includes an "anonymous" region of memory\(emthat is
|
arguments includes an "anonymous" region of memory\(emthat is
|
||||||
|
@ -77,7 +77,7 @@ an initial read access will allocate pages according to the
|
||||||
memory policy of the thread that causes the page to be allocated.
|
memory policy of the thread that causes the page to be allocated.
|
||||||
This may not be the thread that called
|
This may not be the thread that called
|
||||||
.BR mbind ().
|
.BR mbind ().
|
||||||
|
.PP
|
||||||
The specified policy will be ignored for any
|
The specified policy will be ignored for any
|
||||||
.B MAP_SHARED
|
.B MAP_SHARED
|
||||||
mappings in the specified memory range.
|
mappings in the specified memory range.
|
||||||
|
@ -85,7 +85,7 @@ Rather the pages will be allocated according to the memory policy
|
||||||
of the thread that caused the page to be allocated.
|
of the thread that caused the page to be allocated.
|
||||||
Again, this may not be the thread that called
|
Again, this may not be the thread that called
|
||||||
.BR mbind ().
|
.BR mbind ().
|
||||||
|
.PP
|
||||||
If the specified memory range includes a shared memory region
|
If the specified memory range includes a shared memory region
|
||||||
created using the
|
created using the
|
||||||
.BR shmget (2)
|
.BR shmget (2)
|
||||||
|
@ -102,7 +102,7 @@ the huge pages will be allocated according to the policy specified
|
||||||
only if the page allocation is caused by the process that calls
|
only if the page allocation is caused by the process that calls
|
||||||
.BR mbind ()
|
.BR mbind ()
|
||||||
for that region.
|
for that region.
|
||||||
|
.PP
|
||||||
By default,
|
By default,
|
||||||
.BR mbind ()
|
.BR mbind ()
|
||||||
has an effect only for new allocations; if the pages inside
|
has an effect only for new allocations; if the pages inside
|
||||||
|
@ -113,7 +113,7 @@ This default behavior may be overridden by the
|
||||||
and
|
and
|
||||||
.B MPOL_MF_MOVE_ALL
|
.B MPOL_MF_MOVE_ALL
|
||||||
flags described below.
|
flags described below.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument must specify one of
|
argument must specify one of
|
||||||
|
@ -130,7 +130,7 @@ require the caller to specify the node or nodes to which the mode applies,
|
||||||
via the
|
via the
|
||||||
.I nodemask
|
.I nodemask
|
||||||
argument.
|
argument.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument may also include an optional
|
argument may also include an optional
|
||||||
|
@ -182,7 +182,7 @@ allowed by the thread's current cpuset context
|
||||||
.B MPOL_F_STATIC_NODES
|
.B MPOL_F_STATIC_NODES
|
||||||
mode flag is specified),
|
mode flag is specified),
|
||||||
and contains memory.
|
and contains memory.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument must include one of the following values:
|
argument must include one of the following values:
|
||||||
|
@ -296,7 +296,7 @@ if the existing pages in the memory range don't follow the policy.
|
||||||
.\" --Lee Schermerhorn
|
.\" --Lee Schermerhorn
|
||||||
.\" In 2.6.16 or later the kernel will also try to move pages
|
.\" In 2.6.16 or later the kernel will also try to move pages
|
||||||
.\" to the requested node with this flag.
|
.\" to the requested node with this flag.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.B MPOL_MF_MOVE
|
.B MPOL_MF_MOVE
|
||||||
is specified in
|
is specified in
|
||||||
|
@ -309,7 +309,7 @@ If
|
||||||
is also specified, then the call will fail with the error
|
is also specified, then the call will fail with the error
|
||||||
.B EIO
|
.B EIO
|
||||||
if some pages could not be moved.
|
if some pages could not be moved.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.B MPOL_MF_MOVE_ALL
|
.B MPOL_MF_MOVE_ALL
|
||||||
is passed in
|
is passed in
|
||||||
|
@ -427,12 +427,12 @@ This system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
For information on library support, see
|
For information on library support, see
|
||||||
.BR numa (7).
|
.BR numa (7).
|
||||||
|
.PP
|
||||||
NUMA policy is not supported on a memory-mapped file range
|
NUMA policy is not supported on a memory-mapped file range
|
||||||
that was mapped with the
|
that was mapped with the
|
||||||
.B MAP_SHARED
|
.B MAP_SHARED
|
||||||
flag.
|
flag.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B MPOL_DEFAULT
|
.B MPOL_DEFAULT
|
||||||
mode can have different effects for
|
mode can have different effects for
|
||||||
|
@ -466,14 +466,14 @@ with an empty set of nodes.
|
||||||
This method will work for
|
This method will work for
|
||||||
.BR set_mempolicy (2),
|
.BR set_mempolicy (2),
|
||||||
as well.
|
as well.
|
||||||
|
.PP
|
||||||
Support for huge page policy was added with 2.6.16.
|
Support for huge page policy was added with 2.6.16.
|
||||||
For interleave policy to be effective on huge page mappings the
|
For interleave policy to be effective on huge page mappings the
|
||||||
policied memory needs to be tens of megabytes or larger.
|
policied memory needs to be tens of megabytes or larger.
|
||||||
|
.PP
|
||||||
.B MPOL_MF_STRICT
|
.B MPOL_MF_STRICT
|
||||||
is ignored on huge page mappings.
|
is ignored on huge page mappings.
|
||||||
|
.PP
|
||||||
.B MPOL_MF_MOVE
|
.B MPOL_MF_MOVE
|
||||||
and
|
and
|
||||||
.B MPOL_MF_MOVE_ALL
|
.B MPOL_MF_MOVE_ALL
|
||||||
|
|
|
@ -39,12 +39,12 @@ effectively is
|
||||||
.I not
|
.I not
|
||||||
as simple as replacing memory barriers with this
|
as simple as replacing memory barriers with this
|
||||||
system call, but requires understanding of the details below.
|
system call, but requires understanding of the details below.
|
||||||
|
.PP
|
||||||
Use of memory barriers needs to be done taking into account that a
|
Use of memory barriers needs to be done taking into account that a
|
||||||
memory barrier always needs to be either matched with its memory barrier
|
memory barrier always needs to be either matched with its memory barrier
|
||||||
counterparts, or that the architecture's memory model doesn't require the
|
counterparts, or that the architecture's memory model doesn't require the
|
||||||
matching barriers.
|
matching barriers.
|
||||||
|
.PP
|
||||||
There are cases where one side of the matching barriers (which we will
|
There are cases where one side of the matching barriers (which we will
|
||||||
refer to as "fast side") is executed much more often than the other
|
refer to as "fast side") is executed much more often than the other
|
||||||
(which we will refer to as "slow side").
|
(which we will refer to as "slow side").
|
||||||
|
@ -53,18 +53,18 @@ This is a prime target for the use of
|
||||||
The key idea is to replace, for these matching
|
The key idea is to replace, for these matching
|
||||||
barriers, the fast-side memory barriers by simple compiler barriers,
|
barriers, the fast-side memory barriers by simple compiler barriers,
|
||||||
for example:
|
for example:
|
||||||
|
.PP
|
||||||
asm volatile ("" : : : "memory")
|
asm volatile ("" : : : "memory")
|
||||||
|
.PP
|
||||||
and replace the slow-side memory barriers by calls to
|
and replace the slow-side memory barriers by calls to
|
||||||
.BR membarrier ().
|
.BR membarrier ().
|
||||||
|
.PP
|
||||||
This will add overhead to the slow side, and remove overhead from the
|
This will add overhead to the slow side, and remove overhead from the
|
||||||
fast side, thus resulting in an overall performance increase as long as
|
fast side, thus resulting in an overall performance increase as long as
|
||||||
the slow side is infrequent enough that the overhead of the
|
the slow side is infrequent enough that the overhead of the
|
||||||
.BR membarrier ()
|
.BR membarrier ()
|
||||||
calls does not outweigh the performance gain on the fast side.
|
calls does not outweigh the performance gain on the fast side.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I cmd
|
.I cmd
|
||||||
argument is one of the following:
|
argument is one of the following:
|
||||||
|
@ -95,7 +95,7 @@ argument is currently unused and must be specified as 0.
|
||||||
All memory accesses performed in program order from each targeted thread
|
All memory accesses performed in program order from each targeted thread
|
||||||
are guaranteed to be ordered with respect to
|
are guaranteed to be ordered with respect to
|
||||||
.BR membarrier ().
|
.BR membarrier ().
|
||||||
|
.PP
|
||||||
If we use the semantic
|
If we use the semantic
|
||||||
.I barrier()
|
.I barrier()
|
||||||
to represent a compiler barrier forcing memory
|
to represent a compiler barrier forcing memory
|
||||||
|
@ -109,7 +109,7 @@ each pairing of
|
||||||
and
|
and
|
||||||
.IR smp_mb() .
|
.IR smp_mb() .
|
||||||
The pair ordering is detailed as (O: ordered, X: not ordered):
|
The pair ordering is detailed as (O: ordered, X: not ordered):
|
||||||
|
.PP
|
||||||
barrier() smp_mb() membarrier()
|
barrier() smp_mb() membarrier()
|
||||||
barrier() X X O
|
barrier() X X O
|
||||||
smp_mb() X O O
|
smp_mb() X O O
|
||||||
|
@ -124,7 +124,7 @@ On error, \-1 is returned,
|
||||||
and
|
and
|
||||||
.I errno
|
.I errno
|
||||||
is set appropriately.
|
is set appropriately.
|
||||||
|
.PP
|
||||||
For a given command, with
|
For a given command, with
|
||||||
.I flags
|
.I flags
|
||||||
set to 0, this system call is
|
set to 0, this system call is
|
||||||
|
@ -171,10 +171,10 @@ matching barriers on other cores.
|
||||||
For instance, a load fence can order
|
For instance, a load fence can order
|
||||||
loads prior to and following that fence with respect to stores ordered
|
loads prior to and following that fence with respect to stores ordered
|
||||||
by store fences.
|
by store fences.
|
||||||
|
.PP
|
||||||
Program order is the order in which instructions are ordered in the
|
Program order is the order in which instructions are ordered in the
|
||||||
program assembly code.
|
program assembly code.
|
||||||
|
.PP
|
||||||
Examples where
|
Examples where
|
||||||
.BR membarrier ()
|
.BR membarrier ()
|
||||||
can be useful include implementations
|
can be useful include implementations
|
||||||
|
@ -184,7 +184,7 @@ Assuming a multithreaded application where "fast_path()" is executed
|
||||||
very frequently, and where "slow_path()" is executed infrequently, the
|
very frequently, and where "slow_path()" is executed infrequently, the
|
||||||
following code (x86) can be transformed using
|
following code (x86) can be transformed using
|
||||||
.BR membarrier ():
|
.BR membarrier ():
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -230,11 +230,11 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
The code above transformed to use
|
The code above transformed to use
|
||||||
.BR membarrier ()
|
.BR membarrier ()
|
||||||
becomes:
|
becomes:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
|
@ -51,14 +51,14 @@ memory allocations such as those allocated using
|
||||||
with the
|
with the
|
||||||
.BR MAP_ANONYMOUS
|
.BR MAP_ANONYMOUS
|
||||||
flag.
|
flag.
|
||||||
|
.PP
|
||||||
The initial size of the file is set to 0.
|
The initial size of the file is set to 0.
|
||||||
Following the call, the file size should be set using
|
Following the call, the file size should be set using
|
||||||
.BR ftruncate (2).
|
.BR ftruncate (2).
|
||||||
(Alternatively, the file may be populated by calls to
|
(Alternatively, the file may be populated by calls to
|
||||||
.BR write (2)
|
.BR write (2)
|
||||||
or similar.)
|
or similar.)
|
||||||
|
.PP
|
||||||
The name supplied in
|
The name supplied in
|
||||||
.I name
|
.I name
|
||||||
is used as a filename and will be displayed
|
is used as a filename and will be displayed
|
||||||
|
@ -69,7 +69,7 @@ The displayed name is always prefixed with
|
||||||
and serves only for debugging purposes.
|
and serves only for debugging purposes.
|
||||||
Names do not affect the behavior of the file descriptor,
|
Names do not affect the behavior of the file descriptor,
|
||||||
and as such multiple files can have the same name without any side effects.
|
and as such multiple files can have the same name without any side effects.
|
||||||
|
.PP
|
||||||
The following values may be bitwise ORed in
|
The following values may be bitwise ORed in
|
||||||
.IR flags
|
.IR flags
|
||||||
to change the behavior of
|
to change the behavior of
|
||||||
|
@ -104,7 +104,7 @@ meaning that no other seals can be set on the file.
|
||||||
Unused bits in
|
Unused bits in
|
||||||
.I flags
|
.I flags
|
||||||
must be 0.
|
must be 0.
|
||||||
|
.PP
|
||||||
As its return value,
|
As its return value,
|
||||||
.BR memfd_create ()
|
.BR memfd_create ()
|
||||||
returns a new file descriptor that can be used to refer to the file.
|
returns a new file descriptor that can be used to refer to the file.
|
||||||
|
@ -113,7 +113,7 @@ This file descriptor is opened for both reading and writing
|
||||||
and
|
and
|
||||||
.B O_LARGEFILE
|
.B O_LARGEFILE
|
||||||
is set for the file descriptor.
|
is set for the file descriptor.
|
||||||
|
.PP
|
||||||
With respect to
|
With respect to
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
and
|
and
|
||||||
|
@ -166,7 +166,7 @@ system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Glibc does not provide a wrapper for this system call; call it using
|
Glibc does not provide a wrapper for this system call; call it using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
.\" See also http://lwn.net/Articles/593918/
|
.\" See also http://lwn.net/Articles/593918/
|
||||||
.\" and http://lwn.net/Articles/594919/ and http://lwn.net/Articles/591108/
|
.\" and http://lwn.net/Articles/594919/ and http://lwn.net/Articles/591108/
|
||||||
The
|
The
|
||||||
|
@ -179,7 +179,7 @@ The primary purpose of
|
||||||
is to create files and associated file descriptors that are
|
is to create files and associated file descriptors that are
|
||||||
used with the file-sealing APIs provided by
|
used with the file-sealing APIs provided by
|
||||||
.BR fcntl (2).
|
.BR fcntl (2).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR memfd_create ()
|
.BR memfd_create ()
|
||||||
system call also has uses without file sealing
|
system call also has uses without file sealing
|
||||||
|
@ -211,13 +211,13 @@ location in the shared memory region.
|
||||||
(Dealing with this possibility necessitates the use of a handler for the
|
(Dealing with this possibility necessitates the use of a handler for the
|
||||||
.BR SIGBUS
|
.BR SIGBUS
|
||||||
signal.)
|
signal.)
|
||||||
|
.PP
|
||||||
Dealing with untrusted peers imposes extra complexity on
|
Dealing with untrusted peers imposes extra complexity on
|
||||||
code that employs shared memory.
|
code that employs shared memory.
|
||||||
Memory sealing enables that extra complexity to be eliminated,
|
Memory sealing enables that extra complexity to be eliminated,
|
||||||
by allowing a process to operate secure in the knowledge that
|
by allowing a process to operate secure in the knowledge that
|
||||||
its peer can't modify the shared memory in an undesired fashion.
|
its peer can't modify the shared memory in an undesired fashion.
|
||||||
|
.PP
|
||||||
An example of the usage of the sealing mechanism is as follows:
|
An example of the usage of the sealing mechanism is as follows:
|
||||||
.IP 1. 3
|
.IP 1. 3
|
||||||
The first process creates a
|
The first process creates a
|
||||||
|
@ -297,7 +297,7 @@ seal has not yet been applied).
|
||||||
Below are shown two example programs that demonstrate the use of
|
Below are shown two example programs that demonstrate the use of
|
||||||
.BR memfd_create ()
|
.BR memfd_create ()
|
||||||
and the file sealing API.
|
and the file sealing API.
|
||||||
|
.PP
|
||||||
The first program,
|
The first program,
|
||||||
.IR t_memfd_create.c ,
|
.IR t_memfd_create.c ,
|
||||||
creates a
|
creates a
|
||||||
|
@ -312,18 +312,18 @@ The first argument is the name to associate with the file,
|
||||||
the second argument is the size to be set for the file,
|
the second argument is the size to be set for the file,
|
||||||
and the optional third argument is a string of characters that specify
|
and the optional third argument is a string of characters that specify
|
||||||
seals to be set on file.
|
seals to be set on file.
|
||||||
|
.PP
|
||||||
The second program,
|
The second program,
|
||||||
.IR t_get_seals.c ,
|
.IR t_get_seals.c ,
|
||||||
can be used to open an existing file that was created via
|
can be used to open an existing file that was created via
|
||||||
.BR memfd_create ()
|
.BR memfd_create ()
|
||||||
and inspect the set of seals that have been applied to that file.
|
and inspect the set of seals that have been applied to that file.
|
||||||
|
.PP
|
||||||
The following shell session demonstrates the use of these programs.
|
The following shell session demonstrates the use of these programs.
|
||||||
First we create a
|
First we create a
|
||||||
.BR tmpfs (5)
|
.BR tmpfs (5)
|
||||||
file and set some seals on it:
|
file and set some seals on it:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
$ \fB./t_memfd_create my_memfd_file 4096 sw &\fP
|
$ \fB./t_memfd_create my_memfd_file 4096 sw &\fP
|
||||||
|
@ -331,7 +331,7 @@ $ \fB./t_memfd_create my_memfd_file 4096 sw &\fP
|
||||||
PID: 11775; fd: 3; /proc/11775/fd/3
|
PID: 11775; fd: 3; /proc/11775/fd/3
|
||||||
.fi
|
.fi
|
||||||
.in
|
.in
|
||||||
|
.PP
|
||||||
At this point, the
|
At this point, the
|
||||||
.I t_memfd_create
|
.I t_memfd_create
|
||||||
program continues to run in the background.
|
program continues to run in the background.
|
||||||
|
@ -347,7 +347,7 @@ Using that pathname, we inspect the content of the
|
||||||
symbolic link, and use our
|
symbolic link, and use our
|
||||||
.I t_get_seals
|
.I t_get_seals
|
||||||
program to view the seals that have been placed on the file:
|
program to view the seals that have been placed on the file:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
$ \fBreadlink /proc/11775/fd/3\fP
|
$ \fBreadlink /proc/11775/fd/3\fP
|
||||||
|
|
|
@ -44,7 +44,7 @@ the kernel maintains the relative topology relationship inside
|
||||||
.I old_nodes
|
.I old_nodes
|
||||||
during the migration to
|
during the migration to
|
||||||
.IR new_nodes .
|
.IR new_nodes .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I old_nodes
|
.I old_nodes
|
||||||
and
|
and
|
||||||
|
@ -66,7 +66,7 @@ as in
|
||||||
.BR mbind (2),
|
.BR mbind (2),
|
||||||
but different from
|
but different from
|
||||||
.BR select (2)).
|
.BR select (2)).
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I pid
|
.I pid
|
||||||
argument is the ID of the process whose pages are to be moved.
|
argument is the ID of the process whose pages are to be moved.
|
||||||
|
@ -80,7 +80,7 @@ If
|
||||||
is 0, then
|
is 0, then
|
||||||
.BR migrate_pages ()
|
.BR migrate_pages ()
|
||||||
moves pages of the calling process.
|
moves pages of the calling process.
|
||||||
|
.PP
|
||||||
Pages shared with another process will be moved only if the initiating
|
Pages shared with another process will be moved only if the initiating
|
||||||
process has the
|
process has the
|
||||||
.B CAP_SYS_NICE
|
.B CAP_SYS_NICE
|
||||||
|
@ -142,7 +142,7 @@ This system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
For information on library support, see
|
For information on library support, see
|
||||||
.BR numa (7).
|
.BR numa (7).
|
||||||
|
.PP
|
||||||
Use
|
Use
|
||||||
.BR get_mempolicy (2)
|
.BR get_mempolicy (2)
|
||||||
with the
|
with the
|
||||||
|
@ -151,7 +151,7 @@ flag to obtain the set of nodes that are allowed by
|
||||||
the calling process's cpuset.
|
the calling process's cpuset.
|
||||||
Note that this information is subject to change at any
|
Note that this information is subject to change at any
|
||||||
time by manual or automatic reconfiguration of the cpuset.
|
time by manual or automatic reconfiguration of the cpuset.
|
||||||
|
.PP
|
||||||
Use of
|
Use of
|
||||||
.BR migrate_pages ()
|
.BR migrate_pages ()
|
||||||
may result in pages whose location
|
may result in pages whose location
|
||||||
|
@ -163,7 +163,7 @@ and/or the specified process (see
|
||||||
That is, memory policy does not constrain the destination
|
That is, memory policy does not constrain the destination
|
||||||
nodes used by
|
nodes used by
|
||||||
.BR migrate_pages ().
|
.BR migrate_pages ().
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I <numaif.h>
|
.I <numaif.h>
|
||||||
header is not included with glibc, but requires installing
|
header is not included with glibc, but requires installing
|
||||||
|
@ -179,6 +179,6 @@ or a similar package.
|
||||||
.BR numa (7),
|
.BR numa (7),
|
||||||
.BR migratepages (8),
|
.BR migratepages (8),
|
||||||
.BR numastat (8)
|
.BR numastat (8)
|
||||||
|
.PP
|
||||||
.IR Documentation/vm/page_migration
|
.IR Documentation/vm/page_migration
|
||||||
in the Linux kernel source tree
|
in the Linux kernel source tree
|
||||||
|
|
|
@ -62,7 +62,7 @@ starting at the address
|
||||||
and continuing for
|
and continuing for
|
||||||
.I length
|
.I length
|
||||||
bytes.
|
bytes.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I addr
|
.I addr
|
||||||
argument must be a multiple of the system page size.
|
argument must be a multiple of the system page size.
|
||||||
|
@ -76,7 +76,7 @@ One may obtain the page size
|
||||||
.RB ( PAGE_SIZE )
|
.RB ( PAGE_SIZE )
|
||||||
using
|
using
|
||||||
.IR sysconf(_SC_PAGESIZE) .
|
.IR sysconf(_SC_PAGESIZE) .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I vec
|
.I vec
|
||||||
argument must point to an array containing at least
|
argument must point to an array containing at least
|
||||||
|
|
14
man2/mkdir.2
14
man2/mkdir.2
|
@ -48,7 +48,7 @@ _ATFILE_SOURCE
|
||||||
.BR mkdir ()
|
.BR mkdir ()
|
||||||
attempts to create a directory named
|
attempts to create a directory named
|
||||||
.IR pathname .
|
.IR pathname .
|
||||||
|
.PP
|
||||||
The argument
|
The argument
|
||||||
.I mode
|
.I mode
|
||||||
specifies the mode for the new directory (see
|
specifies the mode for the new directory (see
|
||||||
|
@ -62,7 +62,7 @@ Whether other
|
||||||
.I mode
|
.I mode
|
||||||
bits are honored for the created directory depends on the operating system.
|
bits are honored for the created directory depends on the operating system.
|
||||||
For Linux, see NOTES below.
|
For Linux, see NOTES below.
|
||||||
|
.PP
|
||||||
The newly created directory will be owned by the effective user ID of the
|
The newly created directory will be owned by the effective user ID of the
|
||||||
process.
|
process.
|
||||||
If the directory containing the file has the set-group-ID
|
If the directory containing the file has the set-group-ID
|
||||||
|
@ -72,7 +72,7 @@ or, synonymously
|
||||||
.IR "mount -o grpid" ),
|
.IR "mount -o grpid" ),
|
||||||
the new directory will inherit the group ownership from its parent;
|
the new directory will inherit the group ownership from its parent;
|
||||||
otherwise it will be owned by the effective group ID of the process.
|
otherwise it will be owned by the effective group ID of the process.
|
||||||
|
.PP
|
||||||
If the parent directory has the set-group-ID bit set, then so will the
|
If the parent directory has the set-group-ID bit set, then so will the
|
||||||
newly created directory.
|
newly created directory.
|
||||||
.\"
|
.\"
|
||||||
|
@ -83,7 +83,7 @@ The
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR mkdir (),
|
.BR mkdir (),
|
||||||
except for the differences described here.
|
except for the differences described here.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -93,7 +93,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR mkdir ()
|
.BR mkdir ()
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -105,7 +105,7 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR mkdir ()).
|
.BR mkdir ()).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
|
@ -209,7 +209,7 @@ library support was added to glibc in version 2.4.
|
||||||
.BR mkdir ():
|
.BR mkdir ():
|
||||||
SVr4, BSD, POSIX.1-2001, POSIX.1-2008.
|
SVr4, BSD, POSIX.1-2001, POSIX.1-2008.
|
||||||
.\" SVr4 documents additional EIO, EMULTIHOP
|
.\" SVr4 documents additional EIO, EMULTIHOP
|
||||||
|
.PP
|
||||||
.BR mkdirat ():
|
.BR mkdirat ():
|
||||||
POSIX.1-2008.
|
POSIX.1-2008.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
|
24
man2/mknod.2
24
man2/mknod.2
|
@ -55,7 +55,7 @@ with attributes specified by
|
||||||
.I mode
|
.I mode
|
||||||
and
|
and
|
||||||
.IR dev .
|
.IR dev .
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument specifies both the file mode to use and the type of node
|
argument specifies both the file mode to use and the type of node
|
||||||
|
@ -63,13 +63,13 @@ to be created.
|
||||||
It should be a combination (using bitwise OR) of one of the file types
|
It should be a combination (using bitwise OR) of one of the file types
|
||||||
listed below and zero or more of the file mode bits listed in
|
listed below and zero or more of the file mode bits listed in
|
||||||
.BR inode (7).
|
.BR inode (7).
|
||||||
|
.PP
|
||||||
The file mode is modified by the process's
|
The file mode is modified by the process's
|
||||||
.I umask
|
.I umask
|
||||||
in the usual way: in the absence of a default ACL, the permissions of the
|
in the usual way: in the absence of a default ACL, the permissions of the
|
||||||
created node are
|
created node are
|
||||||
.RI ( mode " & ~" umask ).
|
.RI ( mode " & ~" umask ).
|
||||||
|
.PP
|
||||||
The file type must be one of
|
The file type must be one of
|
||||||
.BR S_IFREG ,
|
.BR S_IFREG ,
|
||||||
.BR S_IFCHR ,
|
.BR S_IFCHR ,
|
||||||
|
@ -83,7 +83,7 @@ special file, block special file, FIFO (named pipe), or UNIX domain socket,
|
||||||
respectively.
|
respectively.
|
||||||
(Zero file type is equivalent to type
|
(Zero file type is equivalent to type
|
||||||
.BR S_IFREG .)
|
.BR S_IFREG .)
|
||||||
|
.PP
|
||||||
If the file type is
|
If the file type is
|
||||||
.B S_IFCHR
|
.B S_IFCHR
|
||||||
or
|
or
|
||||||
|
@ -96,13 +96,13 @@ special file
|
||||||
may be useful to build the value for
|
may be useful to build the value for
|
||||||
.IR dev );
|
.IR dev );
|
||||||
otherwise it is ignored.
|
otherwise it is ignored.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
already exists, or is a symbolic link, this call fails with an
|
already exists, or is a symbolic link, this call fails with an
|
||||||
.B EEXIST
|
.B EEXIST
|
||||||
error.
|
error.
|
||||||
|
.PP
|
||||||
The newly created node will be owned by the effective user ID of the
|
The newly created node will be owned by the effective user ID of the
|
||||||
process.
|
process.
|
||||||
If the directory containing the node has the set-group-ID
|
If the directory containing the node has the set-group-ID
|
||||||
|
@ -117,7 +117,7 @@ The
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR mknod (),
|
.BR mknod (),
|
||||||
except for the differences described here.
|
except for the differences described here.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -127,7 +127,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR mknod ()
|
.BR mknod ()
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -139,7 +139,7 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR mknod ()).
|
.BR mknod ()).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
|
@ -251,7 +251,7 @@ SVr4, 4.4BSD, POSIX.1-2001 (but see below), POSIX.1-2008.
|
||||||
.\" The Linux version differs from the SVr4 version in that it
|
.\" The Linux version differs from the SVr4 version in that it
|
||||||
.\" does not require root permission to create pipes, also in that no
|
.\" does not require root permission to create pipes, also in that no
|
||||||
.\" EMULTIHOP, ENOLINK, or EINTR error is documented.
|
.\" EMULTIHOP, ENOLINK, or EINTR error is documented.
|
||||||
|
.PP
|
||||||
.BR mknodat ():
|
.BR mknodat ():
|
||||||
POSIX.1-2008.
|
POSIX.1-2008.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
@ -272,14 +272,14 @@ However, nowadays one should never use
|
||||||
for this purpose; one should use
|
for this purpose; one should use
|
||||||
.BR mkfifo (3),
|
.BR mkfifo (3),
|
||||||
a function especially defined for this purpose.
|
a function especially defined for this purpose.
|
||||||
|
.PP
|
||||||
Under Linux,
|
Under Linux,
|
||||||
.BR mknod ()
|
.BR mknod ()
|
||||||
cannot be used to create directories.
|
cannot be used to create directories.
|
||||||
One should make directories with
|
One should make directories with
|
||||||
.BR mkdir (2).
|
.BR mkdir (2).
|
||||||
.\" and one should make UNIX domain sockets with socket(2) and bind(2).
|
.\" and one should make UNIX domain sockets with socket(2) and bind(2).
|
||||||
|
.PP
|
||||||
There are many infelicities in the protocol underlying NFS.
|
There are many infelicities in the protocol underlying NFS.
|
||||||
Some of these affect
|
Some of these affect
|
||||||
.BR mknod ()
|
.BR mknod ()
|
||||||
|
|
44
man2/mlock.2
44
man2/mlock.2
|
@ -45,7 +45,7 @@ and
|
||||||
lock part or all of the calling process's virtual address
|
lock part or all of the calling process's virtual address
|
||||||
space into RAM, preventing that memory from being paged to the
|
space into RAM, preventing that memory from being paged to the
|
||||||
swap area.
|
swap area.
|
||||||
|
.PP
|
||||||
.BR munlock ()
|
.BR munlock ()
|
||||||
and
|
and
|
||||||
.BR munlockall ()
|
.BR munlockall ()
|
||||||
|
@ -53,7 +53,7 @@ perform the converse operation,
|
||||||
unlocking part or all of the calling process's virtual
|
unlocking part or all of the calling process's virtual
|
||||||
address space, so that pages in the specified virtual address range may
|
address space, so that pages in the specified virtual address range may
|
||||||
once more to be swapped out if required by the kernel memory manager.
|
once more to be swapped out if required by the kernel memory manager.
|
||||||
|
.PP
|
||||||
Memory locking and unlocking are performed in units of whole pages.
|
Memory locking and unlocking are performed in units of whole pages.
|
||||||
.SS mlock(), mlock2(), and munlock()
|
.SS mlock(), mlock2(), and munlock()
|
||||||
.BR mlock ()
|
.BR mlock ()
|
||||||
|
@ -65,7 +65,7 @@ bytes.
|
||||||
All pages that contain a part of the specified address range are
|
All pages that contain a part of the specified address range are
|
||||||
guaranteed to be resident in RAM when the call returns successfully;
|
guaranteed to be resident in RAM when the call returns successfully;
|
||||||
the pages are guaranteed to stay in RAM until later unlocked.
|
the pages are guaranteed to stay in RAM until later unlocked.
|
||||||
|
.PP
|
||||||
.BR mlock2 ()
|
.BR mlock2 ()
|
||||||
.\" commit a8ca5d0ecbdde5cc3d7accacbd69968b0c98764e
|
.\" commit a8ca5d0ecbdde5cc3d7accacbd69968b0c98764e
|
||||||
.\" commit de60f5f10c58d4f34b68622442c0e04180367f3f
|
.\" commit de60f5f10c58d4f34b68622442c0e04180367f3f
|
||||||
|
@ -79,7 +79,7 @@ However, the state of the pages contained in that range after the call
|
||||||
returns successfully will depend on the value in the
|
returns successfully will depend on the value in the
|
||||||
.I flags
|
.I flags
|
||||||
argument.
|
argument.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument can be either 0 or the following constant:
|
argument can be either 0 or the following constant:
|
||||||
|
@ -88,19 +88,19 @@ argument can be either 0 or the following constant:
|
||||||
Lock pages that are currently resident and mark the entire range to have
|
Lock pages that are currently resident and mark the entire range to have
|
||||||
pages locked when they are populated by the page fault.
|
pages locked when they are populated by the page fault.
|
||||||
.PP
|
.PP
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I flags
|
.I flags
|
||||||
is 0,
|
is 0,
|
||||||
.BR mlock2 ()
|
.BR mlock2 ()
|
||||||
behaves exactly the same as
|
behaves exactly the same as
|
||||||
.BR mlock ().
|
.BR mlock ().
|
||||||
|
.PP
|
||||||
Note: currently, there is not a glibc wrapper for
|
Note: currently, there is not a glibc wrapper for
|
||||||
.BR mlock2 (),
|
.BR mlock2 (),
|
||||||
so it will need to be invoked using
|
so it will need to be invoked using
|
||||||
.BR syscall (2).
|
.BR syscall (2).
|
||||||
|
.PP
|
||||||
.BR munlock ()
|
.BR munlock ()
|
||||||
unlocks pages in the address range starting at
|
unlocks pages in the address range starting at
|
||||||
.I addr
|
.I addr
|
||||||
|
@ -119,7 +119,7 @@ memory, and memory-mapped files.
|
||||||
All mapped pages are guaranteed
|
All mapped pages are guaranteed
|
||||||
to be resident in RAM when the call returns successfully;
|
to be resident in RAM when the call returns successfully;
|
||||||
the pages are guaranteed to stay in RAM until later unlocked.
|
the pages are guaranteed to stay in RAM until later unlocked.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument is constructed as the bitwise OR of one or more of the
|
argument is constructed as the bitwise OR of one or more of the
|
||||||
|
@ -175,7 +175,7 @@ In the same circumstances, stack growth may likewise fail:
|
||||||
the kernel will deny stack expansion and deliver a
|
the kernel will deny stack expansion and deliver a
|
||||||
.B SIGSEGV
|
.B SIGSEGV
|
||||||
signal to the process.
|
signal to the process.
|
||||||
|
.PP
|
||||||
.BR munlockall ()
|
.BR munlockall ()
|
||||||
unlocks all pages mapped into the address space of the
|
unlocks all pages mapped into the address space of the
|
||||||
calling process.
|
calling process.
|
||||||
|
@ -275,7 +275,7 @@ For
|
||||||
is available since Linux 4.4.
|
is available since Linux 4.4.
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008, SVr4.
|
POSIX.1-2001, POSIX.1-2008, SVr4.
|
||||||
|
.PP
|
||||||
mlock2 ()
|
mlock2 ()
|
||||||
is Linux specific.
|
is Linux specific.
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
|
@ -290,7 +290,7 @@ can be determined from the constant
|
||||||
.B PAGESIZE
|
.B PAGESIZE
|
||||||
(if defined) in \fI<limits.h>\fP or by calling
|
(if defined) in \fI<limits.h>\fP or by calling
|
||||||
.IR sysconf(_SC_PAGESIZE) .
|
.IR sysconf(_SC_PAGESIZE) .
|
||||||
|
.PP
|
||||||
On POSIX systems on which
|
On POSIX systems on which
|
||||||
.BR mlockall ()
|
.BR mlockall ()
|
||||||
and
|
and
|
||||||
|
@ -321,7 +321,7 @@ software has erased the secrets in RAM and terminated.
|
||||||
(But be aware that the suspend mode on laptops and some desktop
|
(But be aware that the suspend mode on laptops and some desktop
|
||||||
computers will save a copy of the system's RAM to disk, regardless
|
computers will save a copy of the system's RAM to disk, regardless
|
||||||
of memory locks.)
|
of memory locks.)
|
||||||
|
.PP
|
||||||
Real-time processes that are using
|
Real-time processes that are using
|
||||||
.BR mlockall ()
|
.BR mlockall ()
|
||||||
to prevent delays on page faults should reserve enough
|
to prevent delays on page faults should reserve enough
|
||||||
|
@ -334,7 +334,7 @@ This way, enough pages will be mapped for the stack and can be
|
||||||
locked into RAM.
|
locked into RAM.
|
||||||
The dummy writes ensure that not even copy-on-write
|
The dummy writes ensure that not even copy-on-write
|
||||||
page faults can occur in the critical section.
|
page faults can occur in the critical section.
|
||||||
|
.PP
|
||||||
Memory locks are not inherited by a child created via
|
Memory locks are not inherited by a child created via
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
and are automatically removed (unlocked) during an
|
and are automatically removed (unlocked) during an
|
||||||
|
@ -349,7 +349,7 @@ settings are not inherited by a child created via
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
and are cleared during an
|
and are cleared during an
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
.PP
|
||||||
Note that
|
Note that
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
will prepare the address space for a copy-on-write operation.
|
will prepare the address space for a copy-on-write operation.
|
||||||
|
@ -363,11 +363,11 @@ or
|
||||||
.BR mlock ()
|
.BR mlock ()
|
||||||
operation\(emnot even from a thread which runs at a low priority within
|
operation\(emnot even from a thread which runs at a low priority within
|
||||||
a process which also has a thread running at elevated priority.
|
a process which also has a thread running at elevated priority.
|
||||||
|
.PP
|
||||||
The memory lock on an address range is automatically removed
|
The memory lock on an address range is automatically removed
|
||||||
if the address range is unmapped via
|
if the address range is unmapped via
|
||||||
.BR munmap (2).
|
.BR munmap (2).
|
||||||
|
.PP
|
||||||
Memory locks do not stack, that is, pages which have been locked several times
|
Memory locks do not stack, that is, pages which have been locked several times
|
||||||
by calls to
|
by calls to
|
||||||
.BR mlock (),
|
.BR mlock (),
|
||||||
|
@ -381,7 +381,7 @@ for the corresponding range or by
|
||||||
Pages which are mapped to several locations or by several processes stay
|
Pages which are mapped to several locations or by several processes stay
|
||||||
locked into RAM as long as they are locked at least at one location or by
|
locked into RAM as long as they are locked at least at one location or by
|
||||||
at least one process.
|
at least one process.
|
||||||
|
.PP
|
||||||
If a call to
|
If a call to
|
||||||
.BR mlockall ()
|
.BR mlockall ()
|
||||||
which uses the
|
which uses the
|
||||||
|
@ -390,7 +390,7 @@ flag is followed by another call that does not specify this flag, the
|
||||||
changes made by the
|
changes made by the
|
||||||
.B MCL_FUTURE
|
.B MCL_FUTURE
|
||||||
call will be lost.
|
call will be lost.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR mlock2 ()
|
.BR mlock2 ()
|
||||||
.B MLOCK_ONFAULT
|
.B MLOCK_ONFAULT
|
||||||
|
@ -417,7 +417,7 @@ and
|
||||||
allows an implementation to require that
|
allows an implementation to require that
|
||||||
.I addr
|
.I addr
|
||||||
is page aligned, so portable applications should ensure this.
|
is page aligned, so portable applications should ensure this.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I VmLck
|
.I VmLck
|
||||||
field of the Linux-specific
|
field of the Linux-specific
|
||||||
|
@ -438,7 +438,7 @@ a process must be privileged
|
||||||
in order to lock memory and the
|
in order to lock memory and the
|
||||||
.B RLIMIT_MEMLOCK
|
.B RLIMIT_MEMLOCK
|
||||||
soft resource limit defines a limit on how much memory the process may lock.
|
soft resource limit defines a limit on how much memory the process may lock.
|
||||||
|
.PP
|
||||||
Since Linux 2.6.9, no limits are placed on the amount of memory
|
Since Linux 2.6.9, no limits are placed on the amount of memory
|
||||||
that a privileged process can lock and the
|
that a privileged process can lock and the
|
||||||
.B RLIMIT_MEMLOCK
|
.B RLIMIT_MEMLOCK
|
||||||
|
@ -467,7 +467,7 @@ would fail on requests that should have succeeded.
|
||||||
This bug was fixed
|
This bug was fixed
|
||||||
.\" commit 0cf2f6f6dc605e587d2c1120f295934c77e810e8
|
.\" commit 0cf2f6f6dc605e587d2c1120f295934c77e810e8
|
||||||
in Linux 4.9
|
in Linux 4.9
|
||||||
|
.PP
|
||||||
In the 2.4 series Linux kernels up to and including 2.4.17,
|
In the 2.4 series Linux kernels up to and including 2.4.17,
|
||||||
a bug caused the
|
a bug caused the
|
||||||
.BR mlockall ()
|
.BR mlockall ()
|
||||||
|
@ -475,7 +475,7 @@ a bug caused the
|
||||||
flag to be inherited across a
|
flag to be inherited across a
|
||||||
.BR fork (2).
|
.BR fork (2).
|
||||||
This was rectified in kernel 2.4.18.
|
This was rectified in kernel 2.4.18.
|
||||||
|
.PP
|
||||||
Since kernel 2.6.9, if a privileged process calls
|
Since kernel 2.6.9, if a privileged process calls
|
||||||
.I mlockall(MCL_FUTURE)
|
.I mlockall(MCL_FUTURE)
|
||||||
and later drops privileges (loses the
|
and later drops privileges (loses the
|
||||||
|
|
34
man2/mmap.2
34
man2/mmap.2
|
@ -60,7 +60,7 @@ The starting address for the new mapping is specified in
|
||||||
The
|
The
|
||||||
.I length
|
.I length
|
||||||
argument specifies the length of the mapping.
|
argument specifies the length of the mapping.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I addr
|
.I addr
|
||||||
is NULL,
|
is NULL,
|
||||||
|
@ -74,7 +74,7 @@ on Linux, the mapping will be created at a nearby page boundary.
|
||||||
.\" Before Linux 2.6.24, the address was rounded up to the next page
|
.\" Before Linux 2.6.24, the address was rounded up to the next page
|
||||||
.\" boundary; since 2.6.24, it is rounded down!
|
.\" boundary; since 2.6.24, it is rounded down!
|
||||||
The address of the new mapping is returned as the result of the call.
|
The address of the new mapping is returned as the result of the call.
|
||||||
|
.PP
|
||||||
The contents of a file mapping (as opposed to an anonymous mapping; see
|
The contents of a file mapping (as opposed to an anonymous mapping; see
|
||||||
.B MAP_ANONYMOUS
|
.B MAP_ANONYMOUS
|
||||||
below), are initialized using
|
below), are initialized using
|
||||||
|
@ -135,7 +135,7 @@ It is unspecified whether changes made to the file after the
|
||||||
call are visible in the mapped region.
|
call are visible in the mapped region.
|
||||||
.LP
|
.LP
|
||||||
Both of these flags are described in POSIX.1-2001 and POSIX.1-2008.
|
Both of these flags are described in POSIX.1-2001 and POSIX.1-2008.
|
||||||
|
.PP
|
||||||
In addition, zero or more of the following values can be ORed in
|
In addition, zero or more of the following values can be ORed in
|
||||||
.IR flags :
|
.IR flags :
|
||||||
.TP
|
.TP
|
||||||
|
@ -251,7 +251,7 @@ Used in conjunction with
|
||||||
.B MAP_HUGETLB
|
.B MAP_HUGETLB
|
||||||
to select alternative hugetlb page sizes (respectively, 2 MB and 1 GB)
|
to select alternative hugetlb page sizes (respectively, 2 MB and 1 GB)
|
||||||
on systems that support multiple hugetlb page sizes.
|
on systems that support multiple hugetlb page sizes.
|
||||||
|
.IP
|
||||||
More generally, the desired huge page size can be configured by encoding
|
More generally, the desired huge page size can be configured by encoding
|
||||||
the base-2 logarithm of the desired page size in the six bits at the offset
|
the base-2 logarithm of the desired page size in the six bits at the offset
|
||||||
.BR MAP_HUGE_SHIFT .
|
.BR MAP_HUGE_SHIFT .
|
||||||
|
@ -261,14 +261,14 @@ the default huge page size can be discovered vie the
|
||||||
field exposed by
|
field exposed by
|
||||||
.IR /proc/meminfo .)
|
.IR /proc/meminfo .)
|
||||||
Thus, the above two constants are defined as:
|
Thus, the above two constants are defined as:
|
||||||
|
.IP
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
|
#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
|
||||||
#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
|
#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
|
||||||
.in
|
.in
|
||||||
.fi
|
.fi
|
||||||
|
.IP
|
||||||
The range of huge page sizes that are supported by the system
|
The range of huge page sizes that are supported by the system
|
||||||
can be discovered by listing the subdirectories in
|
can be discovered by listing the subdirectories in
|
||||||
.IR /sys/kernel/mm/hugepages .
|
.IR /sys/kernel/mm/hugepages .
|
||||||
|
@ -411,7 +411,7 @@ On error, the value
|
||||||
is returned, and
|
is returned, and
|
||||||
.I errno
|
.I errno
|
||||||
is set to indicate the cause of the error.
|
is set to indicate the cause of the error.
|
||||||
|
.PP
|
||||||
On success,
|
On success,
|
||||||
.BR munmap ()
|
.BR munmap ()
|
||||||
returns 0.
|
returns 0.
|
||||||
|
@ -577,7 +577,7 @@ or not.
|
||||||
Portable programs should always set
|
Portable programs should always set
|
||||||
.B PROT_EXEC
|
.B PROT_EXEC
|
||||||
if they intend to execute code in the new mapping.
|
if they intend to execute code in the new mapping.
|
||||||
|
.PP
|
||||||
The portable way to create a mapping is to specify
|
The portable way to create a mapping is to specify
|
||||||
.I addr
|
.I addr
|
||||||
as 0 (NULL), and omit
|
as 0 (NULL), and omit
|
||||||
|
@ -592,7 +592,7 @@ If the
|
||||||
flag is specified, and
|
flag is specified, and
|
||||||
.I addr
|
.I addr
|
||||||
is 0 (NULL), then the mapped address will be 0 (NULL).
|
is 0 (NULL), then the mapped address will be 0 (NULL).
|
||||||
|
.PP
|
||||||
Certain
|
Certain
|
||||||
.I flags
|
.I flags
|
||||||
constants are defined only if suitable feature test macros are defined
|
constants are defined only if suitable feature test macros are defined
|
||||||
|
@ -625,7 +625,7 @@ The relevant flags are:
|
||||||
.BR MAP_POPULATE ,
|
.BR MAP_POPULATE ,
|
||||||
and
|
and
|
||||||
.BR MAP_STACK .
|
.BR MAP_STACK .
|
||||||
|
.PP
|
||||||
An application can determine which pages of a mapping are
|
An application can determine which pages of a mapping are
|
||||||
currently resident in the buffer/page cache using
|
currently resident in the buffer/page cache using
|
||||||
.BR mincore (2).
|
.BR mincore (2).
|
||||||
|
@ -662,7 +662,7 @@ and
|
||||||
.BR munmap ()
|
.BR munmap ()
|
||||||
differ somewhat from the requirements for mappings
|
differ somewhat from the requirements for mappings
|
||||||
that use the native system page size.
|
that use the native system page size.
|
||||||
|
.PP
|
||||||
For
|
For
|
||||||
.BR mmap (),
|
.BR mmap (),
|
||||||
.I offset
|
.I offset
|
||||||
|
@ -670,7 +670,7 @@ must be a multiple of the underlying huge page size.
|
||||||
The system automatically aligns
|
The system automatically aligns
|
||||||
.I length
|
.I length
|
||||||
to be a multiple of the underlying huge page size.
|
to be a multiple of the underlying huge page size.
|
||||||
|
.PP
|
||||||
For
|
For
|
||||||
.BR munmap (),
|
.BR munmap (),
|
||||||
.I addr
|
.I addr
|
||||||
|
@ -698,14 +698,14 @@ On Linux, there are no guarantees like those suggested above under
|
||||||
.BR MAP_NORESERVE .
|
.BR MAP_NORESERVE .
|
||||||
By default, any process can be killed
|
By default, any process can be killed
|
||||||
at any moment when the system runs out of memory.
|
at any moment when the system runs out of memory.
|
||||||
|
.PP
|
||||||
In kernels before 2.6.7, the
|
In kernels before 2.6.7, the
|
||||||
.B MAP_POPULATE
|
.B MAP_POPULATE
|
||||||
flag has effect only if
|
flag has effect only if
|
||||||
.I prot
|
.I prot
|
||||||
is specified as
|
is specified as
|
||||||
.BR PROT_NONE .
|
.BR PROT_NONE .
|
||||||
|
.PP
|
||||||
SUSv3 specifies that
|
SUSv3 specifies that
|
||||||
.BR mmap ()
|
.BR mmap ()
|
||||||
should fail if
|
should fail if
|
||||||
|
@ -720,7 +720,7 @@ Since kernel 2.6.12,
|
||||||
fails with the error
|
fails with the error
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
for this case.
|
for this case.
|
||||||
|
.PP
|
||||||
POSIX specifies that the system shall always
|
POSIX specifies that the system shall always
|
||||||
zero fill any partial page at the end
|
zero fill any partial page at the end
|
||||||
of the object and that system will never write any modification of the
|
of the object and that system will never write any modification of the
|
||||||
|
@ -837,14 +837,14 @@ main(int argc, char *argv[])
|
||||||
.BR userfaultfd (2),
|
.BR userfaultfd (2),
|
||||||
.BR shm_open (3),
|
.BR shm_open (3),
|
||||||
.BR shm_overview (7)
|
.BR shm_overview (7)
|
||||||
|
.PP
|
||||||
The descriptions of the following files in
|
The descriptions of the following files in
|
||||||
.BR proc (5):
|
.BR proc (5):
|
||||||
.IR /proc/[pid]/maps ,
|
.IR /proc/[pid]/maps ,
|
||||||
.IR /proc/[pid]/map_files ,
|
.IR /proc/[pid]/map_files ,
|
||||||
and
|
and
|
||||||
.IR /proc/[pid]/smaps .
|
.IR /proc/[pid]/smaps .
|
||||||
|
.PP
|
||||||
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
|
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
|
||||||
.\"
|
.\"
|
||||||
.\" Repeat after me: private read-only mappings are 100% equivalent to
|
.\" Repeat after me: private read-only mappings are 100% equivalent to
|
||||||
|
|
|
@ -40,7 +40,7 @@ mmap2 \- map files or devices into memory
|
||||||
This is probably not the system call that you are interested in; instead, see
|
This is probably not the system call that you are interested in; instead, see
|
||||||
.BR mmap (2),
|
.BR mmap (2),
|
||||||
which describes the glibc wrapper function that invokes this system call.
|
which describes the glibc wrapper function that invokes this system call.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR mmap2 ()
|
.BR mmap2 ()
|
||||||
system call provides the same interface as
|
system call provides the same interface as
|
||||||
|
@ -83,9 +83,9 @@ the glibc
|
||||||
wrapper function invokes this system call rather than the
|
wrapper function invokes this system call rather than the
|
||||||
.BR mmap (2)
|
.BR mmap (2)
|
||||||
system call.
|
system call.
|
||||||
|
.PP
|
||||||
This system call does not exist on x86-64.
|
This system call does not exist on x86-64.
|
||||||
|
.PP
|
||||||
On ia64, the unit for
|
On ia64, the unit for
|
||||||
.I offset
|
.I offset
|
||||||
is actually the system page size, rather than 4096 bytes.
|
is actually the system page size, rather than 4096 bytes.
|
||||||
|
|
|
@ -70,7 +70,7 @@ structure
|
||||||
and
|
and
|
||||||
.I bytecount
|
.I bytecount
|
||||||
must equal the size of this structure.
|
must equal the size of this structure.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I user_desc
|
.I user_desc
|
||||||
structure is defined in \fI<asm/ldt.h>\fP as:
|
structure is defined in \fI<asm/ldt.h>\fP as:
|
||||||
|
|
|
@ -42,7 +42,7 @@ The result of the move is reflected in
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
indicate constraints on the pages to be moved.
|
indicate constraints on the pages to be moved.
|
||||||
|
.PP
|
||||||
.I pid
|
.I pid
|
||||||
is the ID of the process in which pages are to be moved.
|
is the ID of the process in which pages are to be moved.
|
||||||
To move pages in another process,
|
To move pages in another process,
|
||||||
|
@ -55,7 +55,7 @@ If
|
||||||
is 0, then
|
is 0, then
|
||||||
.BR move_pages ()
|
.BR move_pages ()
|
||||||
moves pages of the calling process.
|
moves pages of the calling process.
|
||||||
|
.PP
|
||||||
.I count
|
.I count
|
||||||
is the number of pages to move.
|
is the number of pages to move.
|
||||||
It defines the size of the three arrays
|
It defines the size of the three arrays
|
||||||
|
@ -63,7 +63,7 @@ It defines the size of the three arrays
|
||||||
.IR nodes ,
|
.IR nodes ,
|
||||||
and
|
and
|
||||||
.IR status .
|
.IR status .
|
||||||
|
.PP
|
||||||
.I pages
|
.I pages
|
||||||
is an array of pointers to the pages that should be moved.
|
is an array of pointers to the pages that should be moved.
|
||||||
These are pointers that should be aligned to page boundaries.
|
These are pointers that should be aligned to page boundaries.
|
||||||
|
@ -71,7 +71,7 @@ These are pointers that should be aligned to page boundaries.
|
||||||
.\" not aligned to page boundaries
|
.\" not aligned to page boundaries
|
||||||
Addresses are specified as seen by the process specified by
|
Addresses are specified as seen by the process specified by
|
||||||
.IR pid .
|
.IR pid .
|
||||||
|
.PP
|
||||||
.I nodes
|
.I nodes
|
||||||
is an array of integers that specify the desired location for each page.
|
is an array of integers that specify the desired location for each page.
|
||||||
Each element in the array is a node number.
|
Each element in the array is a node number.
|
||||||
|
@ -84,13 +84,13 @@ where each page currently resides, in the
|
||||||
array.
|
array.
|
||||||
Obtaining the status of each page may be necessary to determine
|
Obtaining the status of each page may be necessary to determine
|
||||||
pages that need to be moved.
|
pages that need to be moved.
|
||||||
|
.PP
|
||||||
.I status
|
.I status
|
||||||
is an array of integers that return the status of each page.
|
is an array of integers that return the status of each page.
|
||||||
The array contains valid values only if
|
The array contains valid values only if
|
||||||
.BR move_pages ()
|
.BR move_pages ()
|
||||||
did not return an error.
|
did not return an error.
|
||||||
|
.PP
|
||||||
.I flags
|
.I flags
|
||||||
specify what types of pages to move.
|
specify what types of pages to move.
|
||||||
.B MPOL_MF_MOVE
|
.B MPOL_MF_MOVE
|
||||||
|
@ -198,7 +198,7 @@ This system call is Linux-specific.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
For information on library support, see
|
For information on library support, see
|
||||||
.BR numa (7).
|
.BR numa (7).
|
||||||
|
.PP
|
||||||
Use
|
Use
|
||||||
.BR get_mempolicy (2)
|
.BR get_mempolicy (2)
|
||||||
with the
|
with the
|
||||||
|
@ -209,7 +209,7 @@ flag to obtain the set of nodes that are allowed by
|
||||||
the current cpuset.
|
the current cpuset.
|
||||||
Note that this information is subject to change at any
|
Note that this information is subject to change at any
|
||||||
time by manual or automatic reconfiguration of the cpuset.
|
time by manual or automatic reconfiguration of the cpuset.
|
||||||
|
.PP
|
||||||
Use of this function may result in pages whose location
|
Use of this function may result in pages whose location
|
||||||
(node) violates the memory policy established for the
|
(node) violates the memory policy established for the
|
||||||
specified addresses (See
|
specified addresses (See
|
||||||
|
@ -219,7 +219,7 @@ and/or the specified process (See
|
||||||
That is, memory policy does not constrain the destination
|
That is, memory policy does not constrain the destination
|
||||||
nodes used by
|
nodes used by
|
||||||
.BR move_pages ().
|
.BR move_pages ().
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I <numaif.h>
|
.I <numaif.h>
|
||||||
header is not included with glibc, but requires installing
|
header is not included with glibc, but requires installing
|
||||||
|
|
|
@ -47,7 +47,7 @@ containing any part of the address range in the
|
||||||
interval [\fIaddr\fP,\ \fIaddr\fP+\fIlen\fP\-1].
|
interval [\fIaddr\fP,\ \fIaddr\fP+\fIlen\fP\-1].
|
||||||
.I addr
|
.I addr
|
||||||
must be aligned to a page boundary.
|
must be aligned to a page boundary.
|
||||||
|
.PP
|
||||||
If the calling process tries to access memory in a manner
|
If the calling process tries to access memory in a manner
|
||||||
that violates the protections, then the kernel generates a
|
that violates the protections, then the kernel generates a
|
||||||
.B SIGSEGV
|
.B SIGSEGV
|
||||||
|
@ -218,7 +218,7 @@ POSIX says that the behavior of
|
||||||
is unspecified if it is applied to a region of memory that
|
is unspecified if it is applied to a region of memory that
|
||||||
was not obtained via
|
was not obtained via
|
||||||
.BR mmap (2).
|
.BR mmap (2).
|
||||||
|
.PP
|
||||||
.BR pkey_mprotect ()
|
.BR pkey_mprotect ()
|
||||||
is a nonportable Linux extension.
|
is a nonportable Linux extension.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
@ -228,7 +228,7 @@ on any address in a process's address space (except for the
|
||||||
kernel vsyscall area).
|
kernel vsyscall area).
|
||||||
In particular, it can be used
|
In particular, it can be used
|
||||||
to change existing code mappings to be writable.
|
to change existing code mappings to be writable.
|
||||||
|
.PP
|
||||||
Whether
|
Whether
|
||||||
.B PROT_EXEC
|
.B PROT_EXEC
|
||||||
has any effect different from
|
has any effect different from
|
||||||
|
@ -242,12 +242,12 @@ specifying
|
||||||
.B PROT_READ
|
.B PROT_READ
|
||||||
will implicitly add
|
will implicitly add
|
||||||
.BR PROT_EXEC.
|
.BR PROT_EXEC.
|
||||||
|
.PP
|
||||||
On some hardware architectures (e.g., i386),
|
On some hardware architectures (e.g., i386),
|
||||||
.B PROT_WRITE
|
.B PROT_WRITE
|
||||||
implies
|
implies
|
||||||
.BR PROT_READ .
|
.BR PROT_READ .
|
||||||
|
.PP
|
||||||
POSIX.1 says that an implementation may permit access
|
POSIX.1 says that an implementation may permit access
|
||||||
other than that specified in
|
other than that specified in
|
||||||
.IR prot ,
|
.IR prot ,
|
||||||
|
@ -256,7 +256,7 @@ but at a minimum can allow write access only if
|
||||||
has been set, and must not allow any access if
|
has been set, and must not allow any access if
|
||||||
.B PROT_NONE
|
.B PROT_NONE
|
||||||
has been set.
|
has been set.
|
||||||
|
.PP
|
||||||
Applications should be careful when mixing use of
|
Applications should be careful when mixing use of
|
||||||
.BR mprotect ()
|
.BR mprotect ()
|
||||||
and
|
and
|
||||||
|
@ -269,7 +269,7 @@ set to
|
||||||
.B PROT_EXEC
|
.B PROT_EXEC
|
||||||
a pkey is may be allocated and set on the memory implicitly
|
a pkey is may be allocated and set on the memory implicitly
|
||||||
by the kernel, but only when the pkey was 0 previously.
|
by the kernel, but only when the pkey was 0 previously.
|
||||||
|
.PP
|
||||||
On systems that do not support protection keys in hardware,
|
On systems that do not support protection keys in hardware,
|
||||||
.BR pkey_mprotect ()
|
.BR pkey_mprotect ()
|
||||||
may still be used, but
|
may still be used, but
|
||||||
|
@ -287,10 +287,10 @@ The program below demonstrates the use of
|
||||||
The program allocates four pages of memory, makes the third
|
The program allocates four pages of memory, makes the third
|
||||||
of these pages read-only, and then executes a loop that walks upward
|
of these pages read-only, and then executes a loop that walks upward
|
||||||
through the allocated region modifying bytes.
|
through the allocated region modifying bytes.
|
||||||
|
.PP
|
||||||
An example of what we might see when running the program is the
|
An example of what we might see when running the program is the
|
||||||
following:
|
following:
|
||||||
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
.RB "$" " ./a.out"
|
.RB "$" " ./a.out"
|
||||||
|
|
|
@ -39,7 +39,7 @@ mq_getsetattr \- get/set message queue attributes
|
||||||
There is no glibc wrapper for this system call; see NOTES.
|
There is no glibc wrapper for this system call; see NOTES.
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Do not use this system call.
|
Do not use this system call.
|
||||||
|
.PP
|
||||||
This is the low-level system call used to implement
|
This is the low-level system call used to implement
|
||||||
.BR mq_getattr (3)
|
.BR mq_getattr (3)
|
||||||
and
|
and
|
||||||
|
|
|
@ -44,7 +44,7 @@ mremap \- remap a virtual memory address
|
||||||
expands (or shrinks) an existing memory mapping, potentially
|
expands (or shrinks) an existing memory mapping, potentially
|
||||||
moving it at the same time (controlled by the \fIflags\fP argument and
|
moving it at the same time (controlled by the \fIflags\fP argument and
|
||||||
the available virtual address space).
|
the available virtual address space).
|
||||||
|
.PP
|
||||||
\fIold_address\fP is the old address of the virtual memory block that you
|
\fIold_address\fP is the old address of the virtual memory block that you
|
||||||
want to expand (or shrink).
|
want to expand (or shrink).
|
||||||
Note that \fIold_address\fP has to be page
|
Note that \fIold_address\fP has to be page
|
||||||
|
@ -58,7 +58,7 @@ An optional fifth argument,
|
||||||
may be provided; see the description of
|
may be provided; see the description of
|
||||||
.B MREMAP_FIXED
|
.B MREMAP_FIXED
|
||||||
below.
|
below.
|
||||||
|
.PP
|
||||||
In Linux the memory is divided into pages.
|
In Linux the memory is divided into pages.
|
||||||
A user process has (one or)
|
A user process has (one or)
|
||||||
several linear virtual memory segments.
|
several linear virtual memory segments.
|
||||||
|
@ -70,7 +70,7 @@ a segmentation violation if the memory is accessed incorrectly (e.g.,
|
||||||
writing to a read-only segment).
|
writing to a read-only segment).
|
||||||
Accessing virtual memory outside of the
|
Accessing virtual memory outside of the
|
||||||
segments will also cause a segmentation violation.
|
segments will also cause a segmentation violation.
|
||||||
|
.PP
|
||||||
.BR mremap ()
|
.BR mremap ()
|
||||||
uses the Linux page table scheme.
|
uses the Linux page table scheme.
|
||||||
.BR mremap ()
|
.BR mremap ()
|
||||||
|
@ -78,7 +78,7 @@ changes the
|
||||||
mapping between virtual addresses and memory pages.
|
mapping between virtual addresses and memory pages.
|
||||||
This can be used to implement a very efficient
|
This can be used to implement a very efficient
|
||||||
.BR realloc (3).
|
.BR realloc (3).
|
||||||
|
.PP
|
||||||
The \fIflags\fP bit-mask argument may be 0, or include the following flag:
|
The \fIflags\fP bit-mask argument may be 0, or include the following flag:
|
||||||
.TP
|
.TP
|
||||||
.B MREMAP_MAYMOVE
|
.B MREMAP_MAYMOVE
|
||||||
|
@ -196,7 +196,7 @@ and the prototype for
|
||||||
did not allow for the
|
did not allow for the
|
||||||
.I new_address
|
.I new_address
|
||||||
argument.
|
argument.
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.BR mremap ()
|
.BR mremap ()
|
||||||
is used to move or expand an area locked with
|
is used to move or expand an area locked with
|
||||||
|
@ -216,7 +216,7 @@ if the area cannot be populated.
|
||||||
.BR sbrk (2),
|
.BR sbrk (2),
|
||||||
.BR malloc (3),
|
.BR malloc (3),
|
||||||
.BR realloc (3)
|
.BR realloc (3)
|
||||||
|
.PP
|
||||||
Your favorite text book on operating systems
|
Your favorite text book on operating systems
|
||||||
for more information on paged memory
|
for more information on paged memory
|
||||||
(e.g., \fIModern Operating Systems\fP by Andrew S. Tanenbaum,
|
(e.g., \fIModern Operating Systems\fP by Andrew S. Tanenbaum,
|
||||||
|
|
|
@ -247,7 +247,7 @@ A successful
|
||||||
.B MSG_STAT
|
.B MSG_STAT
|
||||||
operation returns the identifier of the queue whose index was given in
|
operation returns the identifier of the queue whose index was given in
|
||||||
.IR msqid .
|
.IR msqid .
|
||||||
|
.PP
|
||||||
On error, \-1 is returned with
|
On error, \-1 is returned with
|
||||||
.I errno
|
.I errno
|
||||||
indicating the error.
|
indicating the error.
|
||||||
|
@ -338,7 +338,7 @@ Applications intended to be portable to such old systems may need
|
||||||
to include these header files.
|
to include these header files.
|
||||||
.\" Like Linux, the FreeBSD man pages still document
|
.\" Like Linux, the FreeBSD man pages still document
|
||||||
.\" the inclusion of these header files.
|
.\" the inclusion of these header files.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.BR IPC_INFO ,
|
.BR IPC_INFO ,
|
||||||
.B MSG_STAT
|
.B MSG_STAT
|
||||||
|
@ -350,7 +350,7 @@ program to provide information on allocated resources.
|
||||||
In the future these may modified or moved to a
|
In the future these may modified or moved to a
|
||||||
.I /proc
|
.I /proc
|
||||||
filesystem interface.
|
filesystem interface.
|
||||||
|
.PP
|
||||||
Various fields in the \fIstruct msqid_ds\fP were
|
Various fields in the \fIstruct msqid_ds\fP were
|
||||||
typed as
|
typed as
|
||||||
.I short
|
.I short
|
||||||
|
|
|
@ -194,7 +194,7 @@ Applications intended to be portable to such old systems may need
|
||||||
to include these header files.
|
to include these header files.
|
||||||
.\" Like Linux, the FreeBSD man pages still document
|
.\" Like Linux, the FreeBSD man pages still document
|
||||||
.\" the inclusion of these header files.
|
.\" the inclusion of these header files.
|
||||||
|
.PP
|
||||||
.B IPC_PRIVATE
|
.B IPC_PRIVATE
|
||||||
isn't a flag field but a
|
isn't a flag field but a
|
||||||
.I key_t
|
.I key_t
|
||||||
|
|
18
man2/msgop.2
18
man2/msgop.2
|
@ -138,7 +138,7 @@ is specified in
|
||||||
.IR msgflg ,
|
.IR msgflg ,
|
||||||
then the call instead fails with the error
|
then the call instead fails with the error
|
||||||
.BR EAGAIN .
|
.BR EAGAIN .
|
||||||
|
.PP
|
||||||
A blocked
|
A blocked
|
||||||
.BR msgsnd ()
|
.BR msgsnd ()
|
||||||
call may also fail if:
|
call may also fail if:
|
||||||
|
@ -262,7 +262,7 @@ Nondestructively fetch a copy of the message at the ordinal position
|
||||||
in the queue specified by
|
in the queue specified by
|
||||||
.I msgtyp
|
.I msgtyp
|
||||||
(messages are considered to be numbered starting at 0).
|
(messages are considered to be numbered starting at 0).
|
||||||
|
.IP
|
||||||
This flag must be specified in conjunction with
|
This flag must be specified in conjunction with
|
||||||
.BR IPC_NOWAIT ,
|
.BR IPC_NOWAIT ,
|
||||||
with the result that, if there is no message available at the given position,
|
with the result that, if there is no message available at the given position,
|
||||||
|
@ -276,7 +276,7 @@ and
|
||||||
.BR MSG_EXCEPT
|
.BR MSG_EXCEPT
|
||||||
may not both be specified in
|
may not both be specified in
|
||||||
.IR msgflg .
|
.IR msgflg .
|
||||||
|
.IP
|
||||||
The
|
The
|
||||||
.BR MSG_COPY
|
.BR MSG_COPY
|
||||||
flag was added for the implementation of
|
flag was added for the implementation of
|
||||||
|
@ -473,7 +473,7 @@ and this kernel was configured without
|
||||||
.BR CONFIG_CHECKPOINT_RESTORE .
|
.BR CONFIG_CHECKPOINT_RESTORE .
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008, SVr4.
|
POSIX.1-2001, POSIX.1-2008, SVr4.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B MSG_EXCEPT
|
.B MSG_EXCEPT
|
||||||
and
|
and
|
||||||
|
@ -496,14 +496,14 @@ Applications intended to be portable to such old systems may need
|
||||||
to include these header files.
|
to include these header files.
|
||||||
.\" Like Linux, the FreeBSD man pages still document
|
.\" Like Linux, the FreeBSD man pages still document
|
||||||
.\" the inclusion of these header files.
|
.\" the inclusion of these header files.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I msgp
|
.I msgp
|
||||||
argument is declared as \fIstruct msgbuf\ *\fP in
|
argument is declared as \fIstruct msgbuf\ *\fP in
|
||||||
glibc 2.0 and 2.1.
|
glibc 2.0 and 2.1.
|
||||||
It is declared as \fIvoid\ *\fP
|
It is declared as \fIvoid\ *\fP
|
||||||
in glibc 2.2 and later, as required by SUSv2 and SUSv3.
|
in glibc 2.2 and later, as required by SUSv2 and SUSv3.
|
||||||
|
.PP
|
||||||
The following limits on message queue resources affect the
|
The following limits on message queue resources affect the
|
||||||
.BR msgsnd ()
|
.BR msgsnd ()
|
||||||
call:
|
call:
|
||||||
|
@ -554,7 +554,7 @@ of whether that message was at the ordinal position
|
||||||
This bug is fixed
|
This bug is fixed
|
||||||
.\" commit 4f87dac386cc43d5525da7a939d4b4e7edbea22c
|
.\" commit 4f87dac386cc43d5525da7a939d4b4e7edbea22c
|
||||||
in Linux 3.14.
|
in Linux 3.14.
|
||||||
|
.PP
|
||||||
Specifying both
|
Specifying both
|
||||||
.B MSG_COPY
|
.B MSG_COPY
|
||||||
and
|
and
|
||||||
|
@ -575,11 +575,11 @@ The program below demonstrates the use of
|
||||||
.BR msgsnd ()
|
.BR msgsnd ()
|
||||||
and
|
and
|
||||||
.BR msgrcv ().
|
.BR msgrcv ().
|
||||||
|
.PP
|
||||||
The example program is first run with the \fB\-s\fP option to send a
|
The example program is first run with the \fB\-s\fP option to send a
|
||||||
message and then run again with the \fB\-r\fP option to receive a
|
message and then run again with the \fB\-r\fP option to receive a
|
||||||
message.
|
message.
|
||||||
|
.PP
|
||||||
The following shell session shows a sample run of the program:
|
The following shell session shows a sample run of the program:
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
|
|
|
@ -45,7 +45,7 @@ corresponds to the memory area starting at
|
||||||
and having length
|
and having length
|
||||||
.I length
|
.I length
|
||||||
is updated.
|
is updated.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument should specify exactly one of
|
argument should specify exactly one of
|
||||||
|
@ -98,7 +98,7 @@ are set in
|
||||||
The indicated memory (or part of it) was not mapped.
|
The indicated memory (or part of it) was not mapped.
|
||||||
.SH CONFORMING TO
|
.SH CONFORMING TO
|
||||||
POSIX.1-2001, POSIX.1-2008.
|
POSIX.1-2001, POSIX.1-2008.
|
||||||
|
.PP
|
||||||
This call was introduced in Linux 1.3.21, and then used
|
This call was introduced in Linux 1.3.21, and then used
|
||||||
.B EFAULT
|
.B EFAULT
|
||||||
instead of
|
instead of
|
||||||
|
@ -149,5 +149,5 @@ in
|
||||||
.IR flags .
|
.IR flags .
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR mmap (2)
|
.BR mmap (2)
|
||||||
|
.PP
|
||||||
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
|
B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue