1.0.22.22: (SETF FIND-CLASSOID) to drop DEFTYPE lambda-lists and source-locations
[sbcl/tcr.git] / src / code / linux-os.lisp
blob640320e566e7b444aef387f9ce235d1bd76332d0
1 ;;;; OS interface functions for SBCL under Linux
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!SYS")
14 ;;; Check that target machine features are set up consistently with
15 ;;; this file.
16 #!-linux (error "missing :LINUX feature")
18 (defun software-type ()
19 #!+sb-doc
20 "Return a string describing the supporting software."
21 (values "Linux"))
23 ;;; FIXME: More duplicated logic here vrt. other oses. Abstract into
24 ;;; uname-software-version?
25 (defun software-version ()
26 #!+sb-doc
27 "Return a string describing version of the supporting software, or NIL
28 if not available."
29 (or *software-version*
30 (setf *software-version*
31 (string-trim '(#\newline)
32 (with-output-to-string (stream)
33 (sb!ext:run-program "/bin/uname" `("-r")
34 :output stream))))))
36 ;;; Return user time, system time, and number of page faults.
37 (defun get-system-info ()
38 (multiple-value-bind
39 (err? utime stime maxrss ixrss idrss isrss minflt majflt)
40 (sb!unix:unix-getrusage sb!unix:rusage_self)
41 (declare (ignore maxrss ixrss idrss isrss minflt))
42 (unless err? ; FIXME: nonmnemonic (reversed) name for ERR?
43 (error "Unix system call getrusage failed: ~A." (strerror utime)))
44 (values utime stime majflt)))
46 ;;; Return the system page size.
47 (defun get-page-size ()
48 sb!c:*backend-page-size*)