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
This commit is contained in:
@@ -1,35 +1,52 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Jérôme Duval [email protected]. All rights reserved.
|
* Copyright 2004, Jérôme Duval [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <OS.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
uname(struct utsname *info)
|
uname(struct utsname *info)
|
||||||
{
|
{
|
||||||
system_info sinfo;
|
system_info systemInfo;
|
||||||
|
const char *platform;
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
errno = B_BAD_VALUE;
|
errno = B_BAD_VALUE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_system_info(&sinfo);
|
get_system_info(&systemInfo);
|
||||||
|
|
||||||
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
|
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
|
||||||
strlcpy(info->version, sinfo.kernel_build_date, sizeof(info->version));
|
strlcpy(info->version, systemInfo.kernel_build_date, sizeof(info->version));
|
||||||
strlcat(info->version, sinfo.kernel_build_time, sizeof(info->version));
|
strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version));
|
||||||
snprintf(info->release, sizeof(info->release), "%lld", sinfo.kernel_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
|
// TODO fill nodename field when we have hostname info
|
||||||
strlcpy(info->nodename, "unknown", sizeof(info->nodename));
|
strlcpy(info->nodename, "unknown", sizeof(info->nodename));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user