version 1.11.16.6, 2006/12/29 17:47:32
|
version 1.11.16.7, 2006/12/29 22:22:04
|
|
|
#define PROCSIZE sizeof(struct procsinfo) | #define PROCSIZE sizeof(struct procsinfo) |
} | } |
#endif | #endif |
#include <Pegasus/ExecutorClient/ExecutorClient.h> |
|
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
{ | { |
#if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) | #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) |
| |
// Register to handle SIGUSR1: |
|
getSigHandle()->registerHandler(PEGASUS_SIGUSR1, sigUsr1Handler); |
|
getSigHandle()->activate(PEGASUS_SIGUSR1); |
|
|
|
// Register to handle SIGTERM: |
|
getSigHandle()->registerHandler(SIGTERM, sigTermHandler); | getSigHandle()->registerHandler(SIGTERM, sigTermHandler); |
getSigHandle()->activate(SIGTERM); | getSigHandle()->activate(SIGTERM); |
|
|
// Set umask to use when creating files. |
|
umask(S_IRWXG | S_IRWXO); |
|
|
|
// Save process id. |
|
server_pid = getpid(); | server_pid = getpid(); |
| |
// Ask the executor process to daemonize. |
|
ExecutorClient::daemonizeExecutor(); |
|
|
|
return 0; | return 0; |
| |
#else /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ | #else /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ |
|
|
getSigHandle()->activate(SIGTERM); | getSigHandle()->activate(SIGTERM); |
| |
pid_t pid; | pid_t pid; |
|
|
if ((pid = fork()) < 0) | if ((pid = fork()) < 0) |
{ | { |
getSigHandle()->deactivate(PEGASUS_SIGUSR1); | getSigHandle()->deactivate(PEGASUS_SIGUSR1); |
|
|
} | } |
if (!handleSigUsr1) | if (!handleSigUsr1) |
{ | { |
MessageLoaderParms parms( |
MessageLoaderParms parms("src.Service.ServerProcessUnix.CIMSERVER_START_TIMEOUT", |
"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 " |
PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl); |
"CIM server to start."); |
|
PEGASUS_STD(cerr) << MessageLoader:: |
|
getMessage(parms) << PEGASUS_STD(endl); |
|
} | } |
exit(graveError); | exit(graveError); |
} | } |
| |
setsid(); | setsid(); |
|
|
umask(S_IRWXG | S_IRWXO); | umask(S_IRWXG | S_IRWXO); |
| |
// spawned daemon process doesn't need the old signal handlers of its |
// spawned daemon process doesn't need the old signal handlers of its parent |
// parent |
|
getSigHandle()->deactivate(PEGASUS_SIGUSR1); | getSigHandle()->deactivate(PEGASUS_SIGUSR1); |
getSigHandle()->deactivate(SIGTERM); | getSigHandle()->deactivate(SIGTERM); |
| |
// 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) */ | #endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ |
|
|
if (aixcimsrvrunning(pid, getProcessName())!=-1) | if (aixcimsrvrunning(pid, getProcessName())!=-1) |
return true; | return true; |
#endif | #endif |
|
|
return false; | return false; |
} | } |
| |