26 lines
704 B
C++
26 lines
704 B
C++
|
#include "arch/CPU.h"
|
||
|
#include "memory/MemoryManager.h"
|
||
|
#include "sys/Syscall.h"
|
||
|
#include <bits/struct_utsname.h>
|
||
|
#include <luna/CString.h>
|
||
|
|
||
|
Result<u64> sys_uname(Registers*, SyscallArgs args)
|
||
|
{
|
||
|
utsname* buf = (utsname*)args[0];
|
||
|
|
||
|
utsname result;
|
||
|
|
||
|
strncpy(result.sysname, "moon", _UTSNAME_LENGTH);
|
||
|
strncpy(result.nodename, "lunar", _UTSNAME_LENGTH);
|
||
|
|
||
|
// FIXME: Hardcode these at build time instead of in code.
|
||
|
strncpy(result.release, "0.1", _UTSNAME_LENGTH);
|
||
|
strncpy(result.version, "alpha", _UTSNAME_LENGTH);
|
||
|
|
||
|
strncpy(result.machine, CPU::platform_string(), _UTSNAME_LENGTH);
|
||
|
|
||
|
if (!MemoryManager::copy_to_user_typed(buf, &result)) return err(EFAULT);
|
||
|
|
||
|
return 0;
|
||
|
}
|