| ... | ... | @@ -386,7 +386,7 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 389 | | if (@hasField(SYS, "pread64")) { |
| 389 | if (@hasField(SYS, "pread64") and usize_bits < 64) { |
| 390 | 390 | const offset_halves = splitValue64(offset); |
| 391 | 391 | if (require_aligned_register_pair) { |
| 392 | 392 | return syscall6( |
| ... | ... | @@ -409,8 +409,10 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 409 | 409 | ); |
| 410 | 410 | } |
| 411 | 411 | } else { |
| 412 | // Some architectures (eg. 64bit SPARC) pread is called pread64. |
| 413 | const S = if (!@hasField(SYS, "pread") and @hasField(SYS, "pread64")) .pread64 else .pread; |
| 412 | 414 | return syscall4( |
| 413 | | .pread, |
| 415 | S, |
| 414 | 416 | @bitCast(usize, @as(isize, fd)), |
| 415 | 417 | @ptrToInt(buf), |
| 416 | 418 | count, |
| ... | ... | @@ -450,7 +452,7 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { |
| 450 | 452 | } |
| 451 | 453 | |
| 452 | 454 | pub fn ftruncate(fd: i32, length: u64) usize { |
| 453 | | if (@hasField(SYS, "ftruncate64")) { |
| 455 | if (@hasField(SYS, "ftruncate64") and usize_bits < 64) { |
| 454 | 456 | const length_halves = splitValue64(length); |
| 455 | 457 | if (require_aligned_register_pair) { |
| 456 | 458 | return syscall4( |
| ... | ... | @@ -478,7 +480,7 @@ pub fn ftruncate(fd: i32, length: u64) usize { |
| 478 | 480 | } |
| 479 | 481 | |
| 480 | 482 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { |
| 481 | | if (@hasField(SYS, "pwrite64")) { |
| 483 | if (@hasField(SYS, "pwrite64") and usize_bits < 64) { |
| 482 | 484 | const offset_halves = splitValue64(offset); |
| 483 | 485 | |
| 484 | 486 | if (require_aligned_register_pair) { |
| ... | ... | @@ -502,8 +504,10 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { |
| 502 | 504 | ); |
| 503 | 505 | } |
| 504 | 506 | } else { |
| 507 | // Some architectures (eg. 64bit SPARC) pwrite is called pread64. |
| 508 | const S = if (!@hasField(SYS, "pwrite") and @hasField(SYS, "pwrite64")) .pwrite64 else .pwrite; |
| 505 | 509 | return syscall4( |
| 506 | | .pwrite, |
| 510 | S, |
| 507 | 511 | @bitCast(usize, @as(isize, fd)), |
| 508 | 512 | @ptrToInt(buf), |
| 509 | 513 | count, |