| @@ -1,8 +1,13 @@ |
| 1 | Mandatory File Locking For The Linux Operating System | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| | 2 | |
| | 3 | ===================================================== |
| | 4 | Mandatory File Locking For The Linux Operating System |
| | 5 | ===================================================== |
| 2 | | 6 | |
| 3 | Andy Walker <andy@lysaker.kvaerner.no> | 7 | Andy Walker <andy@lysaker.kvaerner.no> |
| 4 | | 8 | |
| 5 | 15 April 1996 | 9 | 15 April 1996 |
| | 10 | |
| 6 | (Updated September 2007) | 11 | (Updated September 2007) |
| 7 | | 12 | |
| 8 | 0. Why you should avoid mandatory locking | 13 | 0. Why you should avoid mandatory locking |
| @@ -53,15 +58,17 @@ possible on existing user code. The scheme is based on marking individual files · 44 unmodified lines |
| 53 | as candidates for mandatory locking, and using the existing fcntl()/lockf() | 58 | as candidates for mandatory locking, and using the existing fcntl()/lockf() |
| 54 | interface for applying locks just as if they were normal, advisory locks. | 59 | interface for applying locks just as if they were normal, advisory locks. |
| 55 | | 60 | |
| 56 | Note 1: In saying "file" in the paragraphs above I am actually not telling | 61 | .. Note:: |
| 57 | the whole truth. System V locking is based on fcntl(). The granularity of | 62 | |
| 58 | fcntl() is such that it allows the locking of byte ranges in files, in addition | 63 | 1. In saying "file" in the paragraphs above I am actually not telling |
| 59 | to entire files, so the mandatory locking rules also have byte level | 64 | the whole truth. System V locking is based on fcntl(). The granularity of |
| 60 | granularity. | 65 | fcntl() is such that it allows the locking of byte ranges in files, in |
| | 66 | addition to entire files, so the mandatory locking rules also have byte |
| | 67 | level granularity. |
| 61 | | 68 | |
| 62 | Note 2: POSIX.1 does not specify any scheme for mandatory locking, despite | 69 | 2. POSIX.1 does not specify any scheme for mandatory locking, despite |
| 63 | borrowing the fcntl() locking scheme from System V. The mandatory locking | 70 | borrowing the fcntl() locking scheme from System V. The mandatory locking |
| 64 | scheme is defined by the System V Interface Definition (SVID) Version 3. | 71 | scheme is defined by the System V Interface Definition (SVID) Version 3. |
| 65 | | 72 | |
| 66 | 2. Marking a file for mandatory locking | 73 | 2. Marking a file for mandatory locking |
| 67 | --------------------------------------- | 74 | --------------------------------------- |