0.pre7.74:
[sbcl.git] / src / code / bsd-os.lisp
index e36b615..5567c3f 100644 (file)
@@ -4,9 +4,6 @@
 ;;;; Carnegie Mellon University, and has been placed in the public
 ;;;; domain.
 
-(sb!int:file-comment
-  "$Header$")
-
 (in-package "SB!SYS")
 
 ;;;; Check that target machine features are set up consistently with
        #!+FreeBSD "FreeBSD"
        #!+OpenBSD "OpenBSD"))
 
+(defvar *software-version* nil)
+
 (defun software-version ()
   #!+sb-doc
   "Return a string describing version of the supporting software, or NIL
    if not available."
-  #+nil ; won't work until we support RUN-PROGRAM..
-  (unless *software-version*
-    (setf *software-version*
-         (string-trim '(#\newline)
-                      (with-output-to-string (stream)
-                        (run-program "/usr/bin/uname"
-                                     '("-r")
-                                     :output stream)))))
-  nil)
+  (or *software-version*
+      (setf *software-version*
+           (string-trim '(#\newline)
+                        (with-output-to-string (stream)
+                          (sb!ext:run-program "/usr/bin/uname" `("-r")
+                                              :output stream))))))
 \f
-;;; OS-COLD-INIT-OR-REINIT initializes our operating-system interface.
-;;; It sets the values of the global port variables to what they
-;;; should be and calls the functions that set up the argument blocks
-;;; for the server interfaces.
 (defun os-cold-init-or-reinit ()
-  (setf *software-version* nil))
+  (setf *software-version* nil)
+  (setf *default-pathname-defaults*
+       ;; (temporary value, so that #'PATHNAME won't blow up when
+       ;; we call it below:)
+       (make-trivial-default-pathname)
+       *default-pathname-defaults*
+       ;; (final value, constructed using #'PATHNAME:)
+       (pathname (sb!unix:posix-getcwd/))))
 
 ;;; Return system time, user time and number of page faults.
 (defun get-system-info ()
@@ -49,8 +48,7 @@
                       (sb!unix:unix-getrusage sb!unix:rusage_self)
     (declare (ignore maxrss ixrss idrss isrss minflt))
     (unless err?
-      (error "Unix system call getrusage failed: ~A."
-            (sb!unix:get-unix-error-msg utime)))
+      (simple-perror "Unix system call getrusage() failed" :errno utime))
     
     (values utime stime majflt)))