/[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.14.1 - (hide annotations)
Thu Feb 25 20:34:50 2010 UTC (4 years, 1 month ago) by rtoy
Branch: intl-2-branch
Changes since 1.8: +3 -1 lines
Restart internalization work.  This new branch starts with code from
the intl-branch on date 2010-02-12 18:00:00+0500.  This version works
and

LANG=en@piglatin bin/lisp

works (once the piglatin translation is added).
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.8.14.1 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/linux-os.lisp,v 1.8.14.1 2010/02/25 20:34:50 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.8.14.1 (intl:textdomain "cmucl")
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     "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     (error "Unix system call getrusage failed: ~A."
58     (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     (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
72     val))
73 ram 1.1

  ViewVC Help
Powered by ViewVC 1.1.5