diff --git a/src/kernel/libroot/posix/sys/Jamfile b/src/kernel/libroot/posix/sys/Jamfile index 5c3ec8cb11..7d119a8108 100644 --- a/src/kernel/libroot/posix/sys/Jamfile +++ b/src/kernel/libroot/posix/sys/Jamfile @@ -14,6 +14,7 @@ KernelMergeObject posix_sys.o : times.c uio.c umask.c - wait.c + uname.c + wait.c : -fPIC -DPIC ; diff --git a/src/kernel/libroot/posix/sys/uname.c b/src/kernel/libroot/posix/sys/uname.c new file mode 100644 index 0000000000..430c5f9191 --- /dev/null +++ b/src/kernel/libroot/posix/sys/uname.c @@ -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 +#include +#include +#include +#include + +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; +} +