From owner-freebsd-bugs Fri Sep 8 13:40:15 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 665DC37B443 for ; Fri, 8 Sep 2000 13:40:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id NAA43669; Fri, 8 Sep 2000 13:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail11.disney.com (mail11.disney.com [208.246.35.55]) by hub.freebsd.org (Postfix) with ESMTP id 7E40C37B424 for ; Fri, 8 Sep 2000 13:38:14 -0700 (PDT) Received: from pain.corp.disney.com (pain.corp.disney.com [153.7.231.100]) by mail11.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id e88KnJ203704 for ; Fri, 8 Sep 2000 13:49:20 -0700 (PDT) Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Fri, 8 Sep 2000 13:38:39 -0700 Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2]) by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id NAA28598 for ; Fri, 8 Sep 2000 13:38:08 -0700 (PDT) (envelope-from pirzyk@fa.disney.com) Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [172.30.228.110]) by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id NAA28440 for ; Fri, 8 Sep 2000 13:38:07 -0700 (PDT) (envelope-from pirzyk@fa.disney.com) Received: (from pirzyk@localhost) by snoopy.fan.fa.disney.com (8.9.3/8.9.3) id NAA00820; Fri, 8 Sep 2000 13:38:07 -0700 (PDT) (envelope-from pirzyk@fa.disney.com) Message-Id: <200009082038.NAA00820@snoopy.fan.fa.disney.com> Date: Fri, 8 Sep 2000 13:38:07 -0700 (PDT) From: Jim.Pirzyk@disney.com Reply-To: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/21132: kern.hostid 31bit field and not a 32bit field Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 21132 >Category: kern >Synopsis: setting kern.hostid to 2887705710 fails. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Sep 08 13:40:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Jim Pirzyk >Release: FreeBSD 4.1-RELEASE i386 >Organization: >Environment: Any standard 4.1 enviroment >Description: kern.hostid can only be set up to LONG_MAX >How-To-Repeat: sysctl -w kern.hostid=2887705710 >Fix: *** sbin/sysctl/sysctl.c.orig Fri Sep 8 12:55:12 2000 --- sbin/sysctl/sysctl.c Fri Sep 8 13:03:46 2000 *************** *** 121,127 **** { int len, i, j; void *newval = 0; ! int intval, newsize = 0; quad_t quadval; int mib[CTL_MAXNAME]; char *cp, *bufp, buf[BUFSIZ]; --- 122,128 ---- { int len, i, j; void *newval = 0; ! unsigned int intval, newsize = 0; quad_t quadval; int mib[CTL_MAXNAME]; char *cp, *bufp, buf[BUFSIZ]; *************** *** 167,173 **** switch (kind & CTLTYPE) { case CTLTYPE_INT: ! intval = (int) strtol(newval, NULL, 0); newval = &intval; newsize = sizeof intval; break; --- 168,174 ---- switch (kind & CTLTYPE) { case CTLTYPE_INT: ! intval = (unsigned int) strtoul(newval, NULL, 0); newval = &intval; newsize = sizeof intval; break; *** sys/kern/kern_mib.c.orig Fri Sep 8 12:17:20 2000 --- sys/kern/kern_mib.c Fri Sep 8 12:29:55 2000 *************** *** 186,194 **** SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW, &domainname, sizeof(domainname), "Name of the current YP/NIS domain"); ! long hostid; /* Some trouble here, if sizeof (int) != sizeof (long) */ ! SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID"); /* * This is really cheating. These actually live in the libc, something --- 186,194 ---- SYSCTL_STRING(_kern, KERN_NISDOMAINNAME, domainname, CTLFLAG_RW, &domainname, sizeof(domainname), "Name of the current YP/NIS domain"); ! unsigned long hostid; /* Some trouble here, if sizeof (int) != sizeof (long) */ ! SYSCTL_UINT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID"); /* * This is really cheating. These actually live in the libc, something *** sys/kern/kern_xxx.c.orig Fri Sep 8 12:35:33 2000 --- sys/kern/kern_xxx.c Fri Sep 8 12:36:17 2000 *************** *** 103,109 **** struct ogethostid_args *uap; { ! *(long *)(p->p_retval) = hostid; return (0); } #endif /* COMPAT_43 || COMPAT_SUNOS */ --- 103,109 ---- struct ogethostid_args *uap; { ! *(unsigned long *)(p->p_retval) = hostid; return (0); } #endif /* COMPAT_43 || COMPAT_SUNOS */ *************** *** 111,117 **** #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_ struct osethostid_args { ! long hostid; }; #endif /* ARGSUSED */ --- 111,117 ---- #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_ struct osethostid_args { ! unsigned long hostid; }; #endif /* ARGSUSED */ *** sys/sys/kernel.h.orig Fri Sep 8 12:18:01 2000 --- sys/sys/kernel.h Fri Sep 8 12:18:12 2000 *************** *** 55,61 **** /* Global variables for the kernel. */ /* 1.1 */ ! extern long hostid; extern char hostname[MAXHOSTNAMELEN]; extern int hostnamelen; extern char domainname[MAXHOSTNAMELEN]; --- 55,61 ---- /* Global variables for the kernel. */ /* 1.1 */ ! extern unsigned long hostid; extern char hostname[MAXHOSTNAMELEN]; extern int hostnamelen; extern char domainname[MAXHOSTNAMELEN]; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message