OSDN Git Service

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