0.9.8.7:
[sbcl.git] / src / code / win32-os.lisp
1 ;;;; OS interface functions for SBCL under Win32.
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
11
12 (in-package "SB!SYS")
13
14 ;;; Check that target machine features are set up consistently with
15 ;;; this file.
16 #!-win32 (error "missing :WIN32 feature")
17
18 (defun software-type ()
19   #!+sb-doc
20   "Return a string describing the supporting software."
21   (values "Win32"))
22
23 (defvar *software-version* nil)
24
25 (defun software-version ()
26   #!+sb-doc
27   "Return a string describing version of the supporting software, or NIL
28   if not available."
29   nil ;; FIXME: Implement.
30   #+nil(or *software-version*
31       (setf *software-version*
32             (string-trim '(#\newline)
33                          (with-output-to-string (stream)
34                            (sb!ext:run-program "/bin/uname" `("-r")
35                                                :output stream))))))
36
37 (defun os-cold-init-or-reinit () ; KLUDGE: don't know what to do here
38   (/show0 "entering win32-os.lisp OS-COLD-INIT-OR-REINIT")
39   (setf *software-version* nil)
40   (/show0 "setting *DEFAULT-PATHNAME-DEFAULTS*")
41   (setf *default-pathname-defaults*
42         ;; (temporary value, so that #'NATIVE-PATHNAME won't blow up when
43         ;; we call it below:)
44         (make-trivial-default-pathname)
45         *default-pathname-defaults*
46         ;; (final value, constructed using #'NATIVE-PATHNAME:)
47         (native-pathname (sb!unix:posix-getcwd/)))
48   (/show0 "leaving linux-os.lisp OS-COLD-INIT-OR-REINIT"))
49
50 ;;; Return system time, user time and number of page faults.
51 (defun get-system-info ()
52 #+nil  (multiple-value-bind
53       (err? utime stime maxrss ixrss idrss isrss minflt majflt)
54       (sb!unix:unix-getrusage sb!unix:rusage_self)
55     (declare (ignore maxrss ixrss idrss isrss minflt))
56     (unless err? ; FIXME: nonmnemonic (reversed) name for ERR?
57       (error "Unix system call getrusage failed: ~A." (strerror utime)))
58     (values utime stime majflt)))
59
60 ;;; Return the system page size.
61 (defun get-page-size ()
62   ;; probably should call getpagesize()
63   ;; FIXME: Or we could just get rid of this, since the uses of it look
64   ;; disposable.
65   4096)