.\" Copyright (c) 1989 The Regents of the University of California.
.\" Redistribution and use in source and binary forms are permitted
.\" provided that the above copyright notice and this paragraph are
.\" duplicated in all such forms and that any documentation,
.\" advertising materials, and other materials related to such
.\" distribution and use acknowledge that the software was developed
.\" by the University of California, Berkeley. The name of the
.\" University may not be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\" @(#)mktemp.3 6.6 (Berkeley) %G%
mktemp \- create a unique file name
takes a file name template and overwrites it to create a unique file
name for use by the application.
The template may be any file name with some number of X's appended
to it, for example ``/tmp/temp.XXXX''.
The trailing X's are replaced with the current process number and/or a
unique letter combination.
The number of unique file names
can return depends on the number of X's provided; six X's will
testing roughly 26 ** 6 combinations.
makes the same replacement to the template and creates the template file,
mode 0600, returning a file descriptor opened for reading and writing.
This avoids the race between testing for a file's existence and opening it
returns a pointer to the template on success and NULL on failure.
returns -1 if no suitable file could be created.
If either call fails an error code is placed in the global location
to one of the following values:
The pathname portion of the template is not an existing directory.
to any value specified by the
to any value specified by the
chmod(2), getpid(2), open(2), stat(2)