comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » idl process id
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
idl process id [message #11556] Mon, 20 April 1998 00:00 Go to next message
csaute3 is currently offline  csaute3
Messages: 10
Registered: March 1998
Junior Member
This is my setup:

IDL> help, !version, /str
** Structure !VERSION, 4 tags, length=32:
ARCH STRING 'sparc'
OS STRING 'sunos'
OS_FAMILY STRING 'unix'
RELEASE STRING '4.0.1'
IDL> print, getenv('SHELL')
/bin/tcsh
IDL> print, getenv('TERM')
xterm

I know that I can grab the IP address of my terminal this way:
IDL> print, getenv('DISPLAY')
255.255.255.255:0.0



How would I easily grab the process ID of my IDL session?
255.255.255.255:0.0



How would I easily grab the process ID of my IDL session?

I don't want to do "ps | grep idl" because of the result.

IDL> spawn,'ps | grep idl',result,/sh
IDL> print, result
23847 pd S 0:02 /usr/local/rsi/idl_4/bin/bin.sunos.4.1/idl
23852 pd S 0:00 sh -c ps | grep idl 23853 pd S 0:00 grep idl

There is an option on spawn to return the process ID:

IDL> spawn,'ps | grep idl',result,/sh,pid=processid
IDL> help, processid
PROCESSID LONG = 23852

But pid is for the child process. I would like the process id for
the "parent process."

Cathy Campo

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
Re: idl process id [message #11623 is a reply to message #11556] Fri, 24 April 1998 00:00 Go to previous message
korpela is currently offline  korpela
Messages: 59
Registered: September 1993
Member
In article <353FB8D8.DE9@bial1.ucsd.edu>,
David Foster <foster@bial1.ucsd.edu> wrote:
>> IDL> result=call_external('/lib/libc.so.1.9','getpid')
>> IDL> print,result
>> 23847
>
> Whoa! Does this work in any general sense? Do you have suggestions
> for getting references on which routines are available in which
> libraries? How "safe" is this?

It works for any libc routine that either takes no parameters,
or takes zero or another small integer as the only parameter.
For example time(0) works. That's because call_external uses
an (argc,void *argv[]) calling system. In the above example
the actual call that made is "getpid(0,some_random_pointer)".
Since caller removes the arguments under most systems, this
works as an equivalent of getpid().

As far as where routines are found, most general unix routines
will be in libc. (i.e. anything that doesn't require libraries
to be listed on the command line during a C compile.)

Eric

--
Eric Korpela | An object at rest can never be
korpela@ssl.berkeley.edu | stopped.
<a href="http://sag-www.ssl.berkeley.edu/~korpela">Click for home page.</a>
Re: idl process id [message #11628 is a reply to message #11556] Thu, 23 April 1998 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Eric J. Korpela wrote:
>
> If you really feel lucky you can try something like......
>
> IDL> ; check your libc version before doing this!
> IDL> result=call_external('/lib/libc.so.1.9','getpid')
> IDL> print,result
> 23847

Whoa! Does this work in any general sense? Do you have suggestions
for getting references on which routines are available in which
libraries? How "safe" is this?

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Data Handling
Next Topic: Re: Starting ftp from IDl

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:41:16 PDT 2025

Total time taken to generate the page: 0.48510 seconds