From 8a58166bc42664c1157666d0ee58f83e61dd89b3 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 2 Feb 2021 03:16:43 +0000 Subject: [PATCH] Add OpenSUSE fixes for the uname builtin on Linux Original patches: https://build.opensuse.org/package/view_file/shells/ksh/ksh93-uname.dif https://build.opensuse.org/package/view_file/shells/ksh/ksh93-no-sysctl.dif --- src/lib/libcmd/uname.c | 55 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/lib/libcmd/uname.c b/src/lib/libcmd/uname.c index e914ce0dee19..bd9c09253622 100644 --- a/src/lib/libcmd/uname.c +++ b/src/lib/libcmd/uname.c @@ -79,6 +79,7 @@ __STDPP__directive pragma pp:hide getdomainname gethostid gethostname sethostnam #include #include +#include #include #include "FEATURE/utsname" @@ -86,9 +87,7 @@ __STDPP__directive pragma pp:hide getdomainname gethostid gethostname sethostnam #define MAXHOSTNAME 64 #if _lib_uname && _sys_utsname - -#include - +# include #endif #if defined(__STDPP__directive) && defined(__STDPP__hide) @@ -269,6 +268,9 @@ b_uname(int argc, char** argv, Shbltin_t* context) { case 'a': flags |= OPT_all|((1L< 0) + { + if (strncmp(line, "vendor_id", 9) == 0) + { + if (strstr(line, "AuthenticAMD")) + s = "athlon"; + break; + } + } + sfclose(io); + } + } + } +#endif + if (!s && !*(s = astconf("ARCHITECTURE", NiL, NiL))) s = ut.machine; output(OPT_processor, s, "processor"); } if (flags & OPT_implementation) { - if (!*(s = astconf("PLATFORM", NiL, NiL)) && !*(s = astconf("HW_NAME", NiL, NiL))) + s = NULL; +#ifdef __linux__ + if (!s) + { + strcpy((s = buf), ut.machine); + if (s[0] == 'i' && s[2] == '8' && s[3] == '6' && s[4] == '\0') + s[1] = '3'; + } +#endif + if (!s && !*(s = astconf("PLATFORM", NiL, NiL)) && !*(s = astconf("HW_NAME", NiL, NiL))) { if (t = strchr(hosttype, '.')) t++;