summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorTheFightingCatfish <seekingblues@gmail.com>2021-09-11 23:28:59 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-12 11:24:02 +0200
commita81b21c1a7f80e9e44c87e607049a23e7d9f33fd (patch)
tree53e49882b19f6b409910e7f6aad81c6c4e4433ba /Kernel/Syscalls
parentfd3735199b36e1b9a8776f377f8125bb5c93107f (diff)
downloadserenity-a81b21c1a7f80e9e44c87e607049a23e7d9f33fd.zip
Kernel+LibC: Implement fsync
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/fsync.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Kernel/Syscalls/fsync.cpp b/Kernel/Syscalls/fsync.cpp
new file mode 100644
index 0000000000..3e1445de77
--- /dev/null
+++ b/Kernel/Syscalls/fsync.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <Kernel/Process.h>
+
+namespace Kernel {
+
+KResultOr<FlatPtr> Process::sys$fsync(int fd)
+{
+ VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
+ REQUIRE_PROMISE(stdio);
+ auto description = TRY(fds().open_file_description(fd));
+ return description->sync();
+}
+
+}