authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-21 20:34:55-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-21 20:34:55-05:00
logcd5f4de2a684ab0a3383ff328516243a6e850201
treea421b07b96689a975091f941e94f0d3f3bac0740
parentbf1cbebea1fd846c982e568ef4f013dfaf232e3e
signaturelock-open Commit is signed but in an unrecognized format.

std: remove O_LARGEFILE from OS bits when the OS does not define it


5 files changed, 12 insertions(+), 8 deletions(-)

lib/std/event/fs.zig+6-3
......@@ -415,7 +415,8 @@ pub fn openPosix(
415415pub fn openRead(loop: *Loop, path: []const u8) File.OpenError!fd_t {
416416 switch (builtin.os) {
417417 .macosx, .linux, .freebsd, .netbsd, .dragonfly => {
418 const flags = os.O_LARGEFILE | os.O_RDONLY | os.O_CLOEXEC;
418 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
419 const flags = O_LARGEFILE | os.O_RDONLY | os.O_CLOEXEC;
419420 return openPosix(loop, path, flags, File.default_mode);
420421 },
421422
......@@ -448,7 +449,8 @@ pub fn openWriteMode(loop: *Loop, path: []const u8, mode: File.Mode) File.OpenEr
448449 .netbsd,
449450 .dragonfly,
450451 => {
451 const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
452 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
453 const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
452454 return openPosix(loop, path, flags, File.default_mode);
453455 },
454456 .windows => return windows.CreateFile(
......@@ -472,7 +474,8 @@ pub fn openReadWrite(
472474) File.OpenError!fd_t {
473475 switch (builtin.os) {
474476 .macosx, .linux, .freebsd, .netbsd, .dragonfly => {
475 const flags = os.O_LARGEFILE | os.O_RDWR | os.O_CREAT | os.O_CLOEXEC;
477 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
478 const flags = O_LARGEFILE | os.O_RDWR | os.O_CREAT | os.O_CLOEXEC;
476479 return openPosix(loop, path, flags, mode);
477480 },
478481
lib/std/event/loop.zig+2-1
......@@ -856,7 +856,8 @@ pub const Loop = struct {
856856 },
857857 .Close => |*msg| noasync os.close(msg.fd),
858858 .WriteFile => |*msg| blk: {
859 const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT |
859 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
860 const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT |
860861 os.O_CLOEXEC | os.O_TRUNC;
861862 const fd = noasync os.openC(msg.path.ptr, flags, msg.mode) catch |err| {
862863 msg.result = err;
lib/std/fs/file.zig+4-2
......@@ -66,7 +66,8 @@ pub const File = struct {
6666 const path_w = try windows.cStrToPrefixedFileW(path);
6767 return openWriteModeW(&path_w, file_mode);
6868 }
69 const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
69 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
70 const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_TRUNC;
7071 const fd = try os.openC(path, flags, file_mode);
7172 return openHandle(fd);
7273 }
......@@ -105,7 +106,8 @@ pub const File = struct {
105106 const path_w = try windows.cStrToPrefixedFileW(path);
106107 return openWriteNoClobberW(&path_w, file_mode);
107108 }
108 const flags = os.O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_EXCL;
109 const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
110 const flags = O_LARGEFILE | os.O_WRONLY | os.O_CREAT | os.O_CLOEXEC | os.O_EXCL;
109111 const fd = try os.openC(path, flags, file_mode);
110112 return openHandle(fd);
111113 }
lib/std/os/bits/darwin.zig-1
......@@ -267,7 +267,6 @@ pub const SA_USERTRAMP = 0x0100;
267267/// signal handler with SA_SIGINFO args with 64bit regs information
268268pub const SA_64REGSET = 0x0200;
269269
270pub const O_LARGEFILE = 0x0000;
271270pub const O_PATH = 0x0000;
272271
273272pub const F_OK = 0;
lib/std/os/bits/netbsd.zig-1
......@@ -292,7 +292,6 @@ pub const O_CLOEXEC = 0x00400000;
292292
293293pub const O_ASYNC = 0x0040;
294294pub const O_DIRECT = 0x00080000;
295pub const O_LARGEFILE = 0;
296295pub const O_NOATIME = 0;
297296pub const O_PATH = 0;
298297pub const O_TMPFILE = 0;