Newer
Older
;;; -*- Package: SYSTEM -*-
;;;
;;; **********************************************************************
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/linux-os.lisp,v 1.3 2002/11/18 13:52:24 toy Exp $")
;;;
;;; **********************************************************************
;;;
;;;
;;; Written and maintained mostly by Skef Wholey and Rob MacLachlan.
;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too.
;;;
(in-package "SYSTEM")
(use-package "EXTENSIONS")
(export '(get-system-info get-page-size os-init))
(pushnew :linux *features*)
(setq *software-type* "Linux")
(defun software-version ()
"Returns a string describing version of the supporting software."
(when (probe-file "/proc/version")
(with-open-file (f "/proc/version")
(read-line f))))
;;; OS-Init initializes our operating-system interface.
;;;
(defun os-init () nil)
;;; GET-SYSTEM-INFO -- Interface
;;;
;;; Return system time, user time and number of page faults.
;;;
(defun get-system-info ()
(multiple-value-bind (err? utime stime maxrss ixrss idrss
isrss minflt majflt)
(unix:unix-getrusage unix:rusage_self)
(declare (ignore maxrss ixrss idrss isrss minflt))
(unless err?
(error "Unix system call getrusage failed: ~A."
(unix:get-unix-error-msg utime)))
(values utime stime majflt)))
;;; GET-PAGE-SIZE -- Interface
;;;
;;; Return the system page size.
;;;
(defun get-page-size ()
(multiple-value-bind (val err)
(unix:unix-getpagesize)
(unless val
(error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
val))