/[cmucl]/src/code/mach-os.lisp
ViewVC logotype

Contents of /src/code/mach-os.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12.58.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.12: +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/mach-os.lisp,v 1.12.58.1 2010/02/25 20:34:50 rtoy Exp $")
9 ;;;
10 ;;; **********************************************************************
11 ;;;
12 ;;; OS interface functions for CMU CL under Mach.
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 (in-package "SYSTEM")
18 (use-package "EXTENSIONS")
19 (intl:textdomain "cmucl")
20
21 (export '(get-system-info get-page-size os-init))
22 (export '(*task-self* *task-data* *task-notify*))
23
24 (pushnew :mach *features*)
25 (setq *software-type* "MACH/4.3BSD")
26
27 (defun software-version ()
28 "Returns a string describing version of the supporting software."
29 (string-trim '(#\newline)
30 (with-output-to-string (stream)
31 (run-program "/usr/cs/etc/version" ; Site dependent???
32 nil :output stream))))
33
34
35 ;;; OS-Init initializes our operating-system interface. It sets the values
36 ;;; of the global port variables to what they should be and calls the functions
37 ;;; that set up the argument blocks for the server interfaces.
38
39 (defvar *task-self*)
40
41 (defun os-init ()
42 (setf *task-self* (mach:mach-task_self))
43 #+sparc ;; Can't use #x20000000 thru #xDFFFFFFF, but mach tries to let us.
44 (system:allocate-system-memory-at (system:int-sap #x20000000) #xc0000000))
45
46
47 ;;; GET-SYSTEM-INFO -- Interface
48 ;;;
49 ;;; Return system time, user time and number of page faults. For
50 ;;; page-faults, we add pagein and pageout, since that is a somewhat more
51 ;;; interesting number than the total faults.
52 ;;;
53 (defun get-system-info ()
54 (multiple-value-bind (err? utime stime maxrss ixrss idrss
55 isrss minflt majflt)
56 (unix:unix-getrusage unix:rusage_self)
57 (declare (ignore maxrss ixrss idrss isrss minflt majflt))
58 (unless err?
59 (error "Unix system call getrusage failed: ~A."
60 (unix:get-unix-error-msg utime)))
61
62 (multiple-value-bind (gr ps fc ac ic wc zf ra in ot)
63 (mach:vm_statistics *task-self*)
64 (declare (ignore ps fc ac ic wc zf ra))
65 (mach:gr-error 'mach:vm_statistics gr)
66
67 (values utime stime (+ in ot)))))
68
69
70 ;;; GET-PAGE-SIZE -- Interface
71 ;;;
72 ;;; Return the system page size.
73 ;;;
74 (defun get-page-size ()
75 (mach:gr-call* mach:vm_statistics *task-self*))
76

  ViewVC Help
Powered by ViewVC 1.1.5