/[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.11 - (hide annotations)
Tue Apr 20 17:57:44 2010 UTC (4 years ago) by rtoy
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, release-20b-pre1, release-20b-pre2, sparc-tramp-assem-2010-07-19, GIT-CONVERSION, cross-sol-x86-merged, RELEASE_20b, cross-sol-x86-base, snapshot-2010-12, snapshot-2010-11, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, snapshot-2010-05, snapshot-2010-07, snapshot-2010-06, snapshot-2010-08, cross-sol-x86-2010-12-20, cross-sparc-branch-base, HEAD
Branch point for: cross-sparc-branch, RELEASE-20B-BRANCH, sparc-tramp-assem-branch, cross-sol-x86-branch
Changes since 1.10: +3 -3 lines
Change uses of _"foo" to (intl:gettext "foo").  This is because slime
may get confused with source locations if the reader macros are
installed.
1 ram 1.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 rtoy 1.11 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/linux-os.lisp,v 1.11 2010/04/20 17:57:44 rtoy Rel $")
9 ram 1.1 ;;;
10     ;;; **********************************************************************
11     ;;;
12 toy 1.3 ;;; OS interface functions for CMUCL under Linux.
13 ram 1.1 ;;;
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 toy 1.3 ;;; Derived from mach-os.lisp by Paul Werkowski
18 ram 1.1
19     (in-package "SYSTEM")
20     (use-package "EXTENSIONS")
21 rtoy 1.9 (intl:textdomain "cmucl-linux-os")
22    
23 ram 1.1 (export '(get-system-info get-page-size os-init))
24    
25 fgilham 1.5 (register-lisp-feature :linux)
26     (register-lisp-feature :elf)
27 cshapiro 1.6 (register-lisp-runtime-feature :executable)
28 ram 1.1
29     (setq *software-type* "Linux")
30    
31 rtoy 1.7 ;;; Instead of reading /proc/version (which has some bugs with
32     ;;; select() in Linux kernel 2.6.x) and instead of running uname -r,
33     ;;; let's just get the info from uname().
34 ram 1.1 (defun software-version ()
35 rtoy 1.10 "Returns a string describing version of the supporting software."
36 rtoy 1.7 (multiple-value-bind (sysname nodename release version)
37     (unix:unix-uname)
38     (declare (ignore sysname nodename))
39     (concatenate 'string release " " version)))
40    
41 toy 1.3
42     ;;; OS-Init initializes our operating-system interface.
43     ;;;
44     (defun os-init () nil)
45 ram 1.1
46    
47     ;;; GET-SYSTEM-INFO -- Interface
48     ;;;
49     ;;; Return system time, user time and number of page faults.
50     ;;;
51     (defun get-system-info ()
52     (multiple-value-bind (err? utime stime maxrss ixrss idrss
53     isrss minflt majflt)
54     (unix:unix-getrusage unix:rusage_self)
55     (declare (ignore maxrss ixrss idrss isrss minflt))
56     (unless err?
57 rtoy 1.11 (error (intl:gettext "Unix system call getrusage failed: ~A.")
58 ram 1.1 (unix:get-unix-error-msg utime)))
59    
60     (values utime stime majflt)))
61    
62    
63     ;;; GET-PAGE-SIZE -- Interface
64     ;;;
65     ;;; Return the system page size.
66     ;;;
67     (defun get-page-size ()
68 toy 1.3 (multiple-value-bind (val err)
69     (unix:unix-getpagesize)
70     (unless val
71 rtoy 1.11 (error (intl:gettext "Getpagesize failed: ~A") (unix:get-unix-error-msg err)))
72 toy 1.3 val))
73 ram 1.1

  ViewVC Help
Powered by ViewVC 1.1.5