1 .\" This file is part of the Public Domain C Library (PDCLib).
2 .\" Permission is granted to use, modify, and / or redistribute at will.
9 .Nm flockfile, ftrylockfile, funlockfile
10 .Nd stdio file locking
13 .Sy #define _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || _SVID_SOURCE || _BSD_SOURCE
16 .Fn "void flockfile" "FILE *file"
17 .Fn "int ftrylockfile" "FILE *file"
18 .Fn "void funlockfile" "FILE *file"
22 locks the passed FILE stream for access by the calling thread, potentially
25 attempts to lock the file for the calling thread, but will return failure if
26 another thread has already locked the file.
28 releases the lock on the stream, allowing another thread in the process to
32 The same stream may be locked multiple times by the calling thread; the number
37 on a file must be equal to the number of calls to
41 No other thread may do I/O through the locked file while it is locked.
43 .Sh IMPLEMENTATION NOTES
44 PDCLib implements the file locking on top of the Mutex primitives added by C11
53 The locked I/O routines were initially introduced in
55 and incorporated into POSIX in