/[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 - (show annotations)
Sat Mar 23 18:49:52 2002 UTC (12 years 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 ;;; -*- 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/bsd-os.lisp,v 1.1.2.2 2002/03/23 18:49:52 pw Exp $")
9 ;;;
10 ;;; **********************************************************************
11 ;;;
12 ;;; OS interface functions for CMU CL under BSD Unix.
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 ;;; Hacked into (Free)bsd-os.lisp by Paul Werkowski.
18 ;;; Generalized a bit for OpenBSD by Pierre R. Mai.
19 ;;; Support for NetBSD by Pierre R. Mai.
20
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 (setq *software-type* #+OpenBSD "OpenBSD"
28 #+NetBSD "NetBSD"
29 #+FreeBSD "FreeBSD"
30 #-(or FreeBSD NetBSD OpenBSD) "BSD")
31
32 (defvar *software-version* nil "Version string for supporting software")
33
34 (defun software-version ()
35 "Returns a string describing version of the supporting software."
36 (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
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 (setf *software-version* nil))
52
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