authorgravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-11-03 06:03:38+02:00
committergravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-11-03 06:03:38+02:00
log8193f558200da27531304b77c1e80c16bb728420
treefdba778a4f15ff7063b210dc3206336d9b5b18e7
parent78e9e131e02bba1949aab67b63e7fe94ae8b33bb

Support 32-bit big-endian targets


2 files changed, 8 insertions(+), 9 deletions(-)

lib/std/os/linux.zig+8-6
......@@ -121,16 +121,18 @@ pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, fl
121121 return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(times), flags);
122122}
123123
124pub fn fallocate(fd: i32, mode: i32, offset: u64, len: u64) usize {
124pub fn fallocate(fd: i32, mode: i32, offset: u64, length: u64) usize {
125125 if (@sizeOf(usize) == 4) {
126 const offset_halves = splitValue64(offset);
127 const length_halves = splitValue64(length);
126128 return syscall6(
127129 .fallocate,
128130 @bitCast(usize, @as(isize, fd)),
129131 @bitCast(usize, @as(isize, mode)),
130 @truncate(usize, offset),
131 @truncate(usize, offset >> 32),
132 @truncate(usize, len),
133 @truncate(usize, len >> 32),
132 offset_halves[0],
133 offset_halves[1],
134 length_halves[0],
135 length_halves[1],
134136 );
135137 } else {
136138 return syscall4(
......@@ -138,7 +140,7 @@ pub fn fallocate(fd: i32, mode: i32, offset: u64, len: u64) usize {
138140 @bitCast(usize, @as(isize, fd)),
139141 @bitCast(usize, @as(isize, mode)),
140142 offset,
141 len,
143 length,
142144 );
143145 }
144146}
lib/std/os/linux/test.zig-3
......@@ -12,9 +12,6 @@ const expect = std.testing.expect;
1212const fs = std.fs;
1313
1414test "fallocate" {
15 // TODO https://github.com/ziglang/zig/issues/5127
16 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
17
1815 const path = "test_fallocate";
1916 const file = try fs.cwd().createFile(path, .{ .truncate = true, .mode = 0o666 });
2017 defer file.close();