X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Flinux-os.lisp;h=640320e566e7b444aef387f9ce235d1bd76332d0;hb=77bf768d096845986af71ca5055c94c4abd626ed;hp=b7a235e126c7997146a9df8f097667d7cd2c654f;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/code/linux-os.lisp b/src/code/linux-os.lisp index b7a235e..640320e 100644 --- a/src/code/linux-os.lisp +++ b/src/code/linux-os.lisp @@ -1,4 +1,4 @@ -;;;; OS interface functions for CMU CL under Linux +;;;; OS interface functions for SBCL under Linux ;;;; This software is part of the SBCL system. See the README file for ;;;; more information. @@ -20,44 +20,29 @@ "Return a string describing the supporting software." (values "Linux")) +;;; FIXME: More duplicated logic here vrt. other oses. Abstract into +;;; uname-software-version? (defun software-version () #!+sb-doc "Return a string describing version of the supporting software, or NIL if not available." - ;; The old CMU CL code is NILed out here. If we wanted to do this, we should - ;; probably either use "/bin/uname -r", but since in any case we don't have - ;; RUN-PROGRAM working right now (sbcl-0.6.4), for now we just punt, - ;; returning NIL. - #+nil - (string-trim '(#\newline) - (with-output-to-string (stream) - (run-program "/usr/cs/etc/version" ; Site dependent??? - nil :output stream))) - nil) - -;;; 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 () ; KLUDGE: don't know what to do here - #!+sparc ;; Can't use #x20000000 thru #xDFFFFFFF, but mach tries to let us. - (sb!sys:allocate-system-memory-at (sb!sys:int-sap #x20000000) #xc0000000)) - -;;; Return system time, user time and number of page faults. + (or *software-version* + (setf *software-version* + (string-trim '(#\newline) + (with-output-to-string (stream) + (sb!ext:run-program "/bin/uname" `("-r") + :output stream)))))) + +;;; Return user time, system time, and number of page faults. (defun get-system-info () (multiple-value-bind (err? utime stime maxrss ixrss idrss isrss minflt majflt) (sb!unix:unix-getrusage sb!unix:rusage_self) (declare (ignore maxrss ixrss idrss isrss minflt)) (unless err? ; FIXME: nonmnemonic (reversed) name for ERR? - (error "Unix system call getrusage failed: ~A." - (sb!unix:get-unix-error-msg utime))) - + (error "Unix system call getrusage failed: ~A." (strerror utime))) (values utime stime majflt))) ;;; Return the system page size. (defun get-page-size () - ;; probably should call getpagesize() - ;; FIXME: Or we could just get rid of this, since the uses of it look - ;; disposable. - 4096) + sb!c:*backend-page-size*) \ No newline at end of file