]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/mkdtemp.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / mkdtemp.3
CommitLineData
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
8mkdtemp \- create a unique temporary directory
a603039e
AC
9.SH LIBRARY
10Standard 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
20Feature 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
31The
32.BR mkdtemp ()
3f624b93 33function generates a uniquely named temporary
c13182ef
MK
34directory from \fItemplate\fP.
35The last six characters of \fItemplate\fP
fea681da 36must be XXXXXX and these are replaced with a string that makes the
c13182ef
MK
37directory name unique.
38The directory is then created with
fea681da
MK
39permissions 0700.
40Since it will be modified,
41.I template
42must not be a string constant, but should be declared as a character array.
47297adb 43.SH RETURN VALUE
60a90ecd
MK
44The
45.BR mkdtemp ()
46function returns a pointer to the modified template
35e21ba7 47string on success, and NULL on failure, in which case
0daa9e92 48.I errno
f6a4078b 49is set to indicate the error.
fea681da
MK
50.SH ERRORS
51.TP
52.B EINVAL
53The last six characters of \fItemplate\fP were not XXXXXX.
54Now \fItemplate\fP is unchanged.
cf0a9ace 55.PP
60a90ecd
MK
56Also see
57.BR mkdir (2)
58for other possible values for \fIerrno\fP.
2b2581ee
MK
59.SH VERSIONS
60Available since glibc 2.1.91.
fee98b6e 61.SH ATTRIBUTES
b89f1988
PH
62For 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
67allbox;
c466875e 68lbx lb lb
b89f1988
PH
69l l l.
70Interface Attribute Value
71T{
fee98b6e 72.BR mkdtemp ()
b89f1988
PH
73T} Thread safety MT-Safe
74.TE
c466875e
MK
75.hy
76.ad
77.sp 1
3113c7f3 78.SH STANDARDS
1cc22815 79POSIX.1-2008.
2795ac0b 80This 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)