[plt-scheme] current process id

From: Tim Brown (tim.brown at cityc.co.uk)
Date: Fri Feb 6 05:48:39 EST 2004

I'm kinda new to the scheme mindset, so please would
someone tell me if this is preferable to writing an extension
module wrapping getpid().

Would this not lead to a more portable approach, since you'd
be forced to reimplement this properly for (say) Windows or
other system (such as HPUX) that doesn't implement "/proc"
(or similar).

Or am I thinking like a C programmer?

tim


Eli Barzilay wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> On Feb  5, David J. Neu wrote:
> 
>>Hi all,
>>
>>I'm wondering if there is a way to determine the current process id
>>from within a mzscheme program?
> 
> 
> I don't think that there is any way to do it completely from inside
> MzScheme (it would probably be a useful extension).  Anyway, if you're
> using Linux, a simple way to get the current pid is:
> 
>   (string->number (resolve-path "/proc/self"))
> 
> I found similar tricks for Sun (cd into /proc/self, then check the
> current directory), and FreeBSD (use "/proc/curproc").
> 

-- 
Tim Brown <tim.brown at cityc.co.uk> |            City Computing Limited |
T: +44 20 8770 2110               |      City House, Sutton Park Road |
F: +44 20 8770 2130               |       Sutton, Surrey, SM1 2AE, GB |
BEAUTY: What's in your eye when you have a bee in your hand.__________/




Posted on the users mailing list.