ref: c6d30fe1c03e53c34e326311d1549a947c35d4b3
parent: 7e91f1538aa559da9f3b6a479c2d4227d6be9c38
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Jan 25 02:34:12 EST 2025
posix: always use uname()
--- a/posix/platform.h
+++ b/posix/platform.h
@@ -33,8 +33,6 @@
#if defined(__linux__)
#define __os_name__ "linux"
-extern char linux_kernel_version[];
-#define __os_version__ linux_kernel_version
#elif defined(__OpenBSD__)
#define __os_name__ "openbsd"
#elif defined(__FreeBSD__)
@@ -48,6 +46,9 @@
#else
#define __os_name__ "unknown"
#endif
+
+extern char __os_version__[];
+#define __os_version__ __os_version__
#ifndef __SIZEOF_POINTER__
#error pointer size unknown
--- a/sys_posix.c
+++ b/sys_posix.c
@@ -71,20 +71,16 @@
#include "flisp.boot.h"
};
-#if defined(__linux__)
-char linux_kernel_version[64];
+char __os_version__[64];
#include <sys/utsname.h>
-#endif
int
main(int argc, char **argv)
{
setlocale(LC_NUMERIC, "C");
-#if defined(__linux__)
struct utsname u;
- linux_kernel_version[0] = 0;
+ __os_version__[0] = 0;
if(uname(&u) == 0)
- snprintf(linux_kernel_version, sizeof(linux_kernel_version), "%s", u.release);
-#endif
+ snprintf(__os_version__, sizeof(__os_version__), "%s", u.release);
flmain(boot, sizeof(boot), argc, argv);
}