From c17a1f18a50b95f698010bb516b24030a5597168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 5 Jul 2004 17:55:13 +0000 Subject: [PATCH] Added working sync() and fsync() calls. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8304 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/Jamfile | 1 + src/kernel/libroot/posix/unistd/sync.c | 35 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/kernel/libroot/posix/unistd/sync.c diff --git a/src/kernel/libroot/posix/unistd/Jamfile b/src/kernel/libroot/posix/unistd/Jamfile index 5c6282cbc4..987306f8fa 100644 --- a/src/kernel/libroot/posix/unistd/Jamfile +++ b/src/kernel/libroot/posix/unistd/Jamfile @@ -19,6 +19,7 @@ KernelMergeObject posix_unistd.o : <$(SOURCE_GRIST)>process.c <$(SOURCE_GRIST)>read.c <$(SOURCE_GRIST)>sleep.c + <$(SOURCE_GRIST)>sync.c <$(SOURCE_GRIST)>terminal.c <$(SOURCE_GRIST)>truncate.c <$(SOURCE_GRIST)>ttyname.c diff --git a/src/kernel/libroot/posix/unistd/sync.c b/src/kernel/libroot/posix/unistd/sync.c new file mode 100644 index 0000000000..955c1632b2 --- /dev/null +++ b/src/kernel/libroot/posix/unistd/sync.c @@ -0,0 +1,35 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include +#include + + +int +fsync(int fd) +{ + int status = _kern_fsync(fd); + if (status < 0) { + errno = status; + status = -1; + } + + return status; +} + + +int +sync(void) +{ + int status = _kern_sync(); + if (status < 0) { + errno = status; + status = -1; + } + + return status; +}