OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / capget.2
1 .\" written by Andrew Morgan <morgan@kernel.org>
2 .\" may be distributed as per GPL
3 .\" Modified by David A. Wheeler <dwheeler@ida.org>
4 .\" Modified 2004-05-27, mtk
5 .\" Modified 2004-06-21, aeb
6 .\" Modified 2008-04-28, morgan of kernel.org
7 .\"     Update in line with addition of file capabilities and
8 .\"     64-bit capability sets in kernel 2.6.2[45].
9 .\" Modified 2009-01-26, andi kleen
10 .\"
11 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
12 .\"         all rights reserved.
13 .\" Translated 1999-12-26, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
14 .\" Updated & Modified 2005-02-03, Yuichi SATO <ysato444@yahoo.co.jp>
15 .\" Updated & Modified 2006-01-31, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
16 .\" Updated & Modified 2006-07-23, Akihiro MOTOKI, LDP v2.36
17 .\" Updated & Modified 2008-08-11, Akihiro MOTOKI, LDP v3.05
18 .\" Updated 2009-02-24, Akihiro MOTOKI, LDP v3.19
19 .\"
20 .\"WORD:        capability              ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
21 .\"WORD:        effective capability    ¼Â¸ú¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
22 .\"WORD:        inheritable capabilit   ·Ñ¾µ²Äǽ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
23 .\"WORD:        permitted capabily      µö²Ä¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
24 .\"
25 .TH CAPGET 2 2010-09-20 "Linux" "Linux Programmer's Manual"
26 .\"O .SH NAME
27 .SH Ì¾Á°
28 .\"O capget, capset \- set/get capabilities of thread(s)
29 capget, capset \- ¥¹¥ì¥Ã¥É¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÀßÄê/¼èÆÀ¤¹¤ë
30 .\"O .SH SYNOPSIS
31 .SH ½ñ¼°
32 .B #include <sys/capability.h>
33 .sp
34 .BI "int capget(cap_user_header_t " hdrp ", cap_user_data_t " datap );
35 .sp
36 .BI "int capset(cap_user_header_t " hdrp ", const cap_user_data_t " datap );
37 .\"O .SH DESCRIPTION
38 .SH ÀâÌÀ
39 .\"O As of Linux 2.2,
40 .\"O the power of the superuser (root) has been partitioned into
41 .\"O a set of discrete capabilities.
42 .\"O Each thread has a set of effective capabilities identifying
43 .\"O which capabilities (if any) it may currently exercise.
44 .\"O Each thread also has a set of inheritable capabilities that may be
45 .\"O passed through an
46 .\"O .BR execve (2)
47 .\"O call, and a set of permitted capabilities
48 .\"O that it can make effective or inheritable.
49 Linux 2.2 ¤Ç¡¢¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¡¼ (root) ¤Î¸¢¸Â¤Ï¡¢¸ÄÊ̤Υ±¡¼¥Ñ¥Ó¥ê¥Æ¥£
50 (capabilities) ¤Ø¤Èʬ³ä¤µ¤ì¡¢¤½¤Î½¸¹ç¤È¤·¤Æɽ¸½¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
51 ³Æ¥¹¥ì¥Ã¥É¤Ï¡Ö¼Â¸ú¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (effective capability) ¤Î½¸¹ç¡×¤ò»ý¤Á¡¢
52 ¤½¤ì¤Ë¤è¤Ã¤Æ¸½ºß¤É¤ÎÁàºî¤¬¼Â¹Ô²Äǽ¤«¤ò¼±Ê̤Ǥ­¤ë¡£
53 ¤Þ¤¿¡¢³Æ¥¹¥ì¥Ã¥É¤Ï¡¢
54 ¡Ö·Ñ¾µ²Äǽ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (inheritable capability) ¤Î½¸¹ç¡×¤È
55 ¡Öµö²Ä¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (permitted capability) ¤Î½¸¹ç¡×¤ò»ý¤Ä¡£
56 ¡Ö·Ñ¾µ²Äǽ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î½¸¹ç¡×¤Ï
57 .BR execve (2)
58 ¤òÄ̤¸¤ÆÅϤ¹¤³¤È¤¬¤Ç¤­¤ë¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î½¸¹ç¤Ç¤¢¤ê¡¢
59 ¡Öµö²Ä¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (permitted capability) ¤Î½¸¹ç¡×¤Ï
60 ¼Â¸ú¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ä·Ñ¾µ²Äǽ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤È¤·¤ÆÍ­¸ú¤Ë¤Ç¤­¤ë
61 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òµ¬Äꤹ¤ë¤â¤Î¤Ç¤¢¤ë¡£
62 .PP
63 .\"O These two functions are the raw kernel interface for getting and
64 .\"O setting thread capabilities.
65 .\"O Not only are these system calls specific to Linux,
66 .\"O but the kernel API is likely to change and use of
67 .\"O these functions (in particular the format of the
68 .\"O .I cap_user_*_t
69 .\"O types) is subject to extension with each kernel revision,
70 .\"O but old programs will keep working.
71 ¤³¤ÎÆó¤Ä¤Î´Ø¿ô¤Ï¥¹¥ì¥Ã¥É¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò¼èÆÀ¤·¤¿¤êÀßÄꤷ¤¿¤ê¤¹¤ë¤¿¤á¤Î
72 À¸¤Î¥«¡¼¥Í¥ë¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
73 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux ÆÃÍ­¤Ç¤¢¤ë¤È¤¤¤¦¤À¤±¤Ç¤Ê¤¯¡¢
74 ¥«¡¼¥Í¥ë API ¤ÏÊѹ¹¤µ¤ì¤ë¤«¤â¤·¤ì¤º¡¢¤³¤ì¤é¤Î
75 ´Ø¿ô¤Î»ÈÍÑË¡ (ÆäË
76 .I cap_user_*_t
77 ·¿¤È¤¤¤¦½ñ¼°) ¤Ï¥«¡¼¥Í¥ë¤Î¥ê¥Ó¥¸¥ç¥óËè¤Ë³ÈÄ¥¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¤¬¡¢
78 °ÊÁ°¤Î¥×¥í¥°¥é¥à¤Ï¤½¤Î¤Þ¤ÞÆ°ºî¤¹¤ë¡£
79 .sp
80 .\"O The portable interfaces are
81 .\"O .BR cap_set_proc (3)
82 .\"O and
83 .\"O .BR cap_get_proc (3);
84 °Ü¿¢À­¤Î¤¢¤ë¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ï
85 .BR cap_set_proc (3)
86 ¤È
87 .BR cap_get_proc (3)
88 ¤Ç¤¢¤ë¡£
89 .\"O if possible you should use those interfaces in applications.
90 ²Äǽ¤Ê¤é¤Ð¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¤³¤ì¤é¤Î´Ø¿ô¤ò»ÈÍѤ¹¤Ù¤­¤Ç¤¢¤ë¡£
91 .\"O If you wish to use the Linux extensions in applications, you should
92 .\"O use the easier-to-use interfaces
93 .\"O .BR capsetp (3)
94 .\"O and
95 .\"O .BR capgetp (3).
96 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë Linux ³ÈÄ¥¤ò»ÈÍѤ·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢¤è¤ê´Êñ¤Ë
97 »È¤¨¤ë¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë
98 .BR capsetp (3)
99 ¤È
100 .BR capgetp (3)
101 ¤ò»ÈÍѤ¹¤Ù¤­¤Ç¤¢¤ë¡£
102 .\"O .SS "Current details"
103 .SS ¸½ºß¤Î¾ÜºÙ
104 .\"O Now that you have been warned, some current kernel details.
105 .\"O The structures are defined as follows.
106 ¸½ºß¤Î¥«¡¼¥Í¥ë¤Î¾ÜºÙ¤Ë¤Ä¤¤¤ÆÃí°Õ¤ò½Ò¤Ù¤Æ¤ª¤¯¡£
107 ¹½Â¤ÂΤϰʲ¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë¡£
108 .sp
109 .nf
110 .in +4n
111 #define _LINUX_CAPABILITY_VERSION_1  0x19980330
112 #define _LINUX_CAPABILITY_U32S_1     1
113
114 #define _LINUX_CAPABILITY_VERSION_2  0x20071026
115 #define _LINUX_CAPABILITY_U32S_2     2
116
117 typedef struct __user_cap_header_struct {
118    __u32 version;
119    int pid;
120 } *cap_user_header_t;
121
122 typedef struct __user_cap_data_struct {
123    __u32 effective;
124    __u32 permitted;
125    __u32 inheritable;
126 } *cap_user_data_t;
127 .fi
128 .in -4n
129 .sp
130 .\"O .I effective, permitted, inheritable
131 .\"O are bitmasks of the capabilities defined in
132 .\"O .I capability(7).
133 .\"O Note the
134 .\"O .I CAP_*
135 .\"O values are bit indexes and need to be bit-shifted before ORing into
136 .\"O the bit fields.
137 .\"O To define the structures for passing to the system call you have to use the
138 .\"O .I struct __user_cap_header_struct
139 .\"O and
140 .\"O .I struct __user_cap_data_struct
141 .\"O names because the typedefs are only pointers.
142 .I effective, permitted, inheritable
143 ¤Ï¡¢
144 .BR capability (7)
145 ¤ÇÄêµÁ¤µ¤ì¤ë¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¤¢¤ë¡£
146 .I CAP_*
147 ¤Ï¥Ó¥Ã¥ÈÈÖ¹æ¤òɽ¤¹¥¤¥ó¥Ç¥Ã¥¯¥¹ÃͤǤ¢¤ê¡¢
148 ¥Ó¥Ã¥È¥Õ¥£¡¼¥ë¥É¤Ë OR ¤ò¹Ô¤¦Á°¤Ë
149 .I CAP_*
150 ¤ÎÃͤÎʬ¤À¤±¥Ó¥Ã¥È¥·¥Õ¥È¤ò¹Ô¤¦É¬Íפ¬¤¢¤ë¡£
151 typedef ¤ÎÊý¤Ï¥Ý¥¤¥ó¥¿¤Ê¤Î¤Ç¡¢
152 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÅϤ¹¹½Â¤ÂΤòÄêµÁ¤¹¤ë¤Ë¤Ï¡¢
153 .I struct __user_cap_header_struct
154 ¤È
155 .I struct __user_cap_data_struct
156 ¤È¤¤¤¦Ì¾Á°¤ò»ÈÍѤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
157
158 .\"O Kernels prior to 2.6.25 prefer
159 .\"O 32-bit capabilities with version
160 .\"O .BR _LINUX_CAPABILITY_VERSION_1 ,
161 .\"O and kernels 2.6.25+ prefer 64-bit capabilities with version
162 .\"O .BR _LINUX_CAPABILITY_VERSION_2 .
163 .\"O Note, 64-bit capabilities use
164 .\"O .IR datap [0]
165 .\"O and
166 .\"O .IR datap [1],
167 .\"O whereas 32-bit capabilities only use
168 .\"O .IR datap [0].
169 ¥«¡¼¥Í¥ë 2.6.25 ¤è¤êÁ°¤Ç¤Ï¡¢¥Ð¡¼¥¸¥ç¥ó
170 .B _LINUX_CAPABILITY_VERSION_1
171 ¤Î 32 ¥Ó¥Ã¥È¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬¿ä¾©¤Ç¤¢¤ë¡£
172 ¥«¡¼¥Í¥ë 2.6.25 °Ê¹ß¤Ç¤Ï¡¢¥Ð¡¼¥¸¥ç¥ó
173 .B _LINUX_CAPABILITY_VERSION_2
174 ¤Î 64 ¥Ó¥Ã¥È¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬¿ä¾©¤Ç¤¢¤ë¡£
175 64 ¥Ó¥Ã¥È¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Ç¤Ï
176 .IR datap [0]
177 ¤È
178 .IR datap [1]
179 ¤¬»ÈÍѤµ¤ì¤ë¤Î¤ËÂФ·¡¢
180 32 ¥Ó¥Ã¥È¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Ç¤Ï
181 .IR datap [0]
182 ¤À¤±¤¬»ÈÍѤµ¤ì¤ë¡£
183 .sp
184 .\"O Another change affecting the behavior of these system calls is kernel
185 .\"O support for file capabilities (VFS capability support).
186 .\"O This support is currently a compile time option (added in kernel 2.6.24).
187 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÎµóÆ°¤Ë±Æ¶Á¤¬¤¢¤ë¤â¤¦°ì¤Ä¤ÎÊѹ¹ÅÀ¤Ï¡¢
188 ¥Õ¥¡¥¤¥ë¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (file capabilities) ¤Î¥«¡¼¥Í¥ë¤Ë¤è¤ë¥µ¥Ý¡¼¥È
189 (VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î¥µ¥Ý¡¼¥È) ¤Ç¤¢¤ë¡£
190 VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î¥µ¥Ý¡¼¥È¤Ï¸½ºß¤Î¤È¤³¤í¥³¥ó¥Ñ¥¤¥ë»þ¤Î¥ª¥×¥·¥ç¥ó¤Ç¤¢¤ë
191 (¥«¡¼¥Í¥ë 2.6.24 ¤ÇÄɲ䵤줿)¡£
192 .sp
193 .\"O For
194 .\"O .BR capget ()
195 .\"O calls, one can probe the capabilities of any process by specifying its
196 .\"O process ID with the
197 .\"O .I hdrp->pid
198 .\"O field value.
199 .BR capget ()
200 ¤Ç¤Ï¡¢
201 .I hdrp->pid
202 ¤Î¥Õ¥£¡¼¥ë¥ÉÃͤ˥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÃΤꤿ¤¤¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤ò
203 »ØÄꤹ¤ë¤³¤È¤Ç¡¢Ç¤°Õ¤Î¥×¥í¥»¥¹¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÄ´¤Ù¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
204 .\"O .SS With VFS Capability Support
205 .SS VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
206 .\"O VFS Capability support creates a file-attribute method for adding
207 .\"O capabilities to privileged executables.
208 .\"O This privilege model obsoletes kernel support for one process
209 .\"O asynchronously setting the capabilities of another.
210 .\"O That is, with VFS support, for
211 .\"O .BR capset ()
212 .\"O calls the only permitted values for
213 .\"O .I hdrp->pid
214 .\"O are 0 or
215 .\"O .BR getpid (2),
216 .\"O which are equivalent.
217 VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Î¥µ¥Ý¡¼¥È¤Ç¤Ï¡¢Æø¢¼Â¹Ô¥Õ¥¡¥¤¥ë¤Ë¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò
218 Äɲ乤뤿¤á¤Î¥Õ¥¡¥¤¥ë°À­¥á¥½¥Ã¥É¤¬ºîÀ®¤µ¤ì¤¿¡£
219 ¤³¤ÎÆø¢¥â¥Ç¥ë¤ÎƳÆþ¤Ë¤è¤ê¡¢¤¢¤ë¥×¥í¥»¥¹¤Ë¤è¤êÊÌ¤Î¥×¥í¥»¥¹¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£
220 ¤òÈóƱ´ü¤ËÀßÄꤹ¤ëµ¡Ç½¤Î¥«¡¼¥Í¥ë¤Ë¤è¤ë¥µ¥Ý¡¼¥È¤ÏÇѻߤµ¤ì¤ë¡£
221 ¤Ä¤Þ¤ê¡¢VFS ¥µ¥Ý¡¼¥È¤Ç¤Ï¡¢
222 .BR capset ()
223 ¤ò¸Æ¤Ó½Ð¤¹ºÝ¤Ë
224 .I hdrp->pid
225 ¤ÎÃͤȤ·¤Æµö¤µ¤ì¤ë¤Î¤Ï 0 ¤È
226 .BR getpid (2)
227 ¤¬ÊÖ¤¹ÃͤÀ¤±¤È¤Ê¤ë (¤É¤Á¤é¤ÎÃͤǤâÅù²Á¤Ç¤¢¤ë)¡£
228 .\"O .SS Without VFS Capability Support
229 .SS VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç
230 .\"O When the kernel does not support VFS capabilities,
231 .\"O .BR capset ()
232 .\"O calls can operate on the capabilities of the thread specified by the
233 .\"O .I pid
234 .\"O field of
235 .\"O .I hdrp
236 .\"O when that is nonzero, or on the capabilities of the calling thread if
237 .\"O .I pid
238 .\"O is 0.
239 ¥«¡¼¥Í¥ë¤¬ VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
240 .I hdrp
241 ¤Î
242 .I pid
243 ¥Õ¥£¡¼¥ë¥É¤¬ 0 °Ê³°¤Ç¤¢¤ì¤Ð¡¢
244 .BR capset ()
245 ¤ÎÁàºîÂоݤÏ
246 .I pid
247 ¤Ç»ØÄꤵ¤ì¤¿¥¹¥ì¥Ã¥É¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤Ë¤Ê¤ë¡£
248 .I pid
249 ¤¬ 0 ¤Î¾ì¹ç¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥¹¥ì¥Ã¥É¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬ÁàºîÂоݤȤʤ롣
250 .\"O If
251 .\"O .I pid
252 .\"O refers to a single-threaded process, then
253 .\"O .I pid
254 .\"O can be specified as a traditional process ID;
255 .\"O operating on a thread of a multithreaded process requires a thread ID
256 .\"O of the type returned by
257 .\"O .BR gettid (2).
258 .I pid
259 ¤¬¥·¥ó¥°¥ë¥¹¥ì¥Ã¥É¡¦¥×¥í¥»¥¹¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
260 .I pid
261 ¤Ï°ÊÁ°¤«¤é»È¤ï¤ì¤Æ¤¤¤ë¥×¥í¥»¥¹ID ¤ò»È¤Ã¤Æ»ØÄê¤Ç¤­¤ë¡£
262 ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¡¦¥×¥í¥»¥¹Æâ¤Î¤¢¤ë¥¹¥ì¥Ã¥É¤òÂоݤˤ¹¤ë¾ì¹ç¤Ï¡¢
263 .BR gettid (2)
264 ¤¬ÊÖ¤¹¥¹¥ì¥Ã¥ÉID ¤òÍѤ¤¤Æ»ØÄꤹ¤ëɬÍפ¬¤¢¤ë¡£
265 .\"O For
266 .\"O .BR capset (),
267 .\"O .I pid
268 .\"O can also be: \-1, meaning perform the change on all threads except the
269 .\"O caller and
270 .\"O .BR init (8);
271 .\"O or a value less than \-1, in which case the change is applied
272 .\"O to all members of the process group whose ID is \-\fIpid\fP.
273 ¤Þ¤¿¡¢
274 .BR capset ()
275 ¤Ç¤Ï \-1 ¤ä \-1 ¤è¤ê¾®¤µ¤ÊÃͤò»ØÄꤹ¤ë¤³¤È¤â¤Ç¤­¤ë¡£
276 \-1 ¤Ï¸Æ¤Ó½Ð¤·¸µ¤È
277 .BR init (8)
278 ¤ò½ü¤¯Á´¤Æ¤Î¥¹¥ì¥Ã¥É¤òÂоݤȤ·¤ÆÊѹ¹¤ò¹Ô¤¦¤³¤È¤ò¡¢
279 \-1 ¤è¤ê¾®¤µ¤ÊÃͤϠID ¤¬ \-\fIpid\fP ¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÁ´¥á¥ó¥Ð
280 ¤òÂоݤȤ·¤ÆÊѹ¹¤ò¹Ô¤¦¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
281
282 .\"O For details on the data, see
283 .\"O .BR capabilities (7).
284 ¤³¤Î¥Ç¡¼¥¿¤Î¾ÜºÙ¤Ï
285 .BR capabilities (7)
286 ¤ò»²¾È¤¹¤ë¤³¤È¡£
287 .\"O .SH "RETURN VALUE"
288 .SH ÊÖ¤êÃÍ
289 .\"O On success, zero is returned.
290 .\"O On error, \-1 is returned, and
291 .\"O .I errno
292 .\"O is set appropriately.
293 À®¸ù¤·¤¿¾ì¹ç¤Ë¤Ï 0 ¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï \-1 ¤òÊÖ¤·¡¢
294 .I errno
295 ¤òŬÀÚ¤ËÀßÄꤹ¤ë¡£
296
297 .\"O The calls will fail with the error
298 .\"O .BR EINVAL ,
299 .\"O and set the
300 .\"O .I version
301 .\"O field of
302 .\"O .I hdrp
303 .\"O to the kernel preferred value of
304 .\"O .B _LINUX_CAPABILITY_VERSION_?
305 .\"O when an unsupported
306 .\"O .I version
307 .\"O value is specified.
308 .I hdrp
309 ¤Î¥Õ¥£¡¼¥ë¥É
310 .I version
311 ¤Ë¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤Ãͤ¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
312 ¸Æ¤Ó½Ð¤·¤Ï¥¨¥é¡¼
313 .B EINVAL
314 ¤Ç¼ºÇÔ¤·¡¢
315 .I version
316 ¤Ë¥«¡¼¥Í¥ë¿ä¾©¤Î
317 .B _LINUX_CAPABILITY_VERSION_?
318 ¤òÀßÄꤹ¤ë¡£
319 .\"O In this way, one can probe what the current
320 .\"O preferred capability revision is.
321 ¤³¤Î¤è¤¦¤Ë¤·¤Æ¡¢¸½ºß¤Î¿ä¾©¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¡¦¥ê¥Ó¥¸¥ç¥ó¤¬²¿¤«¤ò
322 Ä´¤Ù¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
323 .\"O .SH ERRORS
324 .SH ¥¨¥é¡¼
325 .TP
326 .B EFAULT
327 .\"O Bad memory address.
328 .\"O .I hdrp
329 .\"O must not be NULL.
330 .\"O .I datap
331 .\"O may only be NULL when the user is trying to determine the preferred
332 .\"O capability version format supported by the kernel.
333 ÉÔÀµ¤Ê¥á¥â¥ê¥¢¥É¥ì¥¹¡£
334 .I hdrp
335 ¤Ï NULL ¤Ç¤¢¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
336 .I datap
337 ¤Ë NULL ¤ò»ØÄꤷ¤Æ¤è¤¤¤Î¤Ï¡¢¥æ¡¼¥¶¤¬¥«¡¼¥Í¥ë¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë
338 ¿ä¾©¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¡¦¥Ð¡¼¥¸¥ç¥ó¤òȽÄꤷ¤è¤¦¤È¤·¤Æ¤¤¤ë¤È¤­¤À¤±¤Ç¤¢¤ë¡£
339 .TP
340 .B EINVAL
341 .\"O One of the arguments was invalid.
342 °ú¤­¿ô¤Î¤É¤ì¤«¤¬Ìµ¸ú¤Ç¤¢¤ë¡£
343 .TP
344 .B EPERM
345 .\"O An attempt was made to add a capability to the Permitted set, or to set
346 .\"O a capability in the Effective or Inheritable sets that is not in the
347 .\"O Permitted set.
348 ¡Öµö²Ä¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¥»¥Ã¥È¡×¤Ë¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÄɲ䷤褦¤È¤·¤Æ¤¤¤ë¤«¡¢
349 ¤â¤·¤¯¤Ï¡Öµö²Ä¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¥»¥Ã¥È¡×¤Ë´Þ¤Þ¤ì¤Ê¤¤¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò
350 ¡Ö¼Â¸ú¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¥»¥Ã¥È¡×¤ä¡Ö·Ñ¾µ²Äǽ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¥»¥Ã¥È¡×¤Ë
351 ¥»¥Ã¥È¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¡£
352 .TP
353 .B EPERM
354 .\"O The caller attempted to use
355 .\"O .BR capset ()
356 .\"O to modify the capabilities of a thread other than itself,
357 .\"O but lacked sufficient privilege.
358 .\"O For kernels supporting VFS
359 .\"O capabilities, this is never permitted.
360 .\"O For kernels lacking VFS
361 .\"O support, the
362 .\"O .B CAP_SETPCAP
363 .\"O capability is required.
364 .\"O (A bug in kernels before 2.6.11 meant that this error could also
365 .\"O occur if a thread without this capability tried to change its
366 .\"O own capabilities by specifying the
367 .\"O .I pid
368 .\"O field as a nonzero value (i.e., the value returned by
369 .\"O .BR getpid (2))
370 .\"O instead of 0.)
371 ¸Æ¤Ó½Ð¤·¸µ¤¬¼«Ê¬°Ê³°¤Î¥¹¥ì¥Ã¥É¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò
372 .BR capset ()
373 ¤ò»È¤Ã¤Æ½¤Àµ¤·¤è¤¦¤È¤·¤¿¤¬¡¢½½Ê¬¤ÊÆø¢¤¬¤Ê¤«¤Ã¤¿¡£
374 VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¥«¡¼¥Í¥ë¤Ç¤Ï¡¢
375 ¤³¤ÎÁàºî¤¬µö²Ä¤µ¤ì¤ë¤³¤È¤Ï·è¤·¤Æ¤Ê¤¤¡£
376 VFS ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¥«¡¼¥Í¥ë¤Ç¤Ï¡¢
377 .B CAP_SETPCAP
378 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬É¬ÍפǤ¢¤ë¡£
379 (¥Ð¡¼¥¸¥ç¥ó 2.6.11 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ë¤Ï¡¢
380 ¤³¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¥¹¥ì¥Ã¥É¤¬
381 .I pid
382 ¥Õ¥£¡¼¥ë¥É¤Ë 0 ¤Ç¤Ê¤¤ÃÍ (¤Ä¤Þ¤ê¡¢0 ¤ÎÂå¤ï¤ê¤Ë
383 .BR getpid (2)
384 ¤¬ÊÖ¤¹ÃÍ) ¤ò»ØÄꤷ¤Æ¼«Ê¬¼«¿È¤Î¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¾ì¹ç¤Ë¤â¡¢
385 ¤³¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¤¤¤¦¥Ð¥°¤¬¤¢¤Ã¤¿¡£)
386 .TP
387 .B ESRCH
388 .\"O No such thread.
389 ¤½¤Î¤è¤¦¤Ê¥¹¥ì¥Ã¥É¤¬Â¸ºß¤·¤Ê¤¤¡£
390 .\"O .SH "CONFORMING TO"
391 .SH ½àµò
392 .\"O These system calls are Linux-specific.
393 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux Æȼ«¤Ç¤¢¤ë¡£
394 .\"O .SH NOTES
395 .SH È÷¹Í
396 .\"O The portable interface to the capability querying and setting
397 .\"O functions is provided by the
398 .\"O .I libcap
399 .\"O library and is available:
400 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤òÀßÄꤷ¤¿¤ê¼èÆÀ¤·¤¿¤ê¤¹¤ëµ¡Ç½¤Î¤¿¤á¤Î°Ü¿¢À­¤¢¤ë
401 ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ï
402 .I libcap
403 ¥é¥¤¥Ö¥é¥ê¤Ë¤è¤Ã¤ÆÄ󶡤µ¤ì¤ë¡£
404 ¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï°Ê²¼¤«¤éÆþ¼ê¤Ç¤­¤ë:
405 .br
406 http://www.kernel.org/pub/linux/libs/security/linux-privs
407 .\"O .SH "SEE ALSO"
408 .SH ´ØÏ¢¹àÌÜ
409 .BR clone (2),
410 .BR gettid (2),
411 .BR capabilities (7)