Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
677 B

  1. #include <unistd.h>
  2. #include <sys/types.h>
  3. #ifdef __MINGW32__
  4. #include <windows.h>
  5. #else
  6. #include <sys/mman.h>
  7. #endif
  8. #include "io_internal.h"
  9. extern void io_dontwantread_really(int64 d,io_entry* e);
  10. extern void io_dontwantwrite_really(int64 d,io_entry* e);
  11. void io_close(int64 d) {
  12. io_entry* e;
  13. if ((e=iarray_get(&io_fds,d))) {
  14. e->inuse=0;
  15. e->cookie=0;
  16. if (e->kernelwantread) io_dontwantread_really(d,e);
  17. if (e->kernelwantwrite) io_dontwantwrite_really(d,e);
  18. if (e->mmapped) {
  19. #ifdef __MINGW32__
  20. UnmapViewOfFile(e->mmapped);
  21. CloseHandle(e->mh);
  22. #else
  23. munmap(e->mmapped,e->maplen);
  24. #endif
  25. e->mmapped=0;
  26. }
  27. }
  28. close(d);
  29. }