As far as I can see (at least in NetBSD) O_NONBLOCK and FIONBIO are equivalent,
[sgt/putty] / unix / uxpty.c
index 60dc7f7..ca7e98a 100644 (file)
@@ -360,8 +360,10 @@ static void pty_open_master(Pty pty)
         /*
          * Set the pty master into non-blocking mode.
          */
-        int i = 1;
-        ioctl(pty->master_fd, FIONBIO, &i);
+        int fl;
+       fl = fcntl(pty->master_fd, F_GETFL);
+       if (fl != -1 && !(fl & O_NONBLOCK))
+           fcntl(pty->master_fd, F_SETFL, fl | O_NONBLOCK);
     }
 
     if (!ptys_by_fd)