Added missing properties.
[AROS.git] / compiler / clib / fsync.c
blob37b22fa85a35cd0c61ec61ec63fa3f2623d81b24
1 /*
2 Copyright © 2004-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function fsync().
6 */
8 #include <exec/types.h>
9 #include <dos/dosextens.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <errno.h>
13 #include "__fdesc.h"
15 /*****************************************************************************
17 NAME */
19 #include <fcntl.h>
20 #include <unistd.h>
22 int fsync(
24 /* SYNOPSIS */
25 int fd)
27 /* FUNCTION
29 INPUTS
31 RESULT
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 ******************************************************************************/
45 fdesc *fdesc = __getfdesc(fd);
47 if (!fdesc || !(fdesc->fcb->flags & O_WRITE))
49 errno = EBADF;
50 return -1;
53 if (!Flush((BPTR) fdesc->fcb->fh))
55 errno = __arosc_ioerr2errno(IoErr());
56 return -1;
59 return 0;
60 } /* fsync */