Exemplo n.º 1
0
 def _setblocking(self, block):
     delay_flag = intmask(_c.fcntl(self.fd, _c.F_GETFL, 0))
     if block:
         delay_flag &= ~_c.O_NONBLOCK
     else:
         delay_flag |= _c.O_NONBLOCK
     _c.fcntl(self.fd, _c.F_SETFL, delay_flag)
Exemplo n.º 2
0
 def _setblocking(self, block):
     orig_delay_flag = intmask(_c.fcntl(self.fd, _c.F_GETFL, 0))
     if block:
         delay_flag = orig_delay_flag & ~_c.O_NONBLOCK
     else:
         delay_flag = orig_delay_flag | _c.O_NONBLOCK
     if orig_delay_flag != delay_flag:
         _c.fcntl(self.fd, _c.F_SETFL, delay_flag)
Exemplo n.º 3
0
 def _setblocking(self, block):
     orig_delay_flag = intmask(_c.fcntl(self.fd, _c.F_GETFL, 0))
     if block:
         delay_flag = orig_delay_flag & ~_c.O_NONBLOCK
     else:
         delay_flag = orig_delay_flag | _c.O_NONBLOCK
     if orig_delay_flag != delay_flag:
         _c.fcntl(self.fd, _c.F_SETFL, delay_flag)
Exemplo n.º 4
0
 def _check_fd_mode(fd, reading, writing):
     flags = intmask(_c.fcntl(fd, _c.F_GETFL, 0))
     if flags & _c.O_RDWR:
         return
     elif flags & _c.O_WRONLY:
         if not reading:
             return
     else:  # O_RDONLY
         if not writing:
             return
     raise OSError(22, "Invalid argument")
Exemplo n.º 5
0
 def _check_fd_mode(fd, reading, writing):
     flags = intmask(_c.fcntl(fd, _c.F_GETFL, 0))
     if flags & _c.O_RDWR:
         return
     elif flags & _c.O_WRONLY:
         if not reading:
             return
     else:  # O_RDONLY
         if not writing:
             return
     raise OSError(22, "Invalid argument")