Upgrade to 4.2.1.
This commit is contained in:
parent
071e854336
commit
1709ca6d1a
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=42483
48 changed files with 90 additions and 1974 deletions
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
PORTNAME= ucd-snmp
|
||||
PORTVERSION= 4.2
|
||||
PORTVERSION= 4.2.1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
|
||||
ftp://ucd-snmp.ucdavis.edu/ \
|
||||
|
|
|
@ -1 +1 @@
|
|||
MD5 (ucd-snmp-4.2.tar.gz) = 7370edec952a6830459948d9808da7cb
|
||||
MD5 (ucd-snmp-4.2.1.tar.gz) = 192d467185c8e7142c155d5e162b1e97
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
--- agent/mibgroup/ucd-snmp/disk.c~ Fri Mar 5 08:45:00 1999
|
||||
+++ agent/mibgroup/ucd-snmp/disk.c Sat Apr 3 13:33:11 1999
|
||||
@@ -24,12 +24,12 @@
|
||||
#include <sys/vmmeter.h>
|
||||
#endif
|
||||
#endif
|
||||
-#if HAVE_SYS_CONF_H
|
||||
-#include <sys/conf.h>
|
||||
-#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
+#if HAVE_SYS_CONF_H
|
||||
+#include <sys/conf.h>
|
||||
+#endif
|
||||
#if HAVE_ASM_PAGE_H
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
@@ -86,6 +86,7 @@
|
||||
#include <vm/vm.h>
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/errormib.c~ Tue Mar 2 05:27:30 1999
|
||||
+++ agent/mibgroup/ucd-snmp/errormib.c Sat Apr 3 13:33:44 1999
|
||||
@@ -93,6 +93,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/extensible.c~ Fri Mar 5 08:45:01 1999
|
||||
+++ agent/mibgroup/ucd-snmp/extensible.c Sat Apr 3 13:34:13 1999
|
||||
@@ -81,6 +81,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
||||
--- agent/mibgroup/ucd-snmp/loadave.c~ Tue Mar 16 08:21:02 1999
|
||||
+++ agent/mibgroup/ucd-snmp/loadave.c Sat Apr 3 13:34:39 1999
|
||||
@@ -80,6 +80,7 @@
|
||||
#define statvfs statfs
|
||||
#endif
|
||||
#if HAVE_VM_SWAP_PAGER_H
|
||||
+#include <vm/vm.h>
|
||||
#include <vm/swap_pager.h>
|
||||
#endif
|
||||
#if HAVE_SYS_FIXPOINT_H
|
|
@ -1,14 +0,0 @@
|
|||
--- agent/mibgroup/ucd_snmp.h.orig Fri Feb 26 03:03:41 1999
|
||||
+++ agent/mibgroup/ucd_snmp.h Sun Apr 4 13:52:23 1999
|
||||
@@ -18,5 +18,11 @@
|
||||
config_arch_require(bsdi3, ucd-snmp/memory)
|
||||
config_arch_require(linux, ucd-snmp/vmstat)
|
||||
config_arch_require(freebsd2, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
|
||||
config_arch_require(freebsd2, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd3, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
|
||||
+config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
|
||||
config_add_mib(UCD-SNMP-MIB)
|
|
@ -1,11 +0,0 @@
|
|||
--- snmplib/ucd-snmp-includes.h.orig Wed Jan 20 18:18:42 1999
|
||||
+++ snmplib/ucd-snmp-includes.h Sat Aug 28 02:13:56 1999
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
/* uncomment if you don't have in_addr_t in netinet/in.h */
|
||||
-/* typedef u_int in_addr_t; */
|
||||
+typedef u_int in_addr_t;
|
||||
|
||||
#include <ucd-snmp/asn1.h>
|
||||
#include <ucd-snmp/snmp_api.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- man/Makefile.in.orig Thu Jan 18 01:37:31 2001
|
||||
+++ man/Makefile.in Thu Jan 18 01:37:39 2001
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
MAN1 = snmpcmd.1 snmpget.1 snmpset.1 snmpwalk.1 snmpbulkwalk.1 snmpbulkget.1 \
|
||||
snmpgetnext.1 snmptest.1 snmpnetstat.1 snmptranslate.1 snmpstatus.1 \
|
||||
- snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1
|
||||
+ snmptrap.1 snmpdelta.1 snmptable.1 snmpusm.1 snmpinform.1 snmpdf.1 snmpconf.1
|
||||
MAN1G = snmpd.1
|
||||
MAN3 = snmp_agent_api.3 snmp_api.3 mib_api.3 snmp_sess_api.3 snmp_trap_api.3 \
|
||||
snmp_alarm.3 snmp_close.3 snmp_free_pdu.3 snmp_open.3 snmp_read.3 \
|
|
@ -1,92 +1,6 @@
|
|||
--- agent/mibgroup/host/hr_swrun.c.orig Tue Oct 3 13:36:38 2000
|
||||
+++ agent/mibgroup/host/hr_swrun.c Fri Feb 2 11:27:39 2001
|
||||
@@ -216,15 +216,15 @@
|
||||
if ( pid == -1 )
|
||||
break;
|
||||
newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
|
||||
- DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
- DEBUGMSG(("host/hr_swrun","\n"));
|
||||
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
|
||||
+ DEBUGMSG(("host/hr_swrun","\n"));
|
||||
result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
|
||||
if (exact && (result == 0)) {
|
||||
LowPid = pid;
|
||||
#ifndef linux
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
-DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
|
||||
/* Save process status information */
|
||||
break;
|
||||
}
|
||||
@@ -235,9 +235,9 @@
|
||||
LowProcIndex = current_proc_entry-1;
|
||||
#endif
|
||||
/* Save process status information */
|
||||
-DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
+ DEBUGMSG(("host/hr_swrun", " saved"));
|
||||
}
|
||||
-DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
+ DEBUGMSG(("host/hr_swrun", "\n"));
|
||||
}
|
||||
|
||||
if ( LowPid == -1 ) {
|
||||
@@ -279,16 +279,16 @@
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
static psinfo_t psinfo;
|
||||
- static psinfo_t *proc_buf = &psinfo;
|
||||
+ static psinfo_t *proc_buf;
|
||||
int procfd;
|
||||
char procfn[sizeof "/proc/00000/psinfo"];
|
||||
#else
|
||||
static struct proc *proc_buf;
|
||||
+ char *cp1;
|
||||
#endif /* _SLASH_PROC_METHOD_ */
|
||||
static time_t when = 0;
|
||||
time_t now;
|
||||
static int oldpid = -1;
|
||||
- char *cp1;
|
||||
#endif
|
||||
#if HAVE_KVM_GETPROCS
|
||||
char **argv;
|
||||
@@ -321,10 +321,13 @@
|
||||
}
|
||||
if (oldpid != pid || proc_buf == NULL) {
|
||||
#if _SLASH_PROC_METHOD_
|
||||
+ proc_buf = &psinfo;
|
||||
sprintf(procfn, "/proc/%.5d/psinfo", pid);
|
||||
- if ((procfd = open(procfn, O_RDONLY)) == -1) return NULL;
|
||||
- if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
- close(procfd);
|
||||
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
|
||||
+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != sizeof(*proc_buf)) abort();
|
||||
+ close(procfd);
|
||||
+ } else
|
||||
+ proc_buf = NULL;
|
||||
#else
|
||||
if (kd == NULL) return NULL;
|
||||
if ((proc_buf = kvm_getproc(kd, pid)) == NULL) return NULL;
|
||||
@@ -340,8 +343,8 @@
|
||||
return NULL;
|
||||
#else
|
||||
long_return = 1; /* Probably! */
|
||||
-#endif
|
||||
return (u_char *)&long_return;
|
||||
+#endif
|
||||
|
||||
case HRSWRUN_INDEX:
|
||||
long_return = pid;
|
||||
@@ -354,12 +357,19 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_fname);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_fname);
|
||||
+ else
|
||||
+ strcpy(string, "<exited>");
|
||||
#else
|
||||
--- agent/mibgroup/host/hr_swrun.c~ Wed Mar 14 22:45:56 2001
|
||||
+++ agent/mibgroup/host/hr_swrun.c Tue Mar 27 12:37:57 2001
|
||||
@@ -365,7 +365,11 @@
|
||||
strcpy(string, proc_buf->p_user.u_comm);
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -98,19 +12,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/status", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -398,7 +408,10 @@
|
||||
*cp = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- strcpy(string, proc_buf->pr_psargs);
|
||||
+ if (proc_buf)
|
||||
+ strcpy(string, proc_buf->pr_psargs);
|
||||
+ else
|
||||
+ sprintf(string, "<exited>");
|
||||
cp = strchr(string, ' ');
|
||||
if (cp) *cp = 0;
|
||||
#else
|
||||
@@ -408,7 +421,11 @@
|
||||
@@ -417,7 +421,11 @@
|
||||
*cp1 = 0;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -122,41 +24,7 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -448,9 +465,12 @@
|
||||
string[0] = '\0';
|
||||
#elif defined(solaris2)
|
||||
#ifdef _SLASH_PROC_METHOD_
|
||||
- cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
- if (cp) strcpy(string, cp+1);
|
||||
- else string[0] = 0;
|
||||
+ if (proc_buf) {
|
||||
+ cp = strchr(proc_buf->pr_psargs, ' ');
|
||||
+ if (cp) strcpy(string, cp+1);
|
||||
+ else string[0] = 0;
|
||||
+ } else
|
||||
+ string[0] = 0;
|
||||
#else
|
||||
cp = proc_buf->p_user.u_psargs;
|
||||
while (*cp && *cp != ' ') cp++;
|
||||
@@ -470,9 +490,15 @@
|
||||
sprintf( string, "/proc/%d/cmdline", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
- if(!fgets( buf, sizeof(buf)-2, fp ))
|
||||
- return NULL; /* argv[0] '\0' argv[1] '\0' .... */
|
||||
|
||||
+ /* argv[0] '\0' argv[1] '\0' .... */
|
||||
+ if(!fgets( buf, sizeof(buf)-2, fp )) {
|
||||
+ /* maybe be empty (even argv[0] is missing) */
|
||||
+ string[0] = '\0';
|
||||
+ *var_len = 0;
|
||||
+ return string;
|
||||
+ }
|
||||
+
|
||||
/* Skip over argv[0] */
|
||||
cp = buf;
|
||||
while ( *cp )
|
||||
@@ -531,10 +557,14 @@
|
||||
@@ -550,7 +558,11 @@
|
||||
}
|
||||
#else
|
||||
#if HAVE_KVM_GETPROCS
|
||||
|
@ -167,72 +35,8 @@
|
|||
+#endif
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- switch (proc_buf->pr_lwp.pr_state) {
|
||||
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
#else
|
||||
switch ( proc_buf->p_stat ) {
|
||||
#endif
|
||||
@@ -566,32 +596,34 @@
|
||||
#endif
|
||||
#else
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
- if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
- fgets( buf, sizeof(buf), fp );
|
||||
- cp = buf;
|
||||
- for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
- while ( *cp != ' ')
|
||||
+ if ((fp = fopen( string, "r")) != NULL) {
|
||||
+ fgets( buf, sizeof(buf), fp );
|
||||
+ cp = buf;
|
||||
+ for ( i = 0 ; i < 2 ; ++i ) { /* skip two fields */
|
||||
+ while ( *cp != ' ')
|
||||
+ ++cp;
|
||||
++cp;
|
||||
- ++cp;
|
||||
- }
|
||||
+ }
|
||||
|
||||
- switch ( *cp ) {
|
||||
- case 'R':
|
||||
+ switch ( *cp ) {
|
||||
+ case 'R':
|
||||
long_return = 1; /* running */
|
||||
break;
|
||||
- case 'S':
|
||||
+ case 'S':
|
||||
long_return = 2; /* runnable */
|
||||
break;
|
||||
- case 'D':
|
||||
- case 'T':
|
||||
+ case 'D':
|
||||
+ case 'T':
|
||||
long_return = 3; /* notRunnable */
|
||||
break;
|
||||
- case 'Z':
|
||||
- default:
|
||||
+ case 'Z':
|
||||
+ default:
|
||||
long_return = 4; /* invalid */
|
||||
break;
|
||||
- }
|
||||
- fclose(fp);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ } else
|
||||
+ long_return = 4; /* invalid */
|
||||
#endif
|
||||
return (u_char *)&long_return;
|
||||
|
||||
@@ -603,16 +635,24 @@
|
||||
*/
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_time.tv_sec * 100 +
|
||||
- proc_buf->pr_time.tv_nsec/10000000;
|
||||
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
|
||||
+ proc_buf->pr_time.tv_nsec/10000000 : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_utime*100 +
|
||||
switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
|
||||
@@ -631,9 +643,17 @@
|
||||
proc_buf->p_stime*100;
|
||||
#endif
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -250,18 +54,9 @@
|
|||
#elif defined(linux)
|
||||
sprintf( string, "/proc/%d/stat", pid );
|
||||
if ((fp = fopen( string, "r")) == NULL) return NULL;
|
||||
@@ -645,13 +685,20 @@
|
||||
long_return = (proc_buf.pst_rssize << PGSHIFT)/1024;
|
||||
#elif defined(solaris2)
|
||||
#if _SLASH_PROC_METHOD_
|
||||
- long_return = proc_buf->pr_rssize;
|
||||
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
|
||||
#else
|
||||
long_return = proc_buf->p_swrss;
|
||||
#endif
|
||||
@@ -673,6 +693,13 @@
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
-#ifdef freebsd3
|
||||
+#if defined(freebsd3)
|
||||
#ifdef freebsd3
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size/1024;
|
||||
+#elif defined(freebsd5) && __FreeBSD_version >= 500014
|
||||
+ /* XXX
|
||||
|
@ -273,18 +68,7 @@
|
|||
#else
|
||||
long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
|
||||
proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
|
||||
@@ -747,6 +794,10 @@
|
||||
}
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
{
|
||||
+ if (kd == NULL) {
|
||||
+ nproc = 0;
|
||||
+ return;
|
||||
+ }
|
||||
proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
|
||||
}
|
||||
#else
|
||||
@@ -794,8 +845,13 @@
|
||||
@@ -819,8 +846,13 @@
|
||||
#elif defined(solaris2)
|
||||
return proc_table[current_proc_entry++];
|
||||
#elif HAVE_KVM_GETPROCS
|
||||
|
@ -298,12 +82,3 @@
|
|||
#else
|
||||
if ( proc_table[current_proc_entry].p_stat != 0 )
|
||||
return proc_table[current_proc_entry++].p_pid;
|
||||
@@ -853,7 +909,7 @@
|
||||
|
||||
int count_processes (void)
|
||||
{
|
||||
-#ifndef linux
|
||||
+#if !(defined(linux) || defined(hpux10) || defined(solaris2) || HAVE_KVM_GETPROCS)
|
||||
int i;
|
||||
#endif
|
||||
int total=0;
|
||||
|
|
|
@ -134,9 +134,12 @@ share/snmp/snmpconf/snmpd.conf/monitor
|
|||
share/snmp/snmpconf/snmpd.conf/operation
|
||||
share/snmp/snmpconf/snmpd.conf/system
|
||||
share/snmp/snmpconf/snmpd.conf/trapsinks
|
||||
share/snmp/snmpconf/snmptrapd.conf/formatting
|
||||
share/snmp/snmpconf/snmptrapd.conf/traphandle
|
||||
@unexec rm -f %D/share/snmp/mibs/.index
|
||||
@dirrm share/snmp/mibs
|
||||
@dirrm share/snmp/snmpconf/snmp.conf
|
||||
@dirrm share/snmp/snmpconf/snmpd.conf
|
||||
@dirrm share/snmp/snmpconf/snmptrapd.conf
|
||||
@dirrm share/snmp/snmpconf
|
||||
@dirrm share/snmp
|
||||
|
|
Loading…
Reference in a new issue