Getting the process ID from a session (no DB)

Posted by Admin on 19-Mar-2012 06:15

Is there a way of getting the process ID of an appserver agent that is not connected to a DB?

At the moment I use:

def buffer connection for _myConnection.

find first connection no-lock no-error.

mypid = if avail connection

        then string(connection._MyConn-Pid)

        else ""

(Which doesn't work for agents with no DB)

I was hoping there would be a nice and easy session:pid attribute, but there doesn't appear to be one.

Chris

10.2B05

Solaris 10

All Replies

Posted by egarcia on 19-Mar-2012 07:52

Hello,

There is an old thread related to this: http://communities.progress.com/pcom/message/114675#114675.

You can use the getpid() function in libc.so to get the PID:

     procedure getpid external 'libc.so' cdecl.

       define return parameter pid as long no-undo.

     end.

     def var p as int no-undo.

     run getpid (output p).

     message p.

I hope this helps.

Posted by Admin on 19-Mar-2012 11:25

Yep does the trick.

Thanks...

This thread is closed