/[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.8 - (show annotations)
Thu Mar 26 03:21:16 1992 UTC (22 years ago) by wlott
Branch: MAIN
Changes since 1.7: +7 -1 lines
Moved exports/defvars for *task-{self,data,notify}* from lispinit to here.
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 ;;; If you want to use this code or any part of CMU Common Lisp, please contact
7 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
8 ;;;
9 (ext:file-comment
10 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/mach-os.lisp,v 1.8 1992/03/26 03:21:16 wlott Exp $")
11 ;;;
12 ;;; **********************************************************************
13 ;;;
14 ;;; OS interface functions for CMU CL under Mach.
15 ;;;
16 ;;; Written and maintained mostly by Skef Wholey and Rob MacLachlan.
17 ;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too.
18 ;;;
19 (in-package "SYSTEM")
20 (use-package "EXTENSIONS")
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 (defconstant foreign-segment-start #x00C00000)
28 (defconstant foreign-segment-size #x00400000)
29
30 (defun software-version ()
31 "Returns a string describing version of the supporting software."
32 (string-trim '(#\newline)
33 (with-output-to-string (stream)
34 (run-program "/usr/cs/etc/version" ; Site dependent???
35 nil :output stream))))
36
37
38 ;;; OS-Init initializes our operating-system interface. It sets the values
39 ;;; of the global port variables to what they should be and calls the functions
40 ;;; that set up the argument blocks for the server interfaces.
41
42 (defvar *task-self*)
43 (defvar *task-data*)
44 (defvar *task-notify*)
45
46 (defun os-init ()
47 (setf *task-self* (mach:mach-task_self))
48 (setf *task-data* (mach:mach-task_data))
49 (setf *task-notify* (mach:mach-task_notify)))
50
51
52 ;;; GET-SYSTEM-INFO -- Interface
53 ;;;
54 ;;; Return system time, user time and number of page faults. For
55 ;;; page-faults, we add pagein and pageout, since that is a somewhat more
56 ;;; interesting number than the total faults.
57 ;;;
58 (defun get-system-info ()
59 (multiple-value-bind (err? utime stime maxrss ixrss idrss
60 isrss minflt majflt)
61 (unix:unix-getrusage unix:rusage_self)
62 (declare (ignore maxrss ixrss idrss isrss minflt majflt))
63 (unless err?
64 (error "Unix system call getrusage failed: ~A."
65 (unix:get-unix-error-msg utime)))
66
67 (multiple-value-bind (gr ps fc ac ic wc zf ra in ot)
68 (mach:vm_statistics *task-self*)
69 (declare (ignore ps fc ac ic wc zf ra))
70 (mach:gr-error 'mach:vm_statistics gr)
71
72 (values utime stime (+ in ot)))))
73
74
75 ;;; GET-PAGE-SIZE -- Interface
76 ;;;
77 ;;; Return the system page size.
78 ;;;
79 (defun get-page-size ()
80 (mach:gr-call* mach:vm_statistics *task-self*))
81

  ViewVC Help
Powered by ViewVC 1.1.5