diff --git a/userspace/libraries/LibC/CMakeLists.txt b/userspace/libraries/LibC/CMakeLists.txt index e6ec4442..113d0c0a 100644 --- a/userspace/libraries/LibC/CMakeLists.txt +++ b/userspace/libraries/LibC/CMakeLists.txt @@ -24,6 +24,7 @@ set(LIBC_SOURCES sys/socket.cpp sys/stat.cpp sys/time.cpp + sys/utsname.cpp sys/wait.cpp termios.cpp time.cpp diff --git a/userspace/libraries/LibC/sys/utsname.cpp b/userspace/libraries/LibC/sys/utsname.cpp new file mode 100644 index 00000000..ff6e4cb1 --- /dev/null +++ b/userspace/libraries/LibC/sys/utsname.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +#define __xstr(s) __str(s) +#define __str(s) #s + +int uname(struct utsname* name) +{ + strcpy(name->sysname, "banan-os"); + if (gethostname(name->nodename, sizeof(name->nodename)) == -1) + return -1; + strcpy(name->release, "0.0.0-banan_os"); + strcpy(name->version, __DATE__ " " __TIME__); + strcpy(name->machine, __xstr(__arch)); + return 0; +}