Kernel: Implement SYS_SYNC and add sync executable to userspace

You can (and have to) manually sync disk after writes to it.
This commit is contained in:
Bananymous
2023-09-11 01:26:27 +03:00
parent eee0537053
commit 63dc2b6aa6
14 changed files with 84 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ set(USERSPACE_PROJECTS
Shell
snake
stat
sync
tee
test
touch

View File

@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.26)
project(sync CXX)
set(SOURCES
main.cpp
)
add_executable(sync ${SOURCES})
target_compile_options(sync PUBLIC -O2 -g)
target_link_libraries(sync PUBLIC libc)
add_custom_target(sync-install
COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/sync ${BANAN_BIN}/
DEPENDS sync
USES_TERMINAL
)

6
userspace/sync/main.cpp Normal file
View File

@@ -0,0 +1,6 @@
#include <unistd.h>
int main()
{
sync();
}