uname: normalize release and version
Most systems provide the full version number in the 'release' field and the kernel version in 'version'. Minix used to split the full version number between release and version which caused problems for pkgsrc and other applications. This patch brings Minix's uname in line with other systems such as NetBSD. It also brings the getty banner in line with NetBSD. Old Minix uname: sysname->Minix nodename->10.0.2.15 release->3 version->2.1 machine->i686 New Minix uname: sysname->Minix nodename->10.0.2.15 release->3.2.1 version->Minix 3.2.1 (GENERIC) machine->i686 Change-Id: I966633dfdcf2f9485966bb0d0d042afc45bbeb7d
This commit is contained in:
parent
36ac0dbcf8
commit
f5dbfe789e
@ -88,7 +88,7 @@ void do_getty(char *name, size_t len, char **args, const char *ttyname)
|
|||||||
int ch;
|
int ch;
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
char **banner, *t;
|
char **banner, *t;
|
||||||
static char *def_banner[] = { "%s Release %r Version %v (%t)\n\n%n login: ", 0 };
|
static char *def_banner[] = { "%s/%p (%t)\n\n%n login: ", 0 };
|
||||||
|
|
||||||
/* Clean up tty name. */
|
/* Clean up tty name. */
|
||||||
if((t = strrchr(ttyname, '/'))) ttyname = t + 1;
|
if((t = strrchr(ttyname, '/'))) ttyname = t + 1;
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
* function:
|
* function:
|
||||||
*
|
*
|
||||||
* system name Minix
|
* system name Minix
|
||||||
* node name waddles
|
* node name 10.0.2.15
|
||||||
* release name 1.5
|
* release name 3.2.1
|
||||||
* version 10
|
* version Minix 3.2.1 (GENERIC)
|
||||||
* machine name i86
|
* machine name i686
|
||||||
* arch i86 (Minix specific)
|
* arch i386 (Minix specific)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#define SYSNAME ((unsigned) 0x01)
|
#define SYSNAME ((unsigned) 0x01)
|
||||||
#define NODENAME ((unsigned) 0x02)
|
#define NODENAME ((unsigned) 0x02)
|
||||||
#define RELEASE ((unsigned) 0x04)
|
#define RELEASE ((unsigned) 0x04)
|
||||||
|
#define VERSION ((unsigned) 0x08)
|
||||||
#define U_MACHINE ((unsigned) 0x10)
|
#define U_MACHINE ((unsigned) 0x10)
|
||||||
#define ARCH ((unsigned) 0x20)
|
#define ARCH ((unsigned) 0x20)
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ char **argv;
|
|||||||
case 'n': info |= NODENAME; break;
|
case 'n': info |= NODENAME; break;
|
||||||
case 'r': info |= RELEASE; break;
|
case 'r': info |= RELEASE; break;
|
||||||
case 's': info |= SYSNAME; break;
|
case 's': info |= SYSNAME; break;
|
||||||
case 'v': info |= RELEASE; break;
|
case 'v': info |= VERSION; break;
|
||||||
case 'p': info |= ARCH; break;
|
case 'p': info |= ARCH; break;
|
||||||
default: usage();
|
default: usage();
|
||||||
}
|
}
|
||||||
@ -106,16 +107,19 @@ char **argv;
|
|||||||
if ((info & (SYSNAME|NODENAME)) != 0)
|
if ((info & (SYSNAME|NODENAME)) != 0)
|
||||||
print(STDOUT_FILENO, " ", (char *) NULL);
|
print(STDOUT_FILENO, " ", (char *) NULL);
|
||||||
print(STDOUT_FILENO, un.release, (char *) NULL);
|
print(STDOUT_FILENO, un.release, (char *) NULL);
|
||||||
print(STDOUT_FILENO, ".", (char *) NULL);
|
}
|
||||||
|
if ((info & VERSION) != 0) {
|
||||||
|
if ((info & (SYSNAME|NODENAME|RELEASE)) != 0)
|
||||||
|
print(STDOUT_FILENO, " ", (char *) NULL);
|
||||||
print(STDOUT_FILENO, un.version, (char *) NULL);
|
print(STDOUT_FILENO, un.version, (char *) NULL);
|
||||||
}
|
}
|
||||||
if ((info & U_MACHINE) != 0) {
|
if ((info & U_MACHINE) != 0) {
|
||||||
if ((info & (SYSNAME|NODENAME|RELEASE)) != 0)
|
if ((info & (SYSNAME|NODENAME|RELEASE|VERSION)) != 0)
|
||||||
print(STDOUT_FILENO, " ", (char *) NULL);
|
print(STDOUT_FILENO, " ", (char *) NULL);
|
||||||
print(STDOUT_FILENO, un.machine, (char *) NULL);
|
print(STDOUT_FILENO, un.machine, (char *) NULL);
|
||||||
}
|
}
|
||||||
if ((info & ARCH) != 0) {
|
if ((info & ARCH) != 0) {
|
||||||
if ((info & (SYSNAME|NODENAME|RELEASE|U_MACHINE)) != 0)
|
if ((info & (SYSNAME|NODENAME|RELEASE|VERSION|U_MACHINE)) != 0)
|
||||||
print(STDOUT_FILENO, " ", (char *) NULL);
|
print(STDOUT_FILENO, " ", (char *) NULL);
|
||||||
print(STDOUT_FILENO, un.arch, (char *) NULL);
|
print(STDOUT_FILENO, un.arch, (char *) NULL);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
#define _CONFIG_H
|
#define _CONFIG_H
|
||||||
|
|
||||||
/* Minix release and version numbers. */
|
/* Minix release and version numbers. */
|
||||||
#define OS_RELEASE "3"
|
#define OS_NAME "Minix"
|
||||||
#define OS_VERSION "3.0"
|
#define OS_RELEASE "3.3.0"
|
||||||
|
#define OS_CONFIG "GENERIC"
|
||||||
|
#define OS_VERSION OS_NAME " " OS_RELEASE " (" OS_CONFIG ")"
|
||||||
|
|
||||||
/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
|
/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
|
||||||
* It is divided up into two main sections. The first section contains
|
* It is divided up into two main sections. The first section contains
|
||||||
|
@ -325,12 +325,12 @@ void kmain(kinfo_t *local_cbi)
|
|||||||
static void announce(void)
|
static void announce(void)
|
||||||
{
|
{
|
||||||
/* Display the MINIX startup banner. */
|
/* Display the MINIX startup banner. */
|
||||||
printf("\nMINIX %s.%s. "
|
printf("\nMINIX %s. "
|
||||||
#ifdef _VCS_REVISION
|
#ifdef _VCS_REVISION
|
||||||
"(" _VCS_REVISION ")\n"
|
"(" _VCS_REVISION ")\n"
|
||||||
#endif
|
#endif
|
||||||
"Copyright 2012, Vrije Universiteit, Amsterdam, The Netherlands\n",
|
"Copyright 2012, Vrije Universiteit, Amsterdam, The Netherlands\n",
|
||||||
OS_RELEASE, OS_VERSION);
|
OS_RELEASE);
|
||||||
printf("MINIX is open source software, see http://www.minix3.org\n");
|
printf("MINIX is open source software, see http://www.minix3.org\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
#include "kernel/proc.h"
|
#include "kernel/proc.h"
|
||||||
|
|
||||||
struct utsname uts_val = {
|
struct utsname uts_val = {
|
||||||
"Minix", /* system name */
|
OS_NAME, /* system name */
|
||||||
"noname", /* node/network name */
|
"noname", /* node/network name */
|
||||||
OS_RELEASE, /* O.S. release (e.g. 1.5) */
|
OS_RELEASE, /* O.S. release (e.g. 3.3.0) */
|
||||||
OS_VERSION, /* O.S. version (e.g. 10) */
|
OS_VERSION, /* O.S. version (e.g. Minix 3.3.0 (GENERIC)) */
|
||||||
"xyzzy", /* machine (cpu) type (filled in later) */
|
"xyzzy", /* machine (cpu) type (filled in later) */
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
"i386", /* architecture */
|
"i386", /* architecture */
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
path="$0"
|
path="$0"
|
||||||
[ "${path#/*}" = "$path" ] && path="./$path"
|
[ "${path#/*}" = "$path" ] && path="./$path"
|
||||||
|
|
||||||
release=`grep OS_RELEASE ${path%/*}/../../include/minix/config.h | awk '{ print $3} ' | tr -d '"'`
|
release=`grep "define OS_RELEASE" ${path%/*}/../../include/minix/config.h | awk '{ print $3} ' | tr -d '"' | awk -F. ' { print $1 }'`
|
||||||
major=`grep OS_VERSION ${path%/*}/../../include/minix/config.h | awk '{ print $3 }' | tr -d '"' | awk -F. ' { print $1 }'`
|
major=`grep "define OS_RELEASE" ${path%/*}/../../include/minix/config.h | awk '{ print $3 }' | tr -d '"' | awk -F. ' { print $2 }'`
|
||||||
minor=`grep OS_VERSION ${path%/*}/../../include/minix/config.h | awk '{ print $3 }' | tr -d '"' | awk -F. ' { print $2 }'`
|
minor=`grep "define OS_RELEASE" ${path%/*}/../../include/minix/config.h | awk '{ print $3 }' | tr -d '"' | awk -F. ' { print $3 }'`
|
||||||
|
|
||||||
|
|
||||||
case "$option" in
|
case "$option" in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user