From 4849be9c13ff83538d27defe6eecf2d1f43fc444 Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Mon, 8 Aug 1994 00:30:12 +0000 Subject: [PATCH] Define a sysctl MIB variable for the YP domain name. --- sys/kern/kern_sysctl.c | 10 +++++++++- sys/kern/kern_xxx.c | 6 +++--- sys/sys/sysctl.h | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 71c8d56d2da5..c1308cdd1315 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id$ + * $Id: kern_sysctl.c,v 1.3 1994/08/02 07:42:19 davidg Exp $ */ /* @@ -176,6 +176,8 @@ __sysctl(p, uap, retval) */ char hostname[MAXHOSTNAMELEN]; int hostnamelen; +char domainname[MAXHOSTNAMELEN]; +int domainnamelen; long hostid; int securelevel; @@ -231,6 +233,12 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) if (newp && !error) hostnamelen = newlen; return (error); + case KERN_DOMAINNAME: + error = sysctl_string(oldp, oldlenp, newp, newlen, + domainname, sizeof(domainname)); + if (newp && !error) + domainnamelen = newlen; + return (error); case KERN_HOSTID: inthostid = hostid; /* XXX assumes sizeof long <= sizeof int */ error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid); diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 5f7ba517f979..8f9b72b2b254 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 - * $Id$ + * $Id: kern_xxx.c,v 1.3 1994/08/02 07:42:23 davidg Exp $ */ #include @@ -43,8 +43,8 @@ #include #include -char domainname[MAXHOSTNAMELEN]; -int domainnamelen; +extern char domainname[MAXHOSTNAMELEN]; +extern int domainnamelen; struct reboot_args { int opt; diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index a27ec38bf9f5..e4e40bd48a45 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $Id$ + * $Id: sysctl.h,v 1.2 1994/08/02 07:53:41 davidg Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -128,7 +128,8 @@ struct ctlname { #define KERN_JOB_CONTROL 19 /* int: is job control available */ #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ #define KERN_BOOTTIME 21 /* struct: time kernel was booted */ -#define KERN_MAXID 22 /* number of valid kern ids */ +#define KERN_DOMAINNAME 22 /* string: YP domain name */ +#define KERN_MAXID 23 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ @@ -153,6 +154,7 @@ struct ctlname { { "job_control", CTLTYPE_INT }, \ { "saved_ids", CTLTYPE_INT }, \ { "boottime", CTLTYPE_STRUCT }, \ + { "domainname", CTLTYPE_STRING }, \ } /*