Blame SOURCES/net-snmp-5.7.2-kernel-threads.patch

9a6c41
979329 - hrSWRunTable does not show kernel threads
9a6c41
9a6c41
commit c655fce784532a523f7db582d0cd07dee4ad7ac5
9a6c41
Author: Niels Baggesen <nba@users.sourceforge.net>
9a6c41
Date:   Mon Oct 22 16:25:59 2012 +0200
9a6c41
9a6c41
    Try to better classify Linux kernel threads as hrSWRunType=Os
9a6c41
9a6c41
diff --git a/agent/mibgroup/host/data_access/swrun_procfs_status.c b/agent/mibgroup/host/data_access/swrun_procfs_status.c
9a6c41
index 80182d0..61c5e3a 100644
9a6c41
--- a/agent/mibgroup/host/data_access/swrun_procfs_status.c
9a6c41
+++ b/agent/mibgroup/host/data_access/swrun_procfs_status.c
9a6c41
@@ -122,11 +122,11 @@ netsnmp_arch_swrun_container_load( netsnmp_container *container, u_int flags)
9a6c41
             continue; /* file (process) probably went away */
9a6c41
 	}
9a6c41
         memset(buf, 0, sizeof(buf));
9a6c41
-        if ((cp = fgets( buf, BUFSIZ-1, fp )) == NULL) {
9a6c41
-            fclose(fp);
9a6c41
-            netsnmp_swrun_entry_free(entry);
9a6c41
-            continue;
9a6c41
-        }
9a6c41
+	entry->hrSWRunType = HRSWRUNTYPE_APPLICATION;
9a6c41
+	if ((cp = fgets( buf, sizeof(buf)-1, fp )) == NULL) {
9a6c41
+	    entry->hrSWRunType = HRSWRUNTYPE_OPERATINGSYSTEM;
9a6c41
+	    buf[0] = '\0';
9a6c41
+	}
9a6c41
         fclose(fp);
9a6c41
 
9a6c41
         /*
9a6c41
@@ -151,11 +151,6 @@ netsnmp_arch_swrun_container_load( netsnmp_container *container, u_int flags)
9a6c41
                       buf + entry->hrSWRunPath_len + 1);
9a6c41
  
9a6c41
         /*
9a6c41
-         * XXX - No information regarding system processes vs applications
9a6c41
-         */
9a6c41
-        entry->hrSWRunType = HRSWRUNTYPE_APPLICATION;
9a6c41
-
9a6c41
-        /*
9a6c41
          *   {xxx} {xxx} STATUS  {xxx}*10  UTIME STIME  {xxx}*8 RSS
9a6c41
          */
9a6c41
         snprintf( buf, BUFSIZ, "/proc/%d/stat", pid );