Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/ipf Fix ipmon problems on sparc64 [Tomi Nylund]



details:   https://anonhg.NetBSD.org/src/rev/b354562e385f
branches:  trunk
changeset: 533469:b354562e385f
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jul 01 13:56:53 2002 +0000

description:
Fix ipmon problems on sparc64 [Tomi Nylund]
        1. localtime() expects a time_t, not a pointer to unsigned long.
        2. adapt to the kernel use of struct timeval.

diffstat:

 dist/ipf/ipmon.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (82 lines):

diff -r 4d88d9ad8620 -r b354562e385f dist/ipf/ipmon.c
--- a/dist/ipf/ipmon.c  Mon Jul 01 13:55:35 2002 +0000
+++ b/dist/ipf/ipmon.c  Mon Jul 01 13:56:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmon.c,v 1.12 2002/05/30 18:10:27 thorpej Exp $       */
+/*     $NetBSD: ipmon.c,v 1.13 2002/07/01 13:56:53 christos Exp $      */
 
 /*
  * Copyright (C) 1993-2002 by Darren Reed.
@@ -670,10 +670,12 @@
        struct  tm      *tm;
        int     res, i, len;
        char    *proto;
+       time_t  ipl_time;
 
        nl = (struct natlog *)((char *)ipl + IPLOG_SIZE);
        res = (opts & OPT_RESOLVE) ? 1 : 0;
-       tm = localtime((time_t *)&ipl->ipl_sec);
+       ipl_time = (time_t) ipl->ipl_time.tv_sec;
+       tm = localtime(&ipl_time);
        len = sizeof(line);
        if (!(opts & OPT_SYSLOG)) {
                (void) strftime(t, len, "%d/%m/%Y ", tm);
@@ -683,7 +685,7 @@
        }
        (void) strftime(t, len, "%T", tm);
        t += strlen(t);
-       (void) sprintf(t, ".%-.6ld @%hd ", ipl->ipl_usec, nl->nl_rule + 1);
+       (void) sprintf(t, ".%-.6ld @%hd ", ipl->ipl_time.tv_usec, nl->nl_rule + 1);
        t += strlen(t);
 
        if (nl->nl_type == NL_NEWMAP)
@@ -744,10 +746,12 @@
        char    *t = line, *proto;
        struct  tm      *tm;
        int     res, i, len;
+       time_t  ipl_time;
 
        sl = (struct ipslog *)((char *)ipl + IPLOG_SIZE);
        res = (opts & OPT_RESOLVE) ? 1 : 0;
-       tm = localtime((time_t *)&ipl->ipl_sec);
+       ipl_time = (time_t) ipl->ipl_time.tv_sec;
+       tm = localtime(&ipl_time);
        len = sizeof(line);
        if (!(opts & OPT_SYSLOG)) {
                (void) strftime(t, len, "%d/%m/%Y ", tm);
@@ -757,7 +761,7 @@
        }
        (void) strftime(t, len, "%T", tm);
        t += strlen(t);
-       (void) sprintf(t, ".%-.6ld ", ipl->ipl_usec);
+       (void) sprintf(t, ".%-.6ld ", ipl->ipl_time.tv_usec);
        t += strlen(t);
 
        if (sl->isl_type == ISL_NEW)
@@ -893,6 +897,7 @@
 #ifdef USE_INET6
        ip6_t *ip6;
 #endif
+       time_t  ipl_time;
 
        ipl = (iplog_t *)buf;
        ipf = (ipflog_t *)((char *)buf + IPLOG_SIZE);
@@ -901,7 +906,8 @@
        res = (opts & OPT_RESOLVE) ? 1 : 0;
        t = line;
        *t = '\0';
-       tm = localtime((time_t *)&ipl->ipl_sec);
+       ipl_time = (time_t) ipl->ipl_time.tv_sec;
+       tm = localtime(&ipl_time);
 #ifdef linux
        if (v == 4)
                ip->ip_len = ntohs(ip->ip_len);
@@ -916,7 +922,7 @@
        }
        (void) strftime(t, len, "%T", tm);
        t += strlen(t);
-       (void) sprintf(t, ".%-.6ld ", ipl->ipl_usec);
+       (void) sprintf(t, ".%-.6ld ", ipl->ipl_time.tv_usec);
        t += strlen(t);
        if (ipl->ipl_count > 1) {
                (void) sprintf(t, "%dx ", ipl->ipl_count);



Home | Main Index | Thread Index | Old Index