diff options
author | jamie <jamie@FreeBSD.org> | 2009-05-29 21:27:12 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2009-05-29 21:27:12 +0000 |
commit | 572db1408a55640213faa331981d20cda01f68d8 (patch) | |
tree | 36c53629863ffb1eb32354e9a24549059dd6273f /sys/cddl | |
parent | 64785ac65985d6800df1bacd80b5a3ba30b36b27 (diff) | |
download | FreeBSD-src-572db1408a55640213faa331981d20cda01f68d8.zip FreeBSD-src-572db1408a55640213faa331981d20cda01f68d8.tar.gz |
Place hostnames and similar information fully under the prison system.
The system hostname is now stored in prison0, and the global variable
"hostname" has been removed, as has the hostname_mtx mutex. Jails may
have their own host information, or they may inherit it from the
parent/system. The proper way to read the hostname is via
getcredhostname(), which will copy either the hostname associated with
the passed cred, or the system hostname if you pass NULL. The system
hostname can still be accessed directly (and without locking) at
prison0.pr_host, but that should be avoided where possible.
The "similar information" referred to is domainname, hostid, and
hostuuid, which have also become prison parameters and had their
associated global variables removed.
Approved by: bz (mentor)
Diffstat (limited to 'sys/cddl')
-rw-r--r-- | sys/cddl/compat/opensolaris/kern/opensolaris.c | 4 | ||||
-rw-r--r-- | sys/cddl/compat/opensolaris/kern/opensolaris_misc.c | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris.c b/sys/cddl/compat/opensolaris/kern/opensolaris.c index 003120f..5595bd1 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris.c @@ -31,11 +31,11 @@ #include <sys/conf.h> #include <sys/cpuvar.h> #include <sys/errno.h> +#include <sys/jail.h> #include <sys/kernel.h> #include <sys/misc.h> #include <sys/module.h> #include <sys/mutex.h> -#include <sys/vimage.h> cpu_core_t cpu_core[MAXCPU]; kmutex_t cpu_lock; @@ -83,7 +83,7 @@ opensolaris_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - utsname.nodename = G_hostname; + utsname.nodename = prison0.pr_host; break; case MOD_UNLOAD: diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c b/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c index af98827..4f46933 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/jail.h> #include <sys/kernel.h> #include <sys/libkern.h> #include <sys/limits.h> @@ -57,7 +58,7 @@ ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result) { if (str == hw_serial) { - *result = hostid; + *result = prison0.pr_hostid; return (0); } |