author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Sat, 18 May 2013 09:18:20 -0700 | |
changeset 1306 | 11b376b53ac1 |
parent 1301 | 636f7c363f41 |
child 1650 | ce501c11d5fa |
permissions | -rw-r--r-- |
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
|
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
|
2 |
* This patch fixes the performance issue observed while retrieving the |
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
|
3 |
* hrStorage parameters in systems with large number of mountpoints |
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
|
4 |
* parameters using snmpwalk. |
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
|
5 |
* |
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
|
6 |
* This issue is happening due to the overhead of large number of |
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
|
7 |
* ioctl() system calls in getmntent() function called by the |
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
|
8 |
* Get_Next_HR_FileSys() function. |
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
|
9 |
* |
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
|
10 |
* We see that in the Get_Next_HR_FileSys() function, inorder to access |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
11 |
* the last mountpoint, the /etc/mnttab is opened and we walk through |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
12 |
* all the mnttab entries for all filesystems till the end. This is the |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
13 |
* reason we find a large number of the MNTIOC_GETMNTENT ioctl() calls. |
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
|
14 |
* |
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
|
15 |
* To reduce the overhead of the getmntent() calls, we maintain a cache |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
16 |
* of all the /etc/mnttab entries and walk through the cache instead of |
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
|
17 |
* opening /etc/mnttab and walking all the entries for each mountpoint. |
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
|
18 |
* This functionality is provided by the load_mnttab_cache_solaris() |
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
|
19 |
* function called from the Init_HR_FileSys() function. |
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
|
20 |
*/ |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
21 |
--- net-snmp-5.4.1.orig/agent/mibgroup/host/hr_filesys.c 2007-05-18 11:08:01.000000000 -0700 |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
22 |
+++ net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c 2013-01-17 03:36:28.181493003 -0800 |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
23 |
@@ -31,6 +31,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
|
24 |
#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
|
25 |
#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
|
26 |
|
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 |
+#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
|
28 |
+#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
|
29 |
+#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
|
30 |
+ |
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 <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
|
32 |
#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
|
33 |
#include <string.h> |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
34 |
@@ -85,7 +89,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
|
35 |
#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
|
36 |
|
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
|
37 |
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
|
38 |
-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
|
39 |
+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
|
40 |
+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
|
41 |
+static int fscount; |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
42 |
+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
|
43 |
+ |
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 |
#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
|
45 |
#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
|
46 |
#define HRFS_type mnt_fstype |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
47 |
@@ -167,6 +175,9 @@ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
48 |
static u_char *when_dumped(char *filesys, int level, size_t * length); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
49 |
int header_hrfilesys(struct variable *, oid *, size_t *, int, |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
50 |
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
|
51 |
+#ifdef solaris2 |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
52 |
+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
|
53 |
+#endif |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
54 |
|
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
55 |
/********************* |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
56 |
* |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
57 |
@@ -606,8 +617,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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
+#ifdef solaris2 |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
62 |
+ if(!load_mnttab_cache_solaris()) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
63 |
+ return; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
64 |
+#else |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
65 |
fp = fopen(ETC_MNTTAB, "r"); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
66 |
#endif |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
67 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
68 |
+#endif |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
69 |
} |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
70 |
|
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
71 |
const char *HRFS_ignores[] = { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
72 |
@@ -663,6 +680,117 @@ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
73 |
0 |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
74 |
}; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
75 |
|
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
76 |
+#ifdef solaris2 |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
77 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
78 |
+/* |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
79 |
+ * This function has been introduced to reduce the overhead |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
80 |
+ * of the getmntent() calls used to fetch the details of |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
81 |
+ * the /etc/mnttab entries in Init_HR_FileSys(). |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
82 |
+ * |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
83 |
+ * We maintain a cache of all the /etc/mnttab entries and |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
84 |
+ * walk through the cache instead of opening /etc/mnttab and |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
85 |
+ * walking all the entries for each mountpoint. |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
86 |
+ */ |
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
|
87 |
+ |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
88 |
+static int |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
89 |
+load_mnttab_cache_solaris() |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
90 |
+{ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
91 |
+ char buf[512] = {NULL}; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
92 |
+ int i = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
93 |
+ struct stat file_stat; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
94 |
+ const char **cpp; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
95 |
+ char *ch; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
96 |
+ int token_flag = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
97 |
+ int skip_flag = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
98 |
+ int ignore_flag = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
99 |
+ int j = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
100 |
+ int lines = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
101 |
+ int ret = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
102 |
+ HRFS_index = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
103 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
104 |
+ stat(ETC_MNTTAB, &file_stat); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
105 |
+ if (last_access == -1 || last_access != file_stat.st_mtime) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
106 |
+ fp = fopen(ETC_MNTTAB, "r"); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
107 |
+ if(fp == NULL) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
108 |
+ { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
109 |
+ DEBUGMSGTL(("host/hr_filesys", "fopen failed for mnttab.\n")); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
110 |
+ return -1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
111 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
112 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
113 |
+ /* find the number of valid entries in mnttab. */ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
114 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
115 |
+ while ((fgets((char *) &buf, sizeof(buf), fp)) != NULL) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
116 |
+ j = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
117 |
+ skip_flag = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
118 |
+ 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
|
119 |
+ |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
120 |
+ /* tokenize the mnttab entries to fetch the fstype |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
121 |
+ * which determines the valid entries. |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
122 |
+ */ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
123 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
124 |
+ ch = strtok(buf, " \t"); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
125 |
+ while (ch != NULL) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
126 |
+ j++; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
127 |
+ if(j == 3) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
128 |
+ for (cpp = HRFS_ignores; *cpp != NULL; ++cpp) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
129 |
+ if(!strncmp(ch, *cpp, strlen(ch))) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
130 |
+ skip_flag = 1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
131 |
+ break; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
132 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
133 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
134 |
+ 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
|
135 |
+ } |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
136 |
+ if(token_flag) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
137 |
+ break; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
138 |
+ ch = strtok(NULL, " \t"); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
139 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
140 |
+ if(!skip_flag) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
141 |
+ lines++; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
142 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
143 |
+ fclose(fp); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
144 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
145 |
+ fscount = lines; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
146 |
+ HRFS_list = (struct mnttab *) malloc (sizeof(struct mnttab) * fscount); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
147 |
+ if(HRFS_list == NULL) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
148 |
+ DEBUGMSGTL(("host/hr_filesys", "Memory allocation for mnttab cache failed.\n")); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
149 |
+ return -1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
150 |
+ } |
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
|
151 |
+ |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
152 |
+ fp = fopen(ETC_MNTTAB, "r"); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
153 |
+ if(fp == NULL) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
154 |
+ DEBUGMSGTL(("host/hr_filesys", "fopen failed for mnttab.\n")); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
155 |
+ free(HRFS_list); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
156 |
+ return -1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
157 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
158 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
159 |
+ while (i < fscount) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
160 |
+ if (getmntent(fp, &HRFS_entry_struct) == 0) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
161 |
+ for (cpp = HRFS_ignores; *cpp != NULL; ++cpp) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
162 |
+ if (!strcmp(HRFS_entry_struct.HRFS_type, *cpp)) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
163 |
+ ignore_flag = 1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
164 |
+ break; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
165 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
166 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
167 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
168 |
+ if(!ignore_flag) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
169 |
+ HRFS_list[i].mnt_special = strdup(HRFS_entry_struct.mnt_special); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
170 |
+ HRFS_list[i].mnt_mountp = strdup(HRFS_entry_struct.mnt_mountp); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
171 |
+ HRFS_list[i].mnt_fstype = strdup(HRFS_entry_struct.mnt_fstype); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
172 |
+ HRFS_list[i].mnt_mntopts = strdup(HRFS_entry_struct.mnt_mntopts); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
173 |
+ i++; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
174 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
175 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
176 |
+ ignore_flag = 0; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
177 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
178 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
179 |
+ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
180 |
+ HRFS_entry = HRFS_list; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
181 |
+ last_access = file_stat.st_mtime; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
182 |
+ } |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
183 |
+ return ret; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
184 |
+} |
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
|
185 |
+#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
|
186 |
+ |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
187 |
int |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
188 |
Get_Next_HR_FileSys(void) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
189 |
{ |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
190 |
@@ -699,17 +827,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
|
191 |
#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
|
192 |
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
|
193 |
|
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
|
194 |
- 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
|
195 |
- 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
|
196 |
|
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 |
#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
|
198 |
- if (getmntent(fp, HRFS_entry) != 0) |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
199 |
+ if (HRFS_index >= fscount) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
200 |
return -1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
201 |
+ HRFS_entry = &HRFS_list[HRFS_index]; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
202 |
+ 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
|
203 |
#else |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
204 |
+ if (fp == NULL) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
205 |
+ 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
|
206 |
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
|
207 |
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
|
208 |
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
|
209 |
-#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
|
210 |
|
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
|
211 |
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
|
212 |
if (!strcmp(HRFS_entry->HRFS_type, *cpp)) |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
213 |
@@ -728,6 +857,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
|
214 |
} |
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 |
|
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 |
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
|
217 |
+#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
|
218 |
+ |
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
|
219 |
#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
|
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 |
|
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
222 |
@@ -791,9 +922,24 @@ |
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
|
223 |
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
|
224 |
} |
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
|
225 |
#else |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
226 |
+ 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
|
227 |
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
|
228 |
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
|
229 |
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
|
230 |
+ |
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
|
231 |
+#ifdef solaris2 |
1306
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
232 |
+while (i < fscount) { |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
233 |
+ free(HRFS_list[i].mnt_special); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
234 |
+ free(HRFS_list[i].mnt_mountp); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
235 |
+ free(HRFS_list[i].mnt_fstype); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
236 |
+ free(HRFS_list[i].mnt_mntopts); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
237 |
+ i++; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
238 |
+} |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
239 |
+ if (HRFS_list != NULL) |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
240 |
+ free(HRFS_list); |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
241 |
+ last_access = -1; |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
242 |
+#endif |
11b376b53ac1
backout 16488880/15685782/15997718/15705167/15754602/16003771/16242256 - needs more work
Mike Sullivan <Mike.Sullivan@Oracle.COM>
parents:
1301
diff
changeset
|
243 |
+ |
1301
636f7c363f41
15685782 SUNBT7005330 NET-SNMP upgrade to latest stable version
gowtham thommandra - Sun Microsystems - Bangalore India <Gowtham.Thommandra@Sun.COM>
parents:
1126
diff
changeset
|
244 |
#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
|
245 |
} |
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
|
246 |