Skip to content
Snippets Groups Projects
Commit 01f97fcf authored by cshapiro's avatar cshapiro
Browse files

The uname exported by the FreeBSD libc expects an older and shorter

struct than the utsname struct in sys/utsname.h and the alien struct
definition in Lisp.  Instead of calling the exported uname, call the
underlying __xuname that knows about with the post FreeBSD 4 struct.
parent ae234346
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.116 2007/11/09 19:24:36 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix.lisp,v 1.117 2007/12/21 08:46:48 cshapiro Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -3258,39 +3258,26 @@ ...@@ -3258,39 +3258,26 @@
:dir (string (cast (slot result 'pw-dir) c-call:c-string)) :dir (string (cast (slot result 'pw-dir) c-call:c-string))
:shell (string (cast (slot result 'pw-shell) c-call:c-string))))))) :shell (string (cast (slot result 'pw-shell) c-call:c-string)))))))
;; From sys/utsname.h
#+(or solaris bsd)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defconstant +sys-namelen+
#+solaris 257
#+bsd 256))
#+(or solaris bsd)
(progn
(def-alien-type nil (def-alien-type nil
(struct utsname (struct utsname
(sysname (array char #.+sys-namelen+)) (sysname (array char #+svr4 257 #+bsd 256))
(nodename (array char #.+sys-namelen+)) (nodename (array char #+svr4 257 #+bsd 256))
(release (array char #.+sys-namelen+)) (release (array char #+svr4 257 #+bsd 256))
(version (array char #.+sys-namelen+)) (version (array char #+svr4 257 #+bsd 256))
(machine (array char #.+sys-namelen+)))) (machine (array char #+svr4 257 #+bsd 256))))
(defun unix-uname () (defun unix-uname ()
(with-alien ((names (struct utsname))) (with-alien ((names (struct utsname)))
(let ((result (syscall* (#-freebsd "uname"
(alien-funcall #+freebsd "__xuname" #+freebsd int
(extern-alien "uname" (* (struct utsname)))
(function int (values (cast (slot names 'sysname) c-string)
(* (struct utsname)))) (cast (slot names 'nodename) c-string)
(addr names)))) (cast (slot names 'release) c-string)
(when (>= result 0) (cast (slot names 'version) c-string)
(values (cast (slot names 'sysname) c-string) (cast (slot names 'machine) c-string))
(cast (slot names 'nodename) c-string) #+freebsd 256
(cast (slot names 'release) c-string) (addr names))))
(cast (slot names 'version) c-string)
(cast (slot names 'machine) c-string))))))
)
#+(and solaris svr4) #+(and solaris svr4)
(progn (progn
......
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