diff --git a/src/kernel/emulation/linux/CMakeLists.txt b/src/kernel/emulation/linux/CMakeLists.txt index 18cd4566a..1b0ec236d 100644 --- a/src/kernel/emulation/linux/CMakeLists.txt +++ b/src/kernel/emulation/linux/CMakeLists.txt @@ -57,6 +57,7 @@ set(emulation_sources stat/common.c dirent/getdirentries.c time/gettimeofday.c + ext/uname.c ext/epoll_create.c ext/epoll_create1.c ext/epoll_ctl.c diff --git a/src/kernel/emulation/linux/ext/sys/utsname.h b/src/kernel/emulation/linux/ext/sys/utsname.h new file mode 100644 index 000000000..61ba00b14 --- /dev/null +++ b/src/kernel/emulation/linux/ext/sys/utsname.h @@ -0,0 +1,19 @@ +#ifndef EXT_UNAME_H +#define EXT_UNAME_H + +#define LINUX_UTSNAME_LENGTH 65 + +struct linux_utsname +{ + char sysname[LINUX_UTSNAME_LENGTH]; + char nodename[LINUX_UTSNAME_LENGTH]; + char release[LINUX_UTSNAME_LENGTH]; + char version[LINUX_UTSNAME_LENGTH]; + char machine[LINUX_UTSNAME_LENGTH]; + char domainname[LINUX_UTSNAME_LENGTH]; +}; + +int __linux_uname(struct linux_utsname* p); + +#endif + diff --git a/src/kernel/emulation/linux/ext/uname.c b/src/kernel/emulation/linux/ext/uname.c new file mode 100644 index 000000000..7a290a33f --- /dev/null +++ b/src/kernel/emulation/linux/ext/uname.c @@ -0,0 +1,21 @@ +#include "sys/utsname.h" +#include "../base.h" +#include "../errno.h" +#include + +extern void cerror(int e); + +int __linux_uname(struct linux_utsname* p) +{ + int rv; + + rv = LINUX_SYSCALL(__NR_uname, p); + if (rv < 0) + { + cerror(errno_linux_to_bsd(rv)); + return -1; + } + + return rv; +} +