Define a sysctl MIB variable for the YP domain name.

This commit is contained in:
Garrett Wollman 1994-08-08 00:30:12 +00:00
parent 5f51a9a8d5
commit 4849be9c13
3 changed files with 16 additions and 6 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * @(#)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]; char hostname[MAXHOSTNAMELEN];
int hostnamelen; int hostnamelen;
char domainname[MAXHOSTNAMELEN];
int domainnamelen;
long hostid; long hostid;
int securelevel; int securelevel;
@ -231,6 +233,12 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
if (newp && !error) if (newp && !error)
hostnamelen = newlen; hostnamelen = newlen;
return (error); 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: case KERN_HOSTID:
inthostid = hostid; /* XXX assumes sizeof long <= sizeof int */ inthostid = hostid; /* XXX assumes sizeof long <= sizeof int */
error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid); error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 * @(#)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 <sys/param.h> #include <sys/param.h>
@ -43,8 +43,8 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/utsname.h> #include <sys/utsname.h>
char domainname[MAXHOSTNAMELEN]; extern char domainname[MAXHOSTNAMELEN];
int domainnamelen; extern int domainnamelen;
struct reboot_args { struct reboot_args {
int opt; int opt;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93 * @(#)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_ #ifndef _SYS_SYSCTL_H_
@ -128,7 +128,8 @@ struct ctlname {
#define KERN_JOB_CONTROL 19 /* int: is job control available */ #define KERN_JOB_CONTROL 19 /* int: is job control available */
#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ #define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ #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 { \ #define CTL_KERN_NAMES { \
{ 0, 0 }, \ { 0, 0 }, \
@ -153,6 +154,7 @@ struct ctlname {
{ "job_control", CTLTYPE_INT }, \ { "job_control", CTLTYPE_INT }, \
{ "saved_ids", CTLTYPE_INT }, \ { "saved_ids", CTLTYPE_INT }, \
{ "boottime", CTLTYPE_STRUCT }, \ { "boottime", CTLTYPE_STRUCT }, \
{ "domainname", CTLTYPE_STRING }, \
} }
/* /*