Files
WrldBox/.tmp_zig/lib/zig/c/fcntl.zig
swim67667 c17dfc94ce
Some checks failed
Build Project / build (ubuntu-latest) (push) Failing after 12m33s
added multi-compiling stuff (only works on my mac for now)
2026-06-28 16:40:20 -04:00

29 lines
881 B
Zig

const builtin = @import("builtin");
const std = @import("std");
const linux = std.os.linux;
const off_t = linux.off_t;
const symbol = @import("../c.zig").symbol;
const errno = @import("../c.zig").errno;
comptime {
if (builtin.target.isMuslLibC()) {
symbol(&fallocateLinux, "fallocate");
symbol(&posix_fadviseLinux, "posix_fadvise");
symbol(&posix_fallocateLinux, "posix_fallocate");
}
}
fn fallocateLinux(fd: c_int, mode: c_int, offset: off_t, len: off_t) callconv(.c) c_int {
return errno(linux.fallocate(fd, mode, offset, len));
}
fn posix_fadviseLinux(fd: c_int, offset: off_t, len: off_t, advice: c_int) callconv(.c) c_int {
return errno(linux.fadvise(fd, offset, len, @intCast(advice)));
}
fn posix_fallocateLinux(fd: c_int, offset: off_t, len: off_t) callconv(.c) c_int {
return errno(linux.fallocate(fd, 0, offset, len));
}