/[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.8 - (show annotations)
Thu Jun 11 16:03:58 2009 UTC (4 years, 10 months ago) by rtoy
Branch: MAIN
CVS Tags: merged-unicode-utf16-extfmt-2009-06-11, unicode-string-buffer-impl-base, unicode-string-buffer-base, amd64-dd-start, intl-2-branch-base, release-20a-base, pre-merge-intl-branch, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, RELEASE_20a, release-20a-pre1, snapshot-2009-11, snapshot-2009-12, portable-clx-import-2009-06-16, intl-branch-base, portable-clx-base, snapshot-2009-08, snapshot-2009-07
Branch point for: portable-clx-branch, unicode-string-buffer-branch, RELEASE-20A-BRANCH, amd64-dd-branch, unicode-string-buffer-impl-branch, intl-branch, intl-2-branch
Changes since 1.7: +1 -2 lines
Merge Unicode work to trunk.  From label
unicode-utf16-extfmt-2009-06-11.
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.8 2009/06/11 16:03:58 rtoy Rel $")
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 (register-lisp-feature :linux)
24 (register-lisp-feature :elf)
25 (register-lisp-runtime-feature :executable)
26
27 (setq *software-type* "Linux")
28
29 ;;; Instead of reading /proc/version (which has some bugs with
30 ;;; select() in Linux kernel 2.6.x) and instead of running uname -r,
31 ;;; let's just get the info from uname().
32 (defun software-version ()
33 "Returns a string describing version of the supporting software."
34 (multiple-value-bind (sysname nodename release version)
35 (unix:unix-uname)
36 (declare (ignore sysname nodename))
37 (concatenate 'string release " " version)))
38
39
40 ;;; OS-Init initializes our operating-system interface.
41 ;;;
42 (defun os-init () nil)
43
44
45 ;;; GET-SYSTEM-INFO -- Interface
46 ;;;
47 ;;; Return system time, user time and number of page faults.
48 ;;;
49 (defun get-system-info ()
50 (multiple-value-bind (err? utime stime maxrss ixrss idrss
51 isrss minflt majflt)
52 (unix:unix-getrusage unix:rusage_self)
53 (declare (ignore maxrss ixrss idrss isrss minflt))
54 (unless err?
55 (error "Unix system call getrusage failed: ~A."
56 (unix:get-unix-error-msg utime)))
57
58 (values utime stime majflt)))
59
60
61 ;;; GET-PAGE-SIZE -- Interface
62 ;;;
63 ;;; Return the system page size.
64 ;;;
65 (defun get-page-size ()
66 (multiple-value-bind (val err)
67 (unix:unix-getpagesize)
68 (unless val
69 (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
70 val))
71

  ViewVC Help
Powered by ViewVC 1.1.5