changeset 73583:75bfdccded78

[!WINDOWSNT]: Include <fcntl.h> if available. (set_tcp_socket): Prefer O_NONBLOCK, then O_NDELAY, then FIONBIO to set the socket in non-blocking mode.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 31 Oct 2006 13:50:35 +0000
parents b10ad78a3492
children e049c4ee04b1
files lib-src/emacsclient.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/emacsclient.c	Tue Oct 31 11:07:10 2006 +0000
+++ b/lib-src/emacsclient.c	Tue Oct 31 13:50:35 2006 +0000
@@ -38,6 +38,9 @@
 # define INITIALIZE() (initialize_sockets ())
 typedef unsigned long IOCTL_BOOL_ARG;
 #else
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
 # include <netinet/in.h>
 # include <sys/ioctl.h>
 # define INVALID_SOCKET -1
@@ -486,7 +489,15 @@
       return INVALID_SOCKET;
     }
 
+#ifdef O_NONBLOCK
+  IOCTL (s, O_NONBLOCK, &c_arg);
+#else
+#ifdef O_NDELAY
+  IOCTL (s, O_NDELAY, &c_arg);
+#else
   IOCTL (s, FIONBIO, &c_arg);
+#endif
+#endif 
   setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg);
 
   /*