]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2001 John Levon <moz@compsoc.man.ac.uk> |
2 | .\" Based on mkstemp(3), Copyright 1993 David Metcalfe (david@prism.demon.co.uk) | |
3 | .\" and GNU libc documentation | |
4 | .\" | |
93015253 | 5 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
6 | .\" Permission is granted to make and distribute verbatim copies of this |
7 | .\" manual provided the copyright notice and this permission notice are | |
8 | .\" preserved on all copies. | |
9 | .\" | |
10 | .\" Permission is granted to copy and distribute modified versions of this | |
11 | .\" manual under the conditions for verbatim copying, provided that the | |
12 | .\" entire resulting derived work is distributed under the terms of a | |
13 | .\" permission notice identical to this one. | |
c13182ef | 14 | .\" |
fea681da MK |
15 | .\" Since the Linux kernel and libraries are constantly changing, this |
16 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
17 | .\" responsibility for errors or omissions, or for damages resulting from | |
18 | .\" the use of the information contained herein. The author(s) may not | |
19 | .\" have taken the same level of care in the production of this manual, | |
20 | .\" which is licensed free of charge, as they might when working | |
21 | .\" professionally. | |
c13182ef | 22 | .\" |
fea681da MK |
23 | .\" Formatted or processed versions of this manual, if unaccompanied by |
24 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 25 | .\" %%%LICENSE_END |
3df541c0 | 26 | .TH MKDTEMP 3 2016-07-17 "GNU" "Linux Programmer's Manual" |
fea681da MK |
27 | .SH NAME |
28 | mkdtemp \- create a unique temporary directory | |
29 | .SH SYNOPSIS | |
30 | .nf | |
31 | .B #include <stdlib.h> | |
68e4db0a | 32 | .PP |
fea681da MK |
33 | .BI "char *mkdtemp(char *" template ); |
34 | .fi | |
68e4db0a | 35 | .PP |
cc4615cc MK |
36 | .in -4n |
37 | Feature Test Macro Requirements for glibc (see | |
38 | .BR feature_test_macros (7)): | |
39 | .in | |
68e4db0a | 40 | .PP |
cc4615cc | 41 | .BR mkdtemp (): |
151429b8 MK |
42 | .br |
43 | .ad l | |
44 | .RS 4 | |
45 | .PD 0 | |
51c612fb MK |
46 | /* Since glibc 2.19: */ _DEFAULT_SOURCE |
47 | .br | |
48 | || /* Glibc 2.19 and earlier: */ _BSD_SOURCE | |
3ba63d80 MK |
49 | .br |
50 | || /* Since glibc 2.10: */ | |
b0da7b8b | 51 | _POSIX_C_SOURCE\ >=\ 200809L |
3ba63d80 | 52 | .ad |
151429b8 MK |
53 | .PD |
54 | .RE | |
fea681da | 55 | .SH DESCRIPTION |
60a90ecd MK |
56 | The |
57 | .BR mkdtemp () | |
3f624b93 | 58 | function generates a uniquely named temporary |
c13182ef MK |
59 | directory from \fItemplate\fP. |
60 | The last six characters of \fItemplate\fP | |
fea681da | 61 | must be XXXXXX and these are replaced with a string that makes the |
c13182ef MK |
62 | directory name unique. |
63 | The directory is then created with | |
fea681da MK |
64 | permissions 0700. |
65 | Since it will be modified, | |
66 | .I template | |
67 | must not be a string constant, but should be declared as a character array. | |
47297adb | 68 | .SH RETURN VALUE |
60a90ecd MK |
69 | The |
70 | .BR mkdtemp () | |
71 | function returns a pointer to the modified template | |
35e21ba7 | 72 | string on success, and NULL on failure, in which case |
0daa9e92 | 73 | .I errno |
fea681da MK |
74 | is set appropriately. |
75 | .SH ERRORS | |
76 | .TP | |
77 | .B EINVAL | |
78 | The last six characters of \fItemplate\fP were not XXXXXX. | |
79 | Now \fItemplate\fP is unchanged. | |
cf0a9ace | 80 | .PP |
60a90ecd MK |
81 | Also see |
82 | .BR mkdir (2) | |
83 | for other possible values for \fIerrno\fP. | |
2b2581ee MK |
84 | .SH VERSIONS |
85 | Available since glibc 2.1.91. | |
fee98b6e | 86 | .SH ATTRIBUTES |
b89f1988 PH |
87 | For an explanation of the terms used in this section, see |
88 | .BR attributes (7). | |
89 | .TS | |
90 | allbox; | |
91 | lb lb lb | |
92 | l l l. | |
93 | Interface Attribute Value | |
94 | T{ | |
fee98b6e | 95 | .BR mkdtemp () |
b89f1988 PH |
96 | T} Thread safety MT-Safe |
97 | .TE | |
47297adb | 98 | .SH CONFORMING TO |
1cc22815 | 99 | POSIX.1-2008. |
2795ac0b | 100 | This function is present on the BSDs. |
68e1685c | 101 | .\" As at 2006, this function is being considered for a revision of POSIX.1 |
fea681da | 102 | .\" Also in NetBSD 1.4. |
47297adb | 103 | .SH SEE ALSO |
c39946e0 | 104 | .BR mktemp (1), |
fea681da MK |
105 | .BR mkdir (2), |
106 | .BR mkstemp (3), | |
107 | .BR mktemp (3), | |
108 | .BR tempnam (3), | |
109 | .BR tmpfile (3), | |
110 | .BR tmpnam (3) |