OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man2 / umask.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 2006, 2008, Michael Kerrisk (mtk.manpages@gmail.com)
4 .\" (A few fragments remain from an earlier (1992) version written in
5 .\" 1992 by Drew Eckhardt <drew@cs.colorado.edu>.)
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\" Modified by Michael Haardt <michael@moria.de>
28 .\" Modified Sat Jul 24 12:51:53 1993 by Rik Faith <faith@cs.unc.edu>
29 .\" Modified Tue Oct 22 22:39:04 1996 by Eric S. Raymond <esr@thyrsus.com>
30 .\" Modified Thu May  1 06:05:54 UTC 1997 by Nicolas Lichtmaier
31 .\"  <nick@debian.com> with Lars Wirzenius <liw@iki.fi> suggestion
32 .\" 2006-05-13, mtk, substantial rewrite of description of 'mask'
33 .\" 2008-01-09, mtk, a few rewrites and additions.
34 .\"
35 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
36 .\"         all rights reserved.
37 .\" Translated 1997-06-26, SUTO Mitsuaki <suto@av.crl.sony.co.jp>
38 .\" Modified 1999-03-21, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
39 .\" Modified 2005-09-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated 2006-07-21, Akihiro MOTOKI, LDP v2.36
41 .\" Updated 2008-02-10, Akihiro MOTOKI, LDP v2.77
42 .\"
43 .TH UMASK 2 2008-01-09 "Linux" "Linux Programmer's Manual"
44 .\"O .SH NAME
45 .SH Ì¾Á°
46 .\"O umask \- set file mode creation mask
47 umask \- ¥Õ¥¡¥¤¥ë¥â¡¼¥ÉºîÀ®¥Þ¥¹¥¯¤òÀßÄꤹ¤ë
48 .\"O .SH SYNOPSIS
49 .SH ½ñ¼°
50 .B #include <sys/types.h>
51 .br
52 .B #include <sys/stat.h>
53 .sp
54 .BI "mode_t umask(mode_t " mask );
55 .\"O .SH DESCRIPTION
56 .SH ÀâÌÀ
57 .\"O .BR umask ()
58 .\"O sets the calling process's file mode creation mask (umask) to
59 .\"O .I mask
60 .\"O & 0777 (i.e., only the file permission bits of
61 .\"O .I mask
62 .\"O are used), and returns the previous value of the mask.
63 .BR umask ()
64 ¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¥Õ¥¡¥¤¥ë¥â¡¼¥ÉºîÀ®¥Þ¥¹¥¯ (umask) ¤ò
65 .I mask
66 & 0777 ¤ËÀßÄꤷ
67 .RI ( umask
68 ¤Î¥Õ¥¡¥¤¥ëµö²Ä¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤Î¤ß¤ò»ÈÍѤ¹¤ë)¡¢
69 Êѹ¹Á°¤Î¥Þ¥¹¥¯ÃͤòÊÖ¤¹¡£
70
71 .\"O The umask is used by
72 .\"O .BR open (2),
73 .\"O .BR mkdir (2),
74 .\"O and other system calls that create files
75 .\"O .\" e.g., mkfifo(), creat(), mknod(), sem_open(), mq_open(), shm_open()
76 .\"O .\" but NOT the System V IPC *get() calls
77 .\"O to modify the permissions placed on newly created files or directories.
78 umask ¤Ï¡¢
79 .BR open (2),
80 .BR mkdir (2)
81 ¤ä¥Õ¥¡¥¤¥ëºîÀ®¤ò¹Ô¤¦¤½¤Î¾¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¡¢
82 .\" Î㤨¤Ð mkfifo(), creat(), mknod(), sem_open(), mq_open(), shm_open()
83 .\" System V IPC *get() ¥³¡¼¥ë¤Ï³ºÅö¤·¤Ê¤¤¡£
84 ¿·¤·¤¯ºîÀ®¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ä¥Ç¥£¥ì¥¯¥È¥ê¤Îµö²Ä (permission) ¤ò
85 ½¤Àµ¤¹¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¡£
86 .\"O Specifically, permissions in the umask are turned off from
87 .\"O the \fImode\fP argument to
88 .\"O .BR open (2)
89 .\"O and
90 .\"O .BR mkdir (2).
91 ¶ñÂÎŪ¤Ë¤Ï umask ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëµö²Ä¤¬
92 .BR open (2)
93 ¤ä
94 .BR mkdir (2)
95 ¤Î \fImode\fP °ú¤­¿ô¤«¤é¼è¤ê¾Ã¤µ¤ì¤ë¡£
96
97 .\"O The constants that should be used to specify
98 .\"O .I mask
99 .\"O are described under
100 .\"O .BR stat (2).
101 .I mask
102 ¤Ë»ØÄꤹ¤ë¤Î¤Ë»ÈÍѤ¹¤Ù¤­Äê¿ô¤Ë¤Ä¤¤¤Æ¤Ï
103 .BR stat (2)
104 ¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¡£
105
106 .\"O The typical default value for the process umask is
107 .\"O .I S_IWGRP\ |\ S_IWOTH
108 .\"O (octal 022).
109 .\"O In the usual case where the
110 .\"O .I mode
111 .\"O argument to
112 .\"O .BR open (2)
113 .\"O is specified as:
114 ¥×¥í¥»¥¹¤Î umask ¤Î¤è¤¯¤¢¤ë¥Ç¥Õ¥©¥ë¥ÈÃͤÏ
115 .I S_IWGRP\ |\ S_IWOTH
116 (8¿Ê¤Ç 022) ¤Ç¤¢¤ë¡£
117 ¿·¤·¤¤¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ëºÝ¤Ë
118 .BR open (2)
119 ¤Î
120 .I mode
121 °ú¤­¿ô¤Ë
122 .nf
123
124     S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
125 .fi
126 ¤ò»ØÄꤹ¤ë¤È¤¤¤¦¤è¤¯¤¢¤ë¥±¡¼¥¹¤Ç¤Ï¡¢ºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ï
127 .\"O (octal 0666) when creating a new file, the permissions on the
128 .\"O resulting file will be:
129 .nf
130
131     S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
132
133 .fi
134 .\"O (because 0666 & ~022 = 0644; i.e., rw\-r\-\-r\-\-).
135 ¤È¤¤¤¦µö²Ä¤ò»ý¤Ä¤³¤È¤Ë¤Ê¤ë
136 (¤Ê¤¼¤Ê¤é 0666 & ~022 = 0644¡¢¤Ä¤Þ¤ê rw\-r\-\-r\-\-)¡£
137 .\"O .SH "RETURN VALUE"
138 .SH ÊÖ¤êÃÍ
139 .\"O This system call always succeeds and the previous value of the mask
140 .\"O is returned.
141 ¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ïɬ¤ºÀ®¸ù¤·¡¢°ÊÁ°¤Î umask ÃͤòÊÖ¤¹¡£
142 .\"O .SH "CONFORMING TO"
143 .SH ½àµò
144 SVr4, 4.3BSD, POSIX.1-2001.
145 .\"O .SH NOTES
146 .SH Ãí°Õ
147 .\"O A child process created via
148 .\"O .BR fork (2)
149 .\"O inherits its parent's umask.
150 .\"O The umask is left unchanged by
151 .\"O .BR execve (2).
152 .BR fork (2)
153 ¤ÇºîÀ®¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Ï¡¢¿Æ¥×¥í¥»¥¹¤Î umask ¤ò·Ñ¾µ¤¹¤ë¡£
154 .BR execve (2)
155 ¤Ë¤è¤Ã¤Æ umask ¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
156
157 .\"O The umask setting also affects the permissions assigned to POSIX IPC objects
158 .\"O .RB ( mq_open (3),
159 .\"O .BR sem_open (3),
160 .\"O .BR shm_open (3)),
161 .\"O FIFOs
162 .\"O .RB ( mkfifo (3)),
163 .\"O and UNIX domain sockets
164 .\"O .RB ( unix (7))
165 .\"O created by the process.
166 .\"O The umask does not affect the permissions assigned
167 .\"O to System V IPC objects created by the process (using
168 .\"O .BR msgget (2),
169 .\"O .BR semget (2),
170 .\"O .BR shmget (2)).
171 umask ¤ÎÀßÄê¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤¬À¸À®¤¹¤ë POSIX IPC ¥ª¥Ö¥¸¥§¥¯¥È
172 .RB ( mq_open (3),
173 .BR sem_open (3),
174 .BR shm_open (3))
175 ¤ä FIFO
176 .RB ( mkfifo (3))¡¢
177 UNIX ¥É¥á¥¤¥ó¥½¥±¥Ã¥È
178 .RB ( unix (7))
179 ¤ËÀßÄꤵ¤ì¤ëµö²Ä¤Ë¤â±Æ¶Á¤òÍ¿¤¨¤ë¡£
180 °ìÊý¡¢umask ¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤¬
181 .RB ( msgget (2),
182 .BR semget (2),
183 .BR shmget (2)
184 ¤ò»È¤Ã¤Æ) À¸À®¤¹¤ë System V IPC ¥ª¥Ö¥¸¥§¥¯¥È¤ËÀßÄꤵ¤ì¤ëµö²Ä¤Ë¤Ï
185 ±Æ¶Á¤òÍ¿¤¨¤Ê¤¤¡£
186 .\"O .SH "SEE ALSO"
187 .SH ´ØÏ¢¹àÌÜ
188 .BR chmod (2),
189 .BR mkdir (2),
190 .BR open (2),
191 .BR stat (2)
192 .\" FIXME . eventually: .BR acl (5)