summaryrefslogtreecommitdiffstats
path: root/sys/compat/svr4
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
committerjamie <jamie@FreeBSD.org>2009-05-29 21:27:12 +0000
commit572db1408a55640213faa331981d20cda01f68d8 (patch)
tree36c53629863ffb1eb32354e9a24549059dd6273f /sys/compat/svr4
parent64785ac65985d6800df1bacd80b5a3ba30b36b27 (diff)
downloadFreeBSD-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/compat/svr4')
-rw-r--r--sys/compat/svr4/svr4_stat.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index 8c7b9b8..42e6122 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/un.h>
-#include <sys/vimage.h>
#include <vm/vm.h>
@@ -386,7 +385,7 @@ svr4_ustat(td, uap)
return 0;
}
-/*extern char ostype[], hostname[], osrelease[], version[], machine[];*/
+/*extern char ostype[], osrelease[], version[], machine[];*/
int
svr4_sys_uname(td, uap)
@@ -412,15 +411,12 @@ svr4_sys_systeminfo(td, uap)
struct thread *td;
struct svr4_sys_systeminfo_args *uap;
{
- INIT_VPROCG(TD_TO_VPROCG(td));
+ struct prison *pr;
char *str = NULL;
int error = 0;
register_t *retval = td->td_retval;
size_t len = 0;
- char buf[11]; /* XXX NetBSD uses 256, but we use 11
- here as that seems like awfully
- excessive kstack usage for hostid
- string... */
+ char buf[MAXHOSTNAMELEN];
u_int rlen = uap->len;
switch (uap->what) {
@@ -429,7 +425,8 @@ svr4_sys_systeminfo(td, uap)
break;
case SVR4_SI_HOSTNAME:
- str = V_hostname;
+ getcredhostname(td->td_ucred, buf, sizeof(buf));
+ str = buf;
break;
case SVR4_SI_RELEASE:
@@ -470,8 +467,11 @@ svr4_sys_systeminfo(td, uap)
break;
case SVR4_SI_SRPC_DOMAIN:
- /* XXXRW: locking? */
- str = V_domainname;
+ pr = td->td_ucred->cr_prison;
+ mtx_lock(&pr->pr_mtx);
+ strlcpy(buf, pr->pr_domain, sizeof(buf));
+ mtx_unlock(&pr->pr_mtx);
+ str = buf;
break;
case SVR4_SI_PLATFORM:
OpenPOWER on IntegriCloud