r10227: updates from phoview@lynx
[kmrcl.git] / os.lisp
diff --git a/os.lisp b/os.lisp
index cce2a2f99fe80f7b221487d08d01ad1f2a20a3c1..9eece913162b90f4b8c9bf9cab0c84749fdcd3b4 100644 (file)
--- a/os.lisp
+++ b/os.lisp
@@ -159,3 +159,21 @@ returns (VALUES output-string pid)"
     #-allegro
     (with-open-file (in file :direction :input)
       (file-length in))))
+
+(defun getpid ()
+  "Return the PID of the lisp process."
+  #+allegro (excl::getpid)
+  #+(and lispworks win32) (win32:get-current-process-id)
+  #+(and lispworks (not win32)) (system::getpid)
+  #+sbcl (sb-posix:getpid)
+  #+cmu (unix:unix-getpid)
+  #+openmcl (ccl:getpid)
+  #+(and clisp unix) (system::program-id)
+  #+(and clisp win32) (cond ((find-package :win32)
+                            (funcall (find-symbol "GetCurrentProcessId" 
+                                                  :win32)))
+                           (t
+                            (system::getenv "PID")))
+  )
+
+