emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacsclient horribly broken


From: Jan Djärv
Subject: Re: emacsclient horribly broken
Date: Tue, 31 Oct 2006 13:36:34 +0100
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)



Juanma Barranquero skrev:
On 10/31/06, Jan Djärv <address@hidden> wrote:

> It is compatible with Windows?

I don't know.  Why is it important?

Because I cannot test it in other platforms, so I've chosen the way
that seemed to work more generally.

We should do the right thing for each platform.

Agreed.

process.c only uses FIONBIO in one place and only on STRIDE, but O_NONBLOCK is
used many times.

I know.

sysdep.c also uses it in one place, this really should be O_NONBLOCK instead.

If you say so; I don't know.

w32.c is MS Windows specific, so it does not count.

For some definition of "does not count", sure.


"which of the two is most widespread in the Unix world."

Something like this would handle all cases:

#ifdef O_NONBLOCK
/* Use O_NONBLOCK. */
#else
#ifdef O_NDELAY
/* Use O_NDELAY */
#else
/* Use FIONBIO */
#endif
#endif

Please, fill the blanks and I'll be happy to install it.


Patch:


*** emacsclient.c.orig  Tue Oct 31 13:27:41 2006
--- emacsclient.c       Tue Oct 31 13:32:25 2006
***************
*** 38,43 ****
--- 38,46 ----
  # 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,492 ****
--- 489,503 ----
        return INVALID_SOCKET;
      }

+ #ifdef O_NONBLOCK
+   IOCTL (s, O_NONBLOCK, &c_arg);
+ #else
+ # include <fcntl.h>
+ #endif
  # include <netinet/in.h>
  # include <sys/ioctl.h>
  # define INVALID_SOCKET -1
***************
*** 486,492 ****
--- 489,503 ----
        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);

    /*


        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]