[net.unix-wizards] Temporary files

minow (11/20/82)

Unix implementors may be interested in a few features from Dec operating
systems the permit flexible handling of temporary files without -- in
general -- cluttering up your disk area.   The following is mostly
from memory, and may not be especially accurate:

	create_tentative_file("name")

		The file is created (equivalent to fopen("name", "w")).
		If your process exits without closing the file, it
		is tossed.  Your process may also "reset" the channel,
		tossing the file.

	create_temp_file()

		A file is created with a filename whose format is
		recognized by the logout utility program.  Logout
		deletes these files.  If the channel is closed
		(rather than reset as noted above), the file will
		exist in the current directory -- useful for
		debugging.  No filename is specified.

	reset_channel()

		Close a channel, but throw away a tentative file if
		one is open.

	reset_all_channels()

		Close down everything, retaining only the command
		terminal (RSTS does not have a built-in stdin/stdout
		redirection).

By the way, RSTS/E has an eminently usable record locking mechanism,
built into the operating system and not implemented by creating magic
files.  I was writing multi-key, multi-user ISAM update programs
in Basic-Plus in 1974 (in about 150 rather unreadable lines of Basic).

Martin Minow
decvax!minow

ignatz (11/25/82)

	Just a brief comment...I might point out that, concerning temp
files, there *is* a routine in the standard UNIX* library that does this;
in section 3:

FILE *tmpfile()

It will "create a temp file, return a file pointer, and "arrange" for the file
to be deleted when the process terminates."

There are also routines which will simply generate unique temporary file
names (mktemp(3C) and tmpnam(3S), leaving all the work to your program.

			Just dusting out my brain cells,

			Dave Ihnat
			ihuxx!ignatz

gwyn@Brl@sri-unix (11/25/82)

From:     Doug Gwyn <gwyn@Brl>
Date:     24 Nov 82 15:45:58-EST (Wed)
UNIX already has a temporary-file mechanism, tmpfile(3).  The file
vanishes when closed.

The trouble with record locking is that the UNIX file system has no
concept of "record" built in.  We would like to keep it this way.
Applications needing record locking should access the file through
a record manager process.