LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-28-2006, 05:07 AM   #1
Kernel programmer
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Rep: Reputation: 0
Mandatory Locking


A file is marked as a candidate for mandatory locking by setting the group-id bit in its file mode but removing the group-execute bit. Can some body explain this in more detail ( w.r.to a open file and its file structure )
 
Old 07-28-2006, 06:10 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
This article explains it.
http://lists.jammed.com/ISN/2003/06/0104.html
The combination of sgid bit set and execution bit cleared would not make sense normally. That's why it was chosen.

The kernel source Documentation has the locks.txt and manditory.txt files. The book "Advanced Unix Programming" ISBN 0-13-141154-3 has example code in section 7.11.5.

When you open the file, you also use the S_ISGID permission flag:
ex:
perms |= S_ISGID;
fd = open("file", O_CREATE | O_RDWR, perms )

Then use the fcntl or flock command as you would to set an advisory lock.

This is an excerpt from the book I mentioned.

Last edited by jschiwal; 07-28-2006 at 06:32 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mandatory Locking Kernel programmer Linux - Software 3 07-28-2006 06:21 AM
Is computer cooling fan mandatory? blackzone Linux - Hardware 5 07-01-2006 07:29 PM
LXer: Congress may consider mandatory ISP snooping LXer Syndicated Linux News 0 05-02-2006 09:03 PM
Mandatory Service Pack 2 coming tuesday ?? BajaNick General 6 04-17-2005 08:59 PM
Mandatory arguments with getopts? rose_bud4201 Programming 2 03-10-2005 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration