version 1.18, 2003/05/07 18:48:16
|
version 1.19, 2003/05/21 11:32:22
|
|
|
// | // |
// Modified By: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) | // Modified By: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) |
// Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) | // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
// |
// Marek Szermutzky, IBM (ddt6szer@de.ibm.com) |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <sys/types.h> | #include <sys/types.h> |
|
|
#include <fcntl.h> | #include <fcntl.h> |
#include <unistd.h> | #include <unistd.h> |
#include <Pegasus/Common/Signal.h> | #include <Pegasus/Common/Signal.h> |
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
|
#include <sys/ps.h> |
|
#endif |
#define MAX_WAIT_TIME 25 | #define MAX_WAIT_TIME 25 |
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
|
|
} | } |
#endif | #endif |
| |
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
|
Boolean isProcRunning(pid_t pid) |
|
{ |
|
W_PSPROC buf; |
|
int token = 0; |
|
memset(&buf, 0x00, sizeof(buf)); |
|
buf.ps_conttyptr =(char *) malloc(buf.ps_conttylen =PS_CONTTYBLEN); |
|
buf.ps_pathptr =(char *) malloc(buf.ps_pathlen =PS_PATHBLEN); |
|
buf.ps_cmdptr =(char *) malloc(buf.ps_cmdlen =PS_CMDBLEN); |
|
|
|
token = w_getpsent(token, &buf, sizeof(buf)); |
|
do { |
|
token = w_getpsent(token, &buf, sizeof(buf)); |
|
if (buf.ps_pid==pid) { |
|
free(buf.ps_conttyptr); |
|
free(buf.ps_pathptr); |
|
free(buf.ps_cmdptr); |
|
return true; |
|
} |
|
} while(token>0); |
|
|
|
free(buf.ps_conttyptr); |
|
free(buf.ps_pathptr); |
|
free(buf.ps_cmdptr); |
|
return false; |
|
} |
|
#endif |
| |
Boolean isCIMServerRunning(void) | Boolean isCIMServerRunning(void) |
{ | { |
|
|
pid_t pid = 0; | pid_t pid = 0; |
| |
// open the file containing the CIMServer process ID | // open the file containing the CIMServer process ID |
pid_file = fopen(CIMSERVER_START_FILE, "rw"); |
pid_file = fopen(CIMSERVER_START_FILE, "r"); |
if (!pid_file) | if (!pid_file) |
{ | { |
return false; | return false; |
|
|
return true; | return true; |
} | } |
#endif | #endif |
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
|
return isProcRunning(pid); |
|
#endif |
return false; | return false; |
} | } |
| |
|
|
kill(pid, SIGKILL); | kill(pid, SIGKILL); |
} | } |
#endif | #endif |
|
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
|
if (isProcRunning(pid)) { |
|
kill(pid, SIGKILL); |
|
} |
|
#endif |
// remove the file | // remove the file |
System::removeFile(CIMSERVER_START_FILE); | System::removeFile(CIMSERVER_START_FILE); |
| |