I have process name and would like to check if process is running in HP NonStop OSS. I created small C demo, but got error from Guardian PROCESS_GETINFO_ procedure. Error number is 3. Below is my code. Could you please tell me what is the problem.
#include <cextdecs.h(PROCESS_GETINFO_)>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
short getProcess(const char*);
enum ZSYSValues
{
ZSYS_VAL_LEN_PROCESSDESCR = 33
} ;
int main() {
const char* processName = "myProcess";
short status = getProcess(processName);
printf("status = %d", status);
return 0;
}
short getProcess(const char* processName) {
short error = 9;
short length = 20;
short maxLength = ZSYS_VAL_LEN_PROCESSDESCR;
/* error: 0 - found; 4 - not found, otherwise - error*/
error = PROCESS_GETINFO_ ( /* *processhandle */
,(char*) processName
,maxLength
,&length
,/* *priority */
,/* *mom’s-processhandle */
,/* *hometerm */
,/* maxlen */
,/* *hometerm-len */
,/* *process-time */
,/* *creator-access-id */
,/* *process-access-id */
,/* *gmom’s-processhandle */
,/* *jobid */
,/* *program-file */
,/* maxlen */
,/* *program-len */
,/* *swap-file */
,/* maxlen */
,/* *swap-len */
,/* *error-detail */
,/* *proc-type */
,/* *oss-pid */
,/* timeout */ );
printf("error = %d", error);
switch(error) {
case 0: return 1; /* found */
case 4: return 0; /* not found */
}
return -1; /* error */
}