| ... | @@ -2243,7 +2243,8 @@ pub const SeekError = error{ | ... | @@ -2243,7 +2243,8 @@ pub const SeekError = error{ |
| 2243 | /// Repositions read/write file offset relative to the beginning. | 2243 | /// Repositions read/write file offset relative to the beginning. |
| 2244 | pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void { | 2244 | pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void { |
| 2245 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { | 2245 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { |
| 2246 | switch (errno(system.llseek(fd, offset, null, SEEK_SET))) { | 2246 | var result: u64 = undefined; |
| | 2247 | switch (errno(system.llseek(fd, offset, &result, SEEK_SET))) { |
| 2247 | 0 => return, | 2248 | 0 => return, |
| 2248 | EBADF => unreachable, // always a race condition | 2249 | EBADF => unreachable, // always a race condition |
| 2249 | EINVAL => return error.Unseekable, | 2250 | EINVAL => return error.Unseekable, |
| ... | @@ -2271,7 +2272,8 @@ pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void { | ... | @@ -2271,7 +2272,8 @@ pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void { |
| 2271 | /// Repositions read/write file offset relative to the current offset. | 2272 | /// Repositions read/write file offset relative to the current offset. |
| 2272 | pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void { | 2273 | pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void { |
| 2273 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { | 2274 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { |
| 2274 | switch (errno(system.llseek(fd, @bitCast(u64, offset), null, SEEK_CUR))) { | 2275 | var result: u64 = undefined; |
| | 2276 | switch (errno(system.llseek(fd, @bitCast(u64, offset), &result, SEEK_CUR))) { |
| 2275 | 0 => return, | 2277 | 0 => return, |
| 2276 | EBADF => unreachable, // always a race condition | 2278 | EBADF => unreachable, // always a race condition |
| 2277 | EINVAL => return error.Unseekable, | 2279 | EINVAL => return error.Unseekable, |
| ... | @@ -2298,7 +2300,9 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void { | ... | @@ -2298,7 +2300,9 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void { |
| 2298 | /// Repositions read/write file offset relative to the end. | 2300 | /// Repositions read/write file offset relative to the end. |
| 2299 | pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void { | 2301 | pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void { |
| 2300 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { | 2302 | if (linux.is_the_target and !builtin.link_libc and @sizeOf(usize) == 4) { |
| 2301 | switch (errno(system.llseek(fd, @bitCast(u64, offset), null, SEEK_END))) { | 2303 | var result: u64 = undefined; |
| | 2304 | switch (errno(system.llseek(fd, @bitCast(u64, offset), &result, SEEK_END))) { |
| | 2305 | 0 => return, |
| 2302 | EBADF => unreachable, // always a race condition | 2306 | EBADF => unreachable, // always a race condition |
| 2303 | EINVAL => return error.Unseekable, | 2307 | EINVAL => return error.Unseekable, |
| 2304 | EOVERFLOW => return error.Unseekable, | 2308 | EOVERFLOW => return error.Unseekable, |