Truncating an existing file (and lockf question)

Jonathan I. Kamens jik at athena.mit.edu
Thu Apr 25 07:45:19 AEST 1991


In article <16836 at chaph.usc.edu>, jeenglis at alcor.usc.edu (Joe English) writes:
|>      A shared or exclusive lock is either advisory  or  mandatory
|>      depending on the mode bits of the file containing the locked
|>      segment.  The lock is mandatory if the set-GID bit (S_ISGID)
|>      is  set  and  the  group execute bit (S_IXGRP) is clear (see
|>      stat(2V) for information about mode bits).   Otherwise,  the
|>      lock is advisory.
|> 
|> This sounds really weird.  Why should locking behaviour depend 
|> on the setgid bit?   Is this just a SunOS quirk?

  They're simply using the S_ISGID bit to store additional information, when
it isn't being used to indicate a setgid executable.  Notice that it only
indicates mandatory locks when the group-executable bit isn't set.  This means
that it has nothing to do with locking when the file *is* group-executable;
instead, it takes on its traditionaal task of indicating a setgid executable.

  Overloading of permission bits has become somewhat common as people find
more and more information that needs to be stored.  For example, the use of
the sticky bit to indicate sticky directories is a somewhat late addition.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list