lyx-devel.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1650 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-03-01 14:26:01 +00:00
parent aae45c2088
commit af1c3bc1b0
4 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2001-02-28 Baruch Even <baruch@ev-en.org>
* filetools.C: Removed dependency on syscall.h
* syscall.h:
* syscall.C: Minor cleanings before I start to touch this code.
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com> 2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* filetools.C (CreateTmpDir): change umask to 0700. * filetools.C (CreateTmpDir): change umask to 0700.

View File

@ -32,7 +32,6 @@
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "FileInfo.h" #include "FileInfo.h"
#include "support/path.h" // I know it's OS/2 specific (SMiyata) #include "support/path.h" // I know it's OS/2 specific (SMiyata)
#include "support/syscall.h"
#include "gettext.h" #include "gettext.h"
#include "lyxlib.h" #include "lyxlib.h"

View File

@ -25,12 +25,7 @@ Systemcalls::Systemcalls() {
Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback) Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback)
{ {
start = how; startscript(how, what, cback);
command = what;
cbk = cback;
pid = static_cast<pid_t>(0);
retval = 0;
startscript();
} }
Systemcalls::~Systemcalls() { Systemcalls::~Systemcalls() {
@ -95,7 +90,7 @@ void Systemcalls::kill(int /*tolerance*/) {
if (wait_for_death) { if (wait_for_death) {
// Here, we should add the PID to a list of // Here, we should add the PID to a list of
// waiting processes to kill if they are not // waiting processes to kill if they are not
// dead without tolerance seconds // dead within tolerance seconds
// CHECK Implement this using the timer of // CHECK Implement this using the timer of
// the singleton systemcontroller (Asger) // the singleton systemcontroller (Asger)
@ -144,14 +139,16 @@ pid_t Systemcalls::fork()
{ {
pid_t cpid= ::fork(); pid_t cpid= ::fork();
if (cpid == 0) { // child if (cpid == 0) { // child
// TODO: Consider doing all of this before the fork, otherwise me
// might have troubles with multi-threaded access. (Baruch 20010228)
string childcommand(command); // copy string childcommand(command); // copy
string rest = split(command, childcommand, ' '); string rest = split(command, childcommand, ' ');
const int MAX_ARGV = 255; const int MAX_ARGV = 255;
char *syscmd = 0; char *syscmd = 0;
char *argv[MAX_ARGV]; char *argv[MAX_ARGV];
int index = 0; int index = 0;
bool more; bool more = true;
do { while (more) {
childcommand = frontStrip(childcommand); childcommand = frontStrip(childcommand);
if (syscmd == 0) { if (syscmd == 0) {
syscmd = new char[childcommand.length() + 1]; syscmd = new char[childcommand.length() + 1];
@ -169,7 +166,7 @@ pid_t Systemcalls::fork()
more = !rest.empty(); more = !rest.empty();
if (more) if (more)
rest = split(rest, childcommand, ' '); rest = split(rest, childcommand, ' ');
} while (more); }
argv[index] = 0; argv[index] = 0;
// replace by command. Expand using PATH-environment-var. // replace by command. Expand using PATH-environment-var.
execvp(syscmd, argv); execvp(syscmd, argv);
@ -187,7 +184,7 @@ pid_t Systemcalls::fork()
// Reuse of instance // Reuse of instance
int Systemcalls::startscript(Starttype how, string const & what, int Systemcalls::startscript(Starttype how, string const & what,
Callbackfct cback) Callbackfct cback)
{ {
start = how; start = how;
command = what; command = what;

View File

@ -86,6 +86,7 @@ public:
When the child is dead, the callback is called. When the child is dead, the callback is called.
*/ */
void kill(int tolerance = 5); void kill(int tolerance = 5);
private: private:
/// Type of execution: system, wait for child or background /// Type of execution: system, wait for child or background
Starttype start; Starttype start;