我有進程名稱,並希望檢查進程是否在HP NonStop OSS中運行。我創建了一個小型C演示程序,但從Guardian PROCESS_GETINFO_過程中得到錯誤。錯誤編號是3. 下面是我的代碼。你能告訴我什麼是問題。檢查進程是否在HP NonStop OSS Tandem中運行
#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 */
}
我對NonStop並不熟悉,但是不能在某處查找錯誤3意味着什麼? – immibis