emulation specific sysctls. Also change the kernel date to nov 11 as requested

by bad.
This commit is contained in:
christos 2002-03-20 00:27:58 +00:00
parent 195539260e
commit 50981e06bc
2 changed files with 67 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.h,v 1.18 2002/01/14 23:14:42 bjh21 Exp $ */
/* $NetBSD: linux_exec.h,v 1.19 2002/03/20 00:27:58 christos Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -82,19 +82,44 @@
/*
* From Linux's include/linux/elf.h
*/
#define LINUX_AT_UID 11 /* real uid */
#define LINUX_AT_EUID 12 /* effective uid */
#define LINUX_AT_GID 13 /* real gid */
#define LINUX_AT_EGID 14 /* effective gid */
#define LINUX_AT_PLATFORM 15 /* string identifying CPU for optimizations */
#define LINUX_AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
#define LINUX_AT_CLKTCK 17 /* frequency at which times() increments */
*/
#define LINUX_AT_UID 11 /* real uid */
#define LINUX_AT_EUID 12 /* effective uid */
#define LINUX_AT_GID 13 /* real gid */
#define LINUX_AT_EGID 14 /* effective gid */
#define LINUX_AT_PLATFORM 15 /* CPU string for optimizations */
#define LINUX_AT_HWCAP 16 /* arch dependent CPU capabilities */
#define LINUX_AT_CLKTCK 17 /* frequency times() increments */
/*
* Emulation specific sysctls.
*/
#define EMUL_LINUX_KERN 1
#define EMUL_LINUX_MAXID 2
#define EMUL_LINUX_NAMES { \
{ 0, 0 }, \
{ "kern", CTLTYPE_NODE }, \
}
#define EMUL_LINUX_KERN_OSTYPE 1
#define EMUL_LINUX_KERN_OSRELEASE 2
#define EMUL_LINUX_KERN_VERSION 3
#define EMUL_LINUX_KERN_MAXID 4
#define EMUL_LINUX_KERN_NAMES { \
{ 0, 0 }, \
{ "ostype", CTLTYPE_STRING }, \
{ "osrelease", CTLTYPE_STRING }, \
{ "osversion", CTLTYPE_STRING }, \
}
#ifdef _KERNEL
__BEGIN_DECLS
extern const struct emul emul_linux;
int sysctl_linux __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
void linux_setregs __P((struct proc *, struct exec_package *, u_long));
int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *));
int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_sysctl.c,v 1.2 2002/02/20 17:02:48 christos Exp $ */
/* $NetBSD: linux_sysctl.c,v 1.3 2002/03/20 00:27:58 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.2 2002/02/20 17:02:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.3 2002/03/20 00:27:58 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sysctl.c,v 1.2 2002/02/20 17:02:48 christos Ex
#include <compat/linux/linux_syscallargs.h>
#include <compat/linux/common/linux_sysctl.h>
#include <compat/linux/common/linux_exec.h>
int linux_kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
@ -178,7 +179,7 @@ linux_sys___sysctl(struct proc *p, void *v, register_t *retval)
*/
char linux_sysname[128] = "Linux";
char linux_release[128] = "2.0.38";
char linux_version[128] = "#0 Sun Apr 1 11:11:11 MET 2000";
char linux_version[128] = "#0 Sun Nov 11 11:11:11 MET 2000";
/*
* kernel related system variables.
@ -206,6 +207,35 @@ linux_kern_sysctl(int *name, u_int nlen, void *oldp, size_t *oldlenp,
}
}
/*
* kernel related system variables.
*/
int
sysctl_linux(int *name, u_int nlen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen, struct proc *p)
{
if (nlen != 2 || name[0] != EMUL_LINUX_KERN)
return EOPNOTSUPP;
/*
* Note that we allow writing into this, so that userland
* programs can setup things as they see fit. This is suboptimal.
*/
switch (name[1]) {
case EMUL_LINUX_KERN_OSTYPE:
return sysctl_string(oldp, oldlenp, newp, newlen,
linux_sysname, sizeof(linux_sysname));
case EMUL_LINUX_KERN_OSRELEASE:
return sysctl_string(oldp, oldlenp, newp, newlen,
linux_release, sizeof(linux_release));
case EMUL_LINUX_KERN_VERSION:
return sysctl_string(oldp, oldlenp, newp, newlen,
linux_version, sizeof(linux_version));
default:
return EOPNOTSUPP;
}
}
/*
* hardware related system variables.
*/