]>
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 | .\" | |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
4c1c5274 | 6 | .TH mkdtemp 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
7 | .SH NAME |
8 | mkdtemp \- create a unique temporary directory | |
a603039e AC |
9 | .SH LIBRARY |
10 | Standard C library | |
8fc3b2cf | 11 | .RI ( libc ", " \-lc ) |
fea681da MK |
12 | .SH SYNOPSIS |
13 | .nf | |
14 | .B #include <stdlib.h> | |
68e4db0a | 15 | .PP |
fea681da MK |
16 | .BI "char *mkdtemp(char *" template ); |
17 | .fi | |
68e4db0a | 18 | .PP |
d39ad78f | 19 | .RS -4 |
cc4615cc MK |
20 | Feature Test Macro Requirements for glibc (see |
21 | .BR feature_test_macros (7)): | |
d39ad78f | 22 | .RE |
68e4db0a | 23 | .PP |
cc4615cc | 24 | .BR mkdtemp (): |
9d2adbae MK |
25 | .nf |
26 | /* Since glibc 2.19: */ _DEFAULT_SOURCE | |
27 | || /* Glibc 2.19 and earlier: */ _BSD_SOURCE | |
5c10d2c5 | 28 | || /* Since glibc 2.10: */ _POSIX_C_SOURCE >= 200809L |
9d2adbae | 29 | .fi |
fea681da | 30 | .SH DESCRIPTION |
60a90ecd MK |
31 | The |
32 | .BR mkdtemp () | |
3f624b93 | 33 | function generates a uniquely named temporary |
c13182ef MK |
34 | directory from \fItemplate\fP. |
35 | The last six characters of \fItemplate\fP | |
fea681da | 36 | must be XXXXXX and these are replaced with a string that makes the |
c13182ef MK |
37 | directory name unique. |
38 | The directory is then created with | |
fea681da MK |
39 | permissions 0700. |
40 | Since it will be modified, | |
41 | .I template | |
42 | must not be a string constant, but should be declared as a character array. | |
47297adb | 43 | .SH RETURN VALUE |
60a90ecd MK |
44 | The |
45 | .BR mkdtemp () | |
46 | function returns a pointer to the modified template | |
35e21ba7 | 47 | string on success, and NULL on failure, in which case |
0daa9e92 | 48 | .I errno |
f6a4078b | 49 | is set to indicate the error. |
fea681da MK |
50 | .SH ERRORS |
51 | .TP | |
52 | .B EINVAL | |
53 | The last six characters of \fItemplate\fP were not XXXXXX. | |
54 | Now \fItemplate\fP is unchanged. | |
cf0a9ace | 55 | .PP |
60a90ecd MK |
56 | Also see |
57 | .BR mkdir (2) | |
58 | for other possible values for \fIerrno\fP. | |
2b2581ee MK |
59 | .SH VERSIONS |
60 | Available since glibc 2.1.91. | |
fee98b6e | 61 | .SH ATTRIBUTES |
b89f1988 PH |
62 | For an explanation of the terms used in this section, see |
63 | .BR attributes (7). | |
c466875e MK |
64 | .ad l |
65 | .nh | |
b89f1988 PH |
66 | .TS |
67 | allbox; | |
c466875e | 68 | lbx lb lb |
b89f1988 PH |
69 | l l l. |
70 | Interface Attribute Value | |
71 | T{ | |
fee98b6e | 72 | .BR mkdtemp () |
b89f1988 PH |
73 | T} Thread safety MT-Safe |
74 | .TE | |
c466875e MK |
75 | .hy |
76 | .ad | |
77 | .sp 1 | |
3113c7f3 | 78 | .SH STANDARDS |
1cc22815 | 79 | POSIX.1-2008. |
2795ac0b | 80 | This function is present on the BSDs. |
68e1685c | 81 | .\" As at 2006, this function is being considered for a revision of POSIX.1 |
fea681da | 82 | .\" Also in NetBSD 1.4. |
47297adb | 83 | .SH SEE ALSO |
c39946e0 | 84 | .BR mktemp (1), |
fea681da MK |
85 | .BR mkdir (2), |
86 | .BR mkstemp (3), | |
87 | .BR mktemp (3), | |
88 | .BR tempnam (3), | |
89 | .BR tmpfile (3), | |
90 | .BR tmpnam (3) |