components/net-snmp-57/patches/027.7118090.hr_filesys.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Tue, 04 Apr 2017 17:27:12 -0700
changeset 7830 a19af6ab1a9c
parent 5867 445e2cf1c845
permissions -rw-r--r--
25816799 Remove more excess FOSS from Desktop gate [PSARC 2016/088 - b122 subset] PSARC/2016/088 EOF of more excess FOSS from Desktop consolidation (scrubbing the decks harder)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     1
# 
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     2
#   This patch fixes the performance issue observed while retrieving the
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     3
#   hrStorage parameters in systems with large number of mountpoints
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     4
#   parameters using snmpwalk.
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     5
#  
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     6
#   This issue is happening due to the overhead of large number of
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     7
#   ioctl() system calls in getmntent() function called by the
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     8
#   Get_Next_HR_FileSys() function.
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
     9
#  
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    10
#   We see that in the Get_Next_HR_FileSys() function, inorder to access
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    11
#   the last mountpoint, the /etc/mnttab is opened and we walk through
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    12
#   all the mnttab entries for all filesystems till the end. This is the
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    13
#   reason we find a large number of the MNTIOC_GETMNTENT ioctl() calls.
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    14
# 
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    15
#   To reduce the overhead of the getmntent() calls, we maintain a cache
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    16
#   of all the /etc/mnttab entries and walk through the cache instead of
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    17
#   opening /etc/mnttab and walking all the entries for each mountpoint.
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    18
#   This functionality is provided by the load_mnttab_cache_solaris()
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    19
#   function called from the Init_HR_FileSys() function.
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    20
#  
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    21
#  Developed in-house. Bug submitted upstream
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    22
#  https://sourceforge.net/p/net-snmp/bugs/2588/
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    23
#  
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    24
--- a/agent/mibgroup/host/hr_filesys.c	Wed Feb 19 18:36:42 2014
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    25
+++ b/agent/mibgroup/host/hr_filesys.c	Wed Nov 26 07:21:17 2014
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    26
@@ -46,6 +46,10 @@
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    27
 #include <sys/mount.h>
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    28
 #endif
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    29
 
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    30
+#ifdef solaris2
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    31
+#include <sys/stat.h>
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    32
+#endif
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    33
+
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    34
 #include <ctype.h>
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    35
 #if HAVE_STRING_H
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    36
 #include <string.h>
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    37
@@ -108,7 +112,11 @@
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    38
 #ifdef solaris2
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    39
 
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    40
 struct mnttab   HRFS_entry_struct;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    41
-struct mnttab  *HRFS_entry = &HRFS_entry_struct;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    42
+struct mnttab  *HRFS_entry;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    43
+struct mnttab	*HRFS_list;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    44
+static int fscount;
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    45
+static time_t last_access = -1;
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    46
+
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    47
 #define	HRFS_name	mnt_special
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    48
 #define	HRFS_mount	mnt_mountp
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    49
 #define	HRFS_type	mnt_fstype
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    50
@@ -207,6 +215,9 @@
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    51
 static u_char  *when_dumped(char *filesys, int level, size_t * length);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    52
 int             header_hrfilesys(struct variable *, oid *, size_t *, int,
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    53
                                  size_t *, WriteMethod **);
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    54
+#ifdef solaris2
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    55
+static int      load_mnttab_cache_solaris(void);
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    56
+#endif
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    57
 
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    58
         /*********************
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    59
 	 *
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    60
@@ -662,11 +673,14 @@
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    61
     HRFS_index = 1;
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    62
     if (fp != NULL)
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    63
         fclose(fp);
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    64
+#ifdef solaris2
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    65
+    if(!load_mnttab_cache_solaris())
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    66
+    	return;
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    67
+#else
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    68
     fp = fopen(ETC_MNTTAB, "r");
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    69
-    if (!fp) {
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    70
-      netsnmp_config_error("Can't open mnttab %s\n", ETC_MNTTAB);
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    71
-    }
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    72
 #endif
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    73
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    74
+#endif
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    75
 }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    76
 
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    77
 const char     *HRFS_ignores[] = {
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    78
@@ -722,6 +736,117 @@
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
    79
     NULL
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    80
 };
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    81
 
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    82
+#ifdef solaris2
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    83
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    84
+/*
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    85
+ *  This function has been introduced to reduce the overhead
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    86
+ *  of the getmntent() calls used to fetch the details of
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    87
+ *  the /etc/mnttab entries in Init_HR_FileSys().
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    88
+ *
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    89
+ *  We maintain a cache of all the /etc/mnttab entries and
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    90
+ *  walk through the cache instead of opening /etc/mnttab and
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    91
+ *  walking all the entries for each mountpoint.
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    92
+ */
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
    93
+
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    94
+static int 
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    95
+load_mnttab_cache_solaris()
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    96
+{
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    97
+    char buf[512] = {NULL};
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    98
+    int i = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
    99
+    struct stat file_stat;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   100
+    const char **cpp;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   101
+    char *ch;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   102
+    int token_flag = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   103
+    int skip_flag = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   104
+    int ignore_flag = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   105
+    int j = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   106
+    int lines = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   107
+    int ret = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   108
+    HRFS_index = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   109
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   110
+    stat(ETC_MNTTAB, &file_stat);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   111
+    if (last_access == -1 || last_access != file_stat.st_mtime) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   112
+        fp = fopen(ETC_MNTTAB, "r");
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   113
+        if(fp == NULL)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   114
+        {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   115
+            DEBUGMSGTL(("host/hr_filesys", "fopen failed for mnttab.\n"));
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   116
+            return -1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   117
+        }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   118
+        
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   119
+        /* find the number of valid entries in mnttab. */
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   120
+        
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   121
+        while ((fgets((char *) &buf, sizeof(buf), fp)) != NULL) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   122
+            j = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   123
+            skip_flag = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   124
+            token_flag = 0;
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   125
+
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   126
+            /* tokenize the mnttab entries to fetch the fstype
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   127
+             * which determines the valid entries.
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   128
+             */
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   129
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   130
+            ch = strtok(buf, " \t");
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   131
+            while (ch != NULL) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   132
+                j++;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   133
+                if(j == 3) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   134
+                    for (cpp = HRFS_ignores; *cpp != NULL; ++cpp) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   135
+                        if(!strncmp(ch, *cpp, strlen(ch))) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   136
+                            skip_flag = 1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   137
+                            break;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   138
+                        }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   139
+                    }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   140
+                    token_flag = 1;
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   141
+                }
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   142
+                if(token_flag)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   143
+                    break;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   144
+                ch = strtok(NULL, " \t");
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   145
+             }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   146
+             if(!skip_flag)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   147
+                 lines++;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   148
+        }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   149
+        fclose(fp);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   150
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   151
+        fscount = lines;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   152
+        HRFS_list = (struct mnttab *) malloc (sizeof(struct mnttab) * fscount);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   153
+        if(HRFS_list == NULL) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   154
+            DEBUGMSGTL(("host/hr_filesys", "Memory allocation for mnttab cache failed.\n"));
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   155
+            return -1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   156
+        }
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   157
+
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   158
+        fp = fopen(ETC_MNTTAB, "r");
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   159
+        if(fp == NULL) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   160
+            DEBUGMSGTL(("host/hr_filesys", "fopen failed for mnttab.\n"));
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   161
+            free(HRFS_list);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   162
+            return -1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   163
+        }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   164
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   165
+        while (i < fscount) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   166
+            if (getmntent(fp, &HRFS_entry_struct) == 0) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   167
+                 for (cpp = HRFS_ignores; *cpp != NULL; ++cpp) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   168
+                     if (!strcmp(HRFS_entry_struct.HRFS_type, *cpp)) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   169
+                         ignore_flag = 1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   170
+                         break;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   171
+                     }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   172
+                 }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   173
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   174
+                 if(!ignore_flag) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   175
+                     HRFS_list[i].mnt_special = strdup(HRFS_entry_struct.mnt_special);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   176
+                     HRFS_list[i].mnt_mountp = strdup(HRFS_entry_struct.mnt_mountp);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   177
+                     HRFS_list[i].mnt_fstype = strdup(HRFS_entry_struct.mnt_fstype);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   178
+                     HRFS_list[i].mnt_mntopts = strdup(HRFS_entry_struct.mnt_mntopts);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   179
+                     i++;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   180
+                 }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   181
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   182
+                 ignore_flag = 0;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   183
+            }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   184
+        }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   185
+
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   186
+        HRFS_entry = HRFS_list;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   187
+        last_access = file_stat.st_mtime;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   188
+    }
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   189
+    return ret;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   190
+}
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   191
+#endif
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   192
+
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   193
 int
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   194
 Get_Next_HR_FileSys(void)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   195
 {
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   196
@@ -758,17 +883,18 @@
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   197
 #else
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   198
     const char    **cpp;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   199
 
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   200
-    if (fp == NULL)
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   201
-        return -1;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   202
 
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   203
 #ifdef solaris2
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   204
-    if (getmntent(fp, HRFS_entry) != 0)
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   205
+    if (HRFS_index >= fscount)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   206
         return -1;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   207
+    HRFS_entry = &HRFS_list[HRFS_index];
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   208
+        return ++HRFS_index;
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   209
 #else
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   210
+    if (fp == NULL)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   211
+        return -1;
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   212
     HRFS_entry = getmntent(fp);
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   213
     if (HRFS_entry == NULL)
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   214
         return -1;
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   215
-#endif                          /* solaris2 */
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   216
 
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   217
     for (cpp = HRFS_ignores; *cpp != NULL; ++cpp)
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   218
         if (!strcmp(HRFS_entry->HRFS_type, *cpp))
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   219
@@ -787,6 +913,8 @@
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   220
     }
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   221
 
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   222
     return HRFS_index++;
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   223
+#endif
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   224
+
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   225
 #endif                          /* HAVE_GETFSSTAT */
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   226
 }
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   227
 
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   228
@@ -854,10 +982,25 @@
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   229
         HRFS_entry = NULL;
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   230
     }
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   231
 #else
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   232
+    int i = 0;
1126
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   233
     if (fp != NULL)
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   234
         fclose(fp);
a7e552aeef46 15818955 SUNBT7201487 snmpd cores multiple times during walk with service ending in maint
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents: 964
diff changeset
   235
     fp = NULL;
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   236
+
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   237
+#ifdef solaris2
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   238
+while (i < fscount) {
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   239
+    free(HRFS_list[i].mnt_special);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   240
+    free(HRFS_list[i].mnt_mountp);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   241
+    free(HRFS_list[i].mnt_fstype);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   242
+    free(HRFS_list[i].mnt_mntopts);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   243
+    i++;
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   244
+}
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   245
+    if (HRFS_list != NULL)
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   246
+        free(HRFS_list);
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   247
+    last_access = -1;
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   248
 #endif
1679
51291a5fd692 backout 17949399/16488880/15685782/15997718/15705167/15754602/16066103/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents: 1650
diff changeset
   249
+
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   250
+#endif
964
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   251
 }
3193e50c7331 7118090 snmpwalk of hrStorageIndex can take several minutes due to excessive ioctl calls for mnttab by snmpd
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
   252
 
5867
445e2cf1c845 PSARC/2014/169 Net-snmp upgrade to version 5.7.2.1
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents: 1679
diff changeset
   253