Path: utzoo!attcan!uunet!pmafire!uudell!milano!cs.utexas.edu!usc!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!uflorida!ziggy!screamer!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.unix.programmer Subject: Re: Determining if an existant file is open Message-ID: <274975C4.21C@tct.uucp> Date: 20 Nov 90 18:28:20 GMT References: <1990Nov16.023110.1305@csun.edu> <1990Nov16.200945.14468@nusdecs.uucp> Organization: Teltronics/TCT, Sarasota, FL Lines: 18 According to rwhite@nusdecs.uucp (0257014-Robert White(140)): >Do the "put process number in lock file" thing as in uucp. This approach cannot be used reliably without either (1) having a lock held forever by a dead process, which I find unacceptable, or (2) using a kernel locking call, which renders the pid file redundant. For you doubters: Once you've determined that a lock file is stale and you want to unlink() it, how do you know the lock file hasn't been replaced in between the decision to unlink() and the unlink() itself? I really like kernel record locks for lots of reasons, but the primary one is that locks disappear automatically when the locking process dies, even if the death is abnormal (SIGKILL, core dump, anything). -- Chip Salzenberg at Teltronics/TCT , "I've been cranky ever since my comp.unix.wizards was removed by that evil Chip Salzenberg." -- John F. Haugh II