This section is based on catpages contributed by Mainichi Communications, Inc. Translated by: MYCOM team Converted by: Japanese Online Manual Project <man-jp@jp.FreeBSD.ORG> Submitted by: Kazuo Horikawa <k-horik@yk.rim.or.jp>
116 lines
3.4 KiB
Groff
116 lines
3.4 KiB
Groff
.\" Copyright (c) 1989, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
|
|
.\"
|
|
.Dd April 28, 1995
|
|
.Dt SETMODE 3
|
|
.Os
|
|
.Sh 名称
|
|
.Nm getmode ,
|
|
.Nm setmode
|
|
.Nd モードビットを更新する
|
|
.Sh 書式
|
|
.Fd #include <unistd.h>
|
|
.Ft mode_t
|
|
.Fn getmode "const void *set" "mode_t mode"
|
|
.Ft void *
|
|
.Fn setmode "const char *mode_str"
|
|
.Sh 解説
|
|
.Fn getmode
|
|
関数は、
|
|
.Fa set
|
|
が指す値によって変更された様にファイルパーミッションビット
|
|
.Fa mode
|
|
のコピーを返します。モードビットだけが変更されるのに対し、
|
|
ファイルモードの他の部分を調査できます。
|
|
.Pp
|
|
.Fn setmode
|
|
関数は、
|
|
.Xr chmod 1
|
|
で述べた様に絶対値
|
|
(8
|
|
進数
|
|
)
|
|
またはシンボリック値を引数として取り、
|
|
.Fn getmode
|
|
に与えられるモード値を指すポインタを返します。
|
|
ファイル作成マスクには相対的なシンボリック値もあるので、
|
|
.Fn setmode
|
|
は
|
|
.Xr umask 2
|
|
を呼び出すことがあります。これが生じた場合、ファイル作成マスクは
|
|
.Fn setmode
|
|
が復帰する前に復元されます。
|
|
呼び出しプログラムがファイル作成マスクの値を
|
|
.Fn setmode
|
|
を呼び出した後で変更する場合、将来のファイルモードを正しく更新するために
|
|
.Fn getmode
|
|
を呼ぶなら、
|
|
.Fn setmode
|
|
をもう一度呼び出す必要があります。
|
|
.Pp
|
|
.Fn setmode
|
|
に渡されたモードが無効な場合、または戻り値に関する
|
|
メモリを割り当てできない場合、
|
|
.Fn setmode
|
|
は
|
|
.Dv NULL
|
|
を返します。
|
|
.Pp
|
|
.Fn setmode
|
|
から返された値は
|
|
.Fn malloc
|
|
から得られ、プログラムがその値に対する処理を終えた時、
|
|
通常は
|
|
.Fn getmode
|
|
の呼び出しの後に、
|
|
.Fn free
|
|
でシステムに返す必要があります。
|
|
.Sh エラー
|
|
.Fn setmode
|
|
関数は、処理に失敗して
|
|
errno
|
|
をライブラリルーチン
|
|
.Xr malloc 3
|
|
で指定されたエラーのどれかに設定することがあります。
|
|
.Sh 関連項目
|
|
.Xr chmod 1 ,
|
|
.Xr stat 2 ,
|
|
.Xr umask 2 ,
|
|
.Xr malloc 3
|
|
.Sh 歴史
|
|
.Fn getmode
|
|
関数と
|
|
.Fn setmode
|
|
関数は
|
|
.Bx 4.4
|
|
で最初に登場しました。
|