summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-02-24 09:12:29 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-02-24 09:12:29 +0000
commit9f9e22a8e9bb9531b962befecffd94d254cd054e (patch)
treee035f17ba6c481f438618af95523bd686a3e7185 /Build
parente009926dcfceace005bbd73a3f67b10616a967b1 (diff)
MinGW build: IPC
git-svn-id: svn://tug.org/texlive/trunk@17182 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog6
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c16
2 files changed, 21 insertions, 1 deletions
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 <peb@mppmu.mpg.de>
+
+ * texmfmp.c (IPC) [WIN32]: #include <winsock2.h> instead of
+ <sys/socket.h> and <fcntl.h>, use ioctlsocket() instead of
+ fcnt() for non-blocking, and use Sleep() instead of sleep().
+
2010-02-21 Peter Breitenlohner <peb@mppmu.mpg.de>
* texmfmp.c: #include <window/mfdisplay.h> 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 <winsock2.h>
+#else
#include <sys/socket.h>
#include <fcntl.h>
#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 ();
}
}