Re: Mandatory File Locking
- From: "test test" <fileuploadoct08@xxxxxxxxx>
- Date: Sat, 22 Nov 2008 01:11:26 +0530
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.
I make executable of attached code. Then run one instance on terminal & 2nd
on another terminal.
Executable on 2nd terminal is able to write in the file.
Regards,
~Nishant
On Sat, Nov 22, 2008 at 12:56 AM, Mark Haney <mhaney@xxxxxxxxxxxxxxxx>wrote:
test test wrote:
Hello,OS.
I need to put a mandatory lock on /dev/fb0 (presently any file) in Linux
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
http://www.hackinglinuxexposed.com/articles/20030623.html
That was a quick google on file locking in Linux. Are you coding these
processes yourself? I mean there are documented ways of locking files
programmatically in linux as well.
Based on what you posted the file locking should work. Are you saying
it doesn't?
--
Frustra laborant quotquot se calculationibus fatigant pro inventione
quadraturae circuli
Mark Haney
Sr. Systems Administrator
ERC Broadband
(828) 350-2415
Call (866) ERC-7110 for after hours support
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Attachment:
filelock.c
Description: Binary data
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- References:
- Mandatory File Locking
- From: test test
- Re: Mandatory File Locking
- From: Mark Haney
- Mandatory File Locking
- Prev by Date: Re: Wi Fi on my laptop
- Next by Date: Re: Super image enhancement
- Previous by thread: Re: Mandatory File Locking
- Next by thread: Super image enhancement
- Index(es):
Relevant Pages
|