OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[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)