Skip to content

Commit

Permalink
Added warning message if plugin doesn't have program control attribute
Browse files Browse the repository at this point in the history
Signed-off-by: TS6320 <[email protected]>

Fixed spacing issues

Signed-off-by: TS6320 <[email protected]>

Removed unneeded variable and added check for status

Signed-off-by: TS6320 <[email protected]>

Added status warning message

Signed-off-by: TS6320 <[email protected]>

Fixed tabs spacing

Signed-off-by: TS6320 <[email protected]>

Changed check to happen before dll loaded therefore it will not be loaded if failed check, and changed print statements to zowe logs

Signed-off-by: TS6320 <[email protected]>

Changed plugin to dataservice in log message

Signed-off-by: sakeerthy <[email protected]>

Changed hard coded number to defined value

Signed-off-by: sakeerthy <[email protected]>
  • Loading branch information
TS6320 authored and sakeerthy committed Jul 22, 2019
1 parent 7f7f7f2 commit d43b955
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
39 changes: 28 additions & 11 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
8 changes: 7 additions & 1 deletion h/unixfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ typedef struct BPXYSTAT_tag{
short fileTaggingTags;
int reserved2[2];
int64 blocks;
int attributeFlags;
uint32_t reservedAttributeFlags: 24;
uint8_t attributeFlags;
#define BPXYSTAT_ATTR_SHARELIB 0x10
#define BPXYSTAT_ATTR_NOSHAREAS 0x08
#define BPXYSTAT_ATTR_APFAUTH 0x04
#define BPXYSTAT_ATTR_PROGCTL 0x02
#define BPXYSTAT_ATTR_EXTLINK 0x01
/* 0x10 shared lib
0x08 no shareas
0x04 APF
Expand Down

0 comments on commit d43b955

Please sign in to comment.