Skip to content
Snippets Groups Projects
Commit 43c3f6dd authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

provide a utsname structure

ZFS wants direct access to a global utsname structure.  Provide one from
core OSv code and rewrite uname to just copy it out.  To ease this move
the uname implementation to a C file as this allows using designated
initializers and avoids the casting mess around memcpy.
parent 6ebb582e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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();
......
#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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment