From 13d77a4cde44adbc3e707af2125cfc51c099480d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 9 Aug 2005 22:58:58 +0000 Subject: [PATCH] Now fills in the machine field with something more appropriate (currently mimics BeOS behaviour). Maybe we want to have some different values here later on. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13926 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/sys/uname.c | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/system/libroot/posix/sys/uname.c b/src/system/libroot/posix/sys/uname.c index 58c0443dd9..86a07afd59 100644 --- a/src/system/libroot/posix/sys/uname.c +++ b/src/system/libroot/posix/sys/uname.c @@ -1,35 +1,52 @@ /* -** Copyright 2004, Jérôme Duval jerome.duval@free.fr. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004, Jérôme Duval jerome.duval@free.fr. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#include + #include -#include #include #include #include + int uname(struct utsname *info) { - system_info sinfo; + system_info systemInfo; + const char *platform; if (!info) { errno = B_BAD_VALUE; return -1; } - get_system_info(&sinfo); + get_system_info(&systemInfo); strlcpy(info->sysname, "Haiku", sizeof(info->sysname)); - strlcpy(info->version, sinfo.kernel_build_date, sizeof(info->version)); - strlcat(info->version, sinfo.kernel_build_time, sizeof(info->version)); - snprintf(info->release, sizeof(info->release), "%lld", sinfo.kernel_version); + strlcpy(info->version, systemInfo.kernel_build_date, sizeof(info->version)); + strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version)); + snprintf(info->release, sizeof(info->release), "%lld", systemInfo.kernel_version); + + // TODO: make this better + switch (systemInfo.platform_type) { + case B_BEBOX_PLATFORM: + platform = "BeBox"; + break; + case B_MAC_PLATFORM: + platform = "BeMac"; + break; + case B_AT_CLONE_PLATFORM: + platform = "BePC"; + break; + default: + platform = "unknown"; + break; + } + strlcpy(info->machine, platform, sizeof(info->machine)); - // TODO fill machine field... - strlcpy(info->machine, "unknown", sizeof(info->machine)); - // TODO fill nodename field when we have hostname info strlcpy(info->nodename, "unknown", sizeof(info->nodename));