From owner-p4-projects@FreeBSD.ORG Sun Sep 4 20:26:41 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 761C916A421; Sun, 4 Sep 2005 20:26:41 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 504D216A41F for ; Sun, 4 Sep 2005 20:26:41 +0000 (GMT) (envelope-from soc-victor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F2ED43D49 for ; Sun, 4 Sep 2005 20:26:41 +0000 (GMT) (envelope-from soc-victor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j84KQekA092625 for ; Sun, 4 Sep 2005 20:26:40 GMT (envelope-from soc-victor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j84KQeUh092622 for perforce@freebsd.org; Sun, 4 Sep 2005 20:26:40 GMT (envelope-from soc-victor@freebsd.org) Date: Sun, 4 Sep 2005 20:26:40 GMT Message-Id: <200509042026.j84KQeUh092622@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to soc-victor@freebsd.org using -f From: Victor Cruceru To: Perforce Change Reviews Cc: Subject: PERFORCE change 83115 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2005 20:26:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=83115 Change 83115 by soc-victor@soc-victor_82.76.158.176 on 2005/09/04 20:26:09 The rest of the basic cleanup for the HOST-RESOURCES-MIB Affected files ... .. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c#7 edit Differences ... ==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c#7 (text+ko) ==== @@ -37,11 +37,9 @@ #include #include #include -#include #include #include #include -#include #include @@ -157,7 +155,8 @@ entry->name[sizeof(entry->name) - 1] = '\0'; - (void)strncpy(&entry->name[0], &kp->ki_ocomm[0], sizeof(entry->name) - 1); + (void)strncpy((char*)&entry->name[0], + &kp->ki_ocomm[0], sizeof(entry->name) - 1); entry->id = oid_zeroDotZero; /*unknown id - FIX ME*/ @@ -178,7 +177,8 @@ */ if(*argv != NULL && (*argv)[0] == '/') { memset(&entry->path[0], '\0', sizeof(entry->path)); - (void)strncpy(&entry->path[0], *argv, sizeof(entry->path) - 1); + (void)strncpy((char*)&entry->path[0], + *argv, sizeof(entry->path) - 1); } argv++; /*skip the first one which was used for path*/ @@ -186,20 +186,25 @@ while (argv != NULL && *argv != NULL ) { if (entry->parameters[0] != 0) { /*add a space between parameters, except before the first one*/ - strncat(&entry->parameters[0], - " ", - sizeof(entry->parameters) - strlen(entry->parameters) - 1); + strncat((char *)&entry->parameters[0], + " ", + sizeof(entry->parameters) - + strlen((const char*)&entry->parameters[0]) + - 1); } - strncat(&entry->parameters[0], *argv, - sizeof(entry->parameters) - strlen(entry->parameters) - 1); + strncat((char *)&entry->parameters[0], *argv, + sizeof(entry->parameters) - + strlen((const char*)&entry->parameters[0]) + - 1); argv++; }/*end while */ } - entry->type = ( IS_KERNPROC(kp) ? SRT_OPERATING_SYSTEM : SRT_APPLICATION ); + entry->type = ( IS_KERNPROC(kp) ? (int32_t)SRT_OPERATING_SYSTEM : + (int32_t)SRT_APPLICATION ); - entry ->status = hrSWRun_OS_get_proc_status(kp); + entry ->status = (int32_t)hrSWRun_OS_get_proc_status(kp); cpu_time = kp->ki_runtime / 100000; /*centi-seconds*/ /*may overflow the snmp type */ entry->perfCPU = (cpu_time > (uint64_t)INT_MAX ? INT_MAX : cpu_time); @@ -216,7 +221,8 @@ assert(entry != NULL); entry->name[sizeof(entry->name) - 1] = '\0'; - (void)strncpy(&entry->name[0], &kfs->name[0], sizeof(entry->name) - 1); + (void)strncpy((char *)&entry->name[0], &kfs->name[0], + sizeof(entry->name) - 1); /*FIX ME: can we find the location where the module was loaded from? */ entry->path[0] = '\0'; @@ -227,12 +233,12 @@ entry->id = oid_zeroDotZero; /*unknown id - FIX ME*/ if (strncmp(kfs->name, "kernel", strlen("kernel") ) == 0) { - entry->type = SRT_OPERATING_SYSTEM; + entry->type = (int32_t)SRT_OPERATING_SYSTEM; hrState_g.hrSWOSIndex = entry->index; }else{ - entry->type = SRT_DEVICE_DRIVER; /*not really*/ + entry->type = (int32_t)SRT_DEVICE_DRIVER; /*well, not really*/ } - entry->status = SRS_RUNNING; + entry->status = (int32_t)SRS_RUNNING; entry->perfCPU = 0; /*Info not available*/ entry->perfMemory = kfs->size / 1024; /*in kilo-bytes*/ entry->r_tick = get_ticks(); @@ -373,8 +379,11 @@ /* not found, it's gone. Mark it as invalid for now, it * will be removed from the list at next global refersh */ - HR_DPRINTF((stderr, "%s: missing item with kid = %d \n ", __func__, entry->index - NO_PID - 1)); - entry->status = SRS_INVALID; + HR_DPRINTF((stderr, + "%s: missing item with kid = %d \n ", + __func__, + entry->index - NO_PID - 1)); + entry->status = (int32_t)SRS_INVALID; } @@ -384,8 +393,10 @@ assert(hrState_g.kd != NULL); plist = kvm_getprocs(hrState_g.kd, KERN_PROC_PID, entry->index - 1, &nproc); if (plist == NULL || nproc != 1) { - HR_DPRINTF((stderr, "%s: missing item with PID = %d \n ", __func__, entry->index - 1)); - entry->status = SRS_INVALID; + HR_DPRINTF((stderr, "%s: missing item with PID = %d \n ", + __func__, + entry->index - 1)); + entry->status = (int32_t)SRS_INVALID; return; } kinfo_proc_to_hrSWRunTblEntry_v(plist,entry); @@ -435,8 +446,10 @@ /* not found, it's gone. Mark it as invalid for now, it * will be removed from the list at next global refersh */ - HR_DPRINTF((stderr, "%s: missing item with kid = %d \n ", __func__, entry->index - NO_PID - 1)); - entry->status = SRS_INVALID; + HR_DPRINTF((stderr, "%s: missing item with kid = %d \n ", + __func__, + entry->index - NO_PID - 1)); + entry->status = (int32_t)SRS_INVALID; return (SNMP_ERR_NOERROR); } @@ -447,8 +460,10 @@ assert(hrState_g.kd != NULL); plist = kvm_getprocs(hrState_g.kd, KERN_PROC_PID, entry->index - 1, &nproc); if (plist == NULL || nproc != 1) { - HR_DPRINTF((stderr, "%s: missing item with PID = %d \n ", __func__, entry->index - 1)); - entry->status = SRS_INVALID; + HR_DPRINTF((stderr, "%s: missing item with PID = %d \n ", + __func__, + entry->index - 1)); + entry->status = (int32_t)SRS_INVALID; return (SNMP_ERR_NOERROR); } if(IS_KERNPROC(plist)) { @@ -528,13 +543,13 @@ entry->index)); fetch_hrSWRun_entry_v(entry); } - if(entry->status == SRS_INVALID){ + if(entry->status == (int32_t)SRS_INVALID){ return (SNMP_ERR_NOERROR); } switch (value->var.subs[sub - 1]) { case LEAF_hrSWRunStatus: { - if( value->v.integer != SRS_INVALID) { + if( value->v.integer != (int32_t)SRS_INVALID) { return (SNMP_ERR_WRONG_VALUE); } return (invalidate_hrSWRun_entry(entry)); @@ -543,7 +558,7 @@ return (SNMP_ERR_NOT_WRITEABLE); } /* end switch (value->var.subs[sub - 1]) */ - return (SNMP_ERR_NOERROR); + /*not reachable*/ case SNMP_OP_ROLLBACK: case SNMP_OP_COMMIT: