1.0.15.38: One more fix for Win32 (oops)
[sbcl/eslaughter.git] / src / code / common-os.lisp
blob7de4d4632da54493a6f8b83b160dc15c59f047d7
1 ;;;; OS interface functions for SBCL common to all target OSes
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.
12 (in-package "SB!SYS")
14 (defvar *software-version* nil)
16 (defvar *core-pathname* nil
17 #!+sb-doc
18 "The absolute pathname of the running SBCL core.")
20 (sb!alien:define-alien-variable ("posix_argv" *native-posix-argv*) (* (* char)))
21 (sb!alien:define-alien-variable ("core_string" *native-core-string*) (* char))
23 ;;; if something ever needs to be done differently for one OS, then
24 ;;; split out the different part into per-os functions.
25 (defun os-cold-init-or-reinit ()
26 (/show0 "setting *CORE-STRING*")
27 (setf *core-string*
28 (sb!alien:cast *native-core-string* sb!alien:c-string))
29 (/show0 "setting *POSIX-ARGV*")
30 (setf sb!ext:*posix-argv*
31 (loop for i from 0
32 for arg = (sb!alien:deref *native-posix-argv* i)
33 until (sb!alien:null-alien arg)
34 collect (sb!alien:cast arg sb!alien:c-string)))
35 (/show0 "entering OS-COLD-INIT-OR-REINIT")
36 (setf *software-version* nil)
37 (/show0 "setting *DEFAULT-PATHNAME-DEFAULTS*")
38 (setf *default-pathname-defaults*
39 ;; (temporary value, so that #'NATIVE-PATHNAME won't blow up when
40 ;; we call it below:)
41 (make-trivial-default-pathname)
42 *default-pathname-defaults*
43 ;; (final value, constructed using #'NATIVE-PATHNAME:)
44 (native-pathname (sb!unix:posix-getcwd/)))
45 (/show0 "setting *CORE-PATHNAME*")
46 (setf *core-pathname*
47 (merge-pathnames (native-pathname *core-string*)))
48 (/show0 "leaving OS-COLD-INIT-OR-REINIT"))