Open System Services System Calls Reference Manual (G06.28+)
tmpnam_r(2) OSS System Calls Reference Manual
NAME
tmpnam_r - Constructs the name for a temporary file (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <stdio.h>]
#include <spthread.h>
char *tmpnam_r (
char *buf
);
PARAMETERS
buf Specifies the address of an array of at least the number of bytes specified by
L_tmpnam, a constant defined in the stdio.h header file.
DESCRIPTION
The tmpnam_r( ) function is the reentrant version of the tmpnam() function.
The tmpnam_r( ) function generates a filename using the pathname defined as P_tmpdir in the
stdio.h header file.
Files created using this function reside in a directory intended for temporary use, and their names
are unique. It is the user’s responsibility to use the unlink() function to remove the file when it is
no longer needed.
Between the time a filename is created and the file is opened, it is possible for some other process
to create a file with the same name. This should not happen if that other process uses these func-
tions, and if the filenames are chosen to make duplication by other means unlikely.
The tmpnam_r( ) function generates a different filename each time it is called. If it is called
more than TMP_MAX times by a single process, it starts reusing previously used names.
RETURN VALUES
If the buf parameter is not a null pointer, it is assumed to be the address of an array of at least the
number of bytes specified by L_tmpnam. L_tmpnam is a constant defined in the stdio.h header
file. The tmpnam_r( ) function places its results into that array and returns the value of the buf
parameter.
If buf is a null pointer, the function returns NULL. This behavior differs from that of the
tmpnam( ) function.
RELATED INFORMATION
Functions: tmpnam(3), tmpnam_oss(3).
STANDARDS CONFORMANCE
This function is an extension to the UNIX98 specification. Interfaces documented on this refer-
ence page conform to the following industry standards:
• IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
8−72 Hewlett-Packard Company 527186-005