newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Jeff on March 13, 2008, 09:19:35 AM

Title: pid of the current proc
Post by: Jeff on March 13, 2008, 09:19:35 AM
Is there any way of intuiting the pid of the current process?  If not, Lutz, is it possible to add this?
Title:
Post by: Lutz on March 13, 2008, 09:34:36 AM
This is the pid of the newLISP process you are in:


> (import "libc.dylib" "getpid")
getpid <951021A4>
> (getpid)
1476
>


On other Unix the library is: libc.so
Title:
Post by: Jeff on March 13, 2008, 10:19:08 AM
Thanks, Lutz.
Title:
Post by: Lutz on March 13, 2008, 10:37:56 AM
Here are more functions you can import from libc:



http://newlisp.nfshost.com/code/modules/unix.lsp.html
Title:
Post by: newdep on March 13, 2008, 11:49:02 AM
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..)
Title:
Post by: Lutz on March 13, 2008, 01:31:39 PM
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)
>
Title:
Post by: newdep on March 13, 2008, 01:36:14 PM
Aaaaaaaaaaa thats a nice place to store that feature ;-) Great thanks !