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

Home » Public Forums » archive » Re: getpid in Mac OS X
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: getpid in Mac OS X [message #39773 is a reply to message #39771] Mon, 14 June 2004 06:07 Go to previous messageGo to previous message
Miguel Angel Cordoba is currently offline  Miguel Angel Cordoba
Messages: 13
Registered: April 2004
Junior Member
Thank you,
but this solution only works if only one IDL process is running. In my
case there are 4 processes and I need all the PID's.

Regards.

M. Katz wrote:

> Here's a possible solution. It's more of a stopgap than anything
> elegant....
> When you spawn, 'ps' you get output that looks like this
>
> PID TT STAT TIME COMMAND 486 std Ss 0:00.27 -csh
> 614 std S+ 0:23.30 /Applications/idl_6.0/bin/bin.darwin.ppc/idl
> 734 std R+ 0:00.05 tcsh -c ps
>
> So we'll use that output to look for the corrent line, and identify
> the ID as 614 in this case
>
> === code snippet ===
> pid = -1 ;--- default value means unknown PID
>
> if (!version.os EQ 'darwin') then begin ;--- we're on a Mac
> spawn, 'ps', list ;--- this returns a long list of processes
> ;--- My IDL app lives in /Applications, so here I'm looking for
> a
> ; line that has "/Applications" and "idl" in the line.
> ; If your IDL app lives somewhere else, change this to
> something else
> ;--- Find which process might be the right one.
> w = where((strpos(list, 'Applications') GT 0) and (strpos(list,
> 'idl') GT 0), count)
> if (count GT 0) then $
> pid = long( (strsplit(list(w), ' ', /EXTRACT))(0) )
> endif
> === end of code snippet ===
>
> Miguel Angel Cordoba <cordoba_nospam@grahi.upc.es> wrote in message news:<40C9B961.8000605@grahi.upc.es>...
>
>
>> Hi,
>> I want to get the process identification (pid) of my IDL. In
>> Linux I get the pid calling:
>>
>> pid=CALL_EXTERNAL('/usr/lib/i686/libc.so.6','getpid')
>>
>> but this library doesn't exist in Mac Os X. I had probed with
>> the '/usr/lib/libc.dylib' but didn't work. Any ideas?
>>
>> IDL>pid=CALL_EXTERNAL('/usr/lib/libc.dylib','getpid')
>> % CALL_EXTERNAL: Error loading sharable exectuble.
>> Symbol: getpid, FILE=/usr/lib/libc.dylib
>> not a Mach-O MH-BUNDLE file type
>>
>> Thanks a lot.
>>
>> --
>> _________________________________________________________
>> Miguel Angel Cordoba
>>
>>

--
_________________________________________________________
Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
Tel. +34 934 017 371
Fax. +34 934 054 194
---------------------------------------------------------
Grup de Recerca Aplicada en Hidrometeorologia (GRAHI-UPC)
http://www.grahi.upc.es
---------------------------------------------------------
Centre membre de la Xarxa d'Innovacio Tecnologica XIT
http://www.cidem.com/xarxait
_________________________________________________________
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: dates transformation
Next Topic: Re: dates transformation

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

Current Time: Sat Oct 11 09:12:51 PDT 2025

Total time taken to generate the page: 1.03977 seconds