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 <errno_private.h> 15 #include <syscalls.h> 16 17 18 int 19 fsync(int fd) 20 { 21 RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_fsync(fd)); 22 } 23 24 25 int 26 sync(void) 27 { 28 int status = _kern_sync(); 29 if (status < 0) { 30 __set_errno(status); 31 status = -1; 32 } 33 34 return status; 35 } 36