Define a sysctl MIB variable for the YP domain name.

This commit is contained in:
wollman 1994-08-08 00:30:12 +00:00
parent 975056963b
commit 873a84d2e3
3 changed files with 16 additions and 6 deletions

View File

@ -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);

View File

@ -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 <sys/param.h>
@ -43,8 +43,8 @@
#include <sys/sysctl.h>
#include <sys/utsname.h>
char domainname[MAXHOSTNAMELEN];
int domainnamelen;
extern char domainname[MAXHOSTNAMELEN];
extern int domainnamelen;
struct reboot_args {
int opt;

View File

@ -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 }, \
}
/*