uname: make OS name configurable
authorRon Yorston <rmy@frippery.org>
Sun, 12 Jul 2015 15:06:37 +0000 (16:06 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 3 Aug 2015 16:09:18 +0000 (18:09 +0200)
A mailing list thread in September 2013 discussed changing the string
returned by the non-POSIX 'uname -o' option.  Nothing ever came of this
because there was no agreement as to what the string should be.

Make the string configurable so that people can decide for themselves.

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/Config.src
coreutils/uname.c

index 02155d22016611f4a665f11a88a30e1b7a982e27..ffbef1a315d177f37ba53ad3e896bbcd76b7698c 100644 (file)
@@ -630,6 +630,14 @@ config UNAME
        help
          uname is used to print system information.
 
+config UNAME_OSNAME
+       string "Operating system name"
+       default "GNU/Linux"
+       depends on UNAME
+       help
+         Sets the operating system name reported by uname -o.  The
+         default is "GNU/Linux".
+
 config UNEXPAND
        bool "unexpand"
        default y
index 1c6aa5f7972dd8b193841a828d16bfcc0e19553e..fd677d27ca6ddfc209268254fa81cd63ec5e6c39 100644 (file)
@@ -74,7 +74,7 @@ typedef struct {
        struct utsname name;
        char processor[sizeof(((struct utsname*)NULL)->machine)];
        char platform[sizeof(((struct utsname*)NULL)->machine)];
-       char os[sizeof("GNU/Linux")];
+       char os[sizeof(CONFIG_UNAME_OSNAME)];
 } uname_info_t;
 
 static const char options[] ALIGN1 = "snrvmpioa";
@@ -141,7 +141,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv)
 #endif
        strcpy(uname_info.processor, unknown_str);
        strcpy(uname_info.platform, unknown_str);
-       strcpy(uname_info.os, "GNU/Linux");
+       strcpy(uname_info.os, CONFIG_UNAME_OSNAME);
 #if 0
        /* Fedora does something like this */
        strcpy(uname_info.processor, uname_info.name.machine);