mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
Remove return value from os.flock()
This commit is contained in:
parent
798207ec80
commit
49886d2e45
@ -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 };
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user