OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[linuxjm/LDP_man-pages.git] / original / man3 / mkdtemp.3
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 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .TH MKDTEMP 3  2010-09-26 "GNU" "Linux Programmer's Manual"
25 .SH NAME
26 mkdtemp \- create a unique temporary directory
27 .SH SYNOPSIS
28 .nf
29 .B #include <stdlib.h>
30 .sp
31 .BI "char *mkdtemp(char *" template );
32 .fi
33 .sp
34 .in -4n
35 Feature Test Macro Requirements for glibc (see
36 .BR feature_test_macros (7)):
37 .in
38 .sp
39 .BR mkdtemp ():
40 .br
41 .ad l
42 .RS 4
43 .PD 0
44 _BSD_SOURCE
45 .br
46 || /* Since glibc 2.10: */
47 .RS 4
48 (_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700)
49 .ad
50 .PD
51 .RE
52 .RE
53 .SH DESCRIPTION
54 The
55 .BR mkdtemp ()
56 function generates a uniquely named temporary
57 directory from \fItemplate\fP.
58 The last six characters of \fItemplate\fP
59 must be XXXXXX and these are replaced with a string that makes the
60 directory name unique.
61 The directory is then created with
62 permissions 0700.
63 Since it will be modified,
64 .I template
65 must not be a string constant, but should be declared as a character array.
66 .SH "RETURN VALUE"
67 The
68 .BR mkdtemp ()
69 function returns a pointer to the modified template
70 string on success, and NULL on failure, in which case
71 .I errno
72 is set appropriately.
73 .SH ERRORS
74 .TP
75 .B EINVAL
76 The last six characters of \fItemplate\fP were not XXXXXX.
77 Now \fItemplate\fP is unchanged.
78 .PP
79 Also see
80 .BR mkdir (2)
81 for other possible values for \fIerrno\fP.
82 .SH VERSIONS
83 Available since glibc 2.1.91.
84 .SH "CONFORMING TO"
85 POSIX.1-2008.
86 This function is present on the BSDs.
87 .\" As at 2006, this function is being considered for a revision of POSIX.1
88 .\" Also in NetBSD 1.4.
89 .SH "SEE ALSO"
90 .BR mkdir (2),
91 .BR mkstemp (3),
92 .BR mktemp (3),
93 .BR tempnam (3),
94 .BR tmpfile (3),
95 .BR tmpnam (3)