version 1.12.2.2, 2007/04/20 14:39:17
|
version 1.13, 2007/04/13 17:41:30
|
|
|
| |
int ServerProcess::cimserver_fork(void) | int ServerProcess::cimserver_fork(void) |
{ | { |
#if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) |
|
|
|
getSigHandle()->registerHandler(SIGTERM, sigTermHandler); |
|
getSigHandle()->activate(SIGTERM); |
|
server_pid = getpid(); |
|
umask(S_IRWXG | S_IRWXO); |
|
|
|
return 0; |
|
|
|
#else /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ |
|
|
|
getSigHandle()->registerHandler(PEGASUS_SIGUSR1, sigUsr1Handler); | getSigHandle()->registerHandler(PEGASUS_SIGUSR1, sigUsr1Handler); |
getSigHandle()->activate(PEGASUS_SIGUSR1); | getSigHandle()->activate(PEGASUS_SIGUSR1); |
getSigHandle()->registerHandler(SIGTERM, sigTermHandler); | getSigHandle()->registerHandler(SIGTERM, sigTermHandler); |
|
|
// get the pid of the cimserver process | // get the pid of the cimserver process |
server_pid = getpid(); | server_pid = getpid(); |
return(0); | return(0); |
|
|
#endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ |
|
} | } |
| |
long ServerProcess::get_server_pid() | long ServerProcess::get_server_pid() |
|
|
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); |