Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
fbb742ae
by Raymond Toy at 2023-04-19T14:14:39+00:00
-
501ca837
by Raymond Toy at 2023-04-19T14:14:40+00:00
8 changed files:
- src/code/bsd-os.lisp
- src/code/linux-os.lisp
- src/code/misc.lisp
- src/code/sunos-os.lisp
- src/general-info/release-21e.md
- src/i18n/locale/cmucl-linux-os.pot
- src/i18n/locale/cmucl.pot
- src/lisp/os-common.c
Changes:
| ... | ... | @@ -48,19 +48,6 @@ |
| 48 | 48 | #+Darwin "Darwin"
|
| 49 | 49 | #-(or freebsd NetBSD OpenBSD Darwin) "BSD")
|
| 50 | 50 | |
| 51 | -(defvar *software-version* nil "Version string for supporting software")
|
|
| 52 | - |
|
| 53 | -(defun software-version ()
|
|
| 54 | - "Returns a string describing version of the supporting software."
|
|
| 55 | - (unless *software-version*
|
|
| 56 | - (setf *software-version*
|
|
| 57 | - (string-trim '(#\newline)
|
|
| 58 | - (with-output-to-string (stream)
|
|
| 59 | - (run-program "/usr/bin/uname"
|
|
| 60 | - '("-r")
|
|
| 61 | - :output stream)))))
|
|
| 62 | - *software-version*)
|
|
| 63 | - |
|
| 64 | 51 | |
| 65 | 52 | ;;; OS-Init initializes our operating-system interface. It sets the values
|
| 66 | 53 | ;;; of the global port variables to what they should be and calls the functions
|
| ... | ... | @@ -28,20 +28,10 @@ |
| 28 | 28 | |
| 29 | 29 | (setq *software-type* "Linux")
|
| 30 | 30 | |
| 31 | -;;; Instead of reading /proc/version (which has some bugs with
|
|
| 32 | -;;; select() in Linux kernel 2.6.x) and instead of running uname -r,
|
|
| 33 | -;;; let's just get the info from uname().
|
|
| 34 | -(defun software-version ()
|
|
| 35 | - "Returns a string describing version of the supporting software."
|
|
| 36 | - (multiple-value-bind (sysname nodename release version)
|
|
| 37 | - (unix:unix-uname)
|
|
| 38 | - (declare (ignore sysname nodename))
|
|
| 39 | - (concatenate 'string release " " version)))
|
|
| 40 | - |
|
| 41 | - |
|
| 42 | 31 | ;;; OS-Init initializes our operating-system interface.
|
| 43 | 32 | ;;;
|
| 44 | -(defun os-init () nil)
|
|
| 33 | +(defun os-init ()
|
|
| 34 | + (setf *software-version* nil))
|
|
| 45 | 35 | |
| 46 | 36 | |
| 47 | 37 | ;;; GET-PAGE-SIZE -- Interface
|
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | (in-package "LISP")
|
| 18 | 18 | (intl:textdomain "cmucl")
|
| 19 | 19 | |
| 20 | -(export '(documentation *features* variable room
|
|
| 20 | +(export '(*features* variable room
|
|
| 21 | 21 | lisp-implementation-type lisp-implementation-version machine-type
|
| 22 | 22 | machine-version machine-instance software-type software-version
|
| 23 | 23 | short-site-name long-site-name dribble compiler-macro))
|
| ... | ... | @@ -81,12 +81,32 @@ |
| 81 | 81 | (unix:unix-gethostname))
|
| 82 | 82 | |
| 83 | 83 | (defvar *software-type* "Unix"
|
| 84 | - "The value of SOFTWARE-TYPE. Set in FOO-os.lisp.")
|
|
| 84 | + _N"The value of SOFTWARE-TYPE. Set in FOO-os.lisp.")
|
|
| 85 | 85 | |
| 86 | 86 | (defun software-type ()
|
| 87 | 87 | "Returns a string describing the supporting software."
|
| 88 | 88 | *software-type*)
|
| 89 | 89 | |
| 90 | +(defvar *software-version* nil
|
|
| 91 | + _N"Version string for supporting software")
|
|
| 92 | + |
|
| 93 | +(defun software-version ()
|
|
| 94 | + _N"Returns a string describing version of the supporting software."
|
|
| 95 | + (unless *software-version*
|
|
| 96 | + (setf *software-version*
|
|
| 97 | + (let (version result)
|
|
| 98 | + (unwind-protect
|
|
| 99 | + (progn
|
|
| 100 | + (setf version
|
|
| 101 | + (alien:alien-funcall
|
|
| 102 | + (alien:extern-alien "os_software_version"
|
|
| 103 | + (function (alien:* c-call:c-string)))))
|
|
| 104 | + (setf result (alien:cast version c-call:c-string))))
|
|
| 105 | + (if (zerop (length result))
|
|
| 106 | + "Unknown"
|
|
| 107 | + result)))
|
|
| 108 | + *software-version*))
|
|
| 109 | + |
|
| 90 | 110 | (defvar *short-site-name* nil
|
| 91 | 111 | "The value of SHORT-SITE-NAME. Set in library:site-init.lisp.")
|
| 92 | 112 |
| ... | ... | @@ -33,19 +33,6 @@ |
| 33 | 33 | |
| 34 | 34 | (setq *software-type* "SunOS")
|
| 35 | 35 | |
| 36 | -(defvar *software-version* nil "Version string for supporting software")
|
|
| 37 | - |
|
| 38 | -(defun software-version ()
|
|
| 39 | - "Returns a string describing version of the supporting software."
|
|
| 40 | - (unless *software-version*
|
|
| 41 | - (setf *software-version*
|
|
| 42 | - (multiple-value-bind (sysname nodename release version)
|
|
| 43 | - (unix:unix-uname)
|
|
| 44 | - (declare (ignore sysname nodename))
|
|
| 45 | - (concatenate 'string release " " version))))
|
|
| 46 | - *software-version*)
|
|
| 47 | - |
|
| 48 | - |
|
| 49 | 36 | ;;; OS-INIT -- interface.
|
| 50 | 37 | ;;;
|
| 51 | 38 | ;;; Other OS dependent initializations.
|
| ... | ... | @@ -49,10 +49,11 @@ public domain. |
| 49 | 49 | * ~~#108~~ Update ASDF.
|
| 50 | 50 | * ~~#112~~ CLX can't connect to X server via inet sockets.
|
| 51 | 51 | * ~~#113~~ REQUIRE on contribs can pull in the wrong things via ASDF.
|
| 52 | - * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM.
|
|
| 53 | - * ~~#122~~ gcc 11 can't build cmucl.
|
|
| 54 | - * ~~#124~~ directory with `:wild-inferiors` doesn't descend subdirectories.
|
|
| 55 | - * ~~#125~~ Linux `unix-stat` returning incorrect values.
|
|
| 52 | + * ~~#120~~ `SOFTWARE-VERSION` is implemented in C.
|
|
| 53 | + * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM
|
|
| 54 | + * ~~#122~~ gcc 11 can't build cmucl
|
|
| 55 | + * ~~#124~~ directory with `:wild-inferiors` doesn't descend subdirectories
|
|
| 56 | + * ~~#125~~ Linux `unix-stat` returning incorrect values
|
|
| 56 | 57 | * ~~#127~~ Linux unix-getpwuid segfaults when given non-existent uid.
|
| 57 | 58 | * ~~#128~~ `QUIT` accepts an exit code.
|
| 58 | 59 | * ~~#130~~ Move file-author to C.
|
| ... | ... | @@ -15,10 +15,6 @@ msgstr "" |
| 15 | 15 | "Content-Type: text/plain; charset=UTF-8\n"
|
| 16 | 16 | "Content-Transfer-Encoding: 8bit\n"
|
| 17 | 17 | |
| 18 | -#: src/code/linux-os.lisp
|
|
| 19 | -msgid "Returns a string describing version of the supporting software."
|
|
| 20 | -msgstr ""
|
|
| 21 | - |
|
| 22 | 18 | #: src/code/linux-os.lisp
|
| 23 | 19 | msgid "Unix system call getrusage failed: ~A."
|
| 24 | 20 | msgstr ""
|
| ... | ... | @@ -5646,6 +5646,14 @@ msgstr "" |
| 5646 | 5646 | msgid "Returns a string describing the supporting software."
|
| 5647 | 5647 | msgstr ""
|
| 5648 | 5648 | |
| 5649 | +#: src/code/misc.lisp
|
|
| 5650 | +msgid "Version string for supporting software"
|
|
| 5651 | +msgstr ""
|
|
| 5652 | + |
|
| 5653 | +#: src/code/misc.lisp
|
|
| 5654 | +msgid "Returns a string describing version of the supporting software."
|
|
| 5655 | +msgstr ""
|
|
| 5656 | + |
|
| 5649 | 5657 | #: src/code/misc.lisp
|
| 5650 | 5658 | msgid "The value of SHORT-SITE-NAME. Set in library:site-init.lisp."
|
| 5651 | 5659 | msgstr ""
|
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | #include <string.h>
|
| 18 | 18 | #include <sys/resource.h>
|
| 19 | 19 | #include <sys/stat.h>
|
| 20 | +#include <sys/utsname.h>
|
|
| 20 | 21 | #include <unistd.h>
|
| 21 | 22 | #include <time.h>
|
| 22 | 23 | |
| ... | ... | @@ -830,4 +831,27 @@ os_get_system_info(int64_t* utime, int64_t* stime, long* major_fault) |
| 830 | 831 | return rc;
|
| 831 | 832 | }
|
| 832 | 833 | |
| 834 | +/*
|
|
| 835 | + * Get the software version. This is the same as "uname -r", the release.
|
|
| 836 | + * A pointer to a static string is returned. If uname fails, an empty
|
|
| 837 | + * string is returned.
|
|
| 838 | + */
|
|
| 839 | +char*
|
|
| 840 | +os_software_version(void)
|
|
| 841 | +{
|
|
| 842 | + struct utsname uts;
|
|
| 843 | + int status;
|
|
| 844 | + |
|
| 845 | + /*
|
|
| 846 | + * Buffer large enough to hold the release.
|
|
| 847 | + */
|
|
| 848 | + static char result[sizeof(uts.release)];
|
|
| 849 | + result[0] = '\0';
|
|
| 850 | + |
|
| 851 | + status = uname(&uts);
|
|
| 852 | + if (status == 0) {
|
|
| 853 | + strcpy(result, uts.release);
|
|
| 854 | + }
|
|
| 833 | 855 |
|
| 856 | + return result;
|
|
| 857 | +} |