diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-05-24 18:27:18 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-05-26 18:32:44 -0400 |
| commit | 17b0166e004e81d9c433576f4c642e743fc527b7 (patch) | |
| tree | 0ba5e905ee444e21ffd68c348de240e76dc7dbef /std/os/linux/sys.zig | |
| parent | 2def23063fbabb4128da17aca27745a7e8062ce5 (diff) | |
| download | zig-17b0166e004e81d9c433576f4c642e743fc527b7.tar.gz zig-17b0166e004e81d9c433576f4c642e743fc527b7.zip | |
do Jay's suggestion with posix/os API naming & layout
Diffstat (limited to 'std/os/linux/sys.zig')
| -rw-r--r-- | std/os/linux/sys.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/std/os/linux/sys.zig b/std/os/linux/sys.zig index 61b21ed2b7..a5939c579b 100644 --- a/std/os/linux/sys.zig +++ b/std/os/linux/sys.zig @@ -320,8 +320,21 @@ pub fn close(fd: i32) usize { return syscall1(SYS_close, @bitCast(usize, isize(fd))); } -pub fn lseek(fd: i32, offset: isize, ref_pos: usize) usize { - return syscall3(SYS_lseek, @bitCast(usize, isize(fd)), @bitCast(usize, offset), ref_pos); +/// Can only be called on 32 bit systems. For 64 bit see `lseek`. +pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize { + return syscall5( + SYS__llseek, + @bitCast(usize, isize(fd)), + @truncate(usize, offset >> 32), + @truncate(usize, offset), + @ptrToInt(result), + whence, + ); +} + +/// Can only be called on 64 bit systems. For 32 bit see `llseek`. +pub fn lseek(fd: i32, offset: i64, whence: usize) usize { + return syscall3(SYS_lseek, @bitCast(usize, isize(fd)), @bitCast(usize, offset), whence); } pub fn exit(status: i32) noreturn { |
