1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:57:35 +00:00

Add sync() syscall and a /bin/sync.

It walks all the live Inode objects and flushes pending metadata changes
wherever needed.

This could be optimized by keeping a separate list of dirty Inodes,
but let's not get ahead of ourselves.
This commit is contained in:
Andreas Kling 2018-12-20 00:39:29 +01:00
parent d0f06e5f3f
commit ed7ae6c02c
14 changed files with 78 additions and 24 deletions

1
Userland/.gitignore vendored
View file

@ -22,3 +22,4 @@ strsignal
fgrep
mkdir
touch
sync

View file

@ -44,7 +44,8 @@ APPS = \
fgrep \
tty \
mkdir \
touch
touch \
sync
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
@ -130,6 +131,9 @@ mkdir: mkdir.o
touch: touch.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
sync: sync.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
.cpp.o:
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<

8
Userland/sync.cpp Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h>
#include <unistd.h>
int main(int, char**)
{
sync();
return 0;
}