OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man2 / setns.2
1 .\" Copyright (C) 2011, Eric Biederman <ebiederm@xmission.com>
2 .\" Licensed under the GPLv2
3 .\"
4 .\"*******************************************************************
5 .\"
6 .\" This file was generated with po4a. Translate the source file.
7 .\"
8 .\"*******************************************************************
9 .TH SETNS 2 2011\-10\-04 Linux "Linux Programmer's Manual"
10 .SH 名前
11 setns \- reassociate thread with a namespace
12 .SH 書式
13 .nf
14 \fB#define _GNU_SOURCE\fP             /* feature_test_macros(7) 参照 */
15 \fB#include <sched.h>\fP
16 .sp
17 \fBint setns(int \fP\fIfd\fP\fB, int \fP\fInstype\fP\fB);\fP
18 .fi
19 .SH 説明
20 Given a file descriptor referring to a namespace, reassociate the calling
21 thread with that namespace.
22
23 The \fIfd\fP argument is a file descriptor referring to one of the namespace
24 entries in a \fI/proc/[pid]/ns/\fP directory; see \fBproc\fP(5)  for further
25 information on \fI/proc/[pid]/ns/\fP.  The calling thread will be reassociated
26 with the corresponding namespace, subject to any constraints imposed by the
27 \fInstype\fP argument.
28
29 The \fInstype\fP argument specifies which type of namespace the calling thread
30 may be reassociated with.  This argument can have one of the following
31 values:
32 .TP 
33 \fB0\fP
34 Allow any type of namespace to be joined.
35 .TP 
36 \fBCLONE_NEWIPC\fP
37 \fIfd\fP must refer to an IPC namespace.
38 .TP 
39 \fBCLONE_NEWNET\fP
40 \fIfd\fP must refer to a network namespace.
41 .TP 
42 \fBCLONE_NEWUTS\fP
43 \fIfd\fP must refer to a UTS namespace.
44 .PP
45 Specifying \fInstype\fP as 0 suffices if the caller knows (or does not care)
46 what type of namespace is referred to by \fIfd\fP.  Specifying a nonzero value
47 for \fInstype\fP is useful if the caller does not know what type of namespace
48 is referred to by \fIfd\fP and wants to ensure that the namespace is of a
49 particular type.  (The caller might not know the type of the namespace
50 referred to by \fIfd\fP if the file descriptor was opened by another process
51 and, for example, passed to the caller via a UNIX domain socket.)
52 .SH 返り値
53 On success, \fIsetns\fP()  returns 0.  On failure, \-1 is returned and \fIerrno\fP
54 is set to indicate the error.
55 .SH エラー
56 .TP 
57 \fBEBADF\fP
58 \fIfd\fP is not a valid file descriptor.
59 .TP 
60 \fBEINVAL\fP
61 \fIfd\fP refers to a namespace whose type does not match that specified in
62 \fInstype\fP, or there is problem with reassociating the the thread with the
63 specified namespace.
64 .TP 
65 \fBENOMEM\fP
66 Cannot allocate sufficient memory to change the specified namespace.
67 .TP 
68 \fBEPERM\fP
69 The calling thread did not have the required privilege (\fBCAP_SYS_ADMIN\fP)
70 for this operation.
71 .SH バージョン
72 The \fBsetns\fP()  system call first appeared in Linux in kernel 3.0
73 .SH 準拠
74 The \fBsetns\fP()  system call is Linux\-specific.
75 .SH 注意
76 Not all of the attributes that can be shared when a new thread is created
77 using \fBclone\fP(2)  can be changed using \fBsetns\fP().
78 .SH バグ
79 The PID namespace and the mount namespace are not currently supported.  (See
80 the descriptions of \fBCLONE_NEWPID\fP and \fBCLONE_NEWNS\fP in \fBclone\fP(2).)
81 .SH 関連項目
82 \fBclone\fP(2), \fBfork\fP(2), \fBvfork\fP(2), \fBproc\fP(5), \fBunix\fP(7)