Curious situation with unlink() and open()

Yanni Chiu yanni-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Apr 30 16:19:15 UTC 2012


On 30/04/12 11:31 AM, William Park wrote:
>
> I think the issue is, lock is applied after open(), not before.
> But, you lock on file descriptor which open() gives you.

I think the issue is that it's a lock on writing the file (so the bits 
don't get garbled by two processes writing at the same time). It's not a 
lock on removing the file entirely. As others have said, the two 
processes have to coordinate, whether or not the file can be removed. 
The write lock is not the right mechanism for this coordination - you 
need additional program logic (maybe another file).
--
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