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
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.
14 (defvar *software-version
* nil
)
16 (defvar *core-pathname
* nil
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*")
28 (sb!alien
:cast
*native-core-string
* sb
!alien
:c-string
))
29 (/show0
"setting *POSIX-ARGV*")
30 (setf sb
!ext
:*posix-argv
*
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
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*")
47 (merge-pathnames (native-pathname *core-string
*)))
48 (/show0
"leaving OS-COLD-INIT-OR-REINIT"))