Dag-Erling Smørgrav
5649afd028
Revert (once again, and hopefully for the last time) to flock(2) locks.
...
The problem with fcntl(2) locks is that they are not inherited by child
processes. This breaks pidfile(3), where the common idiom is to open
and lock the PID file before daemonizing.
2009-06-06 18:47:03 +00:00
Dag-Erling Smørgrav
0e25c55a95
Diff reduction against Varnish, including one important fix: use a shared
...
lock if the file is opened with O_RDONLY.
2008-10-20 18:11:30 +00:00
Dag-Erling Smørgrav
80de06ed6b
Reimplement flopen(3) using fcntl(2) locks instead of flock(2) locks.
2008-10-20 18:02:16 +00:00
Dag-Erling Smørgrav
062044ebbe
Back out previous commit until I figure out why my regression test fails.
...
Approved by: re (kensmith)
2007-08-03 09:20:28 +00:00
Dag-Erling Smørgrav
7eb198c642
Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.
...
Approved by: re (kensmith)
2007-08-03 06:32:45 +00:00
Dag-Erling Smørgrav
4b5b992bba
Nit: avoid shadowing truncate(2) with a local variable.
2007-05-23 12:09:33 +00:00
Dag-Erling Smørgrav
400f772943
Fix stupid braino in previous commit.
2007-05-23 10:06:03 +00:00
Dag-Erling Smørgrav
d75d56060e
If (flags & O_TRUNC), don't truncate the file until we've successfully
...
locked it.
MFC after: 3 weeks
2007-05-23 08:12:34 +00:00
Dag-Erling Smørgrav
8f9085389f
Well gag me with a spoon... I'm so used to working at high WARNS levels
...
that I make stupid fundamental mistakes like this when I don't.
2007-05-10 15:01:42 +00:00
Dag-Erling Smørgrav
b252bedcc9
Remove superfluous unexpanded RCS tag.
2007-05-10 14:56:07 +00:00
Dag-Erling Smørgrav
3dea593400
DTRT when O_NONBLOCK is specified.
...
MFC after: 3 weeks
2007-05-10 14:52:57 +00:00
Dag-Erling Smørgrav
9667055264
I'm tired of seeing this done incorrectly and non-portably, so add a
...
flopen(3) function which reliably opens and locks a file.
MFC after: 3 weeks
2007-05-10 14:43:31 +00:00