Mandatory File Locking

test test fileuploadoct08 at gmail.com
Fri Nov 21 19:19:19 UTC 2008


Hello,



I need to put a mandatory lock on /dev/fb0 (presently any file) in Linux OS.
But in actual scenario it will be a device file.



OS: Ubuntu Hardy Heron 8.04



Scenario:

1. Process A is super process (controller).

2. Process B is normal process.

3. *Process A and B are non-cooperating process, they simple don't know
about other process existence and they are not interested in knowing it
either.(So, advisory locking is out of scope). *

4. At particular instance Process B is accessing /dev/fb0.

5. Now, Process A wants access to it.

6. Process A locks /dev/fb0

7. It can hold the lock as long it wants & in any case process B cannot
write anything to it. (It's better if B cannot read the contents also).



I also changed permissions of directory and lock file.



I used:

chmod g-x test

chmod g+s test



directory:

drwxr-Sr-x 2 ists ists   4096 2008-11-21 11:20 test





chmod g-x lock.txt

chmod g+s lock.txt



file to be locked:

-rw-r-Sr-- 1 ists ists   15 2008-11-21 09:32 lock.txt



uname -a:

Linux ists-desktop 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008
i686 GNU/Linux



Any help will be greatly appreciated.



Regards,

~Nishant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20081122/c2274b2b/attachment.html>


More information about the ubuntu-users mailing list