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.

26 lines
496 B

  1. #include <unistd.h>
  2. #include <fcntl.h>
  3. #include <errno.h>
  4. #include "io_internal.h"
  5. #ifdef __MINGW32__
  6. #include <winsock2.h>
  7. #include <windows.h>
  8. #include "windoze.h"
  9. #endif
  10. #ifndef O_NDELAY
  11. #define O_NDELAY O_NONBLOCK
  12. #endif
  13. void io_nonblock(int64 d) {
  14. io_entry* e=iarray_get(&io_fds,d);
  15. #ifdef __MINGW32__
  16. unsigned long i=1;
  17. if (ioctlsocket( d, FIONBIO, &i)==0)
  18. if (e) e->nonblock=1;
  19. #else
  20. if (fcntl(d,F_SETFL,fcntl(d,F_GETFL,0) | O_NDELAY)==0)
  21. if (e) e->nonblock=1;
  22. #endif
  23. }