/[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.6.1 - (show annotations)
Tue May 12 16:31:48 2009 UTC (4 years, 11 months ago) by rtoy
Branch: unicode-utf16-extfmt-branch
CVS Tags: unicode-snapshot-2009-06, unicode-utf16-extfmt-2009-06-11
Changes since 1.11: +1 -2 lines
o Lots of spelling fixes from Paul.
o Add unicode codepoints in final-sigma.lisp (in case the characters
  there don't show up correctly).
o Support partial-fill in READ-INTO-STRING.
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.11.6.1 2009/05/12 16:31:48 rtoy 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 ;;; Support for Darwin by Pierre R. Mai.
21
22 (in-package "SYSTEM")
23 (use-package "EXTENSIONS")
24 (export '(get-system-info get-page-size os-init))
25
26 (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
34 #+freebsd4
35 (register-lisp-feature :freebsd4)
36 #+elf
37 (register-lisp-feature :elf)
38 #+mach-o
39 (register-lisp-feature :mach-o)
40
41 #+freebsd
42 (register-lisp-runtime-feature :executable)
43
44 (setq *software-type* #+OpenBSD "OpenBSD"
45 #+NetBSD "NetBSD"
46 #+FreeBSD "FreeBSD"
47 #+Darwin "Darwin"
48 #-(or FreeBSD NetBSD OpenBSD Darwin) "BSD")
49
50 (defvar *software-version* nil "Version string for supporting software")
51
52 (defun software-version ()
53 "Returns a string describing version of the supporting software."
54 (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
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 (setf *software-version* nil))
70
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 (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))

  ViewVC Help
Powered by ViewVC 1.1.5