untested uname implementation

still lacking some way of getting/setting hostname in our kernel


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2004-12-17 16:23:22 +00:00
parent cfa4cb788c
commit d1e2263502
2 changed files with 36 additions and 1 deletions

View File

@ -14,6 +14,7 @@ KernelMergeObject posix_sys.o :
times.c
uio.c
umask.c
wait.c
uname.c
wait.c
: -fPIC -DPIC
;

View File

@ -0,0 +1,34 @@
/*
** Copyright 2004, Jérôme Duval jerome.duval@free.fr. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
#include <sys/utsname.h>
#include <OS.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
int
uname(struct utsname *info)
{
system_info sinfo;
if (!info) {
errno = B_BAD_VALUE;
return -1;
}
get_system_info(&sinfo);
strlcpy(info->sysname, sinfo.kernel_name, B_FILE_NAME_LENGTH);
strlcpy(info->version, sinfo.kernel_build_date, B_OS_NAME_LENGTH);
strlcat(info->version, sinfo.kernel_build_time, B_OS_NAME_LENGTH);
sprintf(info->release, "%Ld", sinfo.kernel_version);
// TODO fill nodename field when we have hostname info
return 0;
}