/tmp versus temporary file types

BostonU SysMgr root%bostonu.csnet at CSNET-RELAY.ARPA
Wed Oct 16 12:01:19 AEST 1985


Just a design note: On our IBM system files are named on CLOSE rather
than open (better put, *can* be named on close rather than open.)
This leads one into a call sequence like:

	fd = open(NULL,O_CREAT...) ;
	...write to it...
	close(fd,filename) ;

besides tmp files it just generally guarantees that programs which
for some reason, um, er, abend, and don't want things left around
can have that (if you think about it, it's an easier way to handle
a user ^C'ing a program, besides just providing a way to create
temporary files, now one generally has to provide a signal handler
that tries to carefully undo things on ^C, one assumes that any
exit that tries to close an unnamed file without giving it a name
will cause the file to disappear.

If you think about it, that's actually a lot closer to the 4.2 socket
design (this has nothing whatsoever to do with the current STREAMS/SOCKET
discussions),  a cleaner way to implement the above might be:

	fd = socket(AF_UNIX,SOCK_FILE,..)

At this point, in this domain, writing would be legal, so would reading
back after a seek, it would behave like a new file.
then at some point where maybe it shouldn't be deleted but you are not
ready to close yet:

	bind(fd,filename,..)

and finally

	close(fd)

One suspects that if the first method (close(fd,fname)) were offered
then a need would arise to make a file have a name without having
to close it (remember all those close(creat(fname,mode)) ; fd=open(...);
code sequences so you could get a new r/w/seekable file!)

Just trying to pull together several ideas.

Ok, that settled, onwards to picking funny characters for the
shell to interpret as DISP=(NEW,KEEP,DELETE) :-)

	-Barry Shein, Boston University

hmm, we could make 'dd' a builtin and add a few new keywords...nahhh



More information about the Comp.unix.wizards mailing list