version 1.14, 2003/08/11 15:35:57
|
version 1.15, 2003/08/12 19:24:46
|
|
|
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/Logger.h> | #include <Pegasus/Common/Logger.h> |
|
#include "OS400ConvertChar.h" |
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
#include <except.h> | #include <except.h> |
| |
|
|
/////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////// |
int cimserver_fork(void) | int cimserver_fork(void) |
{ | { |
|
#pragma convert(37) |
char rc5[3] = "05"; // rc5 means the CIMOM Server failed to start | char rc5[3] = "05"; // rc5 means the CIMOM Server failed to start |
char cppServ[10] = "QYCMCIMOM"; | char cppServ[10] = "QYCMCIMOM"; |
ycmJob cppJob(YCMJOB_SRVNAME_10, YCMJOB_SRVUSER_10); | ycmJob cppJob(YCMJOB_SRVNAME_10, YCMJOB_SRVUSER_10); |
|
|
YCMJOB_CCSID_37, | YCMJOB_CCSID_37, |
YCMJOB_THREAD_YES)) | YCMJOB_THREAD_YES)) |
{ // QYCMCIMOM Server Failed on Submit Job | { // QYCMCIMOM Server Failed on Submit Job |
|
#pragma convert(0) |
|
|
//l10n | //l10n |
//Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, | //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
//"cimserver_os400::cimserver_fork() - SBMJOB failed to start the QYCMCIMOM server program!!"); | //"cimserver_os400::cimserver_fork() - SBMJOB failed to start the QYCMCIMOM server program!!"); |
|
|
std::string srvName = cppServ; | std::string srvName = cppServ; |
std::string replacementData = errCode + srvName; | std::string replacementData = errCode + srvName; |
| |
|
#pragma convert(37) |
ycmMessage message(msgCPDDF80, | ycmMessage message(msgCPDDF80, |
CPDprefix, | CPDprefix, |
replacementData, | replacementData, |
"cimserver_os400::cimserver_fork()", | "cimserver_os400::cimserver_fork()", |
ycmCTLCIMID); |
ycmCTLCIMID, |
|
utf8); |
message.joblogIt(UserError,ycmMessage::Diagnostic); | message.joblogIt(UserError,ycmMessage::Diagnostic); |
|
#pragma convert(0) |
| |
// save the job log | // save the job log |
system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)"); | system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)"); |
|
|
// (it's a known problem) and we can uncomment this #pragma. | // (it's a known problem) and we can uncomment this #pragma. |
// #pragma cancel_handler (CancelHandler, NULL) | // #pragma cancel_handler (CancelHandler, NULL) |
try { | try { |
|
|
system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)"); | system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)"); |
|
|
|
#pragma convert(37) |
////////////////////////////////////////// | ////////////////////////////////////////// |
// Change Job API call | // Change Job API call |
// Change the server type to QICM_CIMOM | // Change the server type to QICM_CIMOM |
|
|
"JOBC0200", | "JOBC0200", |
&chg, | &chg, |
&errorCode), OFF, OFF); | &errorCode), OFF, OFF); |
|
#pragma convert(0) |
| |
//////////////////////////////////////////////////// | //////////////////////////////////////////////////// |
// Change authority to the qypsjobd job description | // Change authority to the qypsjobd job description |
|
|
/////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////// |
int cimserver_kill(void) | int cimserver_kill(void) |
{ // Need to kill the server | { // Need to kill the server |
|
#pragma convert(37) |
char rc2[3] = "02"; // CIMOM server failed to end | char rc2[3] = "02"; // CIMOM server failed to end |
char cppServ[10] = "QYCMCIMOM"; | char cppServ[10] = "QYCMCIMOM"; |
std::string number = YCMJOB_ALL_NUMBERS; // parameter passed to job::find method | std::string number = YCMJOB_ALL_NUMBERS; // parameter passed to job::find method |
|
|
CPDprefix, | CPDprefix, |
replacementData, | replacementData, |
"cimserver_os400::cimserver_kill()", | "cimserver_os400::cimserver_kill()", |
ycmCTLCIMID); |
ycmCTLCIMID, |
|
utf8); |
message.joblogIt(UserError,ycmMessage::Diagnostic); | message.joblogIt(UserError,ycmMessage::Diagnostic); |
| |
|
#pragma convert(0) |
|
|
//l10n | //l10n |
//Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, | //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, |
//"cimserver_os400::cimserver_kill - FAILED to end the QYCMCIMOM job!!"); | //"cimserver_os400::cimserver_kill - FAILED to end the QYCMCIMOM job!!"); |
|
|
"cimserver_os400::cimserver_kill -", | "cimserver_os400::cimserver_kill -", |
"QYCMCIMOM"); | "QYCMCIMOM"); |
| |
|
|
return -1; // Note: this return code is ignored by the CIMOM server. | return -1; // Note: this return code is ignored by the CIMOM server. |
} | } |
} | } |
|
|
int init_fifo(const char * fifo_name){ | int init_fifo(const char * fifo_name){ |
int fifo = -1; | int fifo = -1; |
struct stat FIFO_STAT; | struct stat FIFO_STAT; |
int stat_rc = stat( fifo_name, &FIFO_STAT ); |
|
|
// Need to convert the fifo name to ebcdic because |
|
// that is what stat and open want. |
|
char tmp[256]; |
|
strcpy(tmp, fifo_name); |
|
AtoE(tmp); |
|
|
|
int stat_rc = stat( tmp, &FIFO_STAT ); |
| |
// check if the FIFO already exists | // check if the FIFO already exists |
if( S_ISFIFO( FIFO_STAT.st_mode ) ){ | if( S_ISFIFO( FIFO_STAT.st_mode ) ){ |
// prep FIFO, on this end we only want to write to it, | // prep FIFO, on this end we only want to write to it, |
// set its I/O mode to not block on any reads | // set its I/O mode to not block on any reads |
fifo = open(fifo_name, O_RDWR | O_NONBLOCK); |
fifo = open(tmp, O_RDWR | O_NONBLOCK); |
} | } |
return fifo; | return fifo; |
} | } |
|
|
char rc_tmp[3]; | char rc_tmp[3]; |
memset(rc_tmp, 0, 3); | memset(rc_tmp, 0, 3); |
sprintf(rc_tmp,"%d",rc); | sprintf(rc_tmp,"%d",rc); |
|
AtoE(rc_tmp); // qycmctlcim wants ebcdic |
write(fifo,rc_tmp,strlen(rc_tmp)); | write(fifo,rc_tmp,strlen(rc_tmp)); |
} | } |
} | } |