/[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.11 - (hide annotations)
Mon Jul 9 14:17:57 2007 UTC (6 years, 9 months ago) by fgilham
Branch: MAIN
CVS Tags: unicode-utf16-extfmt-2009-03-27, snapshot-2007-09, snapshot-2007-08, snapshot-2008-08, snapshot-2008-09, sse2-packed-2008-11-12, snapshot-2008-05, snapshot-2008-06, snapshot-2008-07, snapshot-2008-01, snapshot-2008-02, snapshot-2008-03, sse2-base, sse2-packed-base, release-19f-pre1, snapshot-2008-12, snapshot-2008-11, release-19e, unicode-utf16-sync-2008-12, label-2009-03-16, release-19f-base, merge-sse2-packed, merge-with-19f, unicode-snapshot-2009-05, unicode-utf16-sync-2008-07, unicode-utf16-sync-2008-09, unicode-utf16-extfmts-sync-2008-12, snapshot-2008-04, unicode-utf16-sync-label-2009-03-16, RELEASE_19f, unicode-utf16-char-support-2009-03-26, unicode-utf16-char-support-2009-03-25, unicode-utf16-extfmts-pre-sync-2008-11, snapshot-2008-10, unicode-utf16-sync-2008-11, release-19e-pre1, release-19e-pre2, label-2009-03-25, sse2-checkpoint-2008-10-01, sse2-merge-with-2008-11, sse2-merge-with-2008-10, unicode-utf16-string-support, release-19e-base, unicode-utf16-base, snapshot-2007-12, snapshot-2007-10, snapshot-2007-11, snapshot-2009-02, snapshot-2009-01, snapshot-2009-05, snapshot-2009-04, pre-telent-clx
Branch point for: RELEASE-19F-BRANCH, sse2-packed-branch, unicode-utf16-branch, release-19e-branch, sse2-branch, unicode-utf16-extfmt-branch
Changes since 1.10: +2 -2 lines
Change "register-lisp-feature" to "register-lisp-runtime-feature" for executable feature.
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 fgilham 1.11 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/bsd-os.lisp,v 1.11 2007/07/09 14:17:57 fgilham 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 pmai 1.7 ;;; Support for Darwin by Pierre R. Mai.
21 ram 1.1
22     (in-package "SYSTEM")
23     (use-package "EXTENSIONS")
24     (export '(get-system-info get-page-size os-init))
25    
26 pmai 1.7 (register-lisp-feature :bsd)
27    
28     (register-lisp-feature #+OpenBSD :OpenBSD
29     #+NetBSD :NetBSD
30     #+FreeBSD :FreeBSD
31     #+Darwin :Darwin
32     #-(or FreeBSD NetBSD OpenBSD Darwin) :bsd)
33 rtoy 1.8
34     #+freebsd4
35     (register-lisp-feature :freebsd4)
36     #+elf
37     (register-lisp-feature :elf)
38 cshapiro 1.9 #+mach-o
39     (register-lisp-feature :mach-o)
40 ram 1.1
41 fgilham 1.10 #+freebsd
42 fgilham 1.11 (register-lisp-runtime-feature :executable)
43 fgilham 1.10
44 pmai 1.4 (setq *software-type* #+OpenBSD "OpenBSD"
45 pmai 1.5 #+NetBSD "NetBSD"
46 pmai 1.4 #+FreeBSD "FreeBSD"
47 pmai 1.7 #+Darwin "Darwin"
48     #-(or FreeBSD NetBSD OpenBSD Darwin) "BSD")
49 ram 1.1
50 dtc 1.3 (defvar *software-version* nil "Version string for supporting software")
51    
52 ram 1.1 (defun software-version ()
53     "Returns a string describing version of the supporting software."
54 dtc 1.3 (unless *software-version*
55     (setf *software-version*
56     (string-trim '(#\newline)
57     (with-output-to-string (stream)
58     (run-program "/usr/bin/uname"
59     '("-r")
60     :output stream)))))
61     *software-version*)
62 ram 1.1
63    
64     ;;; OS-Init initializes our operating-system interface. It sets the values
65     ;;; of the global port variables to what they should be and calls the functions
66     ;;; that set up the argument blocks for the server interfaces.
67    
68     (defun os-init ()
69 dtc 1.3 (setf *software-version* nil))
70 ram 1.1
71     ;;; GET-SYSTEM-INFO -- Interface
72     ;;;
73     ;;; Return system time, user time and number of page faults.
74     ;;;
75     (defun get-system-info ()
76     (multiple-value-bind (err? utime stime maxrss ixrss idrss
77     isrss minflt majflt)
78     (unix:unix-getrusage unix:rusage_self)
79     (declare (ignore maxrss ixrss idrss isrss minflt))
80     (unless err?
81     (error "Unix system call getrusage failed: ~A."
82     (unix:get-unix-error-msg utime)))
83    
84     (values utime stime majflt)))
85    
86    
87     ;;; GET-PAGE-SIZE -- Interface
88     ;;;
89     ;;; Return the system page size.
90     ;;;
91     (defun get-page-size ()
92 toy 1.6 (multiple-value-bind (val err)
93     (unix:unix-getpagesize)
94     (unless val
95     (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
96     val))
97    

  ViewVC Help
Powered by ViewVC 1.1.5