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