From: <dan...@us...> - 2008-08-30 07:52:12
|
Revision: 1170 http://cegcc.svn.sourceforge.net/cegcc/?rev=1170&view=rev Author: dannybackx Date: 2008-08-30 07:52:10 +0000 (Sat, 30 Aug 2008) Log Message: ----------- Implement fsync and fdatasync Modified Paths: -------------- trunk/cegcc/src/newlib/ChangeLog.cegcc trunk/cegcc/src/newlib/newlib/libc/sys/wince/io.c Modified: trunk/cegcc/src/newlib/ChangeLog.cegcc =================================================================== --- trunk/cegcc/src/newlib/ChangeLog.cegcc 2008-08-30 07:46:02 UTC (rev 1169) +++ trunk/cegcc/src/newlib/ChangeLog.cegcc 2008-08-30 07:52:10 UTC (rev 1170) @@ -1,6 +1,7 @@ 2008-08-29 Pawel Veselov <paw...@gm...> + * newlib/libc/sys/wince/io.c (fsync, fdatasync) : Implement. * newlib/libc/sys/wince/sys/io.h newlib/libc/sys/wince/io.c - newlib/libc/sys/wince/stat.c : add critical section parameter + newlib/libc/sys/wince/stat.c : Add critical section parameter to FDCHECK to prevent deadlock when FDCHECK returns. 2008-06-10 Danny Backx <dan...@us...> Modified: trunk/cegcc/src/newlib/newlib/libc/sys/wince/io.c =================================================================== --- trunk/cegcc/src/newlib/newlib/libc/sys/wince/io.c 2008-08-30 07:46:02 UTC (rev 1169) +++ trunk/cegcc/src/newlib/newlib/libc/sys/wince/io.c 2008-08-30 07:52:10 UTC (rev 1170) @@ -5,6 +5,7 @@ #include <stdio.h> #include <sys/stat.h> #include <string.h> +#include <sys/unistd.h> #include <fcntl.h> #include <reent.h> #include <errno.h> @@ -99,6 +100,21 @@ LeaveCriticalSection(&critsect); } +int fsync(int fd) { + WCETRACE(WCE_IO, "syncing descriptor %d", fd); + FDCHECK(fd, 0); + if (FlushFileBuffers(_fdtab[fd].hnd)) { + errno = _winerr2errno(GetLastError()); + WCETRACE(WCE_IO, "FlushFileBuffers(%d): errno=%d oserr=%d\n", fd, errno, GetLastError()); + return -1; + } + return 0; +} + +int fdatasync(int fd) { + return fsync(fd); +} + void _initfds() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |