Commit f0c421a2 authored by rtoy's avatar rtoy
Browse files

linux-os.lisp:

o Use unix:unix-uname to get the software version.  (I don't want to
  deal with broken Linux kernels or other implementation details in
  trying to read /proc/version, and I don't want to run uname -r.)

sunos-os.lisp:
o Use unix:unix-uname to get the software version instead of running
  uname -r.
parent 1ca43a1a
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/linux-os.lisp,v 1.6 2007/07/18 09:50:24 cshapiro Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/linux-os.lisp,v 1.7 2009/03/25 15:28:03 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -26,23 +26,16 @@
(setq *software-type* "Linux")
;;; We use READ-SEQUENCE instead of READ-LINE to work around a bug in
;;; the proc file system on Linux kernel 2.6.x. The select() system
;;; call does not work correctly on certain files; it never reports
;;; that data is available for reading. Since CMUCL's fd-streams use
;;; select(), as a part of the SERVE-EVENT mechanism, normal I/O (for
;;; instance with READ-CHAR or READ-LINE) will fail on these files.
;;; Luckily READ-SEQUENCE does not suffer from this problem.
;;;
;;; We could also call "uname -r" here, but using the filesystem-based
;;; interface seems cleaner.
;;; Instead of reading /proc/version (which has some bugs with
;;; select() in Linux kernel 2.6.x) and instead of running uname -r,
;;; let's just get the info from uname().
(defun software-version ()
"Returns a string describing version of the supporting software."
(when (probe-file "/proc/version")
(with-open-file (f "/proc/version")
(let* ((buf (make-string 1024))
(count (read-sequence buf f :end 1024)))
(subseq buf 0 (1- count))))))
(multiple-value-bind (sysname nodename release version)
(unix:unix-uname)
(declare (ignore sysname nodename))
(concatenate 'string release " " version)))
;;; OS-Init initializes our operating-system interface.
......
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sunos-os.lisp,v 1.11 2007/07/24 19:09:13 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sunos-os.lisp,v 1.12 2009/03/25 15:28:03 rtoy Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -30,14 +30,10 @@
"Returns a string describing version of the supporting software."
(unless *software-version*
(setf *software-version*
(let ((version-line
(with-output-to-string (stream)
(run-program "/usr/bin/uname"
'("-r" )
:output stream
:pty nil
:error nil))))
(subseq version-line 0 (1- (length version-line))))))
(multiple-value-bind (sysname nodename release version)
(unix:unix-uname)
(declare (ignore sysname nodename))
(concatenate 'string release " " version))))
*software-version*)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment