1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
.\" Copyright (C) 2006, Janak Desai <janak@us.ibm.com>
.\" and Copyright (C) 2006, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Licensed under the GPL
.\"
.\" Patch Justification:
.\" unshare system call is needed to implement, using PAM,
.\" per-security_context and/or per-user namespace to provide
.\" polyinstantiated directories. Using unshare and bind mounts, a
.\" PAM module can create private namespace with appropriate
.\" directories(based on user's security context) bind mounted on
.\" public directories such as /tmp, thus providing an instance of
.\" /tmp that is based on user's security context. Without the
.\" unshare system call, namespace separation can only be achieved
.\" by clone, which would require porting and maintaining all commands
.\" such as login, and su, that establish a user session.
.\"
.\" FIXME Document CLONE_NEWIPC, which is new in 2.6.18
.\" FIXME Document CLONE_NEWUTS, which is new in 2.6.19
.\"
.\" Japanese Version Copyright (c) 2006 Yuichi SATO
.\" all rights reserved.
.\" Translated 2006-08-10 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.36
.\"
.TH UNSHARE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
unshare \- ץ¹ԥƥȤΰʬΥ
.SH
.nf
.B #define _GNU_SOURCE
.\" Actually _BSD_SOURCE || _SVID_SOURCE
.\" See http://sources.redhat.com/bugzilla/show_bug.cgi?id=4749
.B #include <sched.h>
.sp
.BI "int unshare(int " flags );
.fi
.SH
.BR unshare ()
Ȥȡץ¾Υץȸ߶ͭƤ
¹ԥƥȤΰʬΥ뤳ȤǤ롣
¹ԥƥȤΰȤ֤̾ʤɤϡ
ץ
.BR fork (2)
ޤ
.BR vfork (2)
ȤäȤˡۤΤ˶ͭ롣
ۥʤɤϡ
.BR clone (2)
ȤäƥץȤˡŪ˶ͭ뤳ȤǤ롣
.BR unshare ()
μˡϡץץ뤳Ȥʤ
ͭ¹ԥƥȤ椹뤳ȤǤ롣
.I flags
ϥӥåȥޥǤꡢ
¹ԥƥȤΤɤʬζͭ뤫ɽ
ΰϡʲ 0 İʾ OR ǻꤹ:
.TP
.B CLONE_FILES
.BR clone (2)
.B CLONE_FILES
ե饰θ̤ä
եǥץơ֥ͭ
ƤӽФץ¾Υץȥեǥץͭʤʤ롣
.TP
.B CLONE_FS
.BR clone (2)
.B CLONE_FS
ե饰θ̤ä
ե륷ƥ°ͭ
ƤӽФץ¾Υץȥ롼ȥǥ쥯ȥꡦ
ȥǥ쥯ȥꡦumask °ͭʤʤ롣
.BR chroot (2),
.BR chdir (2),
.BR umask (2)
˱ƶ롣
.TP
.B CLONE_NEWNS
.\" These flag name are inconsistent:
.\" CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
.\" CLONE_FS, and CLONE_FILES reverse the action of the clone()
.\" flags of the same name.
Υե饰
.BR clone (2)
.B CLONE_NEWNS
ե饰\fIƱ\fR̤ġ
֤̾ͭƤӽФץ
¾ΥץȤ϶ͭʤ֤ͭ̾Υԡġ
Υե饰ꤹȡ
.B CLONE_FS
ۤΤ˻ꤵ롣
.\" As at 2.6.16, the following forced implications also apply,
.\" although the relevant flags are not yet implemented.
.\" If CLONE_THREAD is set force CLONE_VM.
.\" If CLONE_VM is set, force CLONE_SIGHAND.
.\" If CLONE_SIGHAND is set and signals are also being shared
.\" (i.e., current->signal->count > 1), force CLONE_THREAD.
.\"
.\" FIXME . CLONE_VM is not (yet, as at 2.6.16) implemented.
.\" .TP
.\" .B CLONE_VM
.\" Reverse the effect of the
.\" .BR clone (2)
.\" .B CLONE_VM
.\" flag.
.\" .RB ( CLONE_VM
.\" is also implicitly set by
.\" .BR vfork (2),
.\" and can be reversed using this
.\" .BR unshare ()
.\" flag.)
.\" Unshare virtual memory, so that the calling process no
.\" longer shares its virtual address space with any other process.
.PP
.I flags
0 ꤵ줿硢
.BR unshare ()
ϲԤʤΤǡ
ƤӽФץμ¹ԥƥȤϡѹʤ
.SH ֤
0 ֤롣
Ԥ \-1 ֤ơ
.I errno
ˤϥ顼ͤꤵ롣
.SH 顼
.TP
.B EINVAL
.I flags
ʥӥåȤꤵ줿
.TP
.B ENOMEM
ƤӽФΥƥȤΤͭɬפʬԡ뤿ˡ
ʬʥ꤬ݤǤʤä
.TP
.B EPERM
.I flags
.B CLONE_NEWNS
ꤵ줿ƤӽФץø
.RB ( CAP_SYS_ADMIN
ѥӥƥ) ʤä
.SH С
.BR unshare ()
ƥॳ Linux ͥ 2.6.16 ɲä줿
.SH
.BR unshare ()
ƥॳ Linux ͭǤ롣
.SH
.BR clone (2)
ǿץȤ˶ͭƤΥץ°
.BR unshare ()
ˤäƶͭβǤ櫓ǤϤʤ
äˡͥ 2.6.16 ˤƤϡ
.BR unshare ()
.BR CLONE_SIGHAND ,
.\" However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
.\" was not specified when doing clone(); i.e., unsharing
.\" signal handlers is permitted if we are not actually
.\" sharing signal handlers. mtk
.BR CLONE_SYSVSEM ,
.BR CLONE_THREAD ,
.\" FIXME . check future kernel versions (e.g., 2.6.17)
.\" to see if CLONE_VM gets implemented.
.B CLONE_VM
θ̤äΥե饰Ƥʤ
.\" However, as at 2.6.16, we can do unshare(CLONE_VM) if CLONE_VM
.\" was not specified when doing clone(); i.e., unsharing
.\" virtual memory is permitted if we are not actually
.\" sharing virtual memory. mtk
εǽϡɬפǤоɲä뤫⤷ʤ
.\"
.\"9) Future Work
.\"--------------
.\"The current implementation of unshare does not allow unsharing of
.\"signals and signal handlers. Signals are complex to begin with and
.\"to unshare signals and/or signal handlers of a currently running
.\"process is even more complex. If in the future there is a specific
.\"need to allow unsharing of signals and/or signal handlers, it can
.\"be incrementally added to unshare without affecting legacy
.\"applications using unshare.
.\"
.SH Ϣ
.BR clone (2),
.BR fork (2),
.BR vfork (2),
Documentation/unshare.txt
|