From ede7bc952c0b7c21286a98849f306a20fe14ed1f Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Mon, 18 Nov 2002 13:52:24 +0000
Subject: [PATCH] From Eric Marsden:

   Under Linux, the SOFTWARE-VERSION function now returns information
   on the current kernel taken from /proc/version (instead of "n/a").
   Under Linux and xBSD, the internal GET-PAGE-SIZE function obtains
   the page size from the operating system via the getpagesize()
   library call, instead of returning a hard-coded value.

A few random typos were also fixed.
---
 code/bsd-os.lisp   | 10 +++++++---
 code/linux-os.lisp | 34 ++++++++++++++--------------------
 code/sunos-os.lisp |  5 +++--
 3 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/code/bsd-os.lisp b/code/bsd-os.lisp
index a7a7546f7..fd8938b59 100644
--- a/code/bsd-os.lisp
+++ b/code/bsd-os.lisp
@@ -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/bsd-os.lisp,v 1.5 2002/01/28 20:17:08 pmai Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/bsd-os.lisp,v 1.6 2002/11/18 13:52:24 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -71,5 +71,9 @@
 ;;;    Return the system page size.
 ;;;
 (defun get-page-size ()
-  ;; probably should call getpagesize()
-  4096)
+  (multiple-value-bind (val err)
+      (unix:unix-getpagesize)
+    (unless val
+      (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
+    val))
+
diff --git a/code/linux-os.lisp b/code/linux-os.lisp
index e28497088..cd1b8a081 100644
--- a/code/linux-os.lisp
+++ b/code/linux-os.lisp
@@ -5,16 +5,16 @@
 ;;; 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.2 2002/10/07 14:31:04 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/linux-os.lisp,v 1.3 2002/11/18 13:52:24 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
-;;; OS interface functions for CMU CL under Mach.
+;;; OS interface functions for CMUCL under Linux.
 ;;;
 ;;; Written and maintained mostly by Skef Wholey and Rob MacLachlan.
 ;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too.
 ;;;
-;;; Hacked into Linux-os.lisp /Werkowski
+;;; Derived from mach-os.lisp by Paul Werkowski
 
 (in-package "SYSTEM")
 (use-package "EXTENSIONS")
@@ -26,23 +26,14 @@
 
 (defun software-version ()
   "Returns a string describing version of the supporting software."
-  #+nil
-  (string-trim '(#\newline)
-	       (with-output-to-string (stream)
-		 (run-program "/usr/cs/etc/version" ; Site dependent???
-			      nil :output stream)))
-  "n/a")
+  (when (probe-file "/proc/version")
+    (with-open-file (f "/proc/version")
+      (read-line f))))
 
-
-;;; OS-Init initializes our operating-system interface.  It sets the values
-;;; of the global port variables to what they should be and calls the functions
-;;; that set up the argument blocks for the server interfaces.
 
-(defvar *task-self*)
-
-(defun os-init ()			; don't know what to do here
-  #+sparc ;; Can't use #x20000000 thru #xDFFFFFFF, but mach tries to let us.
-  (system:allocate-system-memory-at (system:int-sap #x20000000) #xc0000000))
+;;; OS-Init initializes our operating-system interface.
+;;;
+(defun os-init () nil)
 
 
 ;;; GET-SYSTEM-INFO  --  Interface
@@ -66,6 +57,9 @@
 ;;;    Return the system page size.
 ;;;
 (defun get-page-size ()
-  ;; probably should call getpagesize()
-  4096)
+  (multiple-value-bind (val err)
+      (unix:unix-getpagesize)
+    (unless val
+      (error "Getpagesize failed: ~A" (unix:get-unix-error-msg err)))
+    val))
 
diff --git a/code/sunos-os.lisp b/code/sunos-os.lisp
index 95ad24efa..e3a6c92b1 100644
--- a/code/sunos-os.lisp
+++ b/code/sunos-os.lisp
@@ -5,13 +5,14 @@
 ;;; 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.9 1998/01/29 07:22:50 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sunos-os.lisp,v 1.10 2002/11/18 13:52:24 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
-;;; OS interface functions for CMU CL under Mach.  From Miles Bader and David
+;;; OS interface functions for CMUCL under SunOS.  From Miles Bader and David
 ;;; Axmark.
 ;;;
+
 (in-package "SYSTEM")
 (use-package "EXTENSIONS")
 (export '(get-system-info get-page-size os-init))
-- 
GitLab