/[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 - (show 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 ;;; -*- 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.14.1 2010/02/25 20:34:50 rtoy 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 (intl:textdomain "cmucl")
22
23 (export '(get-system-info get-page-size os-init))
24
25 (register-lisp-feature :linux)
26 (register-lisp-feature :elf)
27 (register-lisp-runtime-feature :executable)
28
29 (setq *software-type* "Linux")
30
31 ;;; 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 (defun software-version ()
35 "Returns a string describing version of the supporting software."
36 (multiple-value-bind (sysname nodename release version)
37 (unix:unix-uname)
38 (declare (ignore sysname nodename))
39 (concatenate 'string release " " version)))
40
41
42 ;;; OS-Init initializes our operating-system interface.
43 ;;;
44 (defun os-init () nil)
45
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 (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

  ViewVC Help
Powered by ViewVC 1.1.5