/*************************************************************************** rlspawn.h - description ------------------- begin : Wed Dec 11 2002 copyright : (C) 2002 by R. Lehrig email : lehrig@t-online.de ***************************************************************************/ /*************************************************************************** * * * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * * published by the Free Software Foundation * * * ***************************************************************************/ #ifndef _RL_PCONTROL_H_ #define _RL_PCONTROL_H_ #include "rltime.h" /*!
A class for starting/stoping/monitoring other processes.*/ class rlPcontrol { public: /*!
construct a process control object
*/
rlPcontrol();
/*!
deconstruct the process control object
*/
virtual ~rlPcontrol();
/*!
set the startup command and the process_name
*/
void setStartupCommand(const char *command, const char *process_name);
/*!
start the process
*/
int start();
/*!
stop the process with SIGTERM
*/
int sigterm();
/*!
stop the process with SIGKILL
*/
int sigkill();
/*!
test if process is alive
*/
int isAlive();
/*!
get startup command
*/
const char *startupCommand();
/*!
get process name
*/
const char *processName();
/*!
get process time start/stop
*/
rlTime *processTime();
/*!
set process id
*/
void setPID(long pid);
/*!
get process id
*/
long pid();
/*!
get next object in list
*/
rlPcontrol *getNext();
/*!
add and return a new rlPcontrol object
*/
rlPcontrol *addNew();
#ifdef __VMS
/*!
set input filename or logical
*/
void setInput (const char *input);
/*!
set output filename or logical
*/
void setOutput(const char *output);
/*!
set error filename or logical
*/
void setError (const char *error);
#endif
/*!
set priority default=8
*/
void setPriority(int priority);
/*!
get priority
*/
int priority();
private:
int rlstrlen(const char *str);
char *startup_command, *process_name;
#ifdef __VMS
char *m_input, *m_output, *m_error;
#endif
#ifdef RLWIN32
long m_dwProcessId;
#endif
long m_pid;
rlTime process_time;
rlPcontrol *next;
int prio;
};
#endif