[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: idl process id

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 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>