Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
UnixTmpNames


NAME

UnixTmpNames - generation of unique names for temporary files

SYNOPSIS

PROCEDURE Create(VAR name: ARRAY OF CHAR);
PROCEDURE CreateD(dir: ARRAY OF CHAR; VAR name: ARRAY OF CHAR);

DESCRIPTION

Create returns an unique path name for a temporary file. While Create chooses the default directory for temporary files, CreateD allows to specify the path name of a temporary directory. Temporary file names are of the following form:
tmpdir/cmdname.pid.unique.random

where

tmpdir
is the directory,
cmdname
is the name of the command (up to 8 characters; see UnixArguments),
pid
is the process id (see SysProcess),
unique
is a per-process unique number, and
random
an additional sequence of random characters (7 characters).

ENVIRONMENT

TMPDIR
specifies the default directory for temporary files.

FILES

/tmp
Default directory for temporary files, if not overridden by the environment variable TMPDIR.

SEE ALSO

UnixFiles
streams which interfaces UNIX files

BUGS

The current version does not assert the uniqueness by looking up in the directory for temporary files. In practice, however, the random character sequence assures the uniqueness even in pathological cases where there are remaining temporary files of a previous process with the same process id and the same command name.

Given a command name of 8 characters in length, UnixTmpNames returns a base name length of at least 24 for long command names. This may be too long for old-fashioned UNIX file systems.


Edited by: borchert, last change: 1995/03/13, revision: 1.1, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module