authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-06 22:07:27-06:00
committergravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-06 22:07:27-06:00
log49886d2e452fd57f996795d92cd951649e4bc255
tree85ac934098fabfda1185789153e824b1b8eeec8f
parent798207ec80c0e0092eb85325921c7656fe4c268d

Remove return value from os.flock()


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 {
619619
620 if (flags.lock and lock_flag == 0) {620 if (flags.lock and lock_flag == 0) {
621 // TODO: integrate async I/O621 // 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 }
624624
625 return File{625 return File{
...@@ -689,8 +689,7 @@ pub const Dir = struct {...@@ -689,8 +689,7 @@ pub const Dir = struct {
689689
690 if (flags.lock and lock_flag == 0) {690 if (flags.lock and lock_flag == 0) {
691 // TODO: integrate async I/O691 // TODO: integrate async I/O
692 // mem.zeroes is used here because flock's structure can vary across architectures and systems692 try os.flock(fd, os.LOCK_EX);
693 _ = try os.flock(fd, os.LOCK_EX);
694 }693 }
695694
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;
32313231
3232pub fn flock(fd: fd_t, operation: i32) FlockError!usize {3232pub 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 parameters3239 EINVAL => unreachable, // invalid parameters