/tmp versus temporary file types

Chris Torek chris at umcp-cs.UUCP
Tue Oct 15 00:56:41 AEST 1985


Funny, Fred and I were talking about flink() and open(O_TEMP) mode
just last week....

There are some problems.  Flink is easy, but O_TEMP is not; not
really.  Basically, O_TEMP wants to open an unnamed file:  to get
an inode on some device, but to leave its link count zero.  So for
an O_TEMP open you do not care at all about the file name.  Why,
then, should you have to specify it?  Well, you *do* care (presumably)
about the device from which the inode is taken.  After all, you
are (most likely) going to flink the inode to a name once the file
is built.  But the device is normally just a part of the file name,
and deduced by namei as mounted file systems are encountered in
the path name.

Fred suggested completely ignoring the `name' argument to open if
you are using O_TEMP, and using u.u_cdir to get the device for the
new inode.  This seems a bit kludgy but would probably work.

If you instead use the pathname to find the device, you run into
a different problem:  what if the named file exists?  Namei currently
will return the inode for that file.  So you must also kludge namei
to ignore the last file name argument.  Somehow, this does not
`feel' like the right solution either.

Any suggestions?  DMR, are you listening?
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list