Curious situation with unlink() and open()

Yanni Chiu yanni-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Tue May 1 02:36:50 UTC 2012


On 30/04/12 10:18 PM, William Park wrote:
>
> Hmm... creating separate lock file (O_RDONLY|O_CREAT|O_EXCL) seems to
> work, by forcing open() to fail for all subsequent attempts to get fd.
> It's polluting the directory, but the code is only few lines more.
> Thanks.

So now the problem that could arise is that some process fails to remove 
the lock file, due to some premature exit.

Is there standard (shell?) code for things like this? Or, is using an 
RDB a quick and easy (but heavyweight) solution.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list