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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.2.2 - (hide annotations)
Sat Mar 23 18:49:52 2002 UTC (12 years, 1 month ago) by pw
Branch: RELENG_18
CVS Tags: RELEASE_18d
Changes since 1.1.2.1: +7 -3 lines
Mega commit to bring RELENG_18 branch in sync with HEAD in preparation
for release tagging 18d.
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 pw 1.1.2.2 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/bsd-os.lisp,v 1.1.2.2 2002/03/23 18:49:52 pw Exp $")
9 ram 1.1 ;;;
10     ;;; **********************************************************************
11     ;;;
12 pw 1.1.2.1 ;;; OS interface functions for CMU CL under BSD Unix.
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 pw 1.1.2.1 ;;; Hacked into (Free)bsd-os.lisp by Paul Werkowski.
18 pw 1.1.2.2 ;;; Generalized a bit for OpenBSD by Pierre R. Mai.
19     ;;; Support for NetBSD by Pierre R. Mai.
20 ram 1.1
21     (in-package "SYSTEM")
22     (use-package "EXTENSIONS")
23     (export '(get-system-info get-page-size os-init))
24    
25     (pushnew :bsd *features*)
26    
27 pw 1.1.2.2 (setq *software-type* #+OpenBSD "OpenBSD"
28     #+NetBSD "NetBSD"
29     #+FreeBSD "FreeBSD"
30     #-(or FreeBSD NetBSD OpenBSD) "BSD")
31 pw 1.1.2.1
32     (defvar *software-version* nil "Version string for supporting software")
33 ram 1.1
34     (defun software-version ()
35     "Returns a string describing version of the supporting software."
36 pw 1.1.2.1 (unless *software-version*
37     (setf *software-version*
38     (string-trim '(#\newline)
39     (with-output-to-string (stream)
40     (run-program "/usr/bin/uname"
41     '("-r")
42     :output stream)))))
43     *software-version*)
44 ram 1.1
45    
46     ;;; OS-Init initializes our operating-system interface. It sets the values
47     ;;; of the global port variables to what they should be and calls the functions
48     ;;; that set up the argument blocks for the server interfaces.
49    
50     (defun os-init ()
51 pw 1.1.2.1 (setf *software-version* nil))
52 ram 1.1
53     ;;; GET-SYSTEM-INFO -- Interface
54     ;;;
55     ;;; Return system time, user time and number of page faults.
56     ;;;
57     (defun get-system-info ()
58     (multiple-value-bind (err? utime stime maxrss ixrss idrss
59     isrss minflt majflt)
60     (unix:unix-getrusage unix:rusage_self)
61     (declare (ignore maxrss ixrss idrss isrss minflt))
62     (unless err?
63     (error "Unix system call getrusage failed: ~A."
64     (unix:get-unix-error-msg utime)))
65    
66     (values utime stime majflt)))
67    
68    
69     ;;; GET-PAGE-SIZE -- Interface
70     ;;;
71     ;;; Return the system page size.
72     ;;;
73     (defun get-page-size ()
74     ;; probably should call getpagesize()
75     4096)

  ViewVC Help
Powered by ViewVC 1.1.5