summaryrefslogtreecommitdiffstats
path: root/lib/libutil/pidfile.c
Commit message (Collapse)AuthorAgeFilesLines
* In pidfile_open(), if the pidfile is locked, but empty (PID is not stored yet)pjd2011-10-161-12/+12
| | | | | | | | | | | and the caller requested other process' PID by passing non-NULL pidptr argument, we will wait at most 100ms for the PID to show up in the file and if it won't, we will store -1 in *pidptr. From now on, pidfile_open() function never sets errno to EAGAIN on failure. In collaboration with: des MFC after: 1 week
* There is no point in releasing a lock on a file which we've unlinked anddes2008-10-201-4/+0
| | | | | are about to close, so don't. As a bonus, pidfile_remove(3) will now work with an fcntl(2)-based flopen(3).
* When pidfile is already locked and has zero length, do not returnkib2007-10-121-1/+15
| | | | | | | | | | | | | | success and zero pid from pidfile_read(). Return EAGAIN instead. Sleep up to three times for 5 ms while waiting for pidfile to be written. mount(8) does the kill(mountpid, SIGHUP). If mountd pidfile is truncated, that would result in the SIGHUP delivered to the mount' process group instead of the mountd. Found and analyzed by: Peter Holm Tested by: Peter Holm, kris Reviewed by: pjd MFC after: 1 week
* Back out previous commit until I figure out why my regression test fails.des2007-08-031-10/+4
| | | | Approved by: re (kensmith)
* Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.des2007-08-031-4/+10
| | | | Approved by: re (kensmith)
* strlcpy() may be faster than snprintf(), but it is less portable, and thisdes2007-05-111-8/+8
| | | | | | | is not performance critical code anyway. Also, avoid using strlen() to obtain information which we already have. MFC after: 3 weeks
* Use flopen(3).des2007-05-101-2/+2
| | | | MFC after: 3 weeks
* Remove some unused variablesbrian2006-06-231-2/+0
|
* use pwrite to always write at the begining of the file.. If multiple callsjmg2006-04-111-1/+1
| | | | | | | | to pidfile_write happen, the pidfile will have nul characters prepended due to the cached file descriptor offset... Reviewed by: scottl MFC after: 3 days
* Add a family of functions for reliable pidfiles handling.pjd2005-08-241-0/+246
Idea from: jmg Discussed on: arch@
OpenPOWER on IntegriCloud