xref: /haiku/src/system/libroot/posix/unistd/sync.c (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
5 
6 
7 #include <unistd.h>
8 #include <syscalls.h>
9 #include <errno.h>
10 
11 
12 int
13 fsync(int fd)
14 {
15 	int status = _kern_fsync(fd);
16 	if (status < 0) {
17 		errno = status;
18 		status = -1;
19 	}
20 
21 	return status;
22 }
23 
24 
25 int
26 sync(void)
27 {
28 	int status = _kern_sync();
29 	if (status < 0) {
30 		errno = status;
31 		status = -1;
32 	}
33 
34 	return status;
35 }
36