Replaced Popscren with a custom pop-up list for selecting public screen. Now it conta...
[tangerine.git] / compiler / clib / fsync.c
blobf0345442d759f57b4ca08f979d6da670b6eb162c
1 /*
2 Copyright © 2004-2007, 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 "__open.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 = IoErr2errno(IoErr());
56 return -1;
59 return 0;
60 } /* fsync */