| ... | ... | @@ -1275,6 +1275,16 @@ pub const OpenError = error{ |
| 1275 | 1275 | BadPathName, |
| 1276 | 1276 | InvalidUtf8, |
| 1277 | 1277 | |
| 1278 | /// One of these three things: |
| 1279 | /// * pathname refers to an executable image which is currently being |
| 1280 | /// executed and write access was requested. |
| 1281 | /// * pathname refers to a file that is currently in use as a swap |
| 1282 | /// file, and the O_TRUNC flag was specified. |
| 1283 | /// * pathname refers to a file that is currently being read by the |
| 1284 | /// kernel (e.g., for module/firmware loading), and write access was |
| 1285 | /// requested. |
| 1286 | FileBusy, |
| 1287 | |
| 1278 | 1288 | WouldBlock, |
| 1279 | 1289 | } || UnexpectedError; |
| 1280 | 1290 | |
| ... | ... | @@ -1468,6 +1478,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t) |
| 1468 | 1478 | .BUSY => return error.DeviceBusy, |
| 1469 | 1479 | .OPNOTSUPP => return error.FileLocksNotSupported, |
| 1470 | 1480 | .AGAIN => return error.WouldBlock, |
| 1481 | .TXTBSY => return error.FileBusy, |
| 1471 | 1482 | else => |err| return unexpectedErrno(err), |
| 1472 | 1483 | } |
| 1473 | 1484 | } |
| ... | ... | @@ -4577,7 +4588,8 @@ pub const FlockError = error{ |
| 4577 | 4588 | FileLocksNotSupported, |
| 4578 | 4589 | } || UnexpectedError; |
| 4579 | 4590 | |
| 4580 | | /// Depending on the operating system `flock` may or may not interact with `fcntl` locks made by other processes. |
| 4591 | /// Depending on the operating system `flock` may or may not interact with |
| 4592 | /// `fcntl` locks made by other processes. |
| 4581 | 4593 | pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 4582 | 4594 | while (true) { |
| 4583 | 4595 | const rc = system.flock(fd, operation); |
| ... | ... | @@ -4650,6 +4662,7 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP |
| 4650 | 4662 | const fd = openZ(pathname, flags, 0) catch |err| switch (err) { |
| 4651 | 4663 | error.FileLocksNotSupported => unreachable, |
| 4652 | 4664 | error.WouldBlock => unreachable, |
| 4665 | error.FileBusy => unreachable, // not asking for write permissions |
| 4653 | 4666 | else => |e| return e, |
| 4654 | 4667 | }; |
| 4655 | 4668 | defer close(fd); |