/[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.13 - (hide annotations)
Sat Oct 10 03:00:03 2009 UTC (4 years, 6 months ago) by agoncharov
Branch: MAIN
CVS Tags: amd64-dd-start, intl-2-branch-base, pre-merge-intl-branch, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, snapshot-2009-11, snapshot-2009-12, intl-branch-base
Branch point for: amd64-dd-branch, intl-branch, intl-2-branch
Changes since 1.12: +5 -7 lines
Remove the "freebsd4" feature from the, well, FreeBSD product
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 agoncharov 1.13 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/bsd-os.lisp,v 1.13 2009/10/10 03:00:03 agoncharov 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 agoncharov 1.13 #+freebsd :freebsd
31 pmai 1.7 #+Darwin :Darwin
32 agoncharov 1.13 #-(or freebsd NetBSD OpenBSD Darwin) :bsd)
33 rtoy 1.8
34     #+elf
35     (register-lisp-feature :elf)
36 cshapiro 1.9 #+mach-o
37     (register-lisp-feature :mach-o)
38 ram 1.1
39 fgilham 1.10 #+freebsd
40 fgilham 1.11 (register-lisp-runtime-feature :executable)
41 fgilham 1.10
42 pmai 1.4 (setq *software-type* #+OpenBSD "OpenBSD"
43 pmai 1.5 #+NetBSD "NetBSD"
44 agoncharov 1.13 #+freebsd "FreeBSD"
45 pmai 1.7 #+Darwin "Darwin"
46 agoncharov 1.13 #-(or freebsd NetBSD OpenBSD Darwin) "BSD")
47 ram 1.1
48 dtc 1.3 (defvar *software-version* nil "Version string for supporting software")
49    
50 ram 1.1 (defun software-version ()
51     "Returns a string describing version of the supporting software."
52 dtc 1.3 (unless *software-version*
53     (setf *software-version*
54     (string-trim '(#\newline)
55     (with-output-to-string (stream)
56     (run-program "/usr/bin/uname"
57     '("-r")
58     :output stream)))))
59     *software-version*)
60 ram 1.1
61    
62     ;;; OS-Init initializes our operating-system interface. It sets the values
63     ;;; of the global port variables to what they should be and calls the functions
64     ;;; that set up the argument blocks for the server interfaces.
65    
66     (defun os-init ()
67 dtc 1.3 (setf *software-version* nil))
68 ram 1.1
69     ;;; GET-SYSTEM-INFO -- Interface
70     ;;;
71     ;;; Return system time, user time and number of page faults.
72     ;;;
73     (defun get-system-info ()
74     (multiple-value-bind (err? utime stime maxrss ixrss idrss
75     isrss minflt majflt)
76     (unix:unix-getrusage unix:rusage_self)
77     (declare (ignore maxrss ixrss idrss isrss minflt))
78     (unless err?
79     (error "Unix system call getrusage failed: ~A."
80     (unix:get-unix-error-msg utime)))
81    
82     (values utime stime majflt)))
83    
84    
85     ;;; GET-PAGE-SIZE -- Interface
86     ;;;
87     ;;; Return the system page size.
88     ;;;
89     (defun get-page-size ()
90 toy 1.6 (multiple-value-bind (val err)
91     (unix:unix-getpagesize)
92     (unless val
93     (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
94     val))

  ViewVC Help
Powered by ViewVC 1.1.5