diff --git a/mod.zig b/mod.zig index a195871a612a95ca3e058a3dbcf26d21268f73b3..83a9dd37f75ca31edd32f19aadfdc9478cbda045 100644 --- a/mod.zig +++ b/mod.zig @@ -917,7 +917,13 @@ pub const chroot = @compileError("TODO: chroot"); // sync // void sync(void); // asmlinkage long sys_sync(void); -pub const sync = @compileError("TODO: sync"); +pub fn sync() errno.Error!void { + const r = syscall0(.sync); + return switch (_errno(r)) { + .ok => {}, + _ => |c| errno.errorFromInt(@intFromEnum(c)), + }; +} // acct // int acct(const char *_Nullable filename); diff --git a/test.zig b/test.zig index a08f76083ebf80b4dfe34363e87a010eb0eaacef..ddab99131ddb76fa37f16571103597ba7e2daa80 100644 --- a/test.zig +++ b/test.zig @@ -21,4 +21,5 @@ test { _ = &linux.setsid; _ = &linux.munlockall; _ = &linux.vhangup; + _ = &linux.sync; }