Re: How to get UNIX Process ID from within a running 4GL program
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Obnoxio The Clown escribis:
>
> From: "Tim Lim" <tim_lim@exe.com.au>
> >
> >I have a need of get the UNIX process ID of my running 4GL program.
> >
> >Anyone has a known answer?
>
> It's ugly, but:
>
> CREATE TEMP TABLE x (pidno int)> RUN "echo $$ > /tmp/someuniquename"
> LOAD FROM /tmp/someuniquename INSERT INTO temptable>
> and there you go.
>
This way you obtain the PID of the child process.
The best way (that I know) without using a C function includded in the
runner, is:
$ fglgo myprog.4gi $$ # (passing the process Id as first argument)
and inside the prog
...
INTEGER pid
...
LET pid = fgl_argval(1)
...
I have not the manuals here, so I can't remember exactly the name of
this function
> HTH.
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
Byte byte!
--
Mario R. Canto
mcanto@intec.unl.edu.ar
mcanto@intec.arcride.edu.ar
http://www.intec.unl.edu.ar/~mcanto
Mario R. Canto <mcanto@intec.unl.edu.ar> wrote:
>> RUN "echo $$ > /tmp/someuniquename"
> This way you obtain the PID of the child process.
Yes. If your shell supports it, use $PPID instead of $$
and you get the PID of the parent. (See my other posting).
> $ fglgo myprog.4gi $$ # (passing the process Id as first argument)
> LET pid = fgl_argval(1)
If you do it this way you get the *parent* PID of your 4gl-
application (i.e. of your shell).
Walter
--
Walter Haslbeck <wh@sonic.ods.de>
"Don't drink and root."
(detlef.neubauer@gmx.de in <m3so7kmafq.fsf@voyager.neubauer.berlin.snafu.de>)