Re: File Locking
In article <m0wecpv-000AhlC@liw.clinet.fi>, Lars Wirzenius <email@example.com> wrote:
>However, I should point out at once that I don't know if my
>lockfile.c will work properly in all situations. I've done the
>best I can, based on manual pages, but I haven't been able to
>test it over NFS when various errors happen. I'm not an expert
>on this. I think I have some notes from Miquel somewhere,
>and will try to find them. The problem is that one needs to
>understand NFS and other failure modes to design the locking
>code properly, and I don't understand NFS.
>And it isn't enough to just create a lock file. If the creator
>of the lock file crashes without removing the lock, everyone
>still alive will starve. There should be a method for automatically
>recovering from this, and that method must not rely on a daemon
>purging lock files at suitable intervals. There's no good way
>of doing this, as far as I can tell.
SystemV has a function "touchlock" or somesuch. You just have to touch
the lockfile regulary. If the delta time between creation time and
modification time gets over 5 minutes, the lock is considered stale.
Read "man maillock" on Solaris, together with /usr/include/maillock.h.
| Miquel van Smoorenburg | "I need more space" "Well, why not move to Texas" |
| firstname.lastname@example.org | "No, on my account, stupid." "Stupid? Uh-oh.." |
| PGP fingerprint: FE 66 52 4F CD 59 A5 36 7F 39 8B 20 F1 D6 74 02 |
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .