muimaster.library: support Listview_List in List
[AROS.git] / compiler / posixc / fsync.c
bloba18d718e2ed120569b72d1f31fd3c1afa4e348bc
1 /*
2 Copyright © 2004-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2008 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 <fcntl.h>
14 #include "__fdesc.h"
16 /*****************************************************************************
18 NAME */
19 #include <unistd.h>
21 int fsync(
23 /* SYNOPSIS */
24 int fd)
26 /* FUNCTION
28 INPUTS
30 RESULT
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 ******************************************************************************/
44 fdesc *fdesc = __getfdesc(fd);
46 if (!fdesc || !(fdesc->fcb->flags & O_WRITE))
48 errno = EBADF;
49 return -1;
52 if (!Flush(fdesc->fcb->handle))
54 errno = __stdc_ioerr2errno(IoErr());
55 return -1;
58 return 0;
59 } /* fsync */