Raymond Toy pushed to branch issue-120-software-type-in-c at cmucl / cmucl
Commits:
e0ecf7d2 by Raymond Toy at 2022-08-30T17:17:58-07:00
Add missing semicolon for macos
- - - - -
1 changed file:
- src/lisp/os-common.c
Changes:
=====================================
src/lisp/os-common.c
=====================================
@@ -750,7 +750,7 @@ os_software_version()
strcat(version, " ");
strcat(version, uts.version);
#else
- strcpy(version, uts.version)
+ strcpy(version, uts.version);
#endif
}
}
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/e0ecf7d2289535975e839b9…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/e0ecf7d2289535975e839b9…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-120-software-type-in-c at cmucl / cmucl
Commits:
3c1f5538 by Raymond Toy at 2022-08-30T06:27:12-07:00
Implement software-type in C
Add function software-type to misc.lisp, and initialize to
*software-type* to NIL so that (software-type) will set it
appropriately.
Add function os_software_type to os-common.c that returns the sysname
slot of struct utsname. On Linux and macos, this value matches the
value that we previously returned.
In linux-os.lisp and bsd-os.lisp, comment out the code that sets
*software-type*. (We need to do this for other OSes, still)
- - - - -
4 changed files:
- src/code/bsd-os.lisp
- src/code/linux-os.lisp
- src/code/misc.lisp
- src/lisp/os-common.c
Changes:
=====================================
src/code/bsd-os.lisp
=====================================
@@ -42,6 +42,7 @@
#+executable
(register-lisp-runtime-feature :executable)
+#+nil
(setq *software-type* #+OpenBSD "OpenBSD"
#+NetBSD "NetBSD"
#+freebsd "FreeBSD"
=====================================
src/code/linux-os.lisp
=====================================
@@ -26,7 +26,7 @@
(register-lisp-feature :elf)
(register-lisp-runtime-feature :executable)
-(setq *software-type* "Linux")
+;;(setq *software-type* "Linux")
(defvar *software-version* nil
"Version string for supporting software")
=====================================
src/code/misc.lisp
=====================================
@@ -183,11 +183,25 @@
"Returns a string giving the name of the local machine."
(unix:unix-gethostname))
-(defvar *software-type* "Unix"
- "The value of SOFTWARE-TYPE. Set in FOO-os.lisp.")
+(defvar *software-type* nil
+ _N"The value of SOFTWARE-TYPE.")
(defun software-type ()
- "Returns a string describing the supporting software."
+ _N"Returns a string describing the supporting software."
+ (unless *software-type*
+ (setf *software-type*
+ (let (software-type)
+ ;; Get the software-type from the C function os_software_type.
+ (unwind-protect
+ (progn
+ (setf software-type
+ (alien:alien-funcall
+ (alien:extern-alien "os_software_type"
+ (function (alien:* c-call:c-string)))))
+ (unless (zerop (sap-int (alien:alien-sap software-type)))
+ (alien:cast software-type c-call:c-string)))
+ (when software-type
+ (alien:free-alien software-type))))))
*software-type*)
(defvar *short-site-name* (intl:gettext "Unknown")
=====================================
src/lisp/os-common.c
=====================================
@@ -757,3 +757,23 @@ os_software_version()
return version;
}
+#undef UNAME_RELEASE_AND_VERSION
+
+char*
+os_software_type()
+{
+ int status;
+ struct utsname uts;
+ char *os_name = NULL;
+
+ status = uname(&uts);
+ if (status == 0) {
+ os_name = malloc(strlen(uts.sysname) + 1);
+ if (os_name) {
+ strcpy(os_name, uts.sysname);
+ }
+ }
+
+ return os_name;
+}
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3c1f5538b09c6256480aac2…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3c1f5538b09c6256480aac2…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-130-file-author-in-c at cmucl / cmucl
Commits:
ec14c5b1 by Raymond Toy at 2022-08-29T14:07:02-07:00
Include stdlib.h and unistd.h
stdlib.h is needed for malloc and friends. unistd.h is needed for
sysconf.
- - - - -
1 changed file:
- src/lisp/os-common.c
Changes:
=====================================
src/lisp/os-common.c
=====================================
@@ -11,8 +11,10 @@
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <time.h>
#include "os.h"
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ec14c5b16fc37e56023f069…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ec14c5b16fc37e56023f069…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
8b9a14fc by Raymond Toy at 2022-08-23T21:39:02-07:00
Add docstring for unix:unix-uname
Update pot file too since the docstring changed.
No functional changes.
- - - - -
2 changed files:
- src/code/unix.lisp
- src/i18n/locale/cmucl-unix.pot
Changes:
=====================================
src/code/unix.lisp
=====================================
@@ -2726,6 +2726,14 @@
(domainname (array char 65))))
(defun unix-uname ()
+ _N"Unix-uname returns information from the uname(2) system call.
+ The return values are
+
+ Name of the operating system
+ Name of this node within some implementation-defined network, if any
+ Release level of this operating system
+ Version level of this operating system release
+ Name of the hardware type on which the system is running"
(with-alien ((names (struct utsname)))
(syscall* (#-(or freebsd (and x86 solaris)) "uname"
#+(and x86 solaris) "nuname" ; See /usr/include/sys/utsname.h
=====================================
src/i18n/locale/cmucl-unix.pot
=====================================
@@ -1365,6 +1365,18 @@ msgid ""
" and its children."
msgstr ""
+#: src/code/unix.lisp
+msgid ""
+"Unix-uname returns information from the uname(2) system call.\n"
+" The return values are\n"
+"\n"
+" Name of the operating system\n"
+" Name of this node within some implementation-defined network, if any\n"
+" Release level of this operating system\n"
+" Version level of this operating system release\n"
+" Name of the hardware type on which the system is running"
+msgstr ""
+
#: src/code/unix.lisp
msgid ""
"Get the value of the environment variable named Name. If no such\n"
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/8b9a14fc3a2c684a538e68a…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/8b9a14fc3a2c684a538e68a…
You're receiving this email because of your account on gitlab.common-lisp.net.