/[cmucl]/src/code/linux-os.lisp
ViewVC logotype

Diff of /src/code/linux-os.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by cshapiro, Wed Jul 18 09:50:24 2007 UTC revision 1.6.6.2 by rtoy, Tue May 12 16:31:48 2009 UTC
# Line 26  Line 26 
26    
27  (setq *software-type* "Linux")  (setq *software-type* "Linux")
28    
29  ;;; We use READ-SEQUENCE instead of READ-LINE to work around a bug in  ;;; Instead of reading /proc/version (which has some bugs with
30  ;;; the proc file system on Linux kernel 2.6.x. The select() system  ;;; select() in Linux kernel 2.6.x) and instead of running uname -r,
31  ;;; call does not work correctly on certain files; it never reports  ;;; let's just get the info from uname().
 ;;; 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.  
32  (defun software-version ()  (defun software-version ()
33    "Returns a string describing version of the supporting software."    "Returns a string describing version of the supporting software."
34    (when (probe-file "/proc/version")    (multiple-value-bind (sysname nodename release version)
35      (with-open-file (f "/proc/version")        (unix:unix-uname)
36        (let* ((buf (make-string 1024))      (declare (ignore sysname nodename))
37               (count (read-sequence buf f :end 1024)))      (concatenate 'string release " " version)))
         (subseq buf 0 (1- count))))))  
38    
39    
40  ;;; OS-Init initializes our operating-system interface.  ;;; OS-Init initializes our operating-system interface.

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.6.2

  ViewVC Help
Powered by ViewVC 1.1.5