From 6cb8bda6e19805dc5ddfd09cf1429a42bbcb31d6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 27 Sep 2023 00:35:36 +0300 Subject: [PATCH] LibC: add syncsync() to unistd.h This is my own WELL NAMED (:D) function that takes a paramemeter to make the sync operation synchronous. --- libc/include/unistd.h | 1 + libc/unistd.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libc/include/unistd.h b/libc/include/unistd.h index 8d47566e7c..374033f82f 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -196,6 +196,7 @@ void swab(const void* __restrict src, void* __restrict dest, ssize_t nbytes); int symlink(const char* path1, const char* path2); int symlinkat(const char* path1, int fd, const char* path2); void sync(void); +void syncsync(int should_block); long sysconf(int name); pid_t tcgetpgrp(int fildes); int tcsetpgrp(int fildes, pid_t pgid_id); diff --git a/libc/unistd.cpp b/libc/unistd.cpp index c6eec3881c..b334b4d411 100644 --- a/libc/unistd.cpp +++ b/libc/unistd.cpp @@ -202,7 +202,12 @@ int chdir(const char* path) void sync(void) { - syscall(SYS_SYNC); + syscall(SYS_SYNC, false); +} + +void syncsync(int should_block) +{ + syscall(SYS_SYNC, should_block); } pid_t getpid(void)