1/* 2 * Copyright (c) 2005-2006 The FreeBSD Project 3 * All rights reserved. 4 * 5 * Author: Victor Cruceru <soc-victor@freebsd.org> 6 * 7 * Redistribution of this software and documentation and use in source and 8 * binary forms, with or without modification, are permitted provided that --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swrun_tbl.c 154249 2006-01-12 07:44:40Z harti $ |
30 * 31 * Host Resources MIB for SNMPd. Implementation for hrSWRunTable 32 */ 33 34#include <sys/param.h> 35#include <sys/proc.h> 36#include <sys/sysctl.h> 37#include <sys/user.h> --- 164 unchanged lines hidden (view full) --- 202 203 strlcpy((char*)entry->name, kp->ki_ocomm, sizeof(entry->name)); 204 205 entry->id = oid_zeroDotZero; /* unknown id - FIXME */ 206 207 entry->path[0] = '\0'; 208 entry->parameters[0] = '\0'; 209 |
210 assert(hr_kd != NULL); |
211 212 argv = kvm_getargv(hr_kd, kp, sizeof(entry->parameters) - 1); 213 if(argv != NULL){ 214 memset(entry->parameters, '\0', sizeof(entry->parameters)); 215 216 /* 217 * FIXME 218 * Path seems to not be available. --- 199 unchanged lines hidden (view full) --- 418 HRDBG("missing item with kid=%d", 419 entry->index - NO_PID - 1); 420 entry->status = (int32_t)SRS_INVALID; 421 } else 422 kld_file_stat_to_swrun(&stat, entry); 423 424 } else { 425 /* this is a process */ |
426 assert(hr_kd != NULL); |
427 plist = kvm_getprocs(hr_kd, KERN_PROC_PID, 428 entry->index - 1, &nproc); 429 if (plist == NULL || nproc != 1) { 430 HRDBG("missing item with PID=%d", entry->index - 1); 431 entry->status = (int32_t)SRS_INVALID; 432 } else 433 kinfo_proc_to_swrun_entry(plist, entry); 434 } --- 49 unchanged lines hidden (view full) --- 484 stat.id, stat.name); 485 if (errno == EBUSY) 486 return (SNMP_ERR_NOT_WRITEABLE); 487 else 488 return (SNMP_ERR_RES_UNAVAIL); 489 } 490 } else { 491 /* this is a process */ |
492 assert(hr_kd != NULL); |
493 494 plist = kvm_getprocs(hr_kd, KERN_PROC_PID, 495 entry->index - 1, &nproc); 496 if (plist == NULL || nproc != 1) { 497 HRDBG("missing item with PID=%d", entry->index - 1); 498 entry->status = (int32_t)SRS_INVALID; 499 return (SNMP_ERR_NOERROR); 500 } --- 251 unchanged lines hidden --- |