Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PROCESS_GETINFO_ from c...?

40 views
Skip to first unread message

Damo

unread,
May 8, 2012, 2:33:15 PM5/8/12
to
Hello

Why are Guardian procedures so hard to call from C.. with next to no
info in the manuals..hmmm...

Anyhow I have a C program and want to call PROCESS_GETINFO_ to return
the running processes object file, and hence location..

My cakk to PROCESS_GETINFO_ gives error 3, and nothing in errordetail
which would appear to indicate the destination is not large enough for
the returned details..

I have defined it as

char *programfile;

If someone could please post a working example I would be most
grateful.. I think I am missing something..

Thanks

Damo

Brandon Jenkins

unread,
Feb 13, 2013, 9:57:58 PM2/13/13
to
From the J series manual:
#include < cextdecs(PROCESS_GETINFO_)>
/*input error*/
/*output detail*/
short PROCESS_GETINFO_ ( [ short *processhandle ] /*i,o 1 */
, [ char *proc-fname ] /* o 2 */
, [ short maxlen ] /* o 2 */
, [ short *proc-fname-len ] /* o 3 */
, [ short *priority ] /* i 4 */
, [ short *mom’s-processhandle ] /*i 5 */
, [ char *hometerm ] /* i 6 */
, [ short maxlen ] /* i 6 */
, [ short *hometerm-len ] /* i 7 */
, [ long long *process-time ]/* i 8 */
, [ short *creator-access-id ]/*i 9 */
, [ short *process-access-id ]/*i 10 */
, [ short *gmom’s-processhandle ]/* i11 */
, [ short *jobid ] /* i 12 */
, [ char *program-file ] /* i 13 */
, [ short maxlen ] /* i 13 */
, [ short *program-len ] /* i 14 */
, [ char *swap-file ] /* i 15 */
, [ short maxlen ] /* i 15 */
, [ short *swap-len ] /* i 16 */
, [ short *error-detail ] /* i 17 */
, [ short *proc-type ] /* i 18 */
, [ __int32_t *oss-pid ] ); /* i 19*/;

The numbering of the fields is incorrect, but the fields are correct.
You will need to pass program_file as a char *. You will also HAVE to pass the maxlen variable populated with the maximum value that can be put into program_file. You do not have the field defined correctly.

char programfile[36];
short programfile_actual_len;
short rslt;
short error_detail;

rslt = PROCESS_GETINFO(/* prrocesshandle */
, /* proc-fname */
, /* maxlen */
, /* proc-fname-len */
, /* priority */
, /* mom’s-processhandle */
, /* hometerm */
, /* maxlen */
, /* hometerm-len */
, /* process-time */
, /* creator-access-id */
, /* process-access-id */
, /* gmom’s-processhandle */
, /* jobid */
, program_file
, sizeof program_file
, &programfile_actual_len
, /* swap-file */
, /* maxlen */
, /* swap-len */
, &error-detail);
0 new messages