def setNonBlocking(fd): """Make a fd non-blocking.""" flags = fcntl.fcntl(fd, FCNTL.F_GETFL) flags = flags | os.O_NONBLOCK fcntl.fcntl(fd, FCNTL.F_SETFL, flags)