Counting files created in /tmp

Ken Yap ken at cs.rochester.edu
Sun Feb 4 05:49:31 AEST 1990


I don't know exactly what the person wants to do with stats from /tmp,
I had some mail from him, but it wasn't totally clear what sorts of
stats he wanted, but I want to point out that not all files in /tmp
have names. A neat trick to avoid leaving /tmp files around when
a program crashes is to do this at creation time.

	fd = creat(name, mode);	/* or open with O_CREAT */
	unlink(name);

Now the file is nameless and can only be accessed via the fd. It
will go away as soon as nobody is referencing it.



More information about the Comp.unix.questions mailing list