BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / bb0cb7718204df7c0cbaf87484b1def3c4b2880f / kernel / uname.c

// Related

Nucleus

Barry Per-CPU Scheduler bb0cb77 (3 years, 2 months ago)
/*
 * This file implements the uname system call.  It stores information about the
 * kernel to a buffer for userspace to read.
 */

#include <string.h>
#include <sys/utsname.h>
#include <errno.h>
#include <nucleus/memory.h>

static const char *SYSNAME = "Nucleus";
static const char *RELEASE = "0.9.2";
static const char *VERSION = "SMP PREEMPT "__DATE__" "__TIME__;
static const char *MACHINE = "x86";

/* Get information about current kernel */
int
uname(struct utsname *buf)
{
	strcpy(buf->sysname, SYSNAME);
	strcpy(buf->release, RELEASE);
	strcpy(buf->version, VERSION);
	strcpy(buf->machine, MACHINE);
}

/* Kernel information system call */
int
sys_uname(struct utsname *buf)
{
	if (!buf || !verify_access(buf, sizeof(struct utsname), PROT_WRITE))
		return -EFAULT;
	uname(buf);
}