Skip to content

Commit

Permalink
Zowe Suite v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Aug 9, 2019
2 parents 3ff8953 + adaa9c6 commit 3d2a915
Show file tree
Hide file tree
Showing 16 changed files with 1,654 additions and 243 deletions.
480 changes: 480 additions & 0 deletions c/alloc.c

Large diffs are not rendered by default.

44 changes: 35 additions & 9 deletions c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,8 @@ static int handleStandardService(CrossMemoryServer *server, CrossMemoryServerPar
return status;
}

static int handleProgramCall(PCHandlerParmList *parmList, bool isSpaceSwitchPC) {
static int handleUnsafeProgramCall(PCHandlerParmList *parmList,
bool isSpaceSwitchPC) {

if (parmList == NULL) {
return RC_CMS_PARM_NULL;
Expand Down Expand Up @@ -1581,15 +1582,11 @@ static int handleProgramCall(PCHandlerParmList *parmList, bool isSpaceSwitchPC)
return RC_CMS_FUNCTION_NULL;
}

PCRoutineEnvironment env;
int envRC = INIT_PC_ENVIRONMENT(&env);
if (envRC != RC_CMS_OK) {
return RC_CMS_PC_ENV_NOT_ESTABLISHED;
}

int returnCode = RC_CMS_OK;

int pushRC = recoveryPush("CMS service function call", RCVR_FLAG_RETRY | RCVR_FLAG_PRODUCE_DUMP, "RCMS", NULL, NULL, NULL, NULL);
int pushRC = recoveryPush("CMS service function call",
RCVR_FLAG_RETRY | RCVR_FLAG_DELETE_ON_RETRY | RCVR_FLAG_PRODUCE_DUMP,
"RCMS", NULL, NULL, NULL, NULL);

if (pushRC == RC_RCV_OK) {

Expand All @@ -1600,13 +1597,42 @@ static int handleProgramCall(PCHandlerParmList *parmList, bool isSpaceSwitchPC)
cmCopyToPrimaryWithCallerKey(&userParmList->serviceRC, &serviceRC, sizeof(userParmList->serviceRC));
}

recoveryPop();

} else if (pushRC == RC_RCV_ABENDED) {
returnCode = RC_CMS_PC_SERVICE_ABEND_DETECTED;
} else {
returnCode = RC_CMS_PC_RECOVERY_ENV_FAILED;
}

recoveryPop();
return returnCode;
}

static int handleProgramCall(PCHandlerParmList *parmList, bool isSpaceSwitchPC) {

PCRoutineEnvironment env;
int envRC = INIT_PC_ENVIRONMENT(&env);
if (envRC != RC_CMS_OK) {
return RC_CMS_PC_ENV_NOT_ESTABLISHED;
}

int returnCode = RC_CMS_OK;

int pushRC = recoveryPush("CMS PC handler",
RCVR_FLAG_RETRY | RCVR_FLAG_DELETE_ON_RETRY,
"RCMS", NULL, NULL, NULL, NULL);

if (pushRC == RC_RCV_OK) {

returnCode = handleUnsafeProgramCall(parmList, isSpaceSwitchPC);

recoveryPop();

} else if (pushRC == RC_RCV_ABENDED) {
returnCode = RC_CMS_PC_SERVICE_ABEND_DETECTED;
} else {
returnCode = RC_CMS_PC_RECOVERY_ENV_FAILED;
}

envRC = TERMINATE_PC_ENVIRONMENT(&env);
if (envRC != RC_CMS_OK) {
Expand Down
57 changes: 44 additions & 13 deletions c/dataservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,35 @@ static void *lookupDLLEntryPoint(char *libraryName, char *functionName){
| RTLD_NOW
#endif
;
void *library = dlopen(libraryName,flags);
if (library){
printf("dll handle for %s = 0x%" PRIxPTR "\n",libraryName, library);
ep = dlsym(library,functionName);
/* dlclose(library); - this will really close the DLL, like not be able to call */
if (ep == NULL){
printf("%s.%s could not be found - dlsym error %s\n", libraryName, functionName, dlerror());
FileInfo info;
int status = 0;
int returnCode = 0;
int reasonCode = 0;
status = fileInfo(libraryName, &info, &returnCode, &reasonCode);
if (status == 0) {
if (!(info.attributeFlags & BPXYSTAT_ATTR_PROGCTL)) {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_SEVERE,
"FAILURE: Dataservice: %s does not have the Program Control attribute this may cause unexpected errors therefore will not be loaded\n",
libraryName);
} else {
printf("%s.%s is at 0x%" PRIxPTR "\n", libraryName, functionName, ep);
}
} else{
printf("dlopen error for %s - %s\n",libraryName, dlerror());
void *library = dlopen(libraryName,flags);
if (library){
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_INFO, "dll handle for %s = 0x%" PRIxPTR "\n", libraryName, library);
ep = dlsym(library,functionName);
/* dlclose(library); - this will really close the DLL, like not be able to call */
if (ep == NULL){
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_SEVERE, "%s.%s could not be found - dlsym error %s\n", libraryName, functionName, dlerror());
} else {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_INFO, "%s.%s is at 0x%" PRIxPTR "\n", libraryName, functionName, ep);
}
} else {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_SEVERE, "dlopen error for %s - %s\n",libraryName, dlerror());
}
}
} else {
zowelog(NULL, LOG_COMP_DATASERVICE, ZOWE_LOG_SEVERE,
"FAILURE: Dataservice: %s status not available therefore will not be loaded, please check the provided file name: (return = 0x%x, reason = 0x%x)\n",
libraryName, returnCode, reasonCode);
}
#endif /* not METTLE */
return ep;
Expand Down Expand Up @@ -164,8 +181,22 @@ static DataService *makeDataService(WebPlugin *plugin, JsonObject *serviceJsonOb
service->initializer = NULL;
printf("*** PANIC *** service loading in METTLE not implemented\n");
#else
printf("going for DLL EP lib=%s epName=%s\n",libraryName,initializerName);
service->initializer = (InitializerAPI*) lookupDLLEntryPoint(libraryName,initializerName);
char dllLocation[1023] = {0}; /* USS max path length */
int pluginLocationLen = strlen(plugin->pluginLocation);

if (plugin->pluginLocation[pluginLocationLen - 1] == '/') {
snprintf(dllLocation, sizeof(dllLocation), "%.*s/lib/%s", strlen(plugin->pluginLocation) - 1, plugin->pluginLocation, libraryName);
}
else {
snprintf(dllLocation, sizeof(dllLocation), "%s/lib/%s", plugin->pluginLocation, libraryName);
}

printf("going for DLL EP lib=%s epName=%s\n",dllLocation,initializerName);
service->initializer = (InitializerAPI*) lookupDLLEntryPoint(dllLocation,initializerName);
if (service->initializer == NULL) {
printf("going for DLL EP lib=%s epName=%s\n",libraryName,initializerName);
service->initializer = (InitializerAPI*) lookupDLLEntryPoint(libraryName,initializerName);
}
printf("DLL EP = 0x%x\n",service->initializer);
fflush(stdout);
fflush(stderr);
Expand Down
Loading

0 comments on commit 3d2a915

Please sign in to comment.