blocking.c 219 B

123456789101112
  1. #include <fcntl.h>
  2. #include "blocking.h"
  3. void blocking_enable(int fd)
  4. {
  5. fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) & ~O_NONBLOCK);
  6. }
  7. void blocking_disable(int fd)
  8. {
  9. fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0) | O_NONBLOCK);
  10. }