> > This isn't locking, it's access exclusion. It's also not correct for > NSK.
what is the difference between locking and access exclusion? i was thinking both are same (locking implies access exclusion). in other words, My idea of mandatory locking is same as exclusive access to the file. are we in sync? else tell me what exactly u mean by "Mandatory locking". > NSK's OPEN procedure allows the following possibilities: > - shared access. Any process can open the file unless another > process has it opened with a different access. > - exclusive access. Only this process can open the file. If it's > already open, the open call will fail. > - protected access. Only this process can have the file open for > write. If it's already open for writing, the open call will fail. > Fine. This is true. i didn't want to give too much details. What i want to tell is, there need not be a special call for lock. Combining lock/access exclusion with open will be better. > > > Also, file need not be explicitly locked. Opening a file puts proper > > lock. > > I'm not sure what you're saying here. Opening a file doesn't lock it. same as above. put lock in open, not after getting fd. open should fail if file is locked. This will help programs unaware of locking to behave better. > > > This kind of locking will solve most of the problems which are > > pointed out. Mandatory locking on a part of the file is in no way > > better than advisory locking. > > Again, I'm not sure how much of this you understand. I was thinking > of doing something like NSK's LOCKREC function. > LOCKREC locks records only. The problem is: processes A & B. B doesn't know about locking (like 'cat') 1. A opened file 2. It locked some part of the file 3. B opens and starts to write 4. B reached the region which is lockd and write blocks 5. A releases lock 6. B's write is unblocked. Here, how mandatory locking of a region help? isn't this same as advisory locking? If opening itself fails coz of lock, the programs unaware of mandatory locking will be forced to start from begining. -Biju To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-hackers" in the body of the message