For the Compleat Fan
Jeff
Posts: 604 Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:
Post
by Jeff » Thu Mar 13, 2008 4:19 pm
Is there any way of intuiting the pid of the current process? If not, Lutz, is it possible to add this?
Jeff
=====
Old programmers don't die. They just parse on...
Artful code
Lutz
Posts: 5289 Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:
Post
by Lutz » Thu Mar 13, 2008 4:34 pm
This is the pid of the newLISP process you are in:
Code: Select all
> (import "libc.dylib" "getpid")
getpid <951021A4>
> (getpid)
1476
>
On other Unix the library is: libc.so
Jeff
Posts: 604 Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:
Post
by Jeff » Thu Mar 13, 2008 5:19 pm
Thanks, Lutz.
Jeff
=====
Old programmers don't die. They just parse on...
Artful code
Lutz
Posts: 5289 Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:
Post
by Lutz » Thu Mar 13, 2008 5:37 pm
newdep
Posts: 2038 Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands
Post
by newdep » Thu Mar 13, 2008 6:49 pm
Auch!.. Yes thisone I would like to have as a newlisp variable too..
..like "ostype" you could request "main-pid" very handy instead of calling
the library's all the time (which is no problem ofcourse but more
a cosmetic issue..)
-- (define? (Cornflakes))
Lutz
Posts: 5289 Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:
Post
by Lutz » Thu Mar 13, 2008 8:31 pm
Code: Select all
newLISP v.9.3.4 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.
> (sys-info -3)
2054
> (fork (println "pid:" (sys-info -3)))
2055
> pid:2055
> (sys-info -3)
2054
> (sys-info)
(366 268435456 362 1 0 2048 2054 9304 131)
>
newdep
Posts: 2038 Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands
Post
by newdep » Thu Mar 13, 2008 8:36 pm
Aaaaaaaaaaa thats a nice place to store that feature ;-) Great thanks !
-- (define? (Cornflakes))