mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
std: remove O_LARGEFILE from OS bits when the OS does not define it
This commit is contained in:
parent
bf1cbebea1
commit
cd5f4de2a6
@ -415,7 +415,8 @@ pub fn openPosix(
|
||||
pub fn openRead(loop: *Loop, path: []const u8) File.OpenError!fd_t {
|
||||
switch (builtin.os) {
|
||||
.macosx, .linux, .freebsd, .netbsd, .dragonfly => {
|
||||
const flags = os.O_LARGEFILE | os.O_RDONLY | os.O_CLOEXEC;
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_RDONLY | os.O_CLOEXEC;
|
||||
return openPosix(loop, path, flags, File.default_mode);
|
||||
},
|
||||
|
||||
@ -448,7 +449,8 @@ pub fn openWriteMode(loop: *Loop, path: []const u8, mode: File.Mode) File.OpenEr
|
||||
.netbsd,
|
||||
.dragonfly,
|
||||
=> {
|
||||
const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
|
||||
return openPosix(loop, path, flags, File.default_mode);
|
||||
},
|
||||
.windows => return windows.CreateFile(
|
||||
@ -472,7 +474,8 @@ pub fn openReadWrite(
|
||||
) File.OpenError!fd_t {
|
||||
switch (builtin.os) {
|
||||
.macosx, .linux, .freebsd, .netbsd, .dragonfly => {
|
||||
const flags = os.O_LARGEFILE | os.O_RDWR | os.O_CREAT | os.O_CLOEXEC;
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_RDWR | os.O_CREAT | os.O_CLOEXEC;
|
||||
return openPosix(loop, path, flags, mode);
|
||||
},
|
||||
|
||||
|
||||
@ -856,7 +856,8 @@ pub const Loop = struct {
|
||||
},
|
||||
.Close => |*msg| noasync os.close(msg.fd),
|
||||
.WriteFile => |*msg| blk: {
|
||||
const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT |
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT |
|
||||
os.O_CLOEXEC | os.O_TRUNC;
|
||||
const fd = noasync os.openC(msg.path.ptr, flags, msg.mode) catch |err| {
|
||||
msg.result = err;
|
||||
|
||||
@ -66,7 +66,8 @@ pub const File = struct {
|
||||
const path_w = try windows.cStrToPrefixedFileW(path);
|
||||
return openWriteModeW(&path_w, file_mode);
|
||||
}
|
||||
const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
|
||||
const fd = try os.openC(path, flags, file_mode);
|
||||
return openHandle(fd);
|
||||
}
|
||||
@ -105,7 +106,8 @@ pub const File = struct {
|
||||
const path_w = try windows.cStrToPrefixedFileW(path);
|
||||
return openWriteNoClobberW(&path_w, file_mode);
|
||||
}
|
||||
const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_EXCL;
|
||||
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
|
||||
const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_EXCL;
|
||||
const fd = try os.openC(path, flags, file_mode);
|
||||
return openHandle(fd);
|
||||
}
|
||||
|
||||
@ -267,7 +267,6 @@ pub const SA_USERTRAMP = 0x0100;
|
||||
/// signal handler with SA_SIGINFO args with 64bit regs information
|
||||
pub const SA_64REGSET = 0x0200;
|
||||
|
||||
pub const O_LARGEFILE = 0x0000;
|
||||
pub const O_PATH = 0x0000;
|
||||
|
||||
pub const F_OK = 0;
|
||||
|
||||
@ -292,7 +292,6 @@ pub const O_CLOEXEC = 0x00400000;
|
||||
|
||||
pub const O_ASYNC = 0x0040;
|
||||
pub const O_DIRECT = 0x00080000;
|
||||
pub const O_LARGEFILE = 0;
|
||||
pub const O_NOATIME = 0;
|
||||
pub const O_PATH = 0;
|
||||
pub const O_TMPFILE = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user