1 .\" Copyright (C) 2011, Eric Biederman <ebiederm@xmission.com>
2 .\" Licensed under the GPLv2
4 .TH SETNS 2 2011-10-04 "Linux" "Linux Programmer's Manual"
6 setns \- reassociate thread with a namespace
9 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
12 .BI "int setns(int " fd ", int " nstype );
15 Given a file descriptor referring to a namespace,
16 reassociate the calling thread with that namespace.
20 argument is a file descriptor referring to one of the namespace entries in a
24 for further information on
26 The calling thread will be reassociated with the corresponding namespace,
27 subject to any constraints imposed by the
33 argument specifies which type of namespace
34 the calling thread may be reassociated with.
35 This argument can have one of the following values:
38 Allow any type of namespace to be joined.
42 must refer to an IPC namespace.
46 must refer to a network namespace.
50 must refer to a UTS namespace.
54 as 0 suffices if the caller knows (or does not care)
55 what type of namespace is referred to by
57 Specifying a nonzero value for
59 is useful if the caller does not know what type of namespace is referred to by
61 and wants to ensure that the namespace is of a particular type.
62 (The caller might not know the type of the namespace referred to by
64 if the file descriptor was opened by another process and, for example,
65 passed to the caller via a UNIX domain socket.)
70 On failure, \-1 is returned and
72 is set to indicate the error.
77 is not a valid file descriptor.
81 refers to a namespace whose type does not match that specified in
83 or there is problem with reassociating the
84 the thread with the specified namespace.
87 Cannot allocate sufficient memory to change the specified namespace.
90 The calling thread did not have the required privilege
96 system call first appeared in Linux in kernel 3.0
100 system call is Linux-specific.
102 Not all of the attributes that can be shared when
103 a new thread is created using
108 The PID namespace and the mount namespace are not currently supported.
109 (See the descriptions of