1 /* Create a temporary file or directory.
3 Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* header written by Eric Blake */
21 # define GL_TEMPNAME_H
26 # define GT_FILE __GT_FILE
27 # define GT_DIR __GT_DIR
28 # define GT_NOCREATE __GT_NOCREATE
32 # define GT_NOCREATE 2
35 /* Generate a temporary file name based on TMPL. TMPL must match the
36 rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
37 The name constructed does not exist at the time of the call to
38 gen_tempname. TMPL is overwritten with the result.
41 GT_NOCREATE: simply verify that the name does not exist
42 at the time of the call.
43 GT_FILE: create a large file using open(O_CREAT|O_EXCL)
44 and return a read-write fd. The file is mode 0600.
45 GT_DIR: create a directory, which will be mode 0700.
47 We use a clever algorithm to get hard-to-predict names. */
48 extern int gen_tempname (char *tmpl
, int suffixlen
, int flags
, int kind
);
50 #endif /* GL_TEMPNAME_H */