| ... | @@ -350,7 +350,13 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { | ... | @@ -350,7 +350,13 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 350 | ); | 350 | ); |
| 351 | } | 351 | } |
| 352 | } else { | 352 | } else { |
| 353 | return syscall4(SYS_pread, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count, offset); | 353 | return syscall4( |
| | 354 | SYS_pread, |
| | 355 | @bitCast(usize, @as(isize, fd)), |
| | 356 | @ptrToInt(buf), |
| | 357 | count, |
| | 358 | offset, |
| | 359 | ); |
| 354 | } | 360 | } |
| 355 | } | 361 | } |
| 356 | | 362 | |
| ... | @@ -385,7 +391,36 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { | ... | @@ -385,7 +391,36 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { |
| 385 | } | 391 | } |
| 386 | | 392 | |
| 387 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: usize) usize { | 393 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: usize) usize { |
| 388 | return syscall4(SYS_pwrite, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count, offset); | 394 | if (@hasDecl(@This(), "SYS_pwrite64")) { |
| | 395 | if (require_aligned_register_pair) { |
| | 396 | return syscall6( |
| | 397 | SYS_pwrite64, |
| | 398 | @bitCast(usize, @as(isize, fd)), |
| | 399 | @ptrToInt(buf), |
| | 400 | count, |
| | 401 | 0, |
| | 402 | @truncate(usize, offset), |
| | 403 | @truncate(usize, offset >> 32), |
| | 404 | ); |
| | 405 | } else { |
| | 406 | return syscall5( |
| | 407 | SYS_pwrite64, |
| | 408 | @bitCast(usize, @as(isize, fd)), |
| | 409 | @ptrToInt(buf), |
| | 410 | count, |
| | 411 | @truncate(usize, offset), |
| | 412 | @truncate(usize, offset >> 32), |
| | 413 | ); |
| | 414 | } |
| | 415 | } else { |
| | 416 | return syscall4( |
| | 417 | SYS_pwrite, |
| | 418 | @bitCast(usize, @as(isize, fd)), |
| | 419 | @ptrToInt(buf), |
| | 420 | count, |
| | 421 | offset, |
| | 422 | ); |
| | 423 | } |
| 389 | } | 424 | } |
| 390 | | 425 | |
| 391 | pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize { | 426 | pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize { |