Yeah it should work supposedly but its not working. For reference I'm attaching a sample file may be I am doing something very wrong.<br>I make executable of attached code. Then run one instance on terminal & 2nd on another terminal.<br>
Executable on 2nd terminal is able to write in the file.<br><br><br>Regards,<br>~Nishant<br><br><div class="gmail_quote">On Sat, Nov 22, 2008 at 12:56 AM, Mark Haney <span dir="ltr"><<a href="mailto:mhaney@ercbroadband.org">mhaney@ercbroadband.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">test test wrote:<br>
> Hello,<br>
><br>
><br>
><br>
> I need to put a mandatory lock on /dev/fb0 (presently any file) in Linux OS.<br>
> But in actual scenario it will be a device file.<br>
><br>
><br>
><br>
> OS: Ubuntu Hardy Heron 8.04<br>
><br>
><br>
><br>
> Scenario:<br>
><br>
> 1. Process A is super process (controller).<br>
><br>
> 2. Process B is normal process.<br>
><br>
> 3. *Process A and B are non-cooperating process, they simple don't know<br>
> about other process existence and they are not interested in knowing it<br>
> either.(So, advisory locking is out of scope). *<br>
><br>
> 4. At particular instance Process B is accessing /dev/fb0.<br>
><br>
> 5. Now, Process A wants access to it.<br>
><br>
> 6. Process A locks /dev/fb0<br>
><br>
> 7. It can hold the lock as long it wants & in any case process B cannot<br>
> write anything to it. (It's better if B cannot read the contents also).<br>
><br>
><br>
><br>
> I also changed permissions of directory and lock file.<br>
><br>
><br>
><br>
> I used:<br>
><br>
> chmod g-x test<br>
><br>
> chmod g+s test<br>
><br>
><br>
<br>
</div><a href="http://www.hackinglinuxexposed.com/articles/20030623.html" target="_blank">http://www.hackinglinuxexposed.com/articles/20030623.html</a><br>
<br>
That was a quick google on file locking in Linux.  Are you coding these<br>
processes yourself?  I mean there are documented ways of locking files<br>
programmatically in linux as well.<br>
<br>
Based on what you posted the file locking should work.  Are you saying<br>
it doesn't?<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Frustra laborant quotquot se calculationibus fatigant pro inventione<br>
quadraturae circuli<br>
<br>
Mark Haney<br>
Sr. Systems Administrator<br>
ERC Broadband<br>
(828) 350-2415<br>
<br>
Call (866) ERC-7110 for after hours support<br>
<font color="#888888"><br>
--<br>
ubuntu-users mailing list<br>
<a href="mailto:ubuntu-users@lists.ubuntu.com">ubuntu-users@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</a><br>
</font></blockquote></div><br>