OSDN Git Service

5c829531d29ea63a18697d342914821ec0438aa3
[linuxjm/LDP_man-pages.git] / release / man2 / umask.2
1 .\" Copyright (c) 2006, 2008, Michael Kerrisk (mtk.manpages@gmail.com)
2 .\" (A few fragments remain from an earlier (1992) version written in
3 .\" 1992 by Drew Eckhardt <drew@cs.colorado.edu>.)
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
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 Nicolás 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 .\"
36 .\" This file was generated with po4a. Translate the source file.
37 .\"
38 .\"*******************************************************************
39 .TH UMASK 2 2008\-01\-09 Linux "Linux Programmer's Manual"
40 .SH 名前
41 umask \- ファイルモード作成マスクを設定する
42 .SH 書式
43 \fB#include <sys/types.h>\fP
44 .br
45 \fB#include <sys/stat.h>\fP
46 .sp
47 \fBmode_t umask(mode_t \fP\fImask\fP\fB);\fP
48 .SH 説明
49 \fBumask\fP()  は、呼び出し元プロセスのファイルモード作成マスク (umask) を \fImask\fP & 0777 に設定し (\fIumask\fP
50 のファイル許可に対応するビットのみを使用する)、 変更前のマスク値を返す。
51
52 .\" e.g., mkfifo(), creat(), mknod(), sem_open(), mq_open(), shm_open()
53 .\" but NOT the System V IPC *get() calls
54 umask は、 \fBopen\fP(2), \fBmkdir\fP(2)  やファイル作成を行うその他のシステムコールで、
55 新しく作成されるファイルやディレクトリの許可 (permission) を 修正するために使用される。 具体的には umask に設定されている許可が
56 \fBopen\fP(2)  や \fBmkdir\fP(2)  の \fImode\fP 引き数から取り消される。
57
58 \fImask\fP に指定するのに使用すべき定数については \fBstat\fP(2)  で説明されている。
59
60 プロセスの umask のよくあるデフォルト値は \fIS_IWGRP\ |\ S_IWOTH\fP (8進で 022) である。
61 新しいファイルを作成する際に \fBopen\fP(2)  の \fImode\fP 引き数に
62 .nf
63
64     S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
65
66 .fi
67 を指定するというよくあるケースでは、作成されたファイルは
68 .nf
69
70     S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
71
72 .fi
73 という許可を持つことになる (なぜなら 0666 & ~022 = 0644、つまり rw\-r\-\-r\-\-)。
74 .SH 返り値
75 このシステムコールは必ず成功し、以前の umask 値を返す。
76 .SH 準拠
77 SVr4, 4.3BSD, POSIX.1\-2001.
78 .SH 注意
79 \fBfork\fP(2)  で作成された子プロセスは、親プロセスの umask を継承する。 \fBexecve\fP(2)  によって umask
80 は変更されない。
81
82 umask の設定は、そのプロセスが生成する POSIX IPC オブジェクト (\fBmq_open\fP(3), \fBsem_open\fP(3),
83 \fBshm_open\fP(3))  や FIFO (\fBmkfifo\fP(3))、 UNIX ドメインソケット (\fBunix\fP(7))
84 に設定される許可にも影響を与える。 一方、umask は、そのプロセスが (\fBmsgget\fP(2), \fBsemget\fP(2),
85 \fBshmget\fP(2)  を使って) 生成する System V IPC オブジェクトに設定される許可には 影響を与えない。
86 .SH 関連項目
87 \fBchmod\fP(2), \fBmkdir\fP(2), \fBopen\fP(2), \fBstat\fP(2), \fBacl\fP(5)
88 .SH この文書について
89 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
90 である。プロジェクトの説明とバグ報告に関する情報は
91 http://www.kernel.org/doc/man\-pages/ に書かれている。