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:
parent
cfa4cb788c
commit
d1e2263502
@ -14,6 +14,7 @@ KernelMergeObject posix_sys.o :
|
|||||||
times.c
|
times.c
|
||||||
uio.c
|
uio.c
|
||||||
umask.c
|
umask.c
|
||||||
|
uname.c
|
||||||
wait.c
|
wait.c
|
||||||
: -fPIC -DPIC
|
: -fPIC -DPIC
|
||||||
;
|
;
|
||||||
|
34
src/kernel/libroot/posix/sys/uname.c
Normal file
34
src/kernel/libroot/posix/sys/uname.c
Normal 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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user