Update the kludge patch whilst we work out how best to address the

remaining issues.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9845 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-04-20 17:50:34 +00:00
parent 4515f9a333
commit d98fb732e9

View File

@ -1,10 +1,10 @@
Index: src/DepTable.C Index: src/DepTable.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/DepTable.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/DepTable.C,v
retrieving revision 1.41 retrieving revision 1.41
diff -u -r1.41 DepTable.C diff -u -a -u -r1.41 DepTable.C
--- src/DepTable.C 2003/10/13 01:01:33 1.41 --- src/DepTable.C 13 Oct 2003 01:01:33 -0000 1.41
+++ src/DepTable.C 2005/02/17 18:19:16 +++ src/DepTable.C 18 Apr 2005 17:37:02 -0000
@@ -26,7 +26,9 @@ @@ -26,7 +26,9 @@
#include <fstream> #include <fstream>
@ -17,12 +17,12 @@ diff -u -r1.41 DepTable.C
using lyx::support::ltrim; using lyx::support::ltrim;
Index: src/buffer.C Index: src/buffer.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/buffer.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.612 retrieving revision 1.615
diff -u -r1.612 buffer.C diff -u -a -u -r1.615 buffer.C
--- src/buffer.C 2005/02/08 13:17:57 1.612 --- src/buffer.C 18 Apr 2005 17:43:08 -0000 1.615
+++ src/buffer.C 2005/02/17 18:19:17 +++ src/buffer.C 18 Apr 2005 17:37:02 -0000
@@ -77,7 +77,11 @@ @@ -78,7 +78,11 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
@ -37,11 +37,11 @@ diff -u -r1.612 buffer.C
#include <stack> #include <stack>
Index: src/cursor.C Index: src/cursor.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/cursor.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.122 retrieving revision 1.123
diff -u -r1.122 cursor.C diff -u -a -u -r1.123 cursor.C
--- src/cursor.C 2005/02/15 17:34:53 1.122 --- src/cursor.C 25 Feb 2005 11:55:31 -0000 1.123
+++ src/cursor.C 2005/02/17 18:19:18 +++ src/cursor.C 18 Apr 2005 17:37:02 -0000
@@ -58,7 +58,9 @@ @@ -58,7 +58,9 @@
using std::vector; using std::vector;
using std::endl; using std::endl;
@ -54,11 +54,11 @@ diff -u -r1.122 cursor.C
using std::swap; using std::swap;
Index: src/ispell.C Index: src/ispell.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/ispell.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ispell.C,v
retrieving revision 1.25 retrieving revision 1.25
diff -u -r1.25 ispell.C diff -u -a -u -r1.25 ispell.C
--- src/ispell.C 2005/01/20 16:17:36 1.25 --- src/ispell.C 20 Jan 2005 16:17:36 -0000 1.25
+++ src/ispell.C 2005/02/17 18:19:18 +++ src/ispell.C 18 Apr 2005 17:37:02 -0000
@@ -24,11 +24,17 @@ @@ -24,11 +24,17 @@
#include "support/forkedcall.h" #include "support/forkedcall.h"
@ -70,11 +70,11 @@ diff -u -r1.25 ispell.C
// HP-UX 11.x doesn't have this header // HP-UX 11.x doesn't have this header
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
+#endif
+#ifndef _WIN32
+# include <sys/time.h>
#endif #endif
-#include <sys/time.h> -#include <sys/time.h>
+#ifndef _WIN32
+# include <sys/time.h>
+#endif
using boost::shared_ptr; using boost::shared_ptr;
@ -160,11 +160,11 @@ diff -u -r1.25 ispell.C
Index: src/lyx_cb.C Index: src/lyx_cb.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyx_cb.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
retrieving revision 1.247 retrieving revision 1.247
diff -u -r1.247 lyx_cb.C diff -u -a -u -r1.247 lyx_cb.C
--- src/lyx_cb.C 2005/01/31 10:42:18 1.247 --- src/lyx_cb.C 31 Jan 2005 10:42:18 -0000 1.247
+++ src/lyx_cb.C 2005/02/17 18:19:19 +++ src/lyx_cb.C 18 Apr 2005 17:37:02 -0000
@@ -44,6 +44,10 @@ @@ -44,6 +44,10 @@
#include "support/path.h" #include "support/path.h"
#include "support/systemcall.h" #include "support/systemcall.h"
@ -178,11 +178,11 @@ diff -u -r1.247 lyx_cb.C
Index: src/lyxserver.C Index: src/lyxserver.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxserver.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v
retrieving revision 1.60 retrieving revision 1.60
diff -u -r1.60 lyxserver.C diff -u -a -u -r1.60 lyxserver.C
--- src/lyxserver.C 2005/02/15 11:04:40 1.60 --- src/lyxserver.C 15 Feb 2005 11:04:40 -0000 1.60
+++ src/lyxserver.C 2005/02/17 18:19:19 +++ src/lyxserver.C 18 Apr 2005 17:37:02 -0000
@@ -54,6 +54,10 @@ @@ -54,6 +54,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -251,11 +251,11 @@ diff -u -r1.60 lyxserver.C
int errnum; int errnum;
Index: src/lyxsocket.C Index: src/lyxsocket.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxsocket.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxsocket.C,v
retrieving revision 1.7 retrieving revision 1.7
diff -u -r1.7 lyxsocket.C diff -u -a -u -r1.7 lyxsocket.C
--- src/lyxsocket.C 2005/02/15 13:45:40 1.7 --- src/lyxsocket.C 15 Feb 2005 13:45:40 -0000 1.7
+++ src/lyxsocket.C 2005/02/17 18:19:20 +++ src/lyxsocket.C 18 Apr 2005 17:37:02 -0000
@@ -69,7 +69,9 @@ @@ -69,7 +69,9 @@
LyXServerSocket::~LyXServerSocket() LyXServerSocket::~LyXServerSocket()
{ {
@ -317,11 +317,11 @@ diff -u -r1.7 lyxsocket.C
// The program will also receive a SIGPIPE // The program will also receive a SIGPIPE
Index: src/client/client.C Index: src/client/client.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/client/client.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/client.C,v
retrieving revision 1.7 retrieving revision 1.7
diff -u -r1.7 client.C diff -u -a -u -r1.7 client.C
--- src/client/client.C 2005/01/20 15:38:13 1.7 --- src/client/client.C 20 Jan 2005 15:38:13 -0000 1.7
+++ src/client/client.C 2005/02/17 18:19:20 +++ src/client/client.C 18 Apr 2005 17:37:02 -0000
@@ -25,12 +25,14 @@ @@ -25,12 +25,14 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -342,11 +342,11 @@ diff -u -r1.7 client.C
#include <fcntl.h> #include <fcntl.h>
Index: src/frontends/LyXView.C Index: src/frontends/LyXView.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/LyXView.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXView.C,v
retrieving revision 1.50 retrieving revision 1.51
diff -u -r1.50 LyXView.C diff -u -a -u -r1.51 LyXView.C
--- src/frontends/LyXView.C 2005/02/08 13:18:02 1.50 --- src/frontends/LyXView.C 13 Apr 2005 09:43:57 -0000 1.51
+++ src/frontends/LyXView.C 2005/02/17 18:19:20 +++ src/frontends/LyXView.C 18 Apr 2005 17:37:02 -0000
@@ -39,7 +39,9 @@ @@ -39,7 +39,9 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
@ -360,11 +360,11 @@ diff -u -r1.50 LyXView.C
#endif #endif
Index: src/frontends/qt2/QLyXKeySym.C Index: src/frontends/qt2/QLyXKeySym.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLyXKeySym.C,v
retrieving revision 1.32 retrieving revision 1.32
diff -u -r1.32 QLyXKeySym.C diff -u -a -u -r1.32 QLyXKeySym.C
--- src/frontends/qt2/QLyXKeySym.C 2004/07/07 09:32:19 1.32 --- src/frontends/qt2/QLyXKeySym.C 7 Jul 2004 09:32:19 -0000 1.32
+++ src/frontends/qt2/QLyXKeySym.C 2005/02/17 18:19:21 +++ src/frontends/qt2/QLyXKeySym.C 18 Apr 2005 17:37:02 -0000
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
void initEncodings() void initEncodings()
{ {
@ -376,12 +376,12 @@ diff -u -r1.32 QLyXKeySym.C
encoding_map["iso8859-2"] = QTextCodec::codecForName("ISO 8859-2"); encoding_map["iso8859-2"] = QTextCodec::codecForName("ISO 8859-2");
Index: src/support/filetools.C Index: src/support/filetools.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/filetools.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.206 retrieving revision 1.207
diff -u -r1.206 filetools.C diff -u -a -u -r1.207 filetools.C
--- src/support/filetools.C 2005/02/15 13:45:40 1.206 --- src/support/filetools.C 18 Apr 2005 17:43:11 -0000 1.207
+++ src/support/filetools.C 2005/02/17 18:19:24 +++ src/support/filetools.C 19 Apr 2005 10:11:54 -0000
@@ -1042,6 +1042,11 @@ @@ -1052,6 +1051,11 @@
cmd_ret const RunCommand(string const & cmd) cmd_ret const RunCommand(string const & cmd)
{ {
@ -393,7 +393,7 @@ diff -u -r1.206 filetools.C
// FIXME: replace all calls to RunCommand with ForkedCall // FIXME: replace all calls to RunCommand with ForkedCall
// (if the output is not needed) or the code in ispell.C // (if the output is not needed) or the code in ispell.C
// (if the output is needed). // (if the output is needed).
@@ -1082,6 +1087,7 @@ @@ -1092,6 +1096,7 @@
sigprocmask(SIG_SETMASK, &oldMask, 0); sigprocmask(SIG_SETMASK, &oldMask, 0);
return make_pair(pret, ret); return make_pair(pret, ret);
@ -401,278 +401,28 @@ diff -u -r1.206 filetools.C
} }
Index: src/support/forkedcall.C Index: src/support/globbing.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/forkedcall.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/globbing.C,v
retrieving revision 1.23 retrieving revision 1.11
diff -u -r1.23 forkedcall.C diff -u -a -u -r1.11 globbing.C
--- src/support/forkedcall.C 2005/02/03 14:55:33 1.23 --- src/support/globbing.C 26 Nov 2004 14:37:40 -0000 1.11
+++ src/support/forkedcall.C 2005/02/17 18:19:24 +++ src/support/globbing.C 19 Apr 2005 08:09:32 -0000
@@ -30,6 +30,10 @@ @@ -10,6 +10,8 @@
#include "support/lyxlib.h"
#include "support/filetools.h"
#include "support/os.h"
+#ifdef _WIN32
+#include "os_win32.h"
+#include <process.h>
+#endif
#include "debug.h" #include <config.h>
@@ -41,7 +45,9 @@ +#if !defined (_WIN32)
#include <csignal>
#include <cstdlib>
#include <sys/types.h>
-#include <sys/wait.h>
+#ifndef _WIN32
+# include <sys/wait.h>
+#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -70,7 +76,9 @@
if (secs > 0) {
new Murder(secs, pid);
} else if (pid != 0) {
+#ifdef SIGKILL
lyx::support::kill(pid, SIGKILL);
+#endif
}
}
@@ -78,7 +86,9 @@
void kill()
{
if (pid_ != 0) {
+#ifdef SIGKILL
lyx::support::kill(pid_, SIGKILL);
+#endif
}
lyxerr << "Killed " << pid_ << std::endl;
delete this;
@@ -152,6 +162,7 @@
if (!pid())
return false;
+#ifndef _WIN32
// Un-UNIX like, but we don't have much use for
// knowing if a zombie exists, so just reap it first.
int waitstatus;
@@ -160,6 +171,7 @@
// Racy of course, but it will do.
if (lyx::support::kill(pid(), 0) && errno == ESRCH)
return false;
+#endif
return true;
}
@@ -178,6 +190,7 @@
Murder::killItDead(0, pid());
} else {
+#ifdef SIGHUP
int ret = lyx::support::kill(pid(), SIGHUP);
// The process is already dead if wait_for_death is false
@@ -186,6 +199,7 @@
if (wait_for_death) {
Murder::killItDead(tolerance, pid());
}
+#endif
}
}
@@ -195,6 +209,7 @@
{
// We'll pretend that the child returns 1 on all error conditions.
retval_ = 1;
+#ifndef _WIN32
int status;
bool wait = true;
while (wait) {
@@ -223,6 +238,7 @@
wait = false;
}
}
+#endif
return retval_;
}
@@ -311,7 +327,12 @@
lyxerr << '\t'<< *ait << '\n';
lyxerr << "</command>" << std::endl;
-#ifndef __EMX__
+#ifdef __EMX
+ pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
+ argv[0], &*argv.begin());
+#elif defined(_WIN32)
+ pid_t const cpid = spawnvp(_P_NOWAIT, argv[0], &*argv.begin());
+#else
pid_t const cpid = ::fork();
if (cpid == 0) {
// Child
@@ -322,9 +343,6 @@
<< strerror(errno) << endl;
_exit(1);
}
-#else
- pid_t const cpid = spawnvp(P_SESSION|P_DEFAULT|P_MINIMIZE|P_BACKGROUND,
- argv[0], &*argv.begin());
#endif
if (cpid < 0) {
Index: src/support/forkedcall.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/forkedcall.h,v
retrieving revision 1.19
diff -u -r1.19 forkedcall.h
--- src/support/forkedcall.h 2004/09/26 14:19:47 1.19
+++ src/support/forkedcall.h 2005/02/17 18:19:24
@@ -31,6 +31,10 @@
#include <sys/types.h>
+#ifdef _WIN32
+typedef int pid_t;
+#endif
+ +
namespace lyx { #include "support/globbing.h"
namespace support { #include "support/path.h"
Index: src/support/forkedcontr.C @@ -42,3 +44,5 @@
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/forkedcontr.C,v
retrieving revision 1.27
diff -u -r1.27 forkedcontr.C
--- src/support/forkedcontr.C 2005/01/20 15:38:14 1.27
+++ src/support/forkedcontr.C 2005/02/17 18:19:24
@@ -19,14 +19,22 @@
#include "debug.h"
+#ifdef _WIN32
+#include "os_win32.h"
+#include <windows.h>
+#endif
+
#include <boost/bind.hpp>
#include <cerrno>
#include <cstdlib>
+
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
-#include <sys/wait.h>
+#ifndef _WIN32
+# include <sys/wait.h>
+#endif
using boost::bind;
@@ -176,7 +184,9 @@
ForkedcallsController::Data & store =
fcc.reaped_children[++fcc.current_child];
// Clean up the child process.
+#ifndef _WIN32
store.pid = wait(&store.status);
+#endif
}
} // namespace anon
@@ -193,11 +203,12 @@
ForkedcallsController::ForkedcallsController()
: reaped_children(50), current_child(-1)
{
+#ifndef _WIN32
signal(SIGCHLD, child_handler);
-
sigemptyset(&oldMask);
sigemptyset(&newMask);
sigaddset(&newMask, SIGCHLD);
+#endif
}
@@ -206,7 +217,9 @@
// I want to print or something.
ForkedcallsController::~ForkedcallsController()
{
+#ifndef _WIN32
signal(SIGCHLD, SIG_DFL);
+#endif
}
@@ -215,6 +228,7 @@
forkedCalls.push_back(newcall.clone());
if (forkedCalls.size() > reaped_children.size()) {
+#ifndef _WIN32
// Block the SIGCHLD signal.
sigprocmask(SIG_BLOCK, &newMask, &oldMask);
@@ -222,6 +236,7 @@
// Unblock the SIGCHLD signal and restore the old mask.
sigprocmask(SIG_SETMASK, &oldMask, 0);
+#endif
}
}
@@ -255,8 +270,10 @@
if (current_child == -1)
return;
+#ifndef _WIN32
// Block the SIGCHLD signal.
sigprocmask(SIG_BLOCK, &newMask, &oldMask);
+#endif
for (int i = 0; i != 1 + current_child; ++i) {
Data & store = reaped_children[i];
@@ -312,8 +329,10 @@
// Reset the counter
current_child = -1;
+#ifndef _WIN32
// Unblock the SIGCHLD signal and restore the old mask.
sigprocmask(SIG_SETMASK, &oldMask, 0);
+#endif
}
} // namespace support } // namespace support
Index: src/support/forkedcontr.h } // namespace lyx
=================================================================== +
RCS file: /cvs/lyx/lyx-devel/src/support/forkedcontr.h,v
retrieving revision 1.18
diff -u -r1.18 forkedcontr.h
--- src/support/forkedcontr.h 2004/11/07 13:22:51 1.18
+++ src/support/forkedcontr.h 2005/02/17 18:19:24
@@ -19,7 +19,10 @@
#include <boost/shared_ptr.hpp>
#include <csignal>
-//#include <sys/types.h> // needed for pid_t
+#ifdef _WIN32
+typedef int pid_t;
+#endif +#endif
+#include <sys/types.h> // needed for pid_t
#include <list>
#include <vector>
@@ -79,8 +82,10 @@
/// The child processes
ListType forkedCalls;
+#ifndef _WIN32
/// Used to block SIGCHLD signals.
sigset_t newMask, oldMask;
+#endif
};
} // namespace support
Index: src/support/os_win32.C Index: src/support/os_win32.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/os_win32.C,v RCS file: /cvs/lyx/lyx-devel/src/support/os_win32.C,v
@ -715,11 +465,11 @@ diff -u -r1.27 os_win32.C
Index: src/support/socktools.C Index: src/support/socktools.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/socktools.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/socktools.C,v
retrieving revision 1.6 retrieving revision 1.6
diff -u -r1.6 socktools.C diff -u -a -u -r1.6 socktools.C
--- src/support/socktools.C 2005/01/20 15:38:14 1.6 --- src/support/socktools.C 20 Jan 2005 15:38:14 -0000 1.6
+++ src/support/socktools.C 2005/02/17 18:19:25 +++ src/support/socktools.C 19 Apr 2005 08:09:40 -0000
@@ -15,8 +15,10 @@ @@ -15,8 +15,10 @@
#include "debug.h" #include "debug.h"
@ -770,11 +520,11 @@ diff -u -r1.6 socktools.C
} // namespace socktools } // namespace socktools
Index: src/support/tempname.C Index: src/support/tempname.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/tempname.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/tempname.C,v
retrieving revision 1.25 retrieving revision 1.25
diff -u -r1.25 tempname.C diff -u -a -u -r1.25 tempname.C
--- src/support/tempname.C 2005/01/20 15:38:14 1.25 --- src/support/tempname.C 20 Jan 2005 15:38:14 -0000 1.25
+++ src/support/tempname.C 2005/02/17 18:19:25 +++ src/support/tempname.C 19 Apr 2005 08:09:40 -0000
@@ -30,6 +30,10 @@ @@ -30,6 +30,10 @@
# include <sys/stat.h> # include <sys/stat.h>
#endif #endif
@ -820,11 +570,11 @@ diff -u -r1.25 tempname.C
return t; return t;
Index: src/support/userinfo.C Index: src/support/userinfo.C
=================================================================== ===================================================================
RCS file: /cvs/lyx/lyx-devel/src/support/userinfo.C,v RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/userinfo.C,v
retrieving revision 1.10 retrieving revision 1.10
diff -u -r1.10 userinfo.C diff -u -a -u -r1.10 userinfo.C
--- src/support/userinfo.C 2005/02/15 13:45:41 1.10 --- src/support/userinfo.C 15 Feb 2005 13:45:41 -0000 1.10
+++ src/support/userinfo.C 2005/02/17 18:19:25 +++ src/support/userinfo.C 19 Apr 2005 08:09:40 -0000
@@ -15,7 +15,9 @@ @@ -15,7 +15,9 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>