Skip to content
Snippets Groups Projects
Commit f13173bb authored by rtoy's avatar rtoy
Browse files

UNIX-SYSINFO was broken for Unicode builds, which made MACHINE-TYPE

and MACHINE-VERSION return incorrect values on Solaris.  Rewrite it to
work for both unicode and non-unicode builds, thereby fixing
MACHINE-TYPE and MACHINE-VERSION.
parent 03f8a6a6
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.124 2009/10/15 14:07:35 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.125 2009/10/15 19:36:08 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -3408,11 +3408,6 @@ ...@@ -3408,11 +3408,6 @@
#+(and solaris svr4) #+(and solaris svr4)
(progn (progn
(def-alien-routine sysinfo long
(command int)
(buf c-string)
(count long))
;; From sys/systeminfo.h. We don't list the set values here. ;; From sys/systeminfo.h. We don't list the set values here.
(def-enum + 1 (def-enum + 1
si-sysname si-hostname si-release si-version si-machine si-sysname si-hostname si-release si-version si-machine
...@@ -3421,12 +3416,21 @@ ...@@ -3421,12 +3416,21 @@
(def-enum + 513 (def-enum + 513
si-platform si-isalist si-dhcp-cache) si-platform si-isalist si-dhcp-cache)
(defun unix-sysinfo (command) (defun unix-sysinfo (command)
(let* ((count 2048) ; Hope this is long enough! ;; Hope a buffer of length 2048 is long enough.
(buf (make-string count)) (with-alien ((buf (array c-call:unsigned-char 2048)))
(result (sysinfo command buf count))) (let ((result
(when (>= result 0) (alien-funcall
(subseq buf 0 (1- result))))) (extern-alien "sysinfo"
(function c-call:int
c-call:int
c-call:c-string
c-call:int))
command
(cast buf (* c-call:char))
2048)))
(when (>= result 0)
(cast buf c-call:c-string)))))
) )
;; EOF ;; EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment