| ... | @@ -4501,8 +4501,12 @@ pub const FlockError = error{ | ... | @@ -4501,8 +4501,12 @@ pub const FlockError = error{ |
| 4501 | | 4501 | |
| 4502 | /// The kernel ran out of memory for allocating file locks | 4502 | /// The kernel ran out of memory for allocating file locks |
| 4503 | SystemResources, | 4503 | SystemResources, |
| | 4504 | |
| | 4505 | /// The underlying filesystem does not support file locks |
| | 4506 | FileLocksNotSupported, |
| 4504 | } || UnexpectedError; | 4507 | } || UnexpectedError; |
| 4505 | | 4508 | |
| | 4509 | /// Depending on the operating system `flock` may or may not interact with `fcntl` locks made by other processes. |
| 4506 | pub fn flock(fd: fd_t, operation: i32) FlockError!void { | 4510 | pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 4507 | while (true) { | 4511 | while (true) { |
| 4508 | const rc = system.flock(fd, operation); | 4512 | const rc = system.flock(fd, operation); |
| ... | @@ -4513,6 +4517,7 @@ pub fn flock(fd: fd_t, operation: i32) FlockError!void { | ... | @@ -4513,6 +4517,7 @@ pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 4513 | .INVAL => unreachable, // invalid parameters | 4517 | .INVAL => unreachable, // invalid parameters |
| 4514 | .NOLCK => return error.SystemResources, | 4518 | .NOLCK => return error.SystemResources, |
| 4515 | .AGAIN => return error.WouldBlock, // TODO: integrate with async instead of just returning an error | 4519 | .AGAIN => return error.WouldBlock, // TODO: integrate with async instead of just returning an error |
| | 4520 | .OPNOTSUPP => return error.FileLocksNotSupported, |
| 4516 | else => |err| return unexpectedErrno(err), | 4521 | else => |err| return unexpectedErrno(err), |
| 4517 | } | 4522 | } |
| 4518 | } | 4523 | } |