OSDN Git Service

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