Remove return value from os.flock()

This commit is contained in:
LeRoyce Pearson 2020-04-06 22:07:27 -06:00
parent 798207ec80
commit 49886d2e45
2 changed files with 4 additions and 5 deletions

View File

@ -619,7 +619,7 @@ pub const Dir = struct {
if (flags.lock and lock_flag == 0) {
// TODO: integrate async I/O
_ = try os.flock(fd, if (flags.write) os.LOCK_EX else os.LOCK_SH);
try os.flock(fd, if (flags.write) os.LOCK_EX else os.LOCK_SH);
}
return File{
@ -689,8 +689,7 @@ pub const Dir = struct {
if (flags.lock and lock_flag == 0) {
// TODO: integrate async I/O
// mem.zeroes is used here because flock's structure can vary across architectures and systems
_ = try os.flock(fd, os.LOCK_EX);
try os.flock(fd, os.LOCK_EX);
}
return File{ .handle = fd, .io_mode = .blocking };

View File

@ -3229,11 +3229,11 @@ pub const FlockError = error{
SystemResources,
} || UnexpectedError;
pub fn flock(fd: fd_t, operation: i32) FlockError!usize {
pub fn flock(fd: fd_t, operation: i32) FlockError!void {
while (true) {
const rc = system.flock(fd, operation);
switch (errno(rc)) {
0 => return @intCast(usize, rc),
0 => return,
EBADF => unreachable,
EINTR => continue,
EINVAL => unreachable, // invalid parameters