summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
committersjg <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
commit97d8b9495668afa398ab17c8c5f7e223b5fd2e89 (patch)
tree54038c9ac32a45f8741dcc23fb9a8ffc0e15ff89 /usr.sbin/bsnmpd
parent5ee3bfdb338e7c80af29a67f4425c4be24c7b866 (diff)
parent086d73aef6d0ab7d21daa2076fdc8d25961f9b05 (diff)
downloadFreeBSD-src-97d8b9495668afa398ab17c8c5f7e223b5fd2e89.zip
FreeBSD-src-97d8b9495668afa398ab17c8c5f7e223b5fd2e89.tar.gz
sync from head
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c32
-rw-r--r--usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.18
2 files changed, 17 insertions, 23 deletions
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c
index ee8bdcc..ced7e8d 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c
@@ -442,10 +442,9 @@ static void
storage_OS_get_fs(void)
{
struct storage_entry *entry;
- uint64_t used_blocks_count = 0;
+ uint64_t size, used;
+ int i, mounted_fs_count, units;
char fs_string[SE_DESC_MLEN];
- int mounted_fs_count;
- int i = 0;
if ((mounted_fs_count = getfsstat(NULL, 0, MNT_NOWAIT)) < 0) {
syslog(LOG_ERR, "hrStorageTable: getfsstat() failed: %m");
@@ -488,22 +487,17 @@ storage_OS_get_fs(void)
entry->flags |= HR_STORAGE_FOUND;
entry->type = fs_get_type(&fs_buf[i]); /*XXX - This is wrong*/
- if (fs_buf[i].f_bsize > INT_MAX)
- entry->allocationUnits = INT_MAX;
- else
- entry->allocationUnits = fs_buf[i].f_bsize;
-
- if (fs_buf[i].f_blocks > INT_MAX)
- entry->size = INT_MAX;
- else
- entry->size = fs_buf[i].f_blocks;
-
- used_blocks_count = fs_buf[i].f_blocks - fs_buf[i].f_bfree;
-
- if (used_blocks_count > INT_MAX)
- entry->used = INT_MAX;
- else
- entry->used = used_blocks_count;
+ units = fs_buf[i].f_bsize;
+ size = fs_buf[i].f_blocks;
+ used = fs_buf[i].f_blocks - fs_buf[i].f_bfree;
+ while (size > INT_MAX) {
+ units <<= 1;
+ size >>= 1;
+ used >>= 1;
+ }
+ entry->allocationUnits = units;
+ entry->size = size;
+ entry->used = used;
entry->allocationFailures = 0;
diff --git a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
index 57a85d6..16eec25 100644
--- a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
+++ b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1
@@ -108,7 +108,7 @@ Depending on the options
.Nm bsnmpget
constructs either a SMNP GetRequest, GetNextRequest
or a GetBulkRequest packet, fills in the object identifiers (OIDs) of the
-objects whose values will be retrived, waits for a response and prints it if
+objects whose values will be retrieved, waits for a response and prints it if
received successfully.
.Pp
.Nm Bsnmpwalk
@@ -259,7 +259,7 @@ for
and getnext for
.Nm bsnmpwalk .
Getbulk allows executing the so called SNMP "bulkwalks" allowing the values of
-multiple columns to be retrived in a single PDU by
+multiple columns to be retrieved in a single PDU by
.Nm bsnmpwalk .
.It Fl r Ar retries
Number of resends of request packets before giving up if the agent does
@@ -332,7 +332,7 @@ will use version 2.
Note that GetBulkRequest-PDUs were introduced in SNMPv2 thus setting the
version to 1 is incompatiable with sending a GetBulk PDU.
.It OID
-The object identifier whose value to retrive.
+The object identifier whose value to retrieve.
At least one OID should be provided for
.Nm bsnmpget
to be able to send a request.
@@ -340,7 +340,7 @@ to be able to send a request.
For
.Nm bsnmpwalk
this is the root object identifier of the subtree whose values are to be
-retrived.
+retrieved.
If no OID is provided
.Nm bsnmpwalk
will walk the mib2 subtree rooted
OpenPOWER on IntegriCloud