authorgravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-11-01 11:49:08+02:00
committergravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-11-01 11:49:08+02:00
log2dd8613adcac695468937156f6e13dc5a4828e4c
tree99f0913e883071210c19978b68ff4ab7271564d7
parent2fdb30a571564253d110d27329a898a1d169553c

"The Traveling Wilburys' - Handle With Care"

Both `offset` and `len` are `off_t`. Like the rest of the std lib we assume that `_FILE_OFFSET_BITS == 64` is always true, so that `off_t` is a `u64`. When passing to 32-bit kernels, we split these into two `u32` parameters.

1 files changed, 20 insertions(+), 8 deletions(-)

lib/std/os/linux.zig+20-8
...@@ -121,14 +121,26 @@ pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, fl...@@ -121,14 +121,26 @@ pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, fl
121 return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(times), flags);121 return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(times), flags);
122}122}
123123
124pub fn fallocate(fd: i32, mode: i32, offset: usize, len: usize) usize {124pub fn fallocate(fd: i32, mode: i32, offset: u64, len: u64) usize {
125 return syscall4(125 if (@sizeOf(usize) == 4) {
126 .fallocate,126 return syscall6(
127 @bitCast(usize, @as(isize, fd)),127 .fallocate,
128 @bitCast(usize, @as(isize, mode)),128 @bitCast(usize, @as(isize, fd)),
129 offset,129 @bitCast(usize, @as(isize, mode)),
130 len,130 @truncate(usize, offset >> 32),
131 );131 @truncate(usize, offset),
132 @truncate(usize, len >> 32),
133 @truncate(usize, len),
134 );
135 } else {
136 return syscall4(
137 .fallocate,
138 @bitCast(usize, @as(isize, fd)),
139 @bitCast(usize, @as(isize, mode)),
140 offset,
141 len,
142 );
143 }
132}144}
133145
134pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*timespec) usize {146pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*timespec) usize {