/[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.7 - (hide annotations)
Sat Feb 29 02:29:53 1992 UTC (22 years, 1 month ago) by wlott
Branch: MAIN
Changes since 1.6: +12 -2 lines
Moved OS-INIT into mumble-os.lisp
1 wlott 1.5 ;;; -*- Package: SYSTEM -*-
2 ram 1.1 ;;;
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 wlott 1.7 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/mach-os.lisp,v 1.7 1992/02/29 02:29:53 wlott Exp $")
11 ram 1.1 ;;;
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 ram 1.2 (use-package "EXTENSIONS")
21 wlott 1.7 (export '(get-system-info get-page-size os-init))
22 ram 1.1
23     (pushnew :mach *features*)
24     (setq *software-type* "MACH/4.3BSD")
25    
26     (defconstant foreign-segment-start #x00C00000)
27     (defconstant foreign-segment-size #x00400000)
28    
29     (defun software-version ()
30     "Returns a string describing version of the supporting software."
31     (string-trim '(#\newline)
32     (with-output-to-string (stream)
33     (run-program "/usr/cs/etc/version" ; Site dependent???
34     nil :output stream))))
35 wlott 1.7
36     ;;; OS-Init initializes our operating-system interface. It sets the values
37     ;;; of the global port variables to what they should be and calls the functions
38     ;;; that set up the argument blocks for the server interfaces.
39    
40     (defun os-init ()
41     (setf *task-self* (mach:mach-task_self))
42     (setf *task-data* (mach:mach-task_data))
43     (setf *task-notify* (mach:mach-task_notify)))
44    
45 ram 1.1
46     ;;; GET-SYSTEM-INFO -- Interface
47     ;;;
48     ;;; Return system time, user time and number of page faults. For
49     ;;; page-faults, we add pagein and pageout, since that is a somewhat more
50     ;;; interesting number than the total faults.
51     ;;;
52     (defun get-system-info ()
53 wlott 1.3 (multiple-value-bind (err? utime stime maxrss ixrss idrss
54     isrss minflt majflt)
55 wlott 1.4 (unix:unix-getrusage unix:rusage_self)
56 wlott 1.3 (declare (ignore maxrss ixrss idrss isrss minflt majflt))
57     (unless err?
58     (error "Unix system call getrusage failed: ~A."
59     (unix:get-unix-error-msg utime)))
60    
61     (multiple-value-bind (gr ps fc ac ic wc zf ra in ot)
62     (mach:vm_statistics *task-self*)
63     (declare (ignore ps fc ac ic wc zf ra))
64 wlott 1.5 (mach:gr-error 'mach:vm_statistics gr)
65 wlott 1.3
66     (values utime stime (+ in ot)))))
67 ram 1.1
68    
69     ;;; GET-PAGE-SIZE -- Interface
70     ;;;
71     ;;; Return the system page size.
72     ;;;
73     (defun get-page-size ()
74 wlott 1.6 (mach:gr-call* mach:vm_statistics *task-self*))
75 wlott 1.3

  ViewVC Help
Powered by ViewVC 1.1.5