8 #include "wvlockfile.h"
23 return !pid || pid == getpid();
32 WvFile lock(lockname, O_WRONLY|O_CREAT|O_EXCL);
36 lock.print(
"%s\n", getpid());
56 WvString lockdir(getdirname(lockname));
58 if (access(lockdir, W_OK) < 0
59 || (!access(lockname, F_OK) && access(lockname, R_OK) < 0))
68 if (pid != -1 && kill(pid, 0) < 0 && errno == ESRCH)
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
WvFile implements a stream connected to a file or Unix device.
char * blocking_getline(time_t wait_msec, int separator= '\n', int readahead=1024)
This is a version of getline() that allows you to block for more data to arrive.
bool isok()
Check to make sure no lock is established or that it's owned by us.
virtual bool isok() const
return true if the stream is actually usable right now
bool lock()
Creates the lockfile with the current pid.
bool unlock()
Removes the lockfile if present.
WvString is an implementation of a simple and efficient printable-string class.
pid_t readpid()
Returns one of three things: -1 if the lockfile exists, but is inaccessible.