× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi!
I have changed my program according to notes from Scott Klement.
But cpid = waitpid(processID:stat_loc:0) still returns stat_loc = *zero
althought cpid = processID.
What is wrong!?

/EJECT
***
D spawn PR extproc('spawn') like(pid_t)
D path * value options(*string)
D fd_count 10I 0 value
D fd_map 10I 0 dim(256) options(*varsize:*omit)
D inherit likeds(inheritance_t)
D argv * dim(4)
D options(*varsize)
D envp * dim(256) options(*varsize)

D waitpid PR extproc('waitpid')
D pid 10I 0 value
D stat_loc 10I 0
D options 10I 0 value


D chkStatus PR
D status 10i 0
d n
d n
d n

d ended s n
d failed s n
d stopped s n
D flagset_t S 10U 0 based(Template)
D pid_t S 10I 0 based(Template)
D sigset_t s 20U 0 based(Template)
D parms s 100A dim(4)
D PgmLib s 100A inz('ALIBDV1')
D PgmName s 100A inz('Childprc')
D path s 200A varying
D inh ds likeds(inheritance_t)
D argv s * dim(4)
D envp s * dim(256)
D processID s like(pid_t)

D cpid s like(pid_t)
D stat_loc s 10I 0
D stat_val s 10I 0 based(PtrStat)
D PtrStat s *
D options s 10I 0
D childStatus s 10i 0

D inheritance_t DS based(Template)
D flags like(flagset_t)
D pgroup like(pid_t)
D sigmask like(sigset_t)
D sigdefault like(sigset_t)

/free

path = '/QSYS.LIB/' + %trim(PgmLib) + '.LIB/' +
%trim(PgmName) + '.PGM';

parms(1) = path + x'00';
parms(2) = 'XXXX';
parms(3) = '1080814';
parms(4) = '2';

argv(1) = %addr(parms(1));
argv(2) = %addr(parms(2));
argv(3) = %addr(parms(3));
argv(4) = %addr(parms(4));

inh = *ALLx'00';


processID = spawn(path: 0: *OMIT: inh: argv: envp);
if processID < 0;
// ReportError();
endif;
//
cpid = waitpid(processID:stat_loc:0);
select;
when ( cpid = ProcessID );
ChkStatus(stat_loc:ended:failed:stopped);
when ( cpid = 0 );
//
when ( cpid = -1 );
//
endsl;

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.