diff --git a/mod.zig b/mod.zig index 6e7f2b3594819139b54a87404f0e8257c2ad25e4..6cf56c950a7bc5b3fd7b494d38c595264d9309db 100644 --- a/mod.zig +++ b/mod.zig @@ -3313,6 +3313,14 @@ pub const W = struct { } }; +pub const SEEK = struct { + pub const SET = 0; + pub const CUR = 1; + pub const END = 2; + pub const DATA = 3; + pub const HOLE = 4; +}; + pub fn getpid() pid_t { return libc.getpid(); } @@ -3700,3 +3708,8 @@ pub fn unlinkat(fd: c_int, name: [*:0]const u8, flag: c_int) !void { if (rc == -1) return errno.fromInt(errno.fromLibC()); std.debug.assert(rc == 0); } +pub fn lseek(fd: c_int, offset: off_t, whence: c_int) !void { + const rc = libc.lseek(fd, offset, whence); + if (rc == -1) return errno.fromInt(errno.fromLibC()); + std.debug.assert(rc >= 0); +} diff --git a/test.zig b/test.zig index 2daeaf20e20c38b8c8f9e4aea04a90c86faf8fb7..e687df0b2f0d2d09ecd2a7afa1e6a006483a5616 100644 --- a/test.zig +++ b/test.zig @@ -79,4 +79,5 @@ test { _ = &linux.poll; _ = &linux.waitpid; _ = &linux.unlinkat; + _ = &linux.lseek; }