mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-30 14:08:21 +00:00
kernel: usercopy functions
This commit is contained in:
@@ -11,6 +11,8 @@ typedef struct {
|
||||
} utsname_t;
|
||||
|
||||
void hostname_get(char *buf);
|
||||
static char *sysname = "Astral";
|
||||
static char *release = "Astral";
|
||||
|
||||
syscallret_t syscall_uname(context_t *, utsname_t *utsname) {
|
||||
syscallret_t ret = {0};
|
||||
@@ -18,12 +20,14 @@ syscallret_t syscall_uname(context_t *, utsname_t *utsname) {
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
hostname_get(hostname);
|
||||
|
||||
strcpy(utsname->sysname, "Astral");
|
||||
strcpy(utsname->nodename, hostname);
|
||||
strcpy(utsname->release, "Astral");
|
||||
strcpy(utsname->version, BUILD_DATE);
|
||||
strcpy(utsname->machine, BUILD_TARGET);
|
||||
strcpy(utsname->domainname, hostname);
|
||||
if (
|
||||
usercopy_touser(utsname->sysname, sysname, strlen(sysname) + 1) ||
|
||||
usercopy_touser(utsname->nodename, hostname, strlen(hostname) + 1) ||
|
||||
usercopy_touser(utsname->release, release, strlen(release) + 1) ||
|
||||
usercopy_touser(utsname->version, BUILD_DATE, strlen(BUILD_DATE) + 1) ||
|
||||
usercopy_touser(utsname->machine, BUILD_TARGET, strlen(BUILD_TARGET) + 1) ||
|
||||
usercopy_touser(utsname->domainname, hostname, strlen(hostname) + 1))
|
||||
ret.errno = EFAULT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user