1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright (C) 2008, Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" References consulted:
25 .\" Linux libc source code
26 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\" Modified Sat Jul 24 18:48:48 1993 by Rik Faith (faith@cs.unc.edu)
29 .\" Modified 980310, aeb
30 .\" Modified 990328, aeb
31 .\" 2008-06-19, mtk, Added mkostemp(); various other changes
33 .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako
34 .\" all rights reserved.
35 .\" Translated 1997-05-17, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
36 .\" Modified 1997-05-27, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
37 .\" Modified 1998-02-05, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
38 .\" Modified 1998-09-27, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
39 .\" Modified 1999-04-10, Kazuyuki Tanisako <tanisako@osa.dec.com>
40 .\" Updated 2001-01-17, Kentaro Shirakata <argrath@ub32.org>
41 .\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\" Updated 2008-08-10, Akihiro MOTOKI, LDP v3.05
44 .\"WORD: temporary file 一時ファイル
45 .\"WORD: read/write リード/ライト
46 .\"WORD: permissions 許可
48 .TH MKSTEMP 3 2008-06-19 "GNU" "Linux Programmer's Manual"
50 mkstemp, mkostemp \- 他と重ならない名前を持つ一時ファイルを作成する
53 .B #include <stdlib.h>
55 .BI "int mkstemp(char *" template );
57 .BI "int mkostemp (char *" template ", int " flags );
62 .RB ( feature_test_macros (7)
67 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
79 そのファイルに対するオープン済みのファイルディスクリプタを返す。
83 で指示する文字列の後ろの 6 文字は XXXXXX である必要がある。
84 この部分がファイル名を他と重ならないようにする文字で置き換えられる。
86 は書き換えられるため、文字列定数ではなく文字配列として
89 ファイルは許可モード 0600 で作成され、所有者のみが読み書き可能である
90 (glibc バージョン 2.06 以前では、ファイルは許可モード 0666 で作成され、
92 返されるファイルディスクリプタで、このファイルへの読み書き両方のアクセスが
94 呼び出し者がそのファイルを作成するプロセスであることを保証するために、
113 成功すると、これらの関数は一時ファイルのファイルディスクリプタを返す。
121 \fItemplate\fP の内容は不定である。
124 引数 \fItemplate\fP で指示された文字配列の後ろの 6 文字が XXXXXX でない。
125 \fItemplate\fP の内容は変化しない。
129 に書かわれているエラーのいずれかで失敗することもある。
132 は glibc 2.7 以降で利用可能である。
135 4.3BSD, POSIX.1-2001.
139 許可モード 0666 でファイルを作成するという古い動作は、
141 特に他の Unix では許可モードとして 0600 を使うため、
142 プログラムを移植する際、この細かな違いを見落とす可能性が
147 の POSIX 規定ではファイルモードについて何も述べていない。
154 参照) が適切に設定されているか確認するべきである。
157 のプロトタイプ宣言は、libc4, libc5, glibc1 では
159 に含まれる; glibc2 では POSIX.1 に準拠し