/[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 - (hide 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 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 toy 1.6 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/bsd-os.lisp,v 1.6 2002/11/18 13:52:24 toy Exp $")
9 ram 1.1 ;;;
10     ;;; **********************************************************************
11     ;;;
12 pw 1.2 ;;; 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.2 ;;; Hacked into (Free)bsd-os.lisp by Paul Werkowski.
18 pmai 1.4 ;;; Generalized a bit for OpenBSD by Pierre R. Mai.
19 pmai 1.5 ;;; 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 pmai 1.4 (setq *software-type* #+OpenBSD "OpenBSD"
28 pmai 1.5 #+NetBSD "NetBSD"
29 pmai 1.4 #+FreeBSD "FreeBSD"
30 pmai 1.5 #-(or FreeBSD NetBSD OpenBSD) "BSD")
31 ram 1.1
32 dtc 1.3 (defvar *software-version* nil "Version string for supporting software")
33    
34 ram 1.1 (defun software-version ()
35     "Returns a string describing version of the supporting software."
36 dtc 1.3 (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 dtc 1.3 (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 toy 1.6 (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