version 1.11, 2006/08/09 21:13:11
|
version 1.11.18.3, 2007/12/10 21:21:02
|
|
|
#include <sys/stat.h> | #include <sys/stat.h> |
#if defined(PEGASUS_OS_HPUX) | #if defined(PEGASUS_OS_HPUX) |
#include <sys/pstat.h> | #include <sys/pstat.h> |
|
#include <libgen.h> |
#endif | #endif |
#include <fcntl.h> | #include <fcntl.h> |
#include <unistd.h> | #include <unistd.h> |
|
|
#endif | #endif |
#define MAX_WAIT_TIME 240 | #define MAX_WAIT_TIME 240 |
#if defined(PEGASUS_OS_AIX) | #if defined(PEGASUS_OS_AIX) |
extern "C" { |
|
#include <procinfo.h> | #include <procinfo.h> |
extern int getprocs(struct procsinfo *, int, struct fdsinfo *, int,pid_t *,int); |
|
#define PROCSIZE sizeof(struct procsinfo) | #define PROCSIZE sizeof(struct procsinfo) |
|
#if PEGASUS_AIX_VERSION <= 5 |
|
// AIX version 5 does not define getprocs() in procinfo.h |
|
extern "C" { |
|
extern int getprocs(struct procsinfo *, int, struct fdsinfo *, int,pid_t *,int); |
} | } |
#endif | #endif |
|
#endif |
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
} | } |
if( !handleSigUsr1 ) | if( !handleSigUsr1 ) |
{ | { |
|
//NOCHKSRC |
MessageLoaderParms parms("src.Service.ServerProcessUnix.CIMSERVER_START_TIMEOUT", | MessageLoaderParms parms("src.Service.ServerProcessUnix.CIMSERVER_START_TIMEOUT", |
"The cimserver command timed out waiting for the CIM server to start."); | "The cimserver command timed out waiting for the CIM server to start."); |
PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); | PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
|
//DOCHKSRC |
} | } |
exit(graveError); | exit(graveError); |
} | } |
|
|
buf.ps_pathptr =(char *) malloc(buf.ps_pathlen =PS_PATHBLEN); | buf.ps_pathptr =(char *) malloc(buf.ps_pathlen =PS_PATHBLEN); |
buf.ps_cmdptr =(char *) malloc(buf.ps_cmdlen =PS_CMDBLEN); | buf.ps_cmdptr =(char *) malloc(buf.ps_cmdlen =PS_CMDBLEN); |
| |
token = w_getpsent(token, &buf, sizeof(buf)); |
while((token = w_getpsent(token, &buf, sizeof(buf))) > 0) |
do { |
{ |
token = w_getpsent(token, &buf, sizeof(buf)); |
if (buf.ps_pid==pid) |
if (buf.ps_pid==pid) { |
{ |
|
// If the process id is associated with the program |
|
// "cimserver", then a cimserver is still running. |
|
if (strstr(buf.ps_pathptr,"cimserver")!= NULL ) |
|
{ |
free(buf.ps_conttyptr); | free(buf.ps_conttyptr); |
free(buf.ps_pathptr); | free(buf.ps_pathptr); |
free(buf.ps_cmdptr); | free(buf.ps_cmdptr); |
return true; | return true; |
} | } |
} while(token>0); |
// pid found was not associated with a cimserver |
|
break; |
|
} |
|
} |
| |
free(buf.ps_conttyptr); | free(buf.ps_conttyptr); |
free(buf.ps_pathptr); | free(buf.ps_pathptr); |
|
|
int ret_code; | int ret_code; |
ret_code = pstat_getproc(&pstru, sizeof(struct pst_status), (size_t)0, pid); | ret_code = pstat_getproc(&pstru, sizeof(struct pst_status), (size_t)0, pid); |
| |
if ( (ret_code != -1 ) && (strcmp(pstru.pst_ucomm, getProcessName())) == 0) |
if (ret_code != -1) |
|
{ |
|
// |
|
// Gets the command basename disregarding the command parameters |
|
// |
|
char *execName = strchr(pstru.pst_cmd,' '); |
|
if (execName) |
|
{ |
|
*execName = '\0'; |
|
} |
|
execName = basename(pstru.pst_cmd); |
|
|
|
if (strcmp(execName, getProcessName()) == 0) |
{ | { |
// | // |
// Check to see if this command process has the same pid as the | // Check to see if this command process has the same pid as the |
|
|
return true; | return true; |
} | } |
} | } |
|
} |
#endif | #endif |
#if defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_OS_SOLARIS) | #if defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || defined(PEGASUS_OS_SOLARIS) |
if (get_proc(pid) != -1 ) | if (get_proc(pid) != -1 ) |