authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-12 21:19:25-06:00
committergravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-14 10:12:46-06:00
log43ccc2d81ec4c95c04dad9684f8b24633baab33e
treea8a75b9c652f52ddef9be2d4c54390bfcc4ed760
parent43c4faba5516bed725cd058ced6f1a53e166c6af

Add note about mandatory locks on linux


1 files changed, 10 insertions(+), 4 deletions(-)

lib/std/fs/file.zig+10-4
...@@ -46,8 +46,11 @@ pub const File = struct {...@@ -46,8 +46,11 @@ pub const File = struct {
46 /// the file is opened with a shared lock, allowing the other processes to read from the46 /// the file is opened with a shared lock, allowing the other processes to read from the
47 /// file, but not to write to the file.47 /// file, but not to write to the file.
48 ///48 ///
49 /// Note that the lock is only advisory on Linux. This means that a process that does not49 /// Note that the lock is only advisory on Linux, except in very specific cirsumstances[1].
50 /// respect the locking API can still read and write to the file, despite the lock.50 /// This means that a process that does not respect the locking API can still read and write
51 /// to the file, despite the lock.
52 ///
53 /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt
51 lock: bool = false,54 lock: bool = false,
5255
53 /// This prevents `O_NONBLOCK` from being passed even if `std.io.is_async`.56 /// This prevents `O_NONBLOCK` from being passed even if `std.io.is_async`.
...@@ -71,8 +74,11 @@ pub const File = struct {...@@ -71,8 +74,11 @@ pub const File = struct {
7174
72 /// Prevent other files from accessing this file while this process has it is open.75 /// Prevent other files from accessing this file while this process has it is open.
73 ///76 ///
74 /// Note that the lock is only advisory on Linux. This means that a process that does not77 /// Note that the lock is only advisory on Linux, except in very specific cirsumstances[1].
75 /// respect the locking API can still read and write to the file, despite the lock.78 /// This means that a process that does not respect the locking API can still read and write
79 /// to the file, despite the lock.
80 ///
81 /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt
76 lock: bool = false,82 lock: bool = false,
7783
78 /// For POSIX systems this is the file system mode the file will84 /// For POSIX systems this is the file system mode the file will