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