version 1.92, 2004/10/17 20:39:17
|
version 1.120.4.2, 2006/07/29 15:20:14
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; | // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// Sushma Fernandes (sushma_fernandes@hp.com) | // Sushma Fernandes (sushma_fernandes@hp.com) |
// Nag Boranna (nagaraja_boranna@hp.com) | // Nag Boranna (nagaraja_boranna@hp.com) |
// Bapu Patil (bapu_patil@hp.com) | // Bapu Patil (bapu_patil@hp.com) |
// |
// Dave Rosckes (rosckes@us.ibm.com) |
// Modified By: Dave Rosckes (rosckes@us.ibm.com) |
|
// Amit K Arora (amita@in.ibm.com) for PEP101 | // Amit K Arora (amita@in.ibm.com) for PEP101 |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// Yi Zhou (yi.zhou@hp.com) |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3194 |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifdef PEGASUS_OS_HPUX | #ifdef PEGASUS_OS_HPUX |
# include <dl.h> | # include <dl.h> |
|
|
|
#if defined(PEGASUS_HPUX_USE_DLOPEN) |
|
# include <dlfcn.h> |
|
#endif |
|
|
#elif defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) | #elif defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
# include <dll.h> | # include <dll.h> |
#elif defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) | #elif defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) |
|
|
#include <crypt.h> | #include <crypt.h> |
#endif | #endif |
| |
|
#include "Network.h" |
|
|
#ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM | #ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM |
#include <arpa/inet.h> |
# define _OPEN_SYS_EXT |
#include <__ftp.h> |
# include <sys/ps.h> |
#endif | #endif |
| |
#if defined(PEGASUS_USE_SYSLOGS) | #if defined(PEGASUS_USE_SYSLOGS) |
|
|
#include <cstdio> | #include <cstdio> |
#include <time.h> | #include <time.h> |
#include <sys/time.h> | #include <sys/time.h> |
#include <netdb.h> |
|
#include "System.h" | #include "System.h" |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#ifdef PEGASUS_ZOS_SECURITY | #ifdef PEGASUS_ZOS_SECURITY |
#include "DynamicLibraryzOS_inline.h" | #include "DynamicLibraryzOS_inline.h" |
#endif | #endif |
|
#include <Pegasus/Common/Mutex.h> |
| |
#if defined(PEGASUS_OS_LSB) | #if defined(PEGASUS_OS_LSB) |
#include <netinet/in.h> |
|
#include <termios.h> | #include <termios.h> |
#include <stdio.h> | #include <stdio.h> |
#include <stdlib.h> | #include <stdlib.h> |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
#ifdef PEGASUS_OS_OS400 | #ifdef PEGASUS_OS_OS400 |
typedef struct os400_pnstruct |
|
|
struct QlgPath |
{ | { |
|
QlgPath(const char* path); |
|
operator Qlg_Path_Name_T*() { return &qlg_struct; } |
Qlg_Path_Name_T qlg_struct; | Qlg_Path_Name_T qlg_struct; |
char * pn; |
const char* pn; |
} OS400_PNSTRUCT; |
}; |
#endif |
|
|
QlgPath::QlgPath(const char* path) : pn(path) |
|
{ |
|
memset((void*)&qlg_struct, 0, sizeof(Qlg_Path_Name_T)); |
|
qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(qlg_struct.Country_ID,"US",2); |
|
memcpy(qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
qlg_struct.Path_Length = strlen(path); |
|
qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
} |
|
|
|
#endif /* PEGASUS_OS_OS400 */ |
| |
inline void sleep_wrapper(Uint32 seconds) | inline void sleep_wrapper(Uint32 seconds) |
{ | { |
|
|
milliseconds = Uint32(tv.tv_usec) / 1000; | milliseconds = Uint32(tv.tv_usec) / 1000; |
} | } |
| |
|
void System::getCurrentTimeUsec(Uint32& seconds, Uint32& microseconds) |
|
{ |
|
timeval tv; |
|
gettimeofday(&tv, 0); |
|
seconds = Uint32(tv.tv_sec); |
|
microseconds = Uint32(tv.tv_usec); |
|
} |
|
|
String System::getCurrentASCIITime() | String System::getCurrentASCIITime() |
{ | { |
char str[50]; | char str[50]; |
|
|
Boolean System::exists(const char* path) | Boolean System::exists(const char* path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgAccess(QlgPath(path), F_OK) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgAccess((Qlg_Path_Name_T *)&pathname, F_OK) == 0; |
|
#else | #else |
return access(path, F_OK) == 0; | return access(path, F_OK) == 0; |
#endif | #endif |
|
|
| |
Boolean System::canRead(const char* path) | Boolean System::canRead(const char* path) |
{ | { |
|
|
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgAccess(QlgPath(path), R_OK) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgAccess((Qlg_Path_Name_T *)&pathname, R_OK) == 0; |
|
#else | #else |
return access(path, R_OK) == 0; | return access(path, R_OK) == 0; |
#endif | #endif |
|
|
Boolean System::canWrite(const char* path) | Boolean System::canWrite(const char* path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgAccess(QlgPath(path), W_OK) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgAccess((Qlg_Path_Name_T *)&pathname, W_OK) == 0; |
|
#else | #else |
return access(path, W_OK) == 0; | return access(path, W_OK) == 0; |
#endif | #endif |
|
|
Boolean System::getCurrentDirectory(char* path, Uint32 size) | Boolean System::getCurrentDirectory(char* path, Uint32 size) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgGetcwd(QlgPath(path), size) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgGetcwd((Qlg_Path_Name_T *)&pathname, size) == 0; |
|
#else | #else |
return getcwd(path, size) != NULL; | return getcwd(path, size) != NULL; |
#endif | #endif |
|
|
struct stat st; | struct stat st; |
| |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
if (QlgStat(QlgPath(path), &st) != 0) |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
if (QlgStat((Qlg_Path_Name_T *)&pathname, &st) != 0) |
|
return false; | return false; |
#else | #else |
if (stat(path, &st) != 0) | if (stat(path, &st) != 0) |
|
|
Boolean System::changeDirectory(const char* path) | Boolean System::changeDirectory(const char* path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgChdir(QlgPath(path)) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgChdir((Qlg_Path_Name_T *)&pathname) == 0; |
|
#else | #else |
return chdir(path) == 0; | return chdir(path) == 0; |
#endif | #endif |
|
|
| |
Boolean System::makeDirectory(const char* path) | Boolean System::makeDirectory(const char* path) |
{ | { |
|
|
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgMkdir(QlgPath(path), 0777) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgMkdir((Qlg_Path_Name_T *)&pathname, 0777) == 0; |
|
#else | #else |
return mkdir(path, 0777) == 0; | return mkdir(path, 0777) == 0; |
#endif | #endif |
|
|
struct stat st; | struct stat st; |
| |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
if (QlgStat(QlgPath(path), &st) != 0) |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
if (QlgStat((Qlg_Path_Name_T *)&pathname, &st) != 0) |
|
return false; | return false; |
#else | #else |
if (stat(path, &st) != 0) | if (stat(path, &st) != 0) |
|
|
Boolean System::removeDirectory(const char* path) | Boolean System::removeDirectory(const char* path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgRmdir(QlgPath(path)) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgRmdir((Qlg_Path_Name_T *)&pathname) == 0; |
|
#else | #else |
return rmdir(path) == 0; | return rmdir(path) == 0; |
#endif | #endif |
|
|
Boolean System::removeFile(const char* path) | Boolean System::removeFile(const char* path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT pathname; |
return QlgUnlink(QlgPath(path)) == 0; |
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
|
|
return QlgUnlink((Qlg_Path_Name_T *)&pathname) == 0; |
|
#else | #else |
return unlink(path) == 0; | return unlink(path) == 0; |
#endif | #endif |
|
|
Boolean System::renameFile(const char* oldPath, const char* newPath) | Boolean System::renameFile(const char* oldPath, const char* newPath) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
OS400_PNSTRUCT oldpathname; |
if (QlgLink(QlgPath(oldPath), QlgPath(newPath)) != 0) |
memset((void*)&oldpathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
oldpathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(oldpathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(oldpathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
oldpathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
oldpathname.qlg_struct.Path_Length = strlen(oldPath); |
|
oldpathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
oldpathname.pn = (char *)oldPath; |
|
|
|
OS400_PNSTRUCT newpathname; |
|
memset((void*)&newpathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
newpathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(newpathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(newpathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
newpathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
newpathname.qlg_struct.Path_Length = strlen(newPath); |
|
newpathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
newpathname.pn = (char *)newPath; |
|
|
|
if (QlgLink((Qlg_Path_Name_T *)&oldpathname, |
|
(Qlg_Path_Name_T *)&newpathname) != 0) |
|
{ |
|
return false; | return false; |
} |
|
| |
return QlgUnlink((Qlg_Path_Name_T *)&oldpathname) == 0; |
return QlgUnlink(QlgPath(oldPath)) == 0; |
#else | #else |
|
|
if (link(oldPath, newPath) != 0) | if (link(oldPath, newPath) != 0) |
return false; | return false; |
| |
|
|
Tracer::trace(TRC_OS_ABSTRACTION, Tracer::LEVEL2, | Tracer::trace(TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
"Attempting to load library %s", fileName); | "Attempting to load library %s", fileName); |
| |
#if defined(PEGASUS_OS_HPUX) |
#if defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_HPUX_USE_DLOPEN) |
void* handle; | void* handle; |
if (bindVerbose) | if (bindVerbose) |
{ | { |
|
|
return DynamicLibraryHandle(OS400_LoadDynamicLibrary(fileName)); | return DynamicLibraryHandle(OS400_LoadDynamicLibrary(fileName)); |
#else | #else |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return DynamicLibraryHandle(dlopen(fileName, RTLD_NOW)); |
return DynamicLibraryHandle(dlopen(fileName, RTLD_GLOBAL|RTLD_NOW)); |
#endif | #endif |
| |
} | } |
| |
void System::unloadDynamicLibrary(DynamicLibraryHandle libraryHandle) | void System::unloadDynamicLibrary(DynamicLibraryHandle libraryHandle) |
{ | { |
// ATTN: Should this method indicate success/failure? |
|
#if defined(PEGASUS_OS_LINUX) || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_DARWIN) |
|
dlclose(libraryHandle); |
|
#endif |
|
| |
#ifdef PEGASUS_OS_HPUX |
#if defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_HPUX_USE_DLOPEN) |
// Note: shl_unload will unload the library even if it has been loaded | // Note: shl_unload will unload the library even if it has been loaded |
// multiple times. No reference count is kept. | // multiple times. No reference count is kept. |
int ignored = shl_unload(reinterpret_cast<shl_t>(libraryHandle)); | int ignored = shl_unload(reinterpret_cast<shl_t>(libraryHandle)); |
|
// ATTN: Should this method indicate success/failure? |
|
#elif defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_DARWIN) |
|
dlclose(libraryHandle); |
#endif | #endif |
| |
#ifdef PEGASUS_OS_OS400 | #ifdef PEGASUS_OS_OS400 |
|
|
String System::dynamicLoadError() { | String System::dynamicLoadError() { |
// ATTN: Is this safe in a multi-threaded process? Should this string | // ATTN: Is this safe in a multi-threaded process? Should this string |
// be returned from loadDynamicLibrary? | // be returned from loadDynamicLibrary? |
#ifdef PEGASUS_OS_HPUX |
#if defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_HPUX_USE_DLOPEN) |
// If shl_load() returns NULL, errno is set to indicate the error | // If shl_load() returns NULL, errno is set to indicate the error |
return strerror(errno); | return strerror(errno); |
#elif defined(PEGASUS_OS_ZOS) | #elif defined(PEGASUS_OS_ZOS) |
|
|
DynamicLibraryHandle libraryHandle, | DynamicLibraryHandle libraryHandle, |
const char* symbolName) | const char* symbolName) |
{ | { |
#ifdef PEGASUS_OS_HPUX |
#if defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_HPUX_USE_DLOPEN) |
char* p = (char*)symbolName; | char* p = (char*)symbolName; |
void* proc = 0; | void* proc = 0; |
| |
|
|
| |
String System::getHostName() | String System::getHostName() |
{ | { |
static char hostname[PEGASUS_MAXHOSTNAMELEN]; |
static char hostname[PEGASUS_MAXHOSTNAMELEN + 1]; |
| |
if (!*hostname) | if (!*hostname) |
{ | { |
gethostname(hostname, sizeof(hostname)); | gethostname(hostname, sizeof(hostname)); |
|
hostname[sizeof(hostname)-1] = 0; |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
EtoA(hostname); | EtoA(hostname); |
#endif | #endif |
|
|
| |
String System::getFullyQualifiedHostName () | String System::getFullyQualifiedHostName () |
{ | { |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_AIX) || defined(PEGASUS_OS_LINUX) |
#if defined(PEGASUS_OS_ZOS) |
char hostName [PEGASUS_MAXHOSTNAMELEN]; |
char hostName[PEGASUS_MAXHOSTNAMELEN + 1]; |
struct hostent *he; |
|
String fqName; | String fqName; |
|
struct addrinfo *resolv; |
|
struct addrinfo hint; |
|
struct hostent *he; |
|
// receive short name of the local host |
if (gethostname (hostName, PEGASUS_MAXHOSTNAMELEN) != 0) | if (gethostname (hostName, PEGASUS_MAXHOSTNAMELEN) != 0) |
{ | { |
return String::EMPTY; | return String::EMPTY; |
} | } |
|
resolv = new struct addrinfo; |
|
hint.ai_flags = AI_CANONNAME; |
|
hint.ai_family = AF_UNSPEC; // any family |
|
hint.ai_socktype = 0; // any socket type |
|
hint.ai_protocol = 0; // any protocol |
|
int success = getaddrinfo(hostName, |
|
NULL, |
|
&hint, |
|
&resolv); |
|
if (success==0) |
|
{ |
|
// assign fully qualified hostname |
|
fqName.assign(resolv->ai_canonname); |
|
} else |
|
{ |
if ((he = gethostbyname (hostName))) | if ((he = gethostbyname (hostName))) |
{ | { |
strcpy (hostName, he->h_name); | strcpy (hostName, he->h_name); |
} | } |
|
// assign hostName |
|
// if gethostbyname was successful assign that result |
|
// else assign unqualified hostname |
fqName.assign (hostName); | fqName.assign (hostName); |
|
} |
|
freeaddrinfo(resolv); |
|
delete resolv; |
| |
return fqName; | return fqName; |
#elif defined(PEGASUS_OS_ZOS) |
#else |
char hostName [PEGASUS_MAXHOSTNAMELEN]; |
char hostName[PEGASUS_MAXHOSTNAMELEN + 1]; |
char *domainName; |
|
String fqName; |
if (gethostname(hostName, sizeof(hostName)) != 0) |
// receive short name of the local host |
|
if (gethostname(hostName, PEGASUS_MAXHOSTNAMELEN) != 0) |
|
{ | { |
return String::EMPTY; | return String::EMPTY; |
} | } |
// get domain name of the local host |
hostName[sizeof(hostName)-1] = 0; |
domainName= __ipDomainName(); |
|
if (domainName == 0) |
struct hostent *hostEntry; |
|
|
|
# if defined(PEGASUS_OS_LINUX) |
|
char hostEntryBuffer[8192]; |
|
struct hostent hostEntryStruct; |
|
int hostEntryErrno; |
|
|
|
gethostbyname_r( |
|
hostName, |
|
&hostEntryStruct, |
|
hostEntryBuffer, |
|
sizeof(hostEntryBuffer), |
|
&hostEntry, |
|
&hostEntryErrno); |
|
# elif defined(PEGASUS_OS_SOLARIS) |
|
char hostEntryBuffer[8192]; |
|
struct hostent hostEntryStruct; |
|
int hostEntryErrno; |
|
|
|
hostEntry = gethostbyname_r( |
|
hostName, |
|
&hostEntryStruct, |
|
hostEntryBuffer, |
|
sizeof(hostEntryBuffer), |
|
&hostEntryErrno); |
|
# else |
|
hostEntry = gethostbyname(hostName); |
|
# endif |
|
|
|
if (hostEntry) |
{ | { |
return String::EMPTY; |
strncpy(hostName, hostEntry->h_name, sizeof(hostName)-1); |
} | } |
// build fully qualified hostname |
|
fqName.assign(hostName); |
|
fqName.append("."); |
|
fqName.append(domainName); |
|
| |
return fqName; |
# if defined(PEGASUS_OS_OS400) |
#else |
EtoA(hostName); |
// |
# endif |
// ATTN: Implement this method to return the fully qualified host name |
|
// |
return String(hostName); |
return String::EMPTY; |
|
#endif | #endif |
} | } |
| |
|
|
// property used in the instrumentation of the CIM_ComputerSystem class | // property used in the instrumentation of the CIM_ComputerSystem class |
// as determined by the provider for the CIM_ComputerSystem class | // as determined by the provider for the CIM_ComputerSystem class |
// | // |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) |
|
return "CIM_ComputerSystem"; | return "CIM_ComputerSystem"; |
#else |
|
// |
|
// ATTN: Implement this method to return the system creation class name |
|
// |
|
return String::EMPTY; |
|
#endif |
|
} | } |
| |
Uint32 System::lookupPort( | Uint32 System::lookupPort( |
|
|
// | // |
// Get wbem-local port from /etc/services | // Get wbem-local port from /etc/services |
// | // |
#if !defined(PEGASUS_OS_OS400) |
|
#ifdef PEGASUS_OS_SOLARIS | #ifdef PEGASUS_OS_SOLARIS |
#define SERV_BUFF_SIZE 1024 | #define SERV_BUFF_SIZE 1024 |
struct servent serv_result; | struct servent serv_result; |
|
|
| |
if ( (serv = getservbyname_r(serviceName, TCP, &serv_result, | if ( (serv = getservbyname_r(serviceName, TCP, &serv_result, |
buf, SERV_BUFF_SIZE)) != NULL ) | buf, SERV_BUFF_SIZE)) != NULL ) |
|
#elif defined(PEGASUS_OS_OS400) |
|
struct servent serv_result; |
|
serv = &serv_result; |
|
struct servent_data buf; |
|
memset(&buf, 0x00, sizeof(struct servent_data)); |
|
|
|
char srvnameEbcdic[256]; |
|
strcpy(srvnameEbcdic, serviceName); |
|
AtoE(srvnameEbcdic); |
|
|
|
char tcpEbcdic[64]; |
|
strcpy(tcpEbcdic, TCP); |
|
AtoE(tcpEbcdic); |
|
|
|
if ( (getservbyname_r(srvnameEbcdic, tcpEbcdic, &serv_result, |
|
&buf)) == 0 ) |
#else // PEGASUS_OS_SOLARIS | #else // PEGASUS_OS_SOLARIS |
if ( (serv = getservbyname(serviceName, TCP)) != NULL ) | if ( (serv = getservbyname(serviceName, TCP)) != NULL ) |
#endif // PEGASUS_OS_SOLARIS | #endif // PEGASUS_OS_SOLARIS |
#else // !PEGASUS_OS_OS400 |
|
// Note - serviceName came from Constants.h - no need to |
|
// convert to EBCDIC |
|
// Need to cast on OS/400 |
|
if ( (serv = getservbyname((char *)serviceName, TCP)) != NULL ) |
|
#endif // !PEGASUS_OS_OS400 |
|
{ | { |
localPort = htons((uint16_t)serv->s_port); | localPort = htons((uint16_t)serv->s_port); |
} | } |
|
|
| |
#if defined(PEGASUS_OS_SOLARIS) || \ | #if defined(PEGASUS_OS_SOLARIS) || \ |
defined(PEGASUS_OS_HPUX) || \ | defined(PEGASUS_OS_HPUX) || \ |
defined(PEGASUS_OS_LINUX) |
defined(PEGASUS_OS_LINUX) || \ |
|
defined(PEGASUS_OS_OS400) |
| |
const unsigned int PWD_BUFF_SIZE = 1024; | const unsigned int PWD_BUFF_SIZE = 1024; |
struct passwd local_pwd; | struct passwd local_pwd; |
|
|
{ | { |
String errorMsg = String("getpwuid_r failure : ") + | String errorMsg = String("getpwuid_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
// L10N TODO - This message needs to be added. | // L10N TODO - This message needs to be added. |
//Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | //Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
// errorMsg); | // errorMsg); |
} | } |
|
#elif defined(PEGASUS_OS_ZOS) |
|
char effective_username[9]; |
|
__getuserid(effective_username, 9); |
|
__etoa_l(effective_username,9); |
|
userName.assign(effective_username); |
|
return userName; |
#else | #else |
// | // |
// get the currently logged in user's UID. | // get the currently logged in user's UID. |
|
|
| |
#if defined(PEGASUS_OS_SOLARIS) || \ | #if defined(PEGASUS_OS_SOLARIS) || \ |
defined(PEGASUS_OS_HPUX) || \ | defined(PEGASUS_OS_HPUX) || \ |
defined(PEGASUS_OS_LINUX) |
defined(PEGASUS_OS_LINUX) || \ |
|
defined(PEGASUS_OS_OS400) |
| |
const unsigned int PWD_BUFF_SIZE = 1024; | const unsigned int PWD_BUFF_SIZE = 1024; |
struct passwd pwd; | struct passwd pwd; |
|
|
{ | { |
String errorMsg = String("getpwnam_r failure : ") + | String errorMsg = String("getpwnam_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
// L10N TODO - This message needs to be added. | // L10N TODO - This message needs to be added. |
//Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | //Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
// errorMsg); | // errorMsg); |
|
|
return true; | return true; |
} | } |
| |
Boolean System::isPrivilegedUser(const String userName) |
Boolean System::isPrivilegedUser(const String& userName) |
{ | { |
// | // |
// Check if the given user is a privileged user | // Check if the given user is a privileged user |
|
|
{ | { |
String errorMsg = String("getpwnam_r failure : ") + | String errorMsg = String("getpwnam_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
// L10N TODO - This message needs to be added. | // L10N TODO - This message needs to be added. |
//Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | //Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
// errorMsg); | // errorMsg); |
|
|
struct passwd* pwd = NULL; | struct passwd* pwd = NULL; |
#if defined(PEGASUS_OS_SOLARIS) || \ | #if defined(PEGASUS_OS_SOLARIS) || \ |
defined(PEGASUS_OS_HPUX) || \ | defined(PEGASUS_OS_HPUX) || \ |
defined(PEGASUS_OS_LINUX) |
defined(PEGASUS_OS_LINUX) || \ |
|
defined(PEGASUS_OS_OS400) |
const unsigned int PWD_BUFF_SIZE = 1024; | const unsigned int PWD_BUFF_SIZE = 1024; |
struct passwd local_pwd; | struct passwd local_pwd; |
char buf[PWD_BUFF_SIZE]; | char buf[PWD_BUFF_SIZE]; |
|
|
{ | { |
String errorMsg = String("getpwuid_r failure : ") + | String errorMsg = String("getpwuid_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
// L10N TODO - This message needs to be added. | // L10N TODO - This message needs to be added. |
//Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | //Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
// errorMsg); | // errorMsg); |
|
|
{ | { |
String errorMsg = String("getpwnam_r failure : ") + | String errorMsg = String("getpwnam_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
errorMsg); | errorMsg); |
throw InternalSystemError(); | throw InternalSystemError(); |
|
|
{ | { |
String errorMsg = String("getgrgid_r failure : ") + | String errorMsg = String("getgrgid_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
errorMsg); | errorMsg); |
throw InternalSystemError(); | throw InternalSystemError(); |
|
|
{ | { |
String errorMsg = String("getgrnam_r failure : ") + | String errorMsg = String("getgrnam_r failure : ") + |
String(strerror(errno)); | String(strerror(errno)); |
Tracer::PEG_TRACE_STRING (TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, errorMsg); |
errorMsg); |
|
Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, | Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::WARNING, |
errorMsg); | errorMsg); |
throw InternalSystemError(); | throw InternalSystemError(); |
|
|
return retVal; | return retVal; |
} | } |
| |
|
#ifndef PEGASUS_OS_OS400 |
|
Boolean System::lookupUserId( |
|
const char* userName, |
|
PEGASUS_UID_T& uid, |
|
PEGASUS_GID_T& gid) |
|
{ |
|
const unsigned int PWD_BUFF_SIZE = 1024; |
|
struct passwd pwd; |
|
struct passwd *result; |
|
char pwdBuffer[PWD_BUFF_SIZE]; |
|
|
|
# if defined(PEGASUS_OS_OS400) |
|
AtoE((char *)userName); |
|
# endif |
|
|
|
int rc = getpwnam_r(userName, &pwd, pwdBuffer, PWD_BUFF_SIZE, &result); |
|
|
|
# if defined(PEGASUS_OS_OS400) |
|
EtoA((char *)userName); |
|
# endif |
|
|
|
if (rc != 0) |
|
{ |
|
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
|
String("getpwnam_r failed: ") + String(strerror(errno))); |
|
return false; |
|
} |
|
|
|
if (result == 0) |
|
{ |
|
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
|
"getpwnam_r failed."); |
|
return false; |
|
} |
|
|
|
uid = pwd.pw_uid; |
|
gid = pwd.pw_gid; |
|
|
|
return true; |
|
} |
|
|
|
Boolean System::changeUserContext( |
|
const PEGASUS_UID_T& uid, |
|
const PEGASUS_GID_T& gid) |
|
{ |
|
Tracer::trace(TRC_OS_ABSTRACTION, Tracer::LEVEL4, |
|
"Changing user context to: uid = %d, gid = %d", |
|
(int)uid, (int)gid); |
|
|
|
if (setgid(gid) != 0) |
|
{ |
|
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
|
String("setgid failed: ") + String(strerror(errno))); |
|
return false; |
|
} |
|
|
|
if (setuid(uid) != 0) |
|
{ |
|
PEG_TRACE_STRING(TRC_OS_ABSTRACTION, Tracer::LEVEL2, |
|
String("setuid failed: ") + String(strerror(errno))); |
|
return false; |
|
} |
|
|
|
return true; |
|
} |
|
#endif |
|
|
Uint32 System::getPID() | Uint32 System::getPID() |
{ | { |
// | // |
|
|
const char* path, | const char* path, |
size_t newSize) | size_t newSize) |
{ | { |
#if !defined(PEGASUS_OS_OS400) |
#if defined(PEGASUS_OS_OS400) |
return (truncate(path, newSize) == 0); |
int fd = QlgOpen(QlgPath(path), O_WRONLY); |
#else |
|
OS400_PNSTRUCT pathname; |
|
memset((void*)&pathname, 0x00, sizeof(OS400_PNSTRUCT)); |
|
pathname.qlg_struct.CCSID = 1208; |
|
#pragma convert(37) |
|
memcpy(pathname.qlg_struct.Country_ID,"US",2); |
|
memcpy(pathname.qlg_struct.Language_ID,"ENU",3); |
|
#pragma convert(0) |
|
pathname.qlg_struct.Path_Type = QLG_PTR_SINGLE; |
|
pathname.qlg_struct.Path_Length = strlen(path); |
|
pathname.qlg_struct.Path_Name_Delimiter[0] = '/'; |
|
pathname.pn = (char *)path; |
|
| |
int fd = QlgOpen((Qlg_Path_Name_T *)&pathname, O_WRONLY); |
|
if (fd != -1) | if (fd != -1) |
{ | { |
int rc = ftruncate(fd, newSize); | int rc = ftruncate(fd, newSize); |
|
|
} | } |
| |
return false; | return false; |
|
#else |
|
return (truncate(path, newSize) == 0); |
#endif | #endif |
} | } |
| |
|
|
return ( ret != -1 ); | return ( ret != -1 ); |
} | } |
| |
void System::openlog(const String ident) |
Boolean System::verifyFileOwnership(const char* path) |
{ | { |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
struct stat st; |
// ATTN: Hard-code the "cimserver" identifier until the infrastructure |
|
// is set up to pass this as the "ident" string. |
|
//::openlog(ident.getCString(), LOG_PID|LOG_CONS, LOG_DAEMON); |
|
::openlog("cimserver", LOG_PID, LOG_DAEMON); |
|
| |
|
#if defined(PEGASUS_OS_OS400) |
|
if (QlgStat(QlgPath(path), &st) != 0) |
|
return false; |
|
#else |
|
if (lstat(path, &st) != 0) |
|
return false; |
#endif | #endif |
| |
return; |
return ((st.st_uid == geteuid()) && // Verify the file owner |
|
S_ISREG(st.st_mode) && // Verify it is a regular file |
|
(st.st_nlink == 1)); // Verify it is not a hard link |
} | } |
| |
void System::syslog(Uint32 severity, const char *data) |
void System::syslog(const String& ident, Uint32 severity, const char* message) |
{ | { |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) |
|
|
|
// Since the openlog(), syslog(), and closelog() function calls must be |
|
// coordinated (see below), we need a thread control. |
|
|
|
static Mutex logMutex; |
|
|
|
AutoMutex loglock(logMutex); |
| |
// FUTURE-SF-P3-20020517 : Use the Syslog on HP-UX. Eventually only |
// Get a const char* representation of the identifier string. Note: The |
// certain messages will go to the Syslog and others to the |
// character string passed to the openlog() function must persist until |
// Pegasus Logger. |
// closelog() is called. The syslog() method uses this pointer directly |
Uint32 syslogLevel = LOG_DEBUG; |
// rather than a copy of the string it refers to. |
|
|
|
CString identCString = ident.getCString(); |
|
openlog(identCString, LOG_PID, LOG_DAEMON); |
|
|
|
// Map from the Logger log level to the system log level. |
|
|
|
Uint32 syslogLevel; |
|
if (severity & Logger::FATAL) |
|
{ |
|
syslogLevel = LOG_CRIT; |
|
} |
|
else if (severity & Logger::SEVERE) |
|
{ |
|
syslogLevel = LOG_ERR; |
|
} |
|
else if (severity & Logger::WARNING) |
|
{ |
|
syslogLevel = LOG_WARNING; |
|
} |
|
else if (severity & Logger::INFORMATION) |
|
{ |
|
syslogLevel = LOG_INFO; |
|
} |
|
else // if (severity & Logger::TRACE) |
|
{ |
|
syslogLevel = LOG_DEBUG; |
|
} |
| |
// Map the log levels. |
// Write the message to the system log. |
if (severity & Logger::TRACE) syslogLevel = LOG_DEBUG; |
|
if (severity & Logger::INFORMATION) syslogLevel = LOG_INFO; |
|
if (severity & Logger::WARNING) syslogLevel = LOG_WARNING; |
|
if (severity & Logger::SEVERE) syslogLevel = LOG_ERR; |
|
if (severity & Logger::FATAL) syslogLevel = LOG_CRIT; |
|
| |
::syslog(syslogLevel, "%s", data); |
::syslog(syslogLevel, "%s", message); |
|
|
|
closelog(); |
| |
#elif defined(PEGASUS_OS_OS400) | #elif defined(PEGASUS_OS_OS400) |
| |
std::string replacementData = data; |
std::string replacementData = message; |
// All messages will go to the joblog. In the future | // All messages will go to the joblog. In the future |
// some messages may go to other message queues yet | // some messages may go to other message queues yet |
// to be determined. | // to be determined. |
|
|
// turn into ycmMessage so we can put it in the job log | // turn into ycmMessage so we can put it in the job log |
#pragma convert(37) | #pragma convert(37) |
ycmMessage theMessage("CPIDF80", | ycmMessage theMessage("CPIDF80", |
data, |
message, |
strlen(data), |
strlen(message), |
"Logger", | "Logger", |
ycmCTLCIMID, | ycmCTLCIMID, |
TRUE); | TRUE); |
|
|
// turn into ycmMessage so we can put it in the job log | // turn into ycmMessage so we can put it in the job log |
#pragma convert(37) | #pragma convert(37) |
ycmMessage theMessage("CPDDF82", | ycmMessage theMessage("CPDDF82", |
data, |
message, |
strlen(data), |
strlen(message), |
"Logger", | "Logger", |
ycmCTLCIMID, | ycmCTLCIMID, |
TRUE); | TRUE); |
|
|
} | } |
| |
#endif | #endif |
|
|
return; |
|
} | } |
| |
void System::closelog() |
// System ID constants for Logger::put and Logger::trace |
|
#if defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) |
|
const String System::CIMSERVER = "qycmcimom"; // Server system ID |
|
#else |
|
const String System::CIMSERVER = "cimserver"; // Server system ID |
|
#endif |
|
|
|
|
|
|
|
|
|
// |
|
// System Initializater for AIX |
|
// |
|
#ifdef PEGASUS_OS_AIX |
|
#include <cstdlib> |
|
|
|
class SystemInitializer |
{ | { |
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) |
|
| |
::closelog(); |
public: |
|
/** |
|
* |
|
* Default constructor. |
|
* |
|
*/ |
|
SystemInitializer(); |
|
}; |
|
|
| |
#endif |
|
| |
return; |
SystemInitializer::SystemInitializer() |
|
{ |
|
putenv("XPG_SUS_ENV=ON"); |
} | } |
| |
// System ID constants for Logger::put and Logger::trace |
static SystemInitializer initializer; |
#if defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) |
|
const String System::CIMSERVER = "qycmcimom"; // Server system ID |
|
#else |
|
const String System::CIMSERVER = "cimserver"; // Server system ID |
|
#endif | #endif |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |