| author | |
| committer | |
| log | 49886d2e452fd57f996795d92cd951649e4bc255 |
| tree | 85ac934098fabfda1185789153e824b1b8eeec8f |
| parent | 798207ec80c0e0092eb85325921c7656fe4c268d |
2 files changed, 4 insertions(+), 5 deletions(-)
lib/std/fs.zig+2-3| ... | @@ -619,7 +619,7 @@ pub const Dir = struct { | ... | @@ -619,7 +619,7 @@ pub const Dir = struct { |
| 619 | 619 | ||
| 620 | if (flags.lock and lock_flag == 0) { | 620 | if (flags.lock and lock_flag == 0) { |
| 621 | // TODO: integrate async I/O | 621 | // TODO: integrate async I/O |
| 622 | _ = try os.flock(fd, if (flags.write) os.LOCK_EX else os.LOCK_SH); | 622 | try os.flock(fd, if (flags.write) os.LOCK_EX else os.LOCK_SH); |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | return File{ | 625 | return File{ |
| ... | @@ -689,8 +689,7 @@ pub const Dir = struct { | ... | @@ -689,8 +689,7 @@ pub const Dir = struct { |
| 689 | 689 | ||
| 690 | if (flags.lock and lock_flag == 0) { | 690 | if (flags.lock and lock_flag == 0) { |
| 691 | // TODO: integrate async I/O | 691 | // TODO: integrate async I/O |
| 692 | // mem.zeroes is used here because flock's structure can vary across architectures and systems | 692 | try os.flock(fd, os.LOCK_EX); |
| 693 | _ = try os.flock(fd, os.LOCK_EX); | ||
| 694 | } | 693 | } |
| 695 | 694 | ||
| 696 | return File{ .handle = fd, .io_mode = .blocking }; | 695 | return File{ .handle = fd, .io_mode = .blocking }; |
lib/std/os.zig+2-2| ... | @@ -3229,11 +3229,11 @@ pub const FlockError = error{ | ... | @@ -3229,11 +3229,11 @@ pub const FlockError = error{ |
| 3229 | SystemResources, | 3229 | SystemResources, |
| 3230 | } || UnexpectedError; | 3230 | } || UnexpectedError; |
| 3231 | 3231 | ||
| 3232 | pub fn flock(fd: fd_t, operation: i32) FlockError!usize { | 3232 | pub fn flock(fd: fd_t, operation: i32) FlockError!void { |
| 3233 | while (true) { | 3233 | while (true) { |
| 3234 | const rc = system.flock(fd, operation); | 3234 | const rc = system.flock(fd, operation); |
| 3235 | switch (errno(rc)) { | 3235 | switch (errno(rc)) { |
| 3236 | 0 => return @intCast(usize, rc), | 3236 | 0 => return, |
| 3237 | EBADF => unreachable, | 3237 | EBADF => unreachable, |
| 3238 | EINTR => continue, | 3238 | EINTR => continue, |
| 3239 | EINVAL => unreachable, // invalid parameters | 3239 | EINVAL => unreachable, // invalid parameters |