version 1.25.2.7, 2006/10/06 17:40:04
|
version 1.31.2.1, 2006/07/27 23:12:06
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
#include <Pegasus/Common/Signal.h> |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/AutoPtr.h> | #include <Pegasus/Common/AutoPtr.h> |
|
|
the connection is closed. | the connection is closed. |
*/ | */ |
void _processResponses(); | void _processResponses(); |
static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
static ThreadReturnType PEGASUS_THREAD_CDECL |
_responseProcessor(void* arg); | _responseProcessor(void* arg); |
| |
// | // |
|
|
// Wait for the responseProcessor thread to exit | // Wait for the responseProcessor thread to exit |
while (isInitialized()) | while (isInitialized()) |
{ | { |
pegasus_yield(); |
Threads::yield(); |
} | } |
} | } |
} | } |
|
|
{ | { |
if (rtn == PEGASUS_THREAD_INSUFFICIENT_RESOURCES) | if (rtn == PEGASUS_THREAD_INSUFFICIENT_RESOURCES) |
{ | { |
pegasus_yield(); |
Threads::yield(); |
} | } |
else | else |
{ | { |
|
|
if (_isInitialized) | if (_isInitialized) |
{ | { |
// Harvest the status of the agent process to prevent a zombie | // Harvest the status of the agent process to prevent a zombie |
pid_t status = 0; |
Boolean keepWaiting = false; |
do | do |
{ | { |
status = waitpid(_pid, 0, 0); |
pid_t status = waitpid(_pid, 0, 0); |
} while ((status == -1) && (errno == EINTR)); |
|
|
|
if (status == -1) | if (status == -1) |
{ | { |
|
if (errno == EINTR) |
|
{ |
|
keepWaiting = true; |
|
} |
|
else |
|
{ |
Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, | Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"ProviderAgentContainer::_initialize(): " | "ProviderAgentContainer::_initialize(): " |
"waitpid failed; errno = %d.", errno); | "waitpid failed; errno = %d.", errno); |
} | } |
} | } |
|
} while (keepWaiting); |
|
} |
#endif | #endif |
| |
_isInitialized = false; | _isInitialized = false; |
|
|
| |
#if defined(PEGASUS_HAS_SIGNALS) | #if defined(PEGASUS_HAS_SIGNALS) |
// Harvest the status of the agent process to prevent a zombie | // Harvest the status of the agent process to prevent a zombie |
pid_t status = 0; |
Boolean keepWaiting = false; |
do | do |
{ | { |
status = waitpid(_pid, 0, 0); |
pid_t status = waitpid(_pid, 0, 0); |
} while ((status == -1) && (errno == EINTR)); |
|
|
|
if (status == -1) | if (status == -1) |
{ | { |
|
if (errno == EINTR) |
|
{ |
|
keepWaiting = true; |
|
} |
|
else |
|
{ |
Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, | Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"ProviderAgentContainer::_uninitialize(): " | "ProviderAgentContainer::_uninitialize(): " |
"waitpid failed; errno = %d.", errno); | "waitpid failed; errno = %d.", errno); |
} | } |
|
} |
|
} while (keepWaiting); |
#endif | #endif |
| |
_isInitialized = false; | _isInitialized = false; |
|
|
} | } |
} while (response == _REQUEST_NOT_PROCESSED); | } while (response == _REQUEST_NOT_PROCESSED); |
| |
if (request->getType() == CIM_SUBSCRIPTION_INIT_COMPLETE_REQUEST_MESSAGE) |
|
{ |
|
_subscriptionInitComplete = true; |
|
} |
|
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return response; | return response; |
} | } |
|
|
// Get the provider module from the ProviderIdContainer to see if | // Get the provider module from the ProviderIdContainer to see if |
// we can optimize out the transmission of this instance to the | // we can optimize out the transmission of this instance to the |
// Provider Agent. (See the _providerModuleCache description.) | // Provider Agent. (See the _providerModuleCache description.) |
try |
if(request->operationContext.contains(ProviderIdContainer::NAME)) |
{ | { |
ProviderIdContainer pidc = request->operationContext.get( | ProviderIdContainer pidc = request->operationContext.get( |
ProviderIdContainer::NAME); | ProviderIdContainer::NAME); |
|
|
doProviderModuleOptimization = true; | doProviderModuleOptimization = true; |
} | } |
} | } |
catch (...) |
|
{ |
|
// No ProviderIdContainer to optimize |
|
} |
|
| |
// | // |
// Write the message to the pipe | // Write the message to the pipe |
|
|
| |
} | } |
| |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
ThreadReturnType PEGASUS_THREAD_CDECL |
ProviderAgentContainer::_responseProcessor(void* arg) | ProviderAgentContainer::_responseProcessor(void* arg) |
{ | { |
ProviderAgentContainer* pa = | ProviderAgentContainer* pa = |
|
|
| |
pa->_processResponses(); | pa->_processResponses(); |
| |
return(PEGASUS_THREAD_RETURN(0)); |
return(ThreadReturnType(0)); |
} | } |
| |
///////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////// |
|
|
| |
if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) | if (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR) |
{ | { |
try |
if(request->operationContext.contains(IdentityContainer::NAME)) |
{ | { |
// User Name is in the OperationContext | // User Name is in the OperationContext |
IdentityContainer ic = (IdentityContainer) | IdentityContainer ic = (IdentityContainer) |
request->operationContext.get(IdentityContainer::NAME); | request->operationContext.get(IdentityContainer::NAME); |
userName = ic.getUserName(); | userName = ic.getUserName(); |
} | } |
catch (Exception&) |
//else |
{ |
//{ |
// If no IdentityContainer is present, default to the CIM | // If no IdentityContainer is present, default to the CIM |
// Server's user context | // Server's user context |
} |
//} |
| |
// If authentication is disabled, use the CIM Server's user context | // If authentication is disabled, use the CIM Server's user context |
if (!userName.size()) | if (!userName.size()) |