xref: /haiku/src/system/libroot/posix/unistd/sync.c (revision 4466b89c65970de4c7236ac87faa2bee4589f413)
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 
9 #include <errno.h>
10 #include <pthread.h>
11 
12 #include <syscall_utils.h>
13 
14 #include <syscalls.h>
15 
16 
17 int
18 fsync(int fd)
19 {
20 	RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_fsync(fd));
21 }
22 
23 
24 int
25 sync(void)
26 {
27 	int status = _kern_sync();
28 	if (status < 0) {
29 		errno = status;
30 		status = -1;
31 	}
32 
33 	return status;
34 }
35