summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_mib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_mib.c')
-rw-r--r--sys/compat/linux/linux_mib.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c
index 0721d52..3b02511 100644
--- a/sys/compat/linux/linux_mib.c
+++ b/sys/compat/linux/linux_mib.c
@@ -52,6 +52,7 @@ struct linux_prison {
char pr_osname[LINUX_MAX_UTSNAME];
char pr_osrelease[LINUX_MAX_UTSNAME];
int pr_oss_version;
+ int pr_use_linux26; /* flag to determine whether to use 2.6 emulation */
};
SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0,
@@ -82,6 +83,7 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, osname,
"Linux kernel OS name");
static char linux_osrelease[LINUX_MAX_UTSNAME] = "2.4.2";
+static int linux_use_linux26 = 0;
static int
linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS)
@@ -227,19 +229,45 @@ linux_get_osrelease(struct thread *td, char *dst)
}
int
+linux_use26(struct thread *td)
+{
+ struct prison *pr;
+ struct linux_prison *lpr;
+ int use26 = 0; /* defaults to off */
+
+ pr = td->td_ucred->cr_prison;
+ if (pr != NULL) {
+ mtx_lock(&pr->pr_mtx);
+ if (pr->pr_linux != NULL) {
+ lpr = (struct linux_prison *)pr->pr_linux;
+ use26 = lpr->pr_use_linux26;
+ }
+ mtx_unlock(&pr->pr_mtx);
+ } else
+ use26 = linux_use_linux26;
+
+ return (use26);
+}
+
+int
linux_set_osrelease(struct thread *td, char *osrelease)
{
struct prison *pr;
struct linux_prison *lpr;
+ int use26;
+
+ use26 = (strlen(osrelease) >= 3 && osrelease[2] == '6');
pr = linux_get_prison(td);
if (pr != NULL) {
lpr = (struct linux_prison *)pr->pr_linux;
strcpy(lpr->pr_osrelease, osrelease);
+ lpr->pr_use_linux26 = use26;
mtx_unlock(&pr->pr_mtx);
} else {
mtx_lock(&osname_lock);
strcpy(linux_osrelease, osrelease);
+ linux_use_linux26 = use26;
mtx_unlock(&osname_lock);
}
OpenPOWER on IntegriCloud