From 9f9e22a8e9bb9531b962befecffd94d254cd054e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 24 Feb 2010 09:12:29 +0000 Subject: MinGW build: IPC git-svn-id: svn://tug.org/texlive/trunk@17182 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/lib/ChangeLog | 6 ++++++ Build/source/texk/web2c/lib/texmfmp.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 318a2b8f16b..930d8218d8e 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,9 @@ +2010-02-24 Peter Breitenlohner + + * texmfmp.c (IPC) [WIN32]: #include instead of + and , use ioctlsocket() instead of + fcnt() for non-blocking, and use Sleep() instead of sleep(). + 2010-02-21 Peter Breitenlohner * texmfmp.c: #include instead of externs. diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 8cd5d18834f..13f60297a48 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -884,6 +884,9 @@ topenin (void) incrementally. Shamim Mohamed adapted it for Web2c. */ #if defined (TeX) && defined (IPC) +#ifdef WIN32 +#include +#else #include #include #ifndef O_NONBLOCK /* POSIX */ @@ -897,6 +900,7 @@ what the fcntl? cannot implement IPC without equivalent for O_NONBLOCK. #endif /* no FNDELAY */ #endif /* no O_NDELAY */ #endif /* no O_NONBLOCK */ +#endif /* !WIN32 */ #ifndef IPC_PIPE_NAME /* $HOME is prepended to this. */ #define IPC_PIPE_NAME "/.TeXview_Pipe" @@ -947,6 +951,12 @@ ipc_is_open (void) static void ipc_open_out (void) { +#ifdef WIN32 + u_long mode = 1; +#define SOCK_NONBLOCK(s) ioctlsocket (s, FIONBIO, &mode) +#else +#define SOCK_NONBLOCK(s) fcntl (s, F_SETFL, O_NONBLOCK) +#endif #ifdef IPC_DEBUG fputs ("tex: Opening socket for IPC output ...\n", stderr); #endif @@ -962,7 +972,7 @@ ipc_open_out (void) { sock = socket (PF_UNIX, SOCK_STREAM, 0); if (sock >= 0) { if (connect (sock, ipc_addr, ipc_addr_len) != 0 - || fcntl (sock, F_SETFL, O_NONBLOCK) < 0) { + || SOCK_NONBLOCK (sock) < 0) { close (sock); sock = -1; return; @@ -1444,7 +1454,11 @@ parse_options (int argc, string *argv) if (system (IPC_SERVER_CMD) == 0) { unsigned i; for (i = 0; i < 20 && !ipc_is_open (); i++) { +#ifdef WIN32 + Sleep (2000); +#else sleep (2); +#endif ipc_open_out (); } } -- cgit v1.2.3