/[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.10 - (hide annotations)
Mon Apr 19 02:18:04 2010 UTC (3 years, 11 months ago) by rtoy
Branch: MAIN
Changes since 1.9: +2 -2 lines
Remove _N"" reader macro from docstrings when possible.
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.10 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/linux-os.lisp,v 1.10 2010/04/19 02:18:04 rtoy Exp $")
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.9 (error _"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.9 (error _"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