clone.2: Introduce "flags mask" as a generic term for clone()/clone3()

Use "flags mask" as a generic term to refer to the clone()
'flags' argument and the clone3() 'cl_args.flags' field.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2019-10-25 21:42:05 +02:00
parent 5261b0fe75
commit 16853a31ee
1 changed files with 80 additions and 43 deletions

View File

@ -278,7 +278,7 @@ options when waiting for the child with
If no signal (i.e., zero) is specified, then the parent process is not signaled
when the child terminates.
.\"
.SS The flags bit mask
.SS The flags mask
.PP
Both
.BR clone ()
@ -295,7 +295,14 @@ or the
.I cl_args.flags
field passed to
.BR clone3 ()\(emis
specified as a bitwise-OR of zero or more of the constants listed below.
referred to as the
.I flags
mask in the remainder of this page.
.PP
The
.I flags
mask is specified as a bitwise-OR of zero or more of
the constants listed below.
Except as noted below, these flags are available
(and have the same effect) in both
.BR clone ()
@ -695,8 +702,9 @@ of not much use.
From Linux 2.3.21 onward, this flag could be
specified only by the system boot process (PID 0).
The flag disappeared completely from the kernel sources in Linux 2.5.16.
Since then, the kernel silently ignores this bit if it is specified in
.IR flags .
Since then, the kernel silently ignores this bit if it is specified in the
.IR flags
mask.
.TP
.BR CLONE_PIDFD " (since Linux 5.2)"
.\" commit b3e5838252665ee4cfa76b82bdf1198dca81e5be
@ -797,8 +805,9 @@ process.
.IP
Since Linux 2.6.0,
.\" Precisely: Linux 2.6.0-test6
the
.I flags
must also include
mask must also include
.B CLONE_VM
if
.B CLONE_SIGHAND
@ -913,9 +922,9 @@ then any thread in the group can
.BR wait (2)
for that child.
.IP
Since Linux 2.5.35,
Since Linux 2.5.35, the
.I flags
must also include
mask must also include
.B CLONE_SIGHAND
if
.B CLONE_THREAD
@ -1200,7 +1209,9 @@ Too many processes are already running; see
.TP
.B EINVAL
.B CLONE_SIGHAND
was specified, but
was specified in the
.I flags
mask, but
.B CLONE_VM
was not.
(Since Linux 2.6.0.)
@ -1208,7 +1219,9 @@ was not.
.TP
.B EINVAL
.B CLONE_THREAD
was specified, but
was specified in the
.I flags
mask, but
.B CLONE_SIGHAND
was not.
(Since Linux 2.5.35.)
@ -1223,7 +1236,9 @@ was not.
.TP
.B EINVAL
.B CLONE_THREAD
was specified, but the current process previously called
was specified in the
.I flags
mask, but the current process previously called
.BR unshare (2)
with the
.B CLONE_NEWPID
@ -1237,24 +1252,27 @@ Both
.B CLONE_FS
and
.B CLONE_NEWNS
were specified in
.IR flags .
were specified in the
.IR flags
mask.
.TP
.BR EINVAL " (since Linux 3.9)"
Both
.B CLONE_NEWUSER
and
.B CLONE_FS
were specified in
.IR flags .
were specified in the
.IR flags
mask.
.TP
.B EINVAL
Both
.B CLONE_NEWIPC
and
.B CLONE_SYSVSEM
were specified in
.IR flags .
were specified in the
.IR flags
mask.
.TP
.B EINVAL
One (or both) of
@ -1265,8 +1283,9 @@ and one (or both) of
.BR CLONE_THREAD
or
.BR CLONE_PARENT
were specified in
.IR flags .
were specified in the
.IR flags
mask.
.TP
.B EINVAL
Returned by the glibc
@ -1279,8 +1298,9 @@ is specified as NULL.
.TP
.B EINVAL
.BR CLONE_NEWIPC
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but the kernel was not configured with the
.B CONFIG_SYSVIPC
and
@ -1289,32 +1309,36 @@ options.
.TP
.B EINVAL
.BR CLONE_NEWNET
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but the kernel was not configured with the
.B CONFIG_NET_NS
option.
.TP
.B EINVAL
.BR CLONE_NEWPID
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but the kernel was not configured with the
.B CONFIG_PID_NS
option.
.TP
.B EINVAL
.BR CLONE_NEWUSER
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but the kernel was not configured with the
.B CONFIG_USER_NS
option.
.TP
.B EINVAL
.BR CLONE_NEWUTS
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but the kernel was not configured with the
.B CONFIG_UTS_NS
option.
@ -1329,17 +1353,26 @@ must be a multiple of 16.
.B EINVAL
.B CLONE_PIDFD
was specified together with
.B CLONE_DETACHED.
.B CLONE_DETACHED
in the
.I flags
mask.
.TP
.B EINVAL
.B CLONE_PIDFD
was specified together with
.B CLONE_THREAD.
.B CLONE_THREAD
in the
.I flags
mask.
.TP
.BR "EINVAL " "(" clone "() only)"
.B CLONE_PIDFD
was specified together with
.B CLONE_PARENT_SETTID.
.B CLONE_PARENT_SETTID
in the
.I flags
mask.
.TP
.B ENOMEM
Cannot allocate sufficient memory to allocate a task structure for the
@ -1349,16 +1382,18 @@ copied.
.BR ENOSPC " (since Linux 3.7)"
.\" commit f2302505775fd13ba93f034206f1e2a587017929
.B CLONE_NEWPID
was specified in flags,
was specified in the
.I flags
mask,
but the limit on the nesting depth of PID namespaces
would have been exceeded; see
.BR pid_namespaces (7).
.TP
.BR ENOSPC " (since Linux 4.9; beforehand " EUSERS )
.B CLONE_NEWUSER
was specified in
.IR flags ,
and the call would cause the limit on the number of
was specified in the
.IR flags
mask, and the call would cause the limit on the number of
nested user namespaces to be exceeded.
See
.BR user_namespaces (7).
@ -1367,9 +1402,9 @@ From Linux 3.11 to Linux 4.8, the error diagnosed in this case was
.BR EUSERS .
.TP
.BR ENOSPC " (since Linux 4.9)"
One of the values in
One of the values in the
.I flags
specified the creation of a new user namespace,
mask specified the creation of a new user namespace,
but doing so would have caused the limit defined by the corresponding file in
.IR /proc/sys/user
to be exceeded.
@ -1393,8 +1428,9 @@ was specified by a process other than process 0.
.TP
.B EPERM
.BR CLONE_NEWUSER
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
but either the effective user ID or the effective group ID of the caller
does not have a mapping in the parent namespace (see
.BR user_namespaces (7)).
@ -1402,9 +1438,9 @@ does not have a mapping in the parent namespace (see
.BR EPERM " (since Linux 3.9)"
.\" commit 3151527ee007b73a0ebd296010f1c0454a919c7d
.B CLONE_NEWUSER
was specified in
was specified in the
.I flags
and the caller is in a chroot environment
mask and the caller is in a chroot environment
.\" FIXME What is the rationale for this restriction?
(i.e., the caller's root directory does not match the root directory
of the mount namespace in which it resides).
@ -1416,8 +1452,9 @@ System call was interrupted by a signal and will be restarted.
.TP
.BR EUSERS " (Linux 3.11 to Linux 4.8)"
.B CLONE_NEWUSER
was specified in
.IR flags ,
was specified in the
.IR flags
mask,
and the limit on the number of nested user namespaces would be exceeded.
See the discussion of the
.BR ENOSPC