home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / unistd / fsync.c next >
Encoding:
C/C++ Source or Header  |  1995-11-12  |  461 b   |  24 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <libc/stubs.h>
  3. #include <unistd.h>
  4. #include <dpmi.h>
  5. #include <errno.h>
  6. #include <libc/dosio.h>
  7.  
  8. int
  9. fsync(int _fd)
  10. {
  11.   int oerrno = errno;
  12.   __dpmi_regs r;
  13.   r.h.ah = 0x68;
  14.   r.x.bx = _fd;
  15.   __dpmi_int(0x21, &r);
  16.   if ((r.x.flags & 1) && (r.x.ax != 1) && (r.x.ax != 6))
  17.   {
  18.     errno = __doserr_to_errno(r.x.ax);
  19.     return -1;
  20.   }
  21.   errno = oerrno;
  22.   return 0;
  23. }
  24.