/[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.6 - (show annotations)
Mon Nov 18 13:52:24 2002 UTC (11 years, 5 months ago) by toy
Branch: MAIN
CVS Tags: snapshot-2003-10, release-18e-base, remove_negative_zero_not_zero, snapshot-2004-05, snapshot-2004-06, snapshot-2004-07, dynamic-extent-base, mod-arith-base, sparc_gencgc_merge, amd64-merge-start, release-18e-pre2, prm-before-macosx-merge-tag, cold-pcl-base, snapshot-2003-11, release-19a-base, sparc_gencgc, snapshot-2003-12, release-19a-pre1, release-19a-pre3, release-19a-pre2, release-19a, release-18e, snapshot-2004-04, lisp-executable-base, release-18e-pre1
Branch point for: mod-arith-branch, sparc_gencgc_branch, dynamic-extent, lisp-executable, release-18e-branch, cold-pcl, release-19a-branch
Changes since 1.5: +7 -3 lines
From Eric Marsden:

   Under Linux, the SOFTWARE-VERSION function now returns information
   on the current kernel taken from /proc/version (instead of "n/a").
   Under Linux and xBSD, the internal GET-PAGE-SIZE function obtains
   the page size from the operating system via the getpagesize()
   library call, instead of returning a hard-coded value.

A few random typos were also fixed.
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.6 2002/11/18 13:52:24 toy 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 (multiple-value-bind (val err)
75 (unix:unix-getpagesize)
76 (unless val
77 (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
78 val))
79

  ViewVC Help
Powered by ViewVC 1.1.5