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 (sb!alien
:define-alien-variable
("posix_argv" *native-posix-argv
*) (* (* char
)))
17 (sb!alien
:define-alien-variable
("core_string" *native-core-string
*) (* char
))
18 (sb!alien
:define-alien-routine os-get-runtime-executable-path sb
!alien
:c-string
)
20 ;;; if something ever needs to be done differently for one OS, then
21 ;;; split out the different part into per-os functions.
22 (defun os-cold-init-or-reinit ()
23 (/show0
"setting *CORE-STRING*")
25 (sb!alien
:cast
*native-core-string
* sb
!alien
:c-string
))
26 (/show0
"setting *POSIX-ARGV*")
27 (setf sb
!ext
:*posix-argv
*
29 for arg
= (sb!alien
:deref
*native-posix-argv
* i
)
30 until
(sb!alien
:null-alien arg
)
31 collect
(sb!alien
:cast arg sb
!alien
:c-string
)))
32 (/show0
"entering OS-COLD-INIT-OR-REINIT")
33 (setf *software-version
* nil
)
34 (/show0
"setting *DEFAULT-PATHNAME-DEFAULTS*")
35 (setf *default-pathname-defaults
*
36 ;; (temporary value, so that #'NATIVE-PATHNAME won't blow up when
38 (make-trivial-default-pathname)
39 *default-pathname-defaults
*
40 ;; (final value, constructed using #'NATIVE-PATHNAME:)
41 (native-pathname (sb!unix
:posix-getcwd
/)))
42 (/show0
"setting *CORE-PATHNAME*")
44 (merge-pathnames (native-pathname *core-string
*)))
45 (/show0
"setting *RUNTIME-PATHNAME*")
46 (setf *runtime-pathname
* (native-pathname (os-get-runtime-executable-path)))
47 (/show0
"leaving OS-COLD-INIT-OR-REINIT"))