OSDN Git Service

5ecf4f0b867e0edb2bd933b7d54e5380c9f64e87
[linuxjm/LDP_man-pages.git] / draft / man3 / mktemp.3
1 .\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sat Jul 24 18:48:06 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified Fri Jun 23 01:26:34 1995 by Andries Brouwer (aeb@cwi.nl)
31 .\" (prompted by Scott Burkett <scottb@IntNet.net>)
32 .\" Modified Sun Mar 28 23:44:38 1999 by Andries Brouwer (aeb@cwi.nl)
33 .\"
34 .\"*******************************************************************
35 .\"
36 .\" This file was generated with po4a. Translate the source file.
37 .\"
38 .\"*******************************************************************
39 .TH MKTEMP 3 2013\-04\-19 GNU "Linux Programmer's Manual"
40 .SH 名前
41 mktemp \- 他と重ならないテンポラリファイル名を作成する
42 .SH 書式
43 .nf
44 \fB#include <stdlib.h>\fP
45 .sp
46 \fBchar *mktemp(char *\fP\fItemplate\fP\fB);\fP
47 .fi
48 .sp
49 .in -4n
50 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
51 .in
52 .sp
53 \fBmktemp\fP():
54 .ad l
55 .PD 0
56 .RS 4
57 .TP  4
58 glibc 2.12 以降:
59 _BSD_SOURCE || _SVID_SOURCE ||
60     (_XOPEN_SOURCE\ >=\ 500 ||
61          _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
62     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
63 .TP 
64 glibc 2.12 より前:
65 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
66 .RE
67 .PD
68 .ad b
69 .SH 説明
70 関数 \fBmktemp\fP()  は引数 \fItemplate\fP から他と重ならない テンポラリファイル名を作成する。引数 \fItemplate\fP
71 で指示する文字配列 の後6文字は XXXXXX である必要がある。この部分がファイル名を他と 重ならないにするような文字で置き換えられる。
72 \fItemplate\fP は書き換えられるため、文字列定数ではなく文字配列として宣言するように しなければならない。
73 .SH 返り値
74 関数 \fBmktemp\fP()  は常に \fItemplate\fP を戻す。 一意な名前が作成された場合、 \fItemplate\fP の最後の 6 バイトに
75 他と重ならない名前 (それまでに出ていない名前) になるような値が格納される。 一意な名前が作成できなかった場合には、 \fItemplate\fP
76 には空文字列がセットされ、 \fIerrno\fP にエラーを示す値がセットされる。
77 .SH エラー
78 .TP 
79 \fBEINVAL\fP
80 引数 \fItemplate\fP で指示された文字列の後6文字が XXXXXX でない。
81 .SH 準拠
82 4.3BSD, POSIX.1\-2001.  POSIX.1\-2008 では \fBmktemp\fP()  の仕様が削除されている。
83 .SH 注意
84 libc4, libc5, glibc1 でのプロトタイプ宣言は \fI<unistd.h>\fP に含まれる; glibc2 では
85 Single UNIX Specification に従って \fI<stdlib.h>\fP に含まれている。
86 .SH バグ
87 \fBmktemp\fP()  を決して使わないこと。4.3BSD 系の実装や XXXXXX を プロセス ID
88 と1文字により置き換える方式ではせいぜい26の名前を返す ことができるにすぎない。
89 この名前は簡単に推測できることや、その名前がすでに存在しているかどうか テストして、そのファイルをオープンする間に競合がある事から、
90 \fBmktemp\fP()  を使うのは毎回セキュリティリスクをおかすことになる。 この競合は \fBmkstemp\fP(3)  を使うことで避けられる。
91 .SH 関連項目
92 \fBmkstemp\fP(3), \fBtempnam\fP(3), \fBtmpfile\fP(3), \fBtmpnam\fP(3)
93 .SH この文書について
94 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
95 である。プロジェクトの説明とバグ報告に関する情報は
96 http://www.kernel.org/doc/man\-pages/ に書かれている。