LibC: Implement uname()
This commit is contained in:
parent
20d38ed28c
commit
adf50dffd8
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue