/[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.8 - (hide annotations)
Wed Jul 13 13:40:55 2005 UTC (8 years, 9 months ago) by rtoy
Branch: MAIN
CVS Tags: double-double-array-base, double-double-init-sparc-2, double-double-base, snapshot-2007-05, snapshot-2006-11, snapshot-2006-10, double-double-init-sparc, snapshot-2006-12, snapshot-2007-01, snapshot-2007-02, release-19d, double-double-init-ppc, release-19c, release-19c-base, double-double-init-%make-sparc, snapshot-2007-03, snapshot-2007-04, snapshot-2007-07, snapshot-2007-06, double-double-array-checkpoint, double-double-reader-checkpoint-1, release-19d-base, double-double-irrat-end, release-19d-pre2, release-19d-pre1, double-double-init-checkpoint-1, double-double-reader-base, double-double-init-x86, snapshot-2005-11, double-double-sparc-checkpoint-1, snapshot-2005-10, snapshot-2005-12, release-19c-pre1, double-double-irrat-start, snapshot-2005-09, snapshot-2005-08, snapshot-2006-02, snapshot-2006-03, snapshot-2006-01, snapshot-2006-06, snapshot-2006-07, snapshot-2006-04, snapshot-2006-05, snapshot-2006-08, snapshot-2006-09
Branch point for: double-double-reader-branch, double-double-array-branch, release-19d-branch, double-double-branch, release-19c-branch
Changes since 1.7: +6 -1 lines
Build support for FreeBSD, based on patches from Eduardo Munoz.

code/bsd-os.lisp:
o Automatically define :freebsd4 and :elf, if compiling lisp has them
  defined.

tools/create-target.sh:
o Support FreeBSD.

tools/setenv-scripts/freebsd-features.lisp:
o New file with default (commented out) example for FreeBSD.
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 rtoy 1.8 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/bsd-os.lisp,v 1.8 2005/07/13 13:40:55 rtoy 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 ram 1.1
39 pmai 1.4 (setq *software-type* #+OpenBSD "OpenBSD"
40 pmai 1.5 #+NetBSD "NetBSD"
41 pmai 1.4 #+FreeBSD "FreeBSD"
42 pmai 1.7 #+Darwin "Darwin"
43     #-(or FreeBSD NetBSD OpenBSD Darwin) "BSD")
44 ram 1.1
45 dtc 1.3 (defvar *software-version* nil "Version string for supporting software")
46    
47 ram 1.1 (defun software-version ()
48     "Returns a string describing version of the supporting software."
49 dtc 1.3 (unless *software-version*
50     (setf *software-version*
51     (string-trim '(#\newline)
52     (with-output-to-string (stream)
53     (run-program "/usr/bin/uname"
54     '("-r")
55     :output stream)))))
56     *software-version*)
57 ram 1.1
58    
59     ;;; OS-Init initializes our operating-system interface. It sets the values
60     ;;; of the global port variables to what they should be and calls the functions
61     ;;; that set up the argument blocks for the server interfaces.
62    
63     (defun os-init ()
64 dtc 1.3 (setf *software-version* nil))
65 ram 1.1
66     ;;; GET-SYSTEM-INFO -- Interface
67     ;;;
68     ;;; Return system time, user time and number of page faults.
69     ;;;
70     (defun get-system-info ()
71     (multiple-value-bind (err? utime stime maxrss ixrss idrss
72     isrss minflt majflt)
73     (unix:unix-getrusage unix:rusage_self)
74     (declare (ignore maxrss ixrss idrss isrss minflt))
75     (unless err?
76     (error "Unix system call getrusage failed: ~A."
77     (unix:get-unix-error-msg utime)))
78    
79     (values utime stime majflt)))
80    
81    
82     ;;; GET-PAGE-SIZE -- Interface
83     ;;;
84     ;;; Return the system page size.
85     ;;;
86     (defun get-page-size ()
87 toy 1.6 (multiple-value-bind (val err)
88     (unix:unix-getpagesize)
89     (unless val
90     (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
91     val))
92    

  ViewVC Help
Powered by ViewVC 1.1.5