LibC: Implement uname()

This commit is contained in:
Bananymous 2024-07-31 23:54:26 +03:00
parent 20d38ed28c
commit adf50dffd8
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,17 @@
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>
#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;
}