diff --git a/libc/build.mak b/libc/build.mak index 7c6665f0907001de0b9d7ad35de87482266a4a81..8d80c92021dd38e674be1653097d18e7b6eabafc 100644 --- a/libc/build.mak +++ b/libc/build.mak @@ -340,6 +340,7 @@ libc += misc/getopt_long.o libc += misc/getsubopt.o libc += misc/realpath.o libc += misc/backtrace.o +libc += misc/uname.o libc += multibyte/btowc.o libc += multibyte/internal.o diff --git a/libc/libc.cc b/libc/libc.cc index 0f683538b4cf126f33050c81e8c7f1e70675335f..27b363a5b8a10cbf72779653fe1ed237bd7315e9 100644 --- a/libc/libc.cc +++ b/libc/libc.cc @@ -97,17 +97,6 @@ struct passwd* getpwuid(uid_t uid) } } -int uname(struct utsname* u) -{ - // lie, to avoid confusing the payload. - strcpy(u->sysname, "Linux"); - strcpy(u->nodename, "osv.local"); - strcpy(u->release, "3.7"); - strcpy(u->version, "#1 SMP"); - strcpy(u->machine, "x86_64"); - return 0; -} - int sched_yield() { sched::thread::yield(); diff --git a/libc/misc/uname.c b/libc/misc/uname.c index 46db90d30bf7a32f87085db5d5e57ddba4992a69..e01583392c82dbd53f778f3d3008b71e9333333d 100644 --- a/libc/misc/uname.c +++ b/libc/misc/uname.c @@ -1,8 +1,16 @@ #include <sys/utsname.h> #include <string.h> -#include "syscall.h" + +struct utsname utsname = { + .sysname = "Linux", /* lie, to avoid confusing the payload. */ + .nodename = "osv.local", + .release = "3.7", + .version = "#1 SMP", + .machine = "x86_64", +}; int uname(struct utsname *uts) { - return syscall(SYS_uname, uts); + memcpy(uts, &utsname, sizeof(struct utsname)); + return 0; }