home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.wizards
- Subject: Re: /dev/null and file locking
- Date: 19 Dec 1992 02:22:38 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 26
- Message-ID: <1gu11eINN4tn@early-bird.think.com>
- References: <15945@auspex-gw.auspex.com> <1992Dec18.182107.22098@zeus.ieee.org>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <1992Dec18.182107.22098@zeus.ieee.org> jbarth@ep.ieee.org writes:
- >I recall reading in Bach's "The Design of the UNIX Operating System" that
- >device inodes, unlike regular inodes, are never locked. I don't remember
- >what the rationale was -- perhaps someone more knowledgeable than me could
- >comment.
-
- The locking operations lock a specific range of bytes of a file. Some
- devices, like tty's, simply present data continuously, and have no
- meaningful notion of offsets into the file.
-
- However, this should only be a problem for mandatory locking, since the
- kernel tries to relate the locks to the read() and write() operations. In
- the case of advisory locks they only interact with other locking
- operations, so the ranges could be considered as arbitrary identifiers,
- with no necessary relationship to the file contents.
-
- It sure would be nice if you could lock devices, though. The lack of this
- forces many applications to create extraneous files just to mediate access
- to a device. An example is the locking files in /usr/spool/uucp. And if
- two applications try to use the same device but have different lock file
- conventions, they don't work together properly.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-