PERFORCE change 80875 for review
Victor Cruceru
soc-victor at FreeBSD.org
Sat Jul 23 18:44:18 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=80875
Change 80875 by soc-victor at soc-victor_82.76.158.176 on 2005/07/23 18:44:05
Made the hrDeviceTable's refresh to work. Note: need to upgrade
libdevinfo with the latest version in order to have the chance
to re-query the system for changes.
Affected files ...
.. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile#11 edit
.. //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c#2 edit
Differences ...
==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile#11 (text+ko) ====
@@ -3,6 +3,28 @@
# All rights reserved.
# Author: Victor Cruceru <soc-victor at freebsd.org>
#
+# Redistribution of this software and documentation and use in source and
+# binary forms, with or without modification, are permitted provided that
+# the following conditions are met:
+#
+# 1. Redistributions of source code or documentation must retain the above
+# copyright notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
CONTRIB=${.CURDIR}/../../../../contrib/bsnmp
==== //depot/projects/soc2005/bsnmp/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c#2 (text+ko) ====
@@ -249,21 +249,6 @@
}
void init_hrDevice_tbl_v(void) {
- if ( hrState_g.dev_root != NULL ) {
- syslog(LOG_ERR,"hrDeviceTable: attempt to re-initialization of devinfo.");
- return;
- }
- if (devinfo_init() != 0) {
- syslog(LOG_ERR,"hrDeviceTable: devinfo_init failed: %m");
- return;
-
- }
- hrState_g.dev_root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE);
-
- if (hrState_g.dev_root == NULL) {
- syslog(LOG_ERR,"hrDeviceTable: can't get the root device: %m");
- return;
- }
refresh_hrDevice_tbl_v();
}
@@ -303,6 +288,23 @@
HR_DPRINTF((stderr, "%s: no refresh needed\n ",__func__));
return;
}
+ if ( hrState_g.dev_root != NULL ) {
+ syslog(LOG_ERR,"hrDeviceTable: attempt to re-initialization of devinfo.");
+ return;
+ }
+ if (devinfo_init() != 0) {
+ syslog(LOG_ERR,"hrDeviceTable: devinfo_init failed: %m");
+ return;
+
+ }
+ hrState_g.dev_root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE);
+
+ if (hrState_g.dev_root == NULL) {
+ syslog(LOG_ERR,"hrDeviceTable: can't get the root device: %m. Most likely you need to upgrade libdevinfo!");
+ return;
+ }
+
+
/*mark each entry as missing*/
TAILQ_FOREACH(entry, &hrState_g.hr_device_tbl, link)
entry->flags &= ~HR_DEVICE_FOUND;
@@ -324,6 +326,11 @@
hrState_g.hrDevice_tbl_age = time(NULL);
+
+ devinfo_free();
+ hrState_g.dev_root = NULL;
+
+
HR_DPRINTF((stderr, "%s: refresh DONE\n ",__func__));
}
More information about the p4-projects
mailing list