non-root process and PID files

Terry Lambert tlambert2 at mindspring.com
Fri Oct 31 02:14:03 PST 2003


Nielsen wrote:
> Christopher Vance wrote:
> > May I suggest a different feature: the ability to mark an open file
> > (not just its fd) 'remove on close', with permission checked at mark
> > time rather than close time (this status forgotten if not permitted
> > when set) and the unlink actually done at close time only if the file
> > has exactly one link and one open file instance at that time.
> 
> WinNT (2K etc...) has this capability. Not saying that this makes it a
> good idea though.

In all Windows supported FS's, there is no separation between the
inode and the directory entry referencing the inode, so you'd expect
them to be able to do this from an open file reference, since they
can always get the directory entry back.

In response to another post: saving the path at startup time is no
good, since if someone moves the file (if it's open) or removes it
preemptively (and it's closed), then there's a race window in
which another instance of the program may start, and the program
exiting removes the wrong file (or gets a permission denied error).

All this hacking to solve the problem of harmless old files lying
around in /var/run is fraught with peril...

-- Terry


More information about the freebsd-hackers mailing list