|
|
DataMuseum.dkPresents historical artifacts from the history of: RC9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: l
Length: 7538 (0x1d72)
Names: »lockf.2«
└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
└─⟦bbf173f5c⟧ »0004«
└─⟦this⟧ »./usr/man/cat2/lockf.2«
0x0000…0020 0a 0a 0a 5f 08 4f 5f 08 6e 5f 08 6c 5f 08 69 5f 08 6e 5f 08 65 20 5f 08 4d 5f 08 61 5f 08 6e 5f ┆ _ O_ n_ l_ i_ n_ e _ M_ a_ n_┆
0x0020…0040 08 75 5f 08 61 5f 08 6c 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 20 43 61 6c 6c ┆ u_ a_ l System Call┆
0x0040…0060 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b 66 28 32 29 0a 0a 0a 0a ┆s lockf(2) ┆
0x0060…0080 4e 08 4e 08 4e 08 4e 41 08 41 08 41 08 41 4d 08 4d 08 4d 08 4d 45 08 45 08 45 08 45 0a 20 20 20 ┆N N N NA A A AM M M ME E E E ┆
0x0080…00a0 20 20 6c 6f 63 6b 66 20 2d 20 72 65 63 6f 72 64 20 6c 6f 63 6b 69 6e 67 20 6f 6e 20 66 69 6c 65 ┆ lockf - record locking on file┆
0x00a0…00c0 73 0a 0a 53 08 53 08 53 08 53 59 08 59 08 59 08 59 4e 08 4e 08 4e 08 4e 54 08 54 08 54 08 54 41 ┆s S S S SY Y Y YN N N NT T T TA┆
0x00c0…00e0 08 41 08 41 08 41 58 08 58 08 58 08 58 0a 20 20 20 20 20 23 08 23 08 23 08 23 69 08 69 08 69 08 ┆ A A AX X X X # # # #i i i ┆
0x00e0…0100 69 6e 08 6e 08 6e 08 6e 63 08 63 08 63 08 63 6c 08 6c 08 6c 08 6c 75 08 75 08 75 08 75 64 08 64 ┆in n n nc c c cl l l lu u u ud d┆
0x0100…0120 08 64 08 64 65 08 65 08 65 08 65 20 3c 08 3c 08 3c 08 3c 73 08 73 08 73 08 73 79 08 79 08 79 08 ┆ d de e e e < < < <s s s sy y y ┆
0x0120…0140 79 73 08 73 08 73 08 73 2f 08 2f 08 2f 08 2f 74 08 74 08 74 08 74 79 08 79 08 79 08 79 70 08 70 ┆ys s s s/ / / /t t t ty y y yp p┆
0x0140…0160 08 70 08 70 65 08 65 08 65 08 65 73 08 73 08 73 08 73 2e 08 2e 08 2e 08 2e 68 08 68 08 68 08 68 ┆ p pe e e es s s s. . . .h h h h┆
0x0160…0180 3e 08 3e 08 3e 08 3e 0a 20 20 20 20 20 23 08 23 08 23 08 23 69 08 69 08 69 08 69 6e 08 6e 08 6e ┆> > > > # # # #i i i in n n┆
0x0180…01a0 08 6e 63 08 63 08 63 08 63 6c 08 6c 08 6c 08 6c 75 08 75 08 75 08 75 64 08 64 08 64 08 64 65 08 ┆ nc c c cl l l lu u u ud d d de ┆
0x01a0…01c0 65 08 65 08 65 20 3c 08 3c 08 3c 08 3c 75 08 75 08 75 08 75 6e 08 6e 08 6e 08 6e 69 08 69 08 69 ┆e e e < < < <u u u un n n ni i i┆
0x01c0…01e0 08 69 73 08 73 08 73 08 73 74 08 74 08 74 08 74 64 08 64 08 64 08 64 2e 08 2e 08 2e 08 2e 68 08 ┆ is s s st t t td d d d. . . .h ┆
0x01e0…0200 68 08 68 08 68 3e 08 3e 08 3e 08 3e 0a 0a 20 20 20 20 20 69 08 69 08 69 08 69 6e 08 6e 08 6e 08 ┆h h h> > > > i i i in n n ┆
0x0200…0220 6e 74 08 74 08 74 08 74 20 6c 08 6c 08 6c 08 6c 6f 08 6f 08 6f 08 6f 63 08 63 08 63 08 63 6b 08 ┆nt t t t l l l lo o o oc c c ck ┆
0x0220…0240 6b 08 6b 08 6b 66 08 66 08 66 08 66 20 28 08 28 08 28 08 28 66 08 66 08 66 08 66 69 08 69 08 69 ┆k k kf f f f ( ( ( (f f f fi i i┆
0x0240…0260 08 69 6c 08 6c 08 6c 08 6c 64 08 64 08 64 08 64 65 08 65 08 65 08 65 73 08 73 08 73 08 73 2c 08 ┆ il l l ld d d de e e es s s s, ┆
0x0260…0280 2c 08 2c 08 2c 20 66 08 66 08 66 08 66 75 08 75 08 75 08 75 6e 08 6e 08 6e 08 6e 63 08 63 08 63 ┆, , , f f f fu u u un n n nc c c┆
0x0280…02a0 08 63 74 08 74 08 74 08 74 69 08 69 08 69 08 69 6f 08 6f 08 6f 08 6f 6e 08 6e 08 6e 08 6e 2c 08 ┆ ct t t ti i i io o o on n n n, ┆
0x02a0…02c0 2c 08 2c 08 2c 20 73 08 73 08 73 08 73 69 08 69 08 69 08 69 7a 08 7a 08 7a 08 7a 65 08 65 08 65 ┆, , , s s s si i i iz z z ze e e┆
0x02c0…02e0 08 65 29 08 29 08 29 08 29 0a 20 20 20 20 20 69 08 69 08 69 08 69 6e 08 6e 08 6e 08 6e 74 08 74 ┆ e) ) ) ) i i i in n n nt t┆
0x02e0…0300 08 74 08 74 20 66 08 66 08 66 08 66 69 08 69 08 69 08 69 6c 08 6c 08 6c 08 6c 64 08 64 08 64 08 ┆ t t f f f fi i i il l l ld d d ┆
0x0300…0320 64 65 08 65 08 65 08 65 73 08 73 08 73 08 73 2c 08 2c 08 2c 08 2c 20 66 08 66 08 66 08 66 75 08 ┆de e e es s s s, , , , f f f fu ┆
0x0320…0340 75 08 75 08 75 6e 08 6e 08 6e 08 6e 63 08 63 08 63 08 63 74 08 74 08 74 08 74 69 08 69 08 69 08 ┆u u un n n nc c c ct t t ti i i ┆
0x0340…0360 69 6f 08 6f 08 6f 08 6f 6e 08 6e 08 6e 08 6e 3b 08 3b 08 3b 08 3b 0a 20 20 20 20 20 6c 08 6c 08 ┆io o o on n n n; ; ; ; l l ┆
0x0360…0380 6c 08 6c 6f 08 6f 08 6f 08 6f 6e 08 6e 08 6e 08 6e 67 08 67 08 67 08 67 20 73 08 73 08 73 08 73 ┆l lo o o on n n ng g g g s s s s┆
0x0380…03a0 69 08 69 08 69 08 69 7a 08 7a 08 7a 08 7a 65 08 65 08 65 08 65 3b 08 3b 08 3b 08 3b 0a 0a 44 08 ┆i i i iz z z ze e e e; ; ; ; D ┆
0x03a0…03c0 44 08 44 08 44 45 08 45 08 45 08 45 53 08 53 08 53 08 53 43 08 43 08 43 08 43 52 08 52 08 52 08 ┆D D DE E E ES S S SC C C CR R R ┆
0x03c0…03e0 52 49 08 49 08 49 08 49 50 08 50 08 50 08 50 54 08 54 08 54 08 54 49 08 49 08 49 08 49 4f 08 4f ┆RI I I IP P P PT T T TI I I IO O┆
0x03e0…0400 08 4f 08 4f 4e 08 4e 08 4e 08 4e 0a 20 20 20 20 20 54 68 65 20 5f 08 6c 5f 08 6f 5f 08 63 5f 08 ┆ O ON N N N The _ l_ o_ c_ ┆
0x0400…0420 6b 5f 08 66 20 72 6f 75 74 69 6e 65 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 73 65 63 74 69 6f 6e 73 ┆k_ f routine will allow sections┆
0x0420…0440 20 6f 66 20 61 20 66 69 6c 65 20 74 6f 20 62 65 20 6c 6f 63 6b 65 64 0a 20 20 20 20 20 77 69 74 ┆ of a file to be locked wit┆
0x0440…0460 68 20 61 64 76 69 73 6f 72 79 2d 6d 6f 64 65 20 6f 72 20 65 6e 66 6f 72 63 65 6d 65 6e 74 2d 6d ┆h advisory-mode or enforcement-m┆
0x0460…0480 6f 64 65 20 6c 6f 63 6b 73 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 0a 20 20 20 20 20 74 68 65 20 ┆ode locks depending on the ┆
0x0480…04a0 6d 6f 64 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 28 73 65 65 20 5f 08 63 5f 08 68 5f 08 6d 5f ┆mode of the file (see _ c_ h_ m_┆
0x04a0…04c0 08 6f 5f 08 64 28 32 29 29 2e 20 5f 08 6c 5f 08 6f 5f 08 63 5f 08 6b 5f 08 66 20 63 61 6c 6c 73 ┆ o_ d(2)). _ l_ o_ c_ k_ f calls┆
0x04c0…04e0 20 66 72 6f 6d 20 6f 74 68 65 72 0a 20 20 20 20 20 70 72 6f 63 65 73 73 65 73 20 77 68 69 63 68 ┆ from other processes which┆
0x04e0…0500 20 61 74 74 65 6d 70 74 20 74 6f 20 6c 6f 63 6b 20 74 68 65 20 6c 6f 63 6b 65 64 20 66 69 6c 65 ┆ attempt to lock the locked file┆
0x0500…0520 20 73 65 63 74 69 6f 6e 20 77 69 6c 6c 0a 20 20 20 20 20 65 69 74 68 65 72 20 72 65 74 75 72 6e ┆ section will either return┆
0x0520…0540 20 61 6e 20 65 72 72 6f 72 20 76 61 6c 75 65 20 6f 72 20 62 65 20 70 75 74 20 74 6f 20 73 6c 65 ┆ an error value or be put to sle┆
0x0540…0560 65 70 20 75 6e 74 69 6c 20 74 68 65 0a 20 20 20 20 20 72 65 73 6f 75 72 63 65 20 62 65 63 6f 6d ┆ep until the resource becom┆
0x0560…0580 65 73 20 75 6e 6c 6f 63 6b 65 64 2e 20 20 41 6c 6c 20 74 68 65 20 6c 6f 63 6b 73 20 66 6f 72 20 ┆es unlocked. All the locks for ┆
0x0580…05a0 61 20 70 72 6f 63 65 73 73 20 61 72 65 0a 20 20 20 20 20 72 65 6d 6f 76 65 64 20 77 68 65 6e 20 ┆a process are removed when ┆
0x05a0…05c0 74 68 65 20 70 72 6f 63 65 73 73 20 74 65 72 6d 69 6e 61 74 65 73 2e 20 20 28 53 65 65 20 74 68 ┆the process terminates. (See th┆
0x05c0…05e0 65 20 5f 08 66 5f 08 63 5f 08 6e 5f 08 74 5f 08 6c 20 63 61 6c 6c 0a 20 20 20 20 20 66 6f 72 20 ┆e _ f_ c_ n_ t_ l call for ┆
0x05e0…0600 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 72 65 63 6f 72 64 20 6c 6f ┆more information about record lo┆
0x0600…0620 63 6b 69 6e 67 2e 29 0a 0a 20 20 20 20 20 5f 08 66 5f 08 69 5f 08 6c 5f 08 64 5f 08 65 5f 08 73 ┆cking.) _ f_ i_ l_ d_ e_ s┆
0x0620…0640 20 69 73 20 61 6e 20 6f 70 65 6e 20 66 69 6c 65 20 64 65 73 63 72 69 70 74 6f 72 2e 20 20 54 68 ┆ is an open file descriptor. Th┆
0x0640…0660 65 20 66 69 6c 65 20 64 65 73 63 72 69 70 74 6f 72 20 6d 75 73 74 0a 20 20 20 20 20 68 61 76 65 ┆e file descriptor must have┆
0x0660…0680 20 62 65 65 6e 20 6f 70 65 6e 65 64 20 77 69 74 68 20 77 72 69 74 65 2d 6f 6e 6c 79 20 70 65 72 ┆ been opened with write-only per┆
0x0680…06a0 6d 69 73 73 69 6f 6e 20 28 4f 5f 57 52 4f 4e 4c 59 29 20 6f 72 0a 20 20 20 20 20 77 69 74 68 20 ┆mission (O_WRONLY) or with ┆
0x06a0…06c0 72 65 61 64 2f 77 72 69 74 65 20 70 65 72 6d 69 73 73 69 6f 6e 20 28 4f 5f 52 44 57 52 29 20 69 ┆read/write permission (O_RDWR) i┆
0x06c0…06e0 6e 20 6f 72 64 65 72 20 74 6f 20 65 73 74 61 62 6c 69 73 68 20 61 0a 20 20 20 20 20 6c 6f 63 6b ┆n order to establish a lock┆
0x06e0…0700 20 77 69 74 68 20 74 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 63 61 6c 6c 20 28 73 65 65 20 5f 08 ┆ with this function call (see _ ┆
0x0700…0720 6f 5f 08 70 5f 08 65 5f 08 6e 28 32 29 29 2e 0a 0a 20 20 20 20 20 5f 08 66 5f 08 75 5f 08 6e 5f ┆o_ p_ e_ n(2)). _ f_ u_ n_┆
0x0720…0740 08 63 5f 08 74 5f 08 69 5f 08 6f 5f 08 6e 20 69 73 20 61 20 63 6f 6e 74 72 6f 6c 20 76 61 6c 75 ┆ c_ t_ i_ o_ n is a control valu┆
0x0740…0760 65 20 77 68 69 63 68 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 61 63 74 69 6f 6e 20 74 6f 20 ┆e which specifies the action to ┆
0x0760…0780 62 65 0a 20 20 20 20 20 74 61 6b 65 6e 2e 20 20 54 68 65 20 70 65 72 6d 69 73 73 69 62 6c 65 20 ┆be taken. The permissible ┆
0x0780…07a0 76 61 6c 75 65 73 20 66 6f 72 20 5f 08 66 5f 08 75 5f 08 6e 5f 08 63 5f 08 74 5f 08 69 5f 08 6f ┆values for _ f_ u_ n_ c_ t_ i_ o┆
0x07a0…07c0 5f 08 6e 20 61 72 65 20 64 65 66 69 6e 65 64 20 69 6e 0a 20 20 20 20 20 3c 75 6e 69 73 74 64 2e ┆_ n are defined in <unistd.┆
0x07c0…07e0 68 3e 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 46 5f 55 ┆h> as follows: #define F_U┆
0x07e0…0800 4c 4f 43 4b 20 20 20 20 20 20 20 20 20 20 30 20 20 20 2f 2a 20 55 6e 6c 6f 63 6b 20 61 20 70 72 ┆LOCK 0 /* Unlock a pr┆
0x0800…0820 65 76 69 6f 75 73 6c 79 20 6c 6f 63 6b 65 64 20 73 65 63 74 69 6f 6e 20 2a 2f 0a 20 20 20 20 20 ┆eviously locked section */ ┆
0x0820…0840 23 64 65 66 69 6e 65 20 46 5f 4c 4f 43 4b 20 20 20 20 20 20 31 20 20 20 2f 2a 20 4c 6f 63 6b 20 ┆#define F_LOCK 1 /* Lock ┆
0x0840…0860 61 20 73 65 63 74 69 6f 6e 20 66 6f 72 20 65 78 63 6c 75 73 69 76 65 20 75 73 65 20 2a 2f 0a 20 ┆a section for exclusive use */ ┆
0x0860…0880 20 20 20 20 23 64 65 66 69 6e 65 20 46 5f 54 4c 4f 43 4b 20 20 20 20 20 20 20 20 20 20 32 20 20 ┆ #define F_TLOCK 2 ┆
0x0880…08a0 20 2f 2a 20 54 65 73 74 20 61 6e 64 20 6c 6f 63 6b 20 61 20 73 65 63 74 69 6f 6e 20 66 6f 72 20 ┆ /* Test and lock a section for ┆
0x08a0…08c0 65 78 63 6c 75 73 69 76 65 20 75 73 65 20 2a 2f 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 46 5f ┆exclusive use */ #define F_┆
0x08c0…08e0 54 45 53 54 20 20 20 20 20 20 33 20 20 20 2f 2a 20 54 65 73 74 20 73 65 63 74 69 6f 6e 20 6c 6f ┆TEST 3 /* Test section lo┆
0x08e0…0900 63 6b 73 20 62 79 20 6f 74 68 65 72 20 70 72 6f 63 65 73 73 65 73 20 2a 2f 0a 0a 20 20 20 20 20 ┆cks by other processes */ ┆
0x0900…0920 46 5f 54 45 53 54 20 69 73 20 75 73 65 64 20 74 6f 20 64 65 74 65 63 74 20 69 66 20 61 20 6c 6f ┆F_TEST is used to detect if a lo┆
0x0920…0940 63 6b 20 62 79 20 61 6e 6f 74 68 65 72 20 70 72 6f 63 65 73 73 20 69 73 0a 20 20 20 20 20 70 72 ┆ck by another process is pr┆
0x0940…0960 65 73 65 6e 74 20 6f 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 73 65 63 74 69 6f 6e 2e 20 ┆esent on the specified section. ┆
0x0960…0980 20 46 5f 4c 4f 43 4b 20 61 6e 64 20 46 5f 54 4c 4f 43 4b 20 62 6f 74 68 0a 20 20 20 20 20 6c 6f ┆ F_LOCK and F_TLOCK both lo┆
0x0980…09a0 63 6b 20 61 20 73 65 63 74 69 6f 6e 20 6f 66 20 61 20 66 69 6c 65 20 69 66 20 74 68 65 20 73 65 ┆ck a section of a file if the se┆
0x09a0…09c0 63 74 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0a 20 20 20 20 20 46 5f 55 4c 4f 43 4b ┆ction is available. F_ULOCK┆
0x09c0…09e0 20 72 65 6d 6f 76 65 73 20 6c 6f 63 6b 73 20 66 72 6f 6d 20 61 20 73 65 63 74 69 6f 6e 20 6f 66 ┆ removes locks from a section of┆
0x09e0…0a00 20 74 68 65 20 66 69 6c 65 2e 20 20 41 6c 6c 20 6f 74 68 65 72 0a 20 20 20 20 20 76 61 6c 75 65 ┆ the file. All other value┆
0x0a00…0a20 73 20 6f 66 20 5f 08 66 5f 08 75 5f 08 6e 5f 08 63 5f 08 74 5f 08 69 5f 08 6f 5f 08 6e 20 61 72 ┆s of _ f_ u_ n_ c_ t_ i_ o_ n ar┆
0x0a20…0a40 65 20 72 65 73 65 72 76 65 64 20 66 6f 72 20 66 75 74 75 72 65 20 65 78 74 65 6e 73 69 6f 6e 73 ┆e reserved for future extensions┆
0x0a40…0a60 20 61 6e 64 0a 20 20 20 20 20 77 69 6c 6c 20 72 65 73 75 6c 74 20 69 6e 20 61 6e 20 65 72 72 6f ┆ and will result in an erro┆
0x0a60…0a80 72 20 72 65 74 75 72 6e 20 69 66 20 74 68 65 79 20 61 72 65 20 6e 6f 74 20 69 6d 70 6c 65 6d 65 ┆r return if they are not impleme┆
0x0a80…0aa0 6e 74 65 64 2e 0a 0a 20 20 20 20 20 5f 08 73 5f 08 69 5f 08 7a 5f 08 65 20 69 73 20 74 68 65 20 ┆nted. _ s_ i_ z_ e is the ┆
0x0aa0…0ac0 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6e 74 69 67 75 6f 75 73 20 62 79 74 65 73 20 74 6f 20 62 65 ┆number of contiguous bytes to be┆
0x0ac0…0ae0 20 6c 6f 63 6b 65 64 20 6f 72 0a 20 20 20 20 20 75 6e 6c 6f 63 6b 65 64 2e 20 20 54 68 65 20 72 ┆ locked or unlocked. The r┆
0x0ae0…0b00 65 73 6f 75 72 63 65 20 74 6f 20 62 65 20 6c 6f 63 6b 65 64 20 6f 72 20 75 6e 6c 6f 63 6b 65 64 ┆esource to be locked or unlocked┆
0x0b00…0b20 20 73 74 61 72 74 73 20 61 74 0a 20 20 20 20 20 74 68 65 20 63 75 72 72 65 6e 74 20 6f 66 66 73 ┆ starts at the current offs┆
0x0b20…0b40 65 74 20 69 6e 20 74 68 65 20 66 69 6c 65 20 61 6e 64 20 65 78 74 65 6e 64 73 20 66 6f 72 77 61 ┆et in the file and extends forwa┆
0x0b40…0b60 72 64 20 66 6f 72 20 61 0a 20 20 20 20 20 70 6f 73 69 74 69 76 65 20 73 69 7a 65 20 6f 72 20 62 ┆rd for a positive size or b┆
0x0b60…0b80 61 63 6b 77 61 72 64 20 66 6f 72 20 61 20 6e 65 67 61 74 69 76 65 20 73 69 7a 65 20 28 74 68 65 ┆ackward for a negative size (the┆
0x0b80…0ba0 20 70 72 65 63 65 64 69 6e 67 0a 20 20 20 20 20 62 79 74 65 73 20 75 70 20 74 6f 20 62 75 74 20 ┆ preceding bytes up to but ┆
0x0ba0…0bc0 6e 6f 74 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 63 75 72 72 65 6e 74 20 6f 66 66 73 65 74 ┆not including the current offset┆
0x0bc0…0be0 29 2e 20 20 49 66 20 5f 08 73 5f 08 69 5f 08 7a 5f 08 65 0a 20 20 20 20 20 69 73 20 7a 65 72 6f ┆). If _ s_ i_ z_ e is zero┆
0x0be0…0c00 2c 20 74 68 65 20 73 65 63 74 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 63 75 72 72 65 6e 74 20 6f ┆, the section from the current o┆
0x0c00…0c20 66 66 73 65 74 20 74 68 72 6f 75 67 68 20 74 68 65 0a 20 20 20 20 20 6c 61 72 67 65 73 74 20 66 ┆ffset through the largest f┆
0x0c20…0c40 69 6c 65 20 6f 66 66 73 65 74 20 7b 46 43 48 52 5f 4d 41 58 7d 20 69 73 20 6c 6f 63 6b 65 64 20 ┆ile offset {FCHR_MAX} is locked ┆
0x0c40…0c60 28 74 68 61 74 20 69 73 2c 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 63 75 72 72 65 6e 74 20 ┆(that is, from the current ┆
0x0c60…0c80 6f 66 66 73 65 74 20 74 68 72 6f 75 67 68 20 74 68 65 20 70 72 65 73 65 6e 74 20 6f 72 20 61 6e ┆offset through the present or an┆
0x0c80…0ca0 79 20 66 75 74 75 72 65 20 65 6e 64 2d 6f 66 2d 0a 20 20 20 20 20 66 69 6c 65 29 2e 20 20 41 6e ┆y future end-of- file). An┆
0x0ca0…0cc0 20 61 72 65 61 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 6c 6c 6f 63 61 74 65 64 20 74 6f 20 74 ┆ area need not be allocated to t┆
0x0cc0…0ce0 68 65 20 66 69 6c 65 20 69 6e 20 6f 72 64 65 72 0a 20 20 20 20 20 74 6f 20 62 65 20 6c 6f 63 6b ┆he file in order to be lock┆
0x0ce0…0d00 65 64 2c 20 61 73 20 73 75 63 68 20 6c 6f 63 6b 73 20 6d 61 79 20 65 78 69 73 74 20 70 61 73 74 ┆ed, as such locks may exist past┆
0x0d00…0d20 20 74 68 65 20 65 6e 64 2d 6f 66 2d 66 69 6c 65 2e 0a 0a 20 20 20 20 20 54 68 65 20 73 65 63 74 ┆ the end-of-file. The sect┆
0x0d20…0d40 69 6f 6e 73 20 6c 6f 63 6b 65 64 20 77 69 74 68 20 46 5f 4c 4f 43 4b 20 6f 72 20 46 5f 54 4c 4f ┆ions locked with F_LOCK or F_TLO┆
0x0d40…0d60 43 4b 20 6d 61 79 2c 20 69 6e 20 77 68 6f 6c 65 20 6f 72 0a 20 20 20 20 20 69 6e 20 70 61 72 74 ┆CK may, in whole or in part┆
0x0d60…0d80 2c 20 63 6f 6e 74 61 69 6e 20 6f 72 20 62 65 20 63 6f 6e 74 61 69 6e 65 64 20 62 79 20 61 20 70 ┆, contain or be contained by a p┆
0x0d80…0da0 72 65 76 69 6f 75 73 6c 79 20 6c 6f 63 6b 65 64 20 73 65 63 2d 0a 20 20 20 20 20 74 69 6f 6e 20 ┆reviously locked sec- tion ┆
0x0da0…0dc0 66 6f 72 20 74 68 65 20 73 61 6d 65 20 70 72 6f 63 65 73 73 2e 20 20 57 68 65 6e 20 74 68 69 73 ┆for the same process. When this┆
0x0dc0…0de0 20 6f 63 63 75 72 73 2c 20 6f 72 20 69 66 20 61 64 6a 61 63 65 6e 74 0a 20 20 20 20 20 6c 6f 63 ┆ occurs, or if adjacent loc┆
0x0de0…0e00 6b 65 64 20 73 65 63 74 69 6f 6e 73 20 6f 63 63 75 72 2c 20 74 68 65 20 73 65 63 74 69 6f 6e 73 ┆ked sections occur, the sections┆
0x0e00…0e20 20 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 69 6e 74 6f 20 61 20 73 69 6e 2d 0a 20 20 20 20 20 67 ┆ are combined into a sin- g┆
0x0e20…0e40 6c 65 20 6c 6f 63 6b 65 64 20 73 65 63 74 69 6f 6e 2e 20 20 49 66 20 74 68 65 20 72 65 71 75 65 ┆le locked section. If the reque┆
0x0e40…0e60 73 74 20 72 65 71 75 69 72 65 73 20 74 68 61 74 20 61 20 6e 65 77 20 65 6c 65 2d 0a 20 20 20 20 ┆st requires that a new ele- ┆
0x0e60…0e80 20 6d 65 6e 74 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 74 61 62 6c 65 20 6f 66 20 61 ┆ ment be added to the table of a┆
0x0e80…0ea0 63 74 69 76 65 20 6c 6f 63 6b 73 20 61 6e 64 20 74 68 69 73 20 74 61 62 6c 65 20 69 73 0a 0a 0a ┆ctive locks and this table is ┆
0x0ea0…0ec0 0a 0a 0a 0a 20 20 20 20 20 61 6c 72 65 61 64 79 20 66 75 6c 6c 2c 20 61 6e 20 65 72 72 6f 72 20 ┆ already full, an error ┆
0x0ec0…0ee0 69 73 20 72 65 74 75 72 6e 65 64 2c 20 61 6e 64 20 74 68 65 20 6e 65 77 20 73 65 63 74 69 6f 6e ┆is returned, and the new section┆
0x0ee0…0f00 20 69 73 0a 20 20 20 20 20 6e 6f 74 20 6c 6f 63 6b 65 64 2e 0a 0a 20 20 20 20 20 46 5f 4c 4f 43 ┆ is not locked. F_LOC┆
0x0f00…0f20 4b 20 61 6e 64 20 46 5f 54 4c 4f 43 4b 20 72 65 71 75 65 73 74 73 20 64 69 66 66 65 72 20 6f 6e ┆K and F_TLOCK requests differ on┆
0x0f20…0f40 6c 79 20 62 79 20 74 68 65 20 61 63 74 69 6f 6e 20 74 61 6b 65 6e 0a 20 20 20 20 20 69 66 20 74 ┆ly by the action taken if t┆
0x0f40…0f60 68 65 20 72 65 73 6f 75 72 63 65 20 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 2e 20 20 46 ┆he resource is not available. F┆
0x0f60…0f80 5f 4c 4f 43 4b 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65 0a 20 20 20 20 20 63 61 6c 6c 69 6e ┆_LOCK will cause the callin┆
0x0f80…0fa0 67 20 70 72 6f 63 65 73 73 20 74 6f 20 73 6c 65 65 70 20 75 6e 74 69 6c 20 74 68 65 20 72 65 73 ┆g process to sleep until the res┆
0x0fa0…0fc0 6f 75 72 63 65 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0a 20 20 20 20 20 46 5f 54 4c 4f 43 4b ┆ource is available. F_TLOCK┆
0x0fc0…0fe0 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 74 75 ┆ will cause the function to retu┆
0x0fe0…1000 72 6e 20 61 20 2d 31 20 61 6e 64 20 73 65 74 20 5f 08 65 5f 08 72 5f 08 72 5f 08 6e 5f 08 6f 0a ┆rn a -1 and set _ e_ r_ r_ n_ o ┆
0x1000…1020 20 20 20 20 20 74 6f 20 5b 45 41 43 43 45 53 5d 20 69 66 20 74 68 65 20 73 65 63 74 69 6f 6e 20 ┆ to [EACCES] if the section ┆
0x1020…1040 69 73 20 61 6c 72 65 61 64 79 20 6c 6f 63 6b 65 64 20 62 79 20 61 6e 6f 74 68 65 72 20 70 72 6f ┆is already locked by another pro┆
0x1040…1060 2d 0a 20 20 20 20 20 63 65 73 73 2e 0a 0a 20 20 20 20 20 46 5f 55 4c 4f 43 4b 20 72 65 71 75 65 ┆- cess. F_ULOCK reque┆
0x1060…1080 73 74 73 20 6d 61 79 2c 20 69 6e 20 77 68 6f 6c 65 20 6f 72 20 69 6e 20 70 61 72 74 2c 20 72 65 ┆sts may, in whole or in part, re┆
0x1080…10a0 6c 65 61 73 65 20 6f 6e 65 20 6f 72 0a 20 20 20 20 20 6d 6f 72 65 20 6c 6f 63 6b 65 64 20 73 65 ┆lease one or more locked se┆
0x10a0…10c0 63 74 69 6f 6e 73 20 63 6f 6e 74 72 6f 6c 6c 65 64 20 62 79 20 74 68 65 20 70 72 6f 63 65 73 73 ┆ctions controlled by the process┆
0x10c0…10e0 2e 20 4c 6f 63 6b 65 64 20 73 65 63 2d 0a 20 20 20 20 20 74 69 6f 6e 73 20 77 69 6c 6c 20 62 65 ┆. Locked sec- tions will be┆
0x10e0…1100 20 75 6e 6c 6f 63 6b 65 64 20 73 74 61 72 74 69 6e 67 20 61 74 20 74 68 65 20 70 6f 69 6e 74 20 ┆ unlocked starting at the point ┆
0x1100…1120 6f 66 20 74 68 65 20 66 69 6c 65 0a 20 20 20 20 20 6f 66 66 73 65 74 20 74 68 72 6f 75 67 68 20 ┆of the file offset through ┆
0x1120…1140 5f 08 73 5f 08 69 5f 08 7a 5f 08 65 20 62 79 74 65 73 20 6f 72 20 74 6f 20 74 68 65 20 65 6e 64 ┆_ s_ i_ z_ e bytes or to the end┆
0x1140…1160 20 6f 66 20 66 69 6c 65 20 69 66 20 5f 08 73 5f 08 69 5f 08 7a 5f 08 65 20 69 73 0a 20 20 20 20 ┆ of file if _ s_ i_ z_ e is ┆
0x1160…1180 20 30 2e 20 20 57 68 65 6e 20 61 6c 6c 20 6f 66 20 61 20 6c 6f 63 6b 65 64 20 73 65 63 74 69 6f ┆ 0. When all of a locked sectio┆
0x1180…11a0 6e 20 69 73 20 6e 6f 74 20 72 65 6c 65 61 73 65 64 20 28 69 2e 65 2e 2c 20 74 68 65 0a 20 20 20 ┆n is not released (i.e., the ┆
0x11a0…11c0 20 20 62 65 67 69 6e 6e 69 6e 67 20 6f 72 20 65 6e 64 20 6f 66 20 74 68 65 20 61 72 65 61 20 74 ┆ beginning or end of the area t┆
0x11c0…11e0 6f 20 62 65 20 75 6e 6c 6f 63 6b 65 64 20 66 61 6c 6c 73 20 77 69 74 68 69 6e 20 61 0a 20 20 20 ┆o be unlocked falls within a ┆
0x11e0…1200 20 20 6c 6f 63 6b 65 64 20 73 65 63 74 69 6f 6e 29 2c 20 74 68 65 20 72 65 6d 61 69 6e 69 6e 67 ┆ locked section), the remaining┆
0x1200…1220 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 61 74 20 73 65 63 74 69 6f 6e 20 61 72 65 0a 20 20 20 ┆ portion of that section are ┆
0x1220…1240 20 20 73 74 69 6c 6c 20 6c 6f 63 6b 65 64 20 62 79 20 74 68 65 20 70 72 6f 63 65 73 73 2e 20 20 ┆ still locked by the process. ┆
0x1240…1260 52 65 6c 65 61 73 69 6e 67 20 74 68 65 20 63 65 6e 74 65 72 20 73 65 63 74 69 6f 6e 0a 20 20 20 ┆Releasing the center section ┆
0x1260…1280 20 20 6f 66 20 61 20 6c 6f 63 6b 65 64 20 73 65 63 74 69 6f 6e 20 77 69 6c 6c 20 6c 65 61 76 65 ┆ of a locked section will leave┆
0x1280…12a0 20 74 68 65 20 70 6f 72 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 73 65 63 74 69 6f 6e 0a 20 20 20 ┆ the portions of the section ┆
0x12a0…12c0 20 20 6f 66 20 74 68 65 20 73 65 63 74 69 6f 6e 20 62 65 66 6f 72 65 20 61 6e 64 20 61 66 74 65 ┆ of the section before and afte┆
0x12c0…12e0 72 20 69 74 20 6c 6f 63 6b 65 64 20 61 6e 64 20 72 65 71 75 69 72 65 73 20 61 6e 0a 20 20 20 20 ┆r it locked and requires an ┆
0x12e0…1300 20 61 64 64 69 74 69 6f 6e 61 6c 20 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 65 20 74 61 62 6c 65 ┆ additional element in the table┆
0x1300…1320 20 6f 66 20 61 63 74 69 76 65 20 6c 6f 63 6b 73 2e 20 20 49 66 20 74 68 69 73 0a 20 20 20 20 20 ┆ of active locks. If this ┆
0x1320…1340 74 61 62 6c 65 20 69 73 20 66 75 6c 6c 2c 20 61 6e 20 5b 45 44 45 41 44 4c 4b 5d 20 65 72 72 6f ┆table is full, an [EDEADLK] erro┆
0x1340…1360 72 20 69 73 20 72 65 74 75 72 6e 65 64 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 72 65 71 75 65 ┆r is returned and the reque┆
0x1360…1380 73 74 65 64 20 73 65 63 74 69 6f 6e 20 69 73 20 6e 6f 74 20 72 65 6c 65 61 73 65 64 2e 0a 0a 20 ┆sted section is not released. ┆
0x1380…13a0 20 20 20 20 41 20 70 6f 74 65 6e 74 69 61 6c 20 66 6f 72 20 64 65 61 64 6c 6f 63 6b 20 6f 63 63 ┆ A potential for deadlock occ┆
0x13a0…13c0 75 72 73 20 69 66 20 61 20 70 72 6f 63 65 73 73 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 61 0a 20 ┆urs if a process controlling a ┆
0x13c0…13e0 20 20 20 20 6c 6f 63 6b 65 64 20 72 65 73 6f 75 72 63 65 20 69 73 20 70 75 74 20 74 6f 20 73 6c ┆ locked resource is put to sl┆
0x13e0…1400 65 65 70 20 62 79 20 61 63 63 65 73 73 69 6e 67 20 61 6e 6f 74 68 65 72 20 70 72 6f 2d 0a 20 20 ┆eep by accessing another pro- ┆
0x1400…1420 20 20 20 63 65 73 73 27 20 6c 6f 63 6b 65 64 20 72 65 73 6f 75 72 63 65 2e 20 20 54 68 75 73 20 ┆ cess' locked resource. Thus ┆
0x1420…1440 63 61 6c 6c 73 20 74 6f 20 5f 08 6c 5f 08 6f 5f 08 63 5f 08 6b 5f 08 66 20 6f 72 20 5f 08 66 5f ┆calls to _ l_ o_ c_ k_ f or _ f_┆
0x1440…1460 08 63 5f 08 6e 5f 08 74 5f 08 6c 20 73 63 61 6e 0a 20 20 20 20 20 66 6f 72 20 61 20 64 65 61 64 ┆ c_ n_ t_ l scan for a dead┆
0x1460…1480 6c 6f 63 6b 20 70 72 69 6f 72 20 74 6f 20 73 6c 65 65 70 69 6e 67 20 6f 6e 20 61 20 6c 6f 63 6b ┆lock prior to sleeping on a lock┆
0x1480…14a0 65 64 20 72 65 73 6f 75 72 63 65 2e 20 20 41 6e 0a 20 20 20 20 20 65 72 72 6f 72 20 72 65 74 75 ┆ed resource. An error retu┆
0x14a0…14c0 72 6e 20 69 73 20 6d 61 64 65 20 69 66 20 73 6c 65 65 70 69 6e 67 20 6f 6e 20 74 68 65 20 6c 6f ┆rn is made if sleeping on the lo┆
0x14c0…14e0 63 6b 65 64 20 72 65 73 6f 75 72 63 65 0a 20 20 20 20 20 77 6f 75 6c 64 20 63 61 75 73 65 20 61 ┆cked resource would cause a┆
0x14e0…1500 20 64 65 61 64 6c 6f 63 6b 2e 0a 0a 20 20 20 20 20 53 6c 65 65 70 69 6e 67 20 6f 6e 20 61 20 72 ┆ deadlock. Sleeping on a r┆
0x1500…1520 65 73 6f 75 72 63 65 20 69 73 20 69 6e 74 65 72 72 75 70 74 65 64 20 77 69 74 68 20 61 6e 79 20 ┆esource is interrupted with any ┆
0x1520…1540 73 69 67 6e 61 6c 2e 20 20 54 68 65 0a 20 20 20 20 20 5f 08 61 5f 08 6c 5f 08 61 5f 08 72 5f 08 ┆signal. The _ a_ l_ a_ r_ ┆
0x1540…1560 6d 20 72 6f 75 74 69 6e 65 20 6d 61 79 20 62 65 20 75 73 65 64 20 74 6f 20 70 72 6f 76 69 64 65 ┆m routine may be used to provide┆
0x1560…1580 20 61 20 74 69 6d 65 6f 75 74 20 66 61 63 69 6c 69 74 79 20 69 6e 0a 20 20 20 20 20 61 70 70 6c ┆ a timeout facility in appl┆
0x1580…15a0 69 63 61 74 69 6f 6e 73 20 74 68 61 74 20 72 65 71 75 69 72 65 20 74 68 69 73 20 66 61 63 69 6c ┆ications that require this facil┆
0x15a0…15c0 69 74 79 2e 0a 0a 52 08 52 08 52 08 52 45 08 45 08 45 08 45 54 08 54 08 54 08 54 55 08 55 08 55 ┆ity. R R R RE E E ET T T TU U U┆
0x15c0…15e0 08 55 52 08 52 08 52 08 52 4e 08 4e 08 4e 08 4e 20 56 08 56 08 56 08 56 41 08 41 08 41 08 41 4c ┆ UR R R RN N N N V V V VA A A AL┆
0x15e0…1600 08 4c 08 4c 08 4c 55 08 55 08 55 08 55 45 08 45 08 45 08 45 0a 20 20 20 20 20 55 70 6f 6e 20 73 ┆ L L LU U U UE E E E Upon s┆
0x1600…1620 75 63 63 65 73 73 66 75 6c 20 63 6f 6d 70 6c 65 74 69 6f 6e 2c 20 61 20 76 61 6c 75 65 20 6f 66 ┆uccessful completion, a value of┆
0x1620…1640 20 30 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20 20 4f 74 68 2d 0a 20 20 20 20 20 65 72 77 69 73 ┆ 0 is returned. Oth- erwis┆
0x1640…1660 65 2c 20 61 20 76 61 6c 75 65 20 6f 66 20 2d 31 20 69 73 20 72 65 74 75 72 6e 65 64 20 61 6e 64 ┆e, a value of -1 is returned and┆
0x1660…1680 20 5f 08 65 5f 08 72 5f 08 72 5f 08 6e 5f 08 6f 20 69 73 20 73 65 74 20 74 6f 20 69 6e 64 69 2d ┆ _ e_ r_ r_ n_ o is set to indi-┆
0x1680…16a0 0a 20 20 20 20 20 63 61 74 65 20 74 68 65 20 65 72 72 6f 72 2e 0a 0a 45 08 45 08 45 08 45 52 08 ┆ cate the error. E E E ER ┆
0x16a0…16c0 52 08 52 08 52 52 08 52 08 52 08 52 4f 08 4f 08 4f 08 4f 52 08 52 08 52 08 52 53 08 53 08 53 08 ┆R R RR R R RO O O OR R R RS S S ┆
0x16c0…16e0 53 0a 20 20 20 20 20 54 68 65 20 5f 08 6c 5f 08 6f 5f 08 63 5f 08 6b 5f 08 66 20 72 6f 75 74 69 ┆S The _ l_ o_ c_ k_ f routi┆
0x16e0…1700 6e 65 20 77 69 6c 6c 20 66 61 69 6c 20 69 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 ┆ne will fail if one or more of t┆
0x1700…1720 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 61 72 65 20 74 72 75 65 3a 0a 0a 20 20 20 ┆he following are true: ┆
0x1720…1740 20 20 5b 45 41 43 43 45 53 5d 20 20 20 20 20 20 20 5f 08 63 5f 08 6d 5f 08 64 20 69 73 20 46 5f ┆ [EACCES] _ c_ m_ d is F_┆
0x1740…1760 54 4c 4f 43 4b 20 6f 72 20 46 5f 54 45 53 54 20 61 6e 64 20 74 68 65 20 73 65 63 74 69 6f 6e 20 ┆TLOCK or F_TEST and the section ┆
0x1760…1780 69 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6c ┆is already l┆
0x1780…17a0 6f 63 6b 65 64 20 62 79 20 61 6e 6f 74 68 65 72 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 20 20 ┆ocked by another process. ┆
0x17a0…17c0 5b 45 42 41 44 46 5d 20 20 20 20 20 20 20 20 5f 08 66 5f 08 69 5f 08 6c 5f 08 64 5f 08 65 5f 08 ┆[EBADF] _ f_ i_ l_ d_ e_ ┆
0x17c0…17e0 73 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 6f 70 65 6e 20 64 65 73 63 72 69 70 74 6f 72 ┆s is not a valid open descriptor┆
0x17e0…1800 2c 20 6f 72 20 5f 08 63 5f 08 6d 5f 08 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆, or _ c_ m_ d ┆
0x1800…1820 20 20 20 69 73 20 46 5f 4c 4f 43 4b 20 6f 72 20 46 5f 54 4c 4f 43 4b 20 61 6e 64 20 5f 08 66 5f ┆ is F_LOCK or F_TLOCK and _ f_┆
0x1820…1840 08 69 5f 08 6c 5f 08 64 5f 08 65 5f 08 73 20 69 73 20 6e 6f 74 20 61 0a 20 20 20 20 20 20 20 20 ┆ i_ l_ d_ e_ s is not a ┆
0x1840…1860 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 69 64 20 66 69 6c 65 2d 64 65 73 63 72 69 70 74 6f ┆ valid file-descripto┆
0x1860…1880 72 20 6f 70 65 6e 20 66 6f 72 20 77 72 69 74 69 6e 67 2e 0a 0a 20 20 20 20 20 5b 45 44 45 41 44 ┆r open for writing. [EDEAD┆
0x1880…18a0 4c 4b 5d 20 20 20 20 20 20 5f 08 63 5f 08 6d 5f 08 64 20 69 73 20 46 5f 4c 4f 43 4b 20 61 6e 64 ┆LK] _ c_ m_ d is F_LOCK and┆
0x18a0…18c0 20 61 20 64 65 61 64 6c 6f 63 6b 20 77 6f 75 6c 64 20 6f 63 63 75 72 2e 0a 20 20 20 20 20 20 20 ┆ a deadlock would occur. ┆
0x18c0…18e0 20 20 20 20 20 20 20 20 20 20 20 20 20 41 6c 73 6f 20 74 68 65 20 5f 08 63 5f 08 6d 5f 08 64 20 ┆ Also the _ c_ m_ d ┆
0x18e0…1900 69 73 20 65 69 74 68 65 72 20 6f 66 20 46 5f 4c 4f 43 4b 2c 20 46 5f 54 4c 4f 43 4b 20 6f 72 0a ┆is either of F_LOCK, F_TLOCK or ┆
0x1900…1920 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 5f 55 4c 4f 43 4b 20 61 6e 64 20 ┆ F_ULOCK and ┆
[…truncated at 200 lines…]