/[cmucl]/src/code/linux-os.lisp
ViewVC logotype

Contents of /src/code/linux-os.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Nov 18 13:52:24 2002 UTC (11 years, 5 months ago) by toy
Branch: MAIN
CVS Tags: snapshot-2003-10, release-18e-base, remove_negative_zero_not_zero, snapshot-2004-05, snapshot-2004-06, dynamic-extent-base, mod-arith-base, sparc_gencgc_merge, amd64-merge-start, release-18e-pre2, cold-pcl-base, snapshot-2003-11, release-19a-base, sparc_gencgc, snapshot-2003-12, release-19a-pre1, release-19a-pre2, release-18e, snapshot-2004-04, lisp-executable-base, release-18e-pre1
Branch point for: mod-arith-branch, sparc_gencgc_branch, dynamic-extent, lisp-executable, release-18e-branch, cold-pcl, release-19a-branch
Changes since 1.2: +16 -22 lines
From Eric Marsden:

   Under Linux, the SOFTWARE-VERSION function now returns information
   on the current kernel taken from /proc/version (instead of "n/a").
   Under Linux and xBSD, the internal GET-PAGE-SIZE function obtains
   the page size from the operating system via the getpagesize()
   library call, instead of returning a hard-coded value.

A few random typos were also fixed.
1 ;;; -*- Package: SYSTEM -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;;
7 (ext:file-comment
8 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/linux-os.lisp,v 1.3 2002/11/18 13:52:24 toy Exp $")
9 ;;;
10 ;;; **********************************************************************
11 ;;;
12 ;;; OS interface functions for CMUCL under Linux.
13 ;;;
14 ;;; Written and maintained mostly by Skef Wholey and Rob MacLachlan.
15 ;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too.
16 ;;;
17 ;;; Derived from mach-os.lisp by Paul Werkowski
18
19 (in-package "SYSTEM")
20 (use-package "EXTENSIONS")
21 (export '(get-system-info get-page-size os-init))
22
23 (pushnew :linux *features*)
24
25 (setq *software-type* "Linux")
26
27 (defun software-version ()
28 "Returns a string describing version of the supporting software."
29 (when (probe-file "/proc/version")
30 (with-open-file (f "/proc/version")
31 (read-line f))))
32
33
34 ;;; OS-Init initializes our operating-system interface.
35 ;;;
36 (defun os-init () nil)
37
38
39 ;;; GET-SYSTEM-INFO -- Interface
40 ;;;
41 ;;; Return system time, user time and number of page faults.
42 ;;;
43 (defun get-system-info ()
44 (multiple-value-bind (err? utime stime maxrss ixrss idrss
45 isrss minflt majflt)
46 (unix:unix-getrusage unix:rusage_self)
47 (declare (ignore maxrss ixrss idrss isrss minflt))
48 (unless err?
49 (error "Unix system call getrusage failed: ~A."
50 (unix:get-unix-error-msg utime)))
51
52 (values utime stime majflt)))
53
54
55 ;;; GET-PAGE-SIZE -- Interface
56 ;;;
57 ;;; Return the system page size.
58 ;;;
59 (defun get-page-size ()
60 (multiple-value-bind (val err)
61 (unix:unix-getpagesize)
62 (unless val
63 (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
64 val))
65

  ViewVC Help
Powered by ViewVC 1.1.5