diff options
author | harti <harti@FreeBSD.org> | 2005-05-23 11:19:11 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-05-23 11:19:11 +0000 |
commit | a585c860e6a23a65af9f6a881ca7c5686cad63a4 (patch) | |
tree | 72add746df3bdc73ab6efb3b2c8f858844a53220 /contrib/bsnmp/snmpd | |
parent | 8bf5d359a297f85eced632d52abdb72d334412c5 (diff) | |
download | FreeBSD-src-a585c860e6a23a65af9f6a881ca7c5686cad63a4.zip FreeBSD-src-a585c860e6a23a65af9f6a881ca7c5686cad63a4.tar.gz |
Virgin import of bsnmpd 1.10
Diffstat (limited to 'contrib/bsnmp/snmpd')
-rw-r--r-- | contrib/bsnmp/snmpd/main.c | 22 | ||||
-rw-r--r-- | contrib/bsnmp/snmpd/snmpmod.3 | 13 | ||||
-rw-r--r-- | contrib/bsnmp/snmpd/snmpmod.h | 15 |
3 files changed, 28 insertions, 22 deletions
diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c index 9c73620..3131384 100644 --- a/contrib/bsnmp/snmpd/main.c +++ b/contrib/bsnmp/snmpd/main.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Begemot: bsnmp/snmpd/main.c,v 1.91 2005/04/22 12:18:14 brandt_h Exp $ + * $Begemot: bsnmp/snmpd/main.c,v 1.93 2005/05/23 11:10:16 brandt_h Exp $ * * SNMPd main stuff. */ @@ -59,8 +59,8 @@ #define PATH_PID "/var/run/%s.pid" #define PATH_CONFIG "/etc/%s.config" -u_int32_t this_tick; /* start of processing of current packet */ -u_int32_t start_tick; /* start of processing */ +uint64_t this_tick; /* start of processing of current packet (absolute) */ +uint64_t start_tick; /* start of processing */ struct systemg systemg = { NULL, @@ -908,8 +908,8 @@ snmpd_input(struct port_input *pi, struct tport *tport) * In case of AF_INET{6} peer, do hosts_access(5) check. */ if (inet_ntop(pi->peer->sa_family, - &((struct sockaddr_in *)pi->peer)->sin_addr, client, - sizeof(client)) != NULL) { + &((const struct sockaddr_in *)(const void *)pi->peer)->sin_addr, + client, sizeof(client)) != NULL) { request_set(&req, RQ_CLIENT_ADDR, client, 0); if (hosts_access(&req) == 0) { syslog(LOG_ERR, "refused connection from %.500s", @@ -1468,8 +1468,8 @@ main(int argc, char *argv[]) init_actvals(); - start_tick = get_ticks(); this_tick = get_ticks(); + start_tick = this_tick; /* start transports */ if (atexit(trans_stop) == -1) { @@ -1596,18 +1596,18 @@ main(int argc, char *argv[]) return (0); } - -u_int32_t +uint64_t get_ticks() { struct timeval tv; - u_int32_t ret; + uint64_t ret; if (gettimeofday(&tv, NULL)) abort(); - ret = tv.tv_sec * 100 + tv.tv_usec / 10000; + ret = tv.tv_sec * 100ULL + tv.tv_usec / 10000ULL; return (ret); } + /* * Timer support */ @@ -2276,7 +2276,7 @@ or_register(const struct asn_oid *or, const char *descr, struct lmodule *mod) objres->index = idx; objres->oid = *or; strlcpy(objres->descr, descr, sizeof(objres->descr)); - objres->uptime = get_ticks() - start_tick; + objres->uptime = (uint32_t)(get_ticks() - start_tick); objres->module = mod; INSERT_OBJECT_INT(objres, &objres_list); diff --git a/contrib/bsnmp/snmpd/snmpmod.3 b/contrib/bsnmp/snmpd/snmpmod.3 index 496bd05..c32eefe 100644 --- a/contrib/bsnmp/snmpd/snmpmod.3 +++ b/contrib/bsnmp/snmpd/snmpmod.3 @@ -26,9 +26,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.8 2005/02/25 11:56:01 brandt_h Exp $ +.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.10 2005/05/23 09:10:11 brandt_h Exp $ .\" -.Dd August 16, 2002 +.Dd May 23, 2005 .Dt SNMPMOD 3 .Os .Sh NAME @@ -119,9 +119,9 @@ Begemot SNMP library .Fn FIND_OBJECT_INT "LIST" "OID" "SUB" .Fn NEXT_OBJECT_OID "LIST" "OID" "SUB" .Fn NEXT_OBJECT_INT "LIST" "OID" "SUB" -.Vt extern u_int32_t this_tick ; -.Vt extern u_int32_t start_tick ; -.Ft u_int32_t +.Vt extern uint64_t this_tick ; +.Vt extern uint64_t start_tick ; +.Ft uint64_t .Fn get_ticks "void" .Vt extern struct systemg systemg ; .Ft u_int @@ -450,7 +450,8 @@ The variable contains the tick when the daemon was started. The function .Fn get_ticks -returns the current tick. The number of ticks since the daemon was started +returns the current tick. +The number of ticks since the daemon was started is .Bd -literal -offset indent get_ticks() - start_tick diff --git a/contrib/bsnmp/snmpd/snmpmod.h b/contrib/bsnmp/snmpd/snmpmod.h index 3ad5dfd..6345955 100644 --- a/contrib/bsnmp/snmpd/snmpmod.h +++ b/contrib/bsnmp/snmpd/snmpmod.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Begemot: bsnmp/snmpd/snmpmod.h,v 1.27 2004/08/06 08:47:14 brandt Exp $ + * $Begemot: bsnmp/snmpd/snmpmod.h,v 1.28 2005/05/23 09:03:59 brandt_h Exp $ * * SNMP daemon data and functions exported to modules. */ @@ -159,11 +159,16 @@ struct lmodule; -/* ticks when program and current packet was started */ -extern u_int32_t this_tick; -extern u_int32_t start_tick; +/* The tick when the program was started. This is the absolute time of + * the start in 100th of a second. */ +extern uint64_t start_tick; -u_int32_t get_ticks(void); +/* The tick when the current packet was received. This is the absolute + * time in 100th of second. */ +extern uint64_t this_tick; + +/* Get the current absolute time in 100th of a second. */ +uint64_t get_ticks(void); /* * Return code for proxy function |