compiles
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/syscall.h>
|
||||
#include <zinnia/usercopy.h>
|
||||
#include <config.h>
|
||||
#include <uapi/utsname.h>
|
||||
|
||||
static spinlock_t uname_lock = {};
|
||||
|
||||
static struct utsname uname_buf = {
|
||||
.sysname = "Zinnia",
|
||||
.release = ZINNIA_VERSION,
|
||||
.version = CONFIG_KERNEL_FLAVOR,
|
||||
.nodename = "localhost",
|
||||
.machine = ZINNIA_ARCH,
|
||||
};
|
||||
|
||||
struct syscall_ret sys_getuname(__user struct utsname* ptr) {
|
||||
struct syscall_ret ret = {};
|
||||
|
||||
if (!ptr) {
|
||||
ret.errno = EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
spin_lock(&uname_lock);
|
||||
|
||||
if (!usercopy_write(ptr, &uname_buf, sizeof(uname_buf)))
|
||||
ret.errno = EFAULT;
|
||||
|
||||
spin_unlock(&uname_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user