Why is this a bad idea? -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/
2004-10-27 Reini Urban <[EMAIL PROTECTED]>
* syscalls.cc (sync): Implement it via cygheap->fdtab and FlushFileBuffers. Better than a noop. Index: syscalls.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/syscalls.cc,v retrieving revision 1.345 diff -u -b -r1.345 syscalls.cc --- syscalls.cc 3 Sep 2004 01:53:12 -0000 1.345 +++ syscalls.cc 27 Oct 2004 02:30:01 -0000 @@ -1082,6 +1082,24 @@ extern "C" void sync () { + int err = 0; + cygheap->fdtab.lock (); + + fhandler_base *fh; + for (int i = 0; i < (int) cygheap->fdtab.size; i++) + if ((fh = cygheap->fdtab[i]) != NULL) + { +#ifdef DEBUGGING + debug_printf ("syncing fd %d", i); +#endif + if (FlushFileBuffers (fh->get_handle ()) == 0) + { + __seterrno (); + err++; + } + } + cygheap->fdtab.unlock (); + return err ? 1 : 0; } /* Cygwin internal */