mirror of
https://github.com/ziglang/zig.git
synced 2025-02-08 21:50:33 +00:00
use close$NOCANCEL on darwin
This commit is contained in:
parent
13265cf7c7
commit
b3dc1c380d
@ -32,6 +32,7 @@ pub extern "c" fn abort() noreturn;
|
||||
pub extern "c" fn exit(code: c_int) noreturn;
|
||||
pub extern "c" fn isatty(fd: fd_t) c_int;
|
||||
pub extern "c" fn close(fd: fd_t) c_int;
|
||||
pub extern "c" fn @"close$NOCANCEL"(fd: fd_t) c_int;
|
||||
pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int;
|
||||
pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;
|
||||
pub extern "c" fn lseek(fd: fd_t, offset: isize, whence: c_int) isize;
|
||||
|
10
std/os.zig
10
std/os.zig
@ -74,9 +74,13 @@ pub fn close(fd: fd_t) void {
|
||||
return windows.CloseHandle(fd);
|
||||
}
|
||||
if (wasi.is_the_target) {
|
||||
switch (wasi.fd_close(fd)) {
|
||||
0 => return,
|
||||
else => |err| return unexpectedErrno(err),
|
||||
_ = wasi.fd_close(fd);
|
||||
}
|
||||
if (darwin.is_the_target) {
|
||||
// This avoids the EINTR problem.
|
||||
switch (darwin.getErrno(darwin.@"close$NOCANCEL"(fd))) {
|
||||
EBADF => unreachable, // Always a race condition.
|
||||
else => return,
|
||||
}
|
||||
}
|
||||
switch (errno(system.close(fd))) {
|
||||
|
Loading…
Reference in New Issue
Block a user