Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!rutgers!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: lockfile type locks Message-ID: <1990Jul5.145451.28108@chinet.chi.il.us> Date: 5 Jul 90 14:54:51 GMT Organization: Chinet - Public Access UNIX Lines: 17 Looking at the code for a mailer that uses lockfiles (/usr/mail/logname.lock) to obtain exclusive access to the mail file I've become convinced that there is *no* robust way to detect and delete lockfiles that have been accidentally left in place. The popular method of picking up the PID from the lockfile and sending signal 0 to the locking process will often falsely indicate that the file is stale since the process that owned the previous lockfile may exit between the time the checking process reads the PID and issues the signal. Worse, regardless of the method of determination, there is no way to insure that the file removed by unlink() is the same file that was checked. Another similar process may have just gone through the same procedure and created its lockfile between this process's check and unlink(). Am I missing something? Les Mikesell les@chinet.chi.il.us