From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,c4cf1503f104397,start X-Google-Attributes: gidf678f,public From: nissankl@cig.mot.com (Ramakrishna Nissankula) Subject: A question on File locking Date: 1998/02/11 Message-ID: <6bta6g$ndh$1@trotsky.cig.mot.com>#1/1 X-Deja-AN: 324263048 Distribution: local Organization: Motorola Inc., Cellular Infrastructure Group Newsgroups: comp.unix.osf.misc I have a question on file locking. Can anyone pl answer this by e-mail? In UNIX, I can lock a file only after opening it for reading or writing. What happens in the following scenario? Process1 Process2 d = open(file for writing) d = open(file for writing) mandatory lock the file mandatory lock the file write sth write some other thing unlock unlock close close The problem is that the process that locks first will lose its data because the other process has opened the file for writing. How can I get around this problem? BR Ramki