Date: Sat, 4 Apr 1998 16:41:47 +0200 (MET DST) From: Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE> To: phk@critter.freebsd.dk (Poul-Henning Kamp) Cc: andreas@klemm.gtn.com, freebsd-isdn@FreeBSD.ORG Subject: Re: -current: Undefined symbol `_time' referenced from text segment Message-ID: <199804041441.QAA00351@rvc1.informatik.ba-stuttgart.de> In-Reply-To: <5385.891695527@critter.freebsd.dk> from Poul-Henning Kamp at "Apr 4, 98 03:12:07 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> > It's very simply, just call getmicrotime() instead. This is a diff merging phk's latest changes to i4b, including his patch fighting the slowdown of netscape, xterm etc ... (BTW, phk, I hardly noticed a slowdown on my machine (i486DX4 100 Mhz), before your patch, after the patch I didn't notice any slowdown!) I'm not sure I did everthing right ... But it seems to work on my machine (-curren) and still to compile on 2.2.5 . Sorry, Andreas, this patch won't help bisdn users. Maybe it's time to move to i4b. Wolfgang diff -u -r /home/helbig/src/i4b/driver/i4b_ipr.c ./driver/i4b_ipr.c --- /home/helbig/src/i4b/driver/i4b_ipr.c Tue Mar 3 13:56:21 1998 +++ ./driver/i4b_ipr.c Sat Apr 4 10:07:33 1998 @@ -749,7 +749,7 @@ static void ipr_activity(int unit, int rxtx) { - ipr_softc[unit].sc_cdp->last_active_time = time.tv_sec; + ipr_softc[unit].sc_cdp->last_active_time = SECOND; } /*---------------------------------------------------------------------------* diff -u -r /home/helbig/src/i4b/driver/i4b_isppp.c ./driver/i4b_isppp.c --- /home/helbig/src/i4b/driver/i4b_isppp.c Thu Mar 19 20:36:51 1998 +++ ./driver/i4b_isppp.c Sat Apr 4 10:36:37 1998 @@ -93,6 +93,7 @@ #include <i4b/i4b_ioctl.h> #endif +#include <i4b/include/i4b_global.h> #include <i4b/include/i4b_mbuf.h> #include <i4b/include/i4b_l3l4.h> @@ -644,7 +645,7 @@ static void i4bisppp_activity(int unit, int rxtx) { - i4bisppp_softc[unit].sc_cdp->last_active_time = time.tv_sec; + i4bisppp_softc[unit].sc_cdp->last_active_time = SECOND; } /*---------------------------------------------------------------------------* diff -u -r /home/helbig/src/i4b/driver/i4b_tel.c ./driver/i4b_tel.c --- /home/helbig/src/i4b/driver/i4b_tel.c Wed Mar 11 17:19:16 1998 +++ ./driver/i4b_tel.c Sat Apr 4 10:35:17 1998 @@ -75,6 +75,7 @@ #include <i4b/i4b_tel_ioctl.h> #endif +#include <i4b/include/i4b_global.h> #include <i4b/include/i4b_mbuf.h> #include <i4b/include/i4b_l3l4.h> @@ -556,7 +557,7 @@ static void tel_activity(int unit, int rxtx) { - tel_sc[unit].cdp->last_active_time = time.tv_sec; + tel_sc[unit].cdp->last_active_time = SECOND; } /*---------------------------------------------------------------------------* diff -u -r /home/helbig/src/i4b/include/i4b_global.h ./include/i4b_global.h --- /home/helbig/src/i4b/include/i4b_global.h Fri Feb 13 18:00:15 1998 +++ ./include/i4b_global.h Sat Apr 4 10:02:57 1998 @@ -50,8 +50,10 @@ #ifdef __FreeBSD__ #if __FreeBSD__ >= 3 #define TIMEOUT_FUNC_T timeout_t * +#define SECOND time_second #else #define TIMEOUT_FUNC_T timeout_func_t +#define SECOND time.tv_sec #endif /* >= 3 */ #endif /* __FreeBSD__ */ diff -u -r /home/helbig/src/i4b/layer1/i4b_bchan.c ./layer1/i4b_bchan.c --- /home/helbig/src/i4b/layer1/i4b_bchan.c Wed Mar 11 10:35:55 1998 +++ ./layer1/i4b_bchan.c Sat Apr 4 11:19:45 1998 @@ -231,7 +231,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); } @@ -301,7 +305,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); } } diff -u -r /home/helbig/src/i4b/layer1/i4b_hscx.c ./layer1/i4b_hscx.c --- /home/helbig/src/i4b/layer1/i4b_hscx.c Thu Mar 12 10:38:52 1998 +++ ./layer1/i4b_hscx.c Sat Apr 4 11:13:21 1998 @@ -214,7 +214,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_NT; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); } @@ -288,7 +292,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_NT; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data); } @@ -371,7 +379,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); } @@ -427,7 +439,11 @@ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2); hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_bcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data); } } diff -u -r /home/helbig/src/i4b/layer1/i4b_isac.c ./layer1/i4b_isac.c --- /home/helbig/src/i4b/layer1/i4b_isac.c Tue Mar 31 12:00:45 1998 +++ ./layer1/i4b_isac.c Sat Apr 4 14:27:38 1998 @@ -183,7 +183,11 @@ hdr.type = TRC_CH_D; hdr.dir = FROM_NT; hdr.count = ++sc->sc_trace_dcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); } diff -u -r /home/helbig/src/i4b/layer1/i4b_l1.c ./layer1/i4b_l1.c --- /home/helbig/src/i4b/layer1/i4b_l1.c Tue Mar 31 11:41:35 1998 +++ ./layer1/i4b_l1.c Sat Apr 4 11:16:27 1998 @@ -222,7 +222,11 @@ hdr.type = TRC_CH_D; hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_dcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, m->m_len, m->m_data); } return(1); @@ -243,7 +247,11 @@ hdr.type = TRC_CH_D; hdr.dir = FROM_TE; hdr.count = ++sc->sc_trace_dcount; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + getmicrotime(&hdr.time); +#else hdr.time = time; +#endif MPH_Trace_Ind(&hdr, m->m_len, m->m_data); } diff -u -r /home/helbig/src/i4b/layer2/i4b_tei.c ./layer2/i4b_tei.c --- /home/helbig/src/i4b/layer2/i4b_tei.c Sat Feb 28 20:55:17 1998 +++ ./layer2/i4b_tei.c Sat Apr 4 02:01:27 1998 @@ -72,6 +72,10 @@ #include <i4b/i4b_ioctl.h> #endif +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include <machine/random.h> +#endif + #include <i4b/include/i4b_l1l2.h> #include <i4b/include/i4b_l2l3.h> #include <i4b/include/i4b_isdnq931.h> @@ -283,6 +287,9 @@ register u_short val; static int called = 42; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + read_random((char *)&val, sizeof(val)); +#else val = (l2sc->last_rih << 8) | l2sc->last_ril; val += ++called; @@ -298,7 +305,7 @@ if(val != 0 && val != 0xffff) break; } - +#endif l2sc->last_rih = (val >> 8) & 0x00ff; l2sc->last_ril = val & 0x00ff; } diff -u -r /home/helbig/src/i4b/layer4/i4b_l4.c ./layer4/i4b_l4.c --- /home/helbig/src/i4b/layer4/i4b_l4.c Thu Feb 26 17:40:46 1998 +++ ./layer4/i4b_l4.c Sat Apr 4 14:35:30 1998 @@ -184,7 +184,7 @@ s = SPLI4B(); - cd->last_active_time = cd->connect_time = time.tv_sec; + cd->last_active_time = cd->connect_time = SECOND; DBGL4(L4_TIMO, "i4b_l4_connect_active_ind", ("last_active/connect_time=%ld\n", (long)cd->connect_time)) @@ -508,7 +508,7 @@ #endif timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2); cd->timeout_active = 1; - DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: incoming-call, setup max_idle_time to %ld\n", (long)time.tv_sec, (long)cd->max_idle_time)) + DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: incoming-call, setup max_idle_time to %ld\n", (long)SECOND, (long)cd->max_idle_time)) } else if((cd->dir == DIR_OUTGOING) && (cd->idle_time > 0)) { @@ -523,7 +523,7 @@ #endif timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2); cd->timeout_active = 1; - DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n", (long)time.tv_sec, (long)cd->idle_time)) + DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n", (long)SECOND, (long)cd->idle_time)) } else if((cd->unitlen_time > 0) && (cd->unitlen_time > (cd->idle_time + cd->earlyhup_time))) { @@ -536,7 +536,7 @@ cd->timeout_active = 1; cd->idletime_state = IST_NONCHK; DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n", - (long)time.tv_sec, (long)(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time)))) + (long)SECOND, (long)(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time)))) if(cd->aocd_flag == 0) { @@ -550,7 +550,7 @@ /* parms somehow got wrong .. */ DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n", - (long)time.tv_sec, (long)cd->idle_time, (long)cd->earlyhup_time, (long)cd->unitlen_time)) + (long)SECOND, (long)cd->idle_time, (long)cd->earlyhup_time, (long)cd->unitlen_time)) } } else @@ -587,15 +587,15 @@ if(cd->dir == DIR_INCOMING) { - if((cd->last_active_time + cd->max_idle_time) <= time.tv_sec) + if((cd->last_active_time + cd->max_idle_time) <= SECOND) { - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, line idle timeout, disconnecting!\n", (long)time.tv_sec)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, line idle timeout, disconnecting!\n", (long)SECOND)) (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, CAUSE_NORMAL); i4b_l4_idle_timeout_ind(cd); } else { - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, activity, last_active=%ld, max_idle=%ld\n", (long)time.tv_sec, (long)cd->last_active_time, (long)cd->max_idle_time)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: incoming-call, activity, last_active=%ld, max_idle=%ld\n", (long)SECOND, (long)cd->last_active_time, (long)cd->max_idle_time)) #if defined(__FreeBSD__) && __FreeBSD__ >= 3 cd->idle_timeout_handle = #endif @@ -613,16 +613,16 @@ if((cd->idle_time > 0) && (cd->unitlen_time == 0)) { - if((cd->last_active_time + cd->idle_time) <= time.tv_sec) + if((cd->last_active_time + cd->idle_time) <= SECOND) { - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)time.tv_sec)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND)) (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, CAUSE_NORMAL); i4b_l4_idle_timeout_ind(cd); } else { DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n", - (long)time.tv_sec, (long)cd->last_active_time, (long)cd->idle_time)) + (long)SECOND, (long)cd->last_active_time, (long)cd->idle_time)) #if defined(__FreeBSD__) && __FreeBSD__ >= 3 cd->idle_timeout_handle = #endif @@ -642,15 +642,15 @@ cd->idle_timeout_handle = #endif timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->idle_time)); - cd->idletimechk_start = time.tv_sec; + cd->idletimechk_start = SECOND; cd->idletime_state = IST_CHECK; cd->timeout_active = 1; - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)time.tv_sec)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND)) break; case IST_CHECK: /* end of idletime chk */ if((cd->last_active_time > cd->idletimechk_start) && - (cd->last_active_time <= time.tv_sec)) + (cd->last_active_time <= SECOND)) { /* activity detected */ #if defined(__FreeBSD__) && __FreeBSD__ >= 3 cd->idle_timeout_handle = @@ -658,11 +658,11 @@ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->earlyhup_time)); cd->timeout_active = 1; cd->idletime_state = IST_SAFE; - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)time.tv_sec, (long)cd->last_active_time)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time)) } else { /* no activity, hangup */ - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)time.tv_sec, (long)cd->last_active_time)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time)) (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, CAUSE_NORMAL); i4b_l4_idle_timeout_ind(cd); cd->idletime_state = IST_IDLE; @@ -684,7 +684,7 @@ i4b_l4_charging_ind(cd); } - DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)time.tv_sec)) + DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND)) break; default: diff -u -r /home/helbig/src/i4b/layer4/i4b_l4mgmt.c ./layer4/i4b_l4mgmt.c --- /home/helbig/src/i4b/layer4/i4b_l4mgmt.c Wed Apr 1 15:45:01 1998 +++ ./layer4/i4b_l4mgmt.c Sat Apr 4 10:54:03 1998 @@ -67,6 +67,9 @@ #ifdef __FreeBSD__ #include <machine/i4b_debug.h> #include <machine/i4b_ioctl.h> +#if __FreeBSD__ >= 3 +#include <machine/random.h> +#endif #else #include <i4b/i4b_debug.h> #include <i4b/i4b_ioctl.h> @@ -280,11 +283,15 @@ { int found = 1; +#if defined(__FreeBSD__) && __FreeBSD__ >=3 + read_random((char *)&val, sizeof(val)); +#else val |= unit+i; val <<= i; val ^= (time.tv_sec >> 8) ^ time.tv_usec; val <<= i; val ^= time.tv_sec ^ (time.tv_usec >> 8); +#endif retval = val & 0x7f; --- /home/helbig/src/i4b/sppp/if_spppsubr.c Thu Mar 19 20:36:57 1998 +++ sppp/if_spppsubr.c Sat Apr 4 16:27:05 1998 @@ -17,9 +17,9 @@ * * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997 * - * From: if_spppsubr.c,v 1.32 1998/02/09 06:09:57 eivind Exp + * From: if_spppsubr.c,v 1.35 1998/03/30 09:52:06 phk Exp $ * - * $Id: if_spppsubr.c,v 1.10 1998/03/19 19:36:57 hm Exp $ + * $Id: if_spppsubr.c,v 1.8 1998/03/13 14:26:21 hm Exp $ */ #if defined(__FreeBSD__) && __FreeBSD__ >= 3 @@ -33,6 +33,9 @@ #include <sys/sockio.h> #include <sys/socket.h> #include <sys/syslog.h> +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 +#include <machine/random.h> +#endif #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/md5.h> @@ -625,7 +628,6 @@ * in front of the queue. */ if (dst->sa_family == AF_INET) { - /* Check mbuf length here??? */ struct ip *ip = mtod (m, struct ip*); struct tcphdr *tcp = (struct tcphdr*) ((long*)ip + ip->ip_hl); @@ -651,10 +653,6 @@ splx (s); return (ENOBUFS); } - /* - * May want to check size of packet - * (albeit due to the implementation it's always enough) - */ h = mtod (m, struct ppp_header*); if (sp->pp_flags & PP_CISCO) { h->address = CISCO_UNICAST; /* unicast address */ @@ -1031,7 +1029,11 @@ ++sp->pp_loopcnt; /* Generate new local sequence number */ +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + read_random((char*)&sp->pp_seq, sizeof sp->pp_seq); +#else sp->pp_seq ^= time.tv_sec ^ time.tv_usec; +#endif break; } sp->pp_loopcnt = 0; @@ -1059,7 +1061,14 @@ struct ppp_header *h; struct cisco_packet *ch; struct mbuf *m; + +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + struct timeval tv; + u_long t = (time_second - boottime.tv_sec) * 1000; + getmicroruntime(&tv); +#else u_long t = (time.tv_sec - boottime.tv_sec) * 1000; +#endif MGETHDR (m, M_DONTWAIT, MT_DATA); if (! m) @@ -1077,8 +1086,13 @@ ch->par1 = htonl (par1); ch->par2 = htonl (par2); ch->rel = -1; +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + ch->time0 = htons ((u_short) (tv.tv_sec >> 16)); + ch->time1 = htons ((u_short) tv.tv_sec); +#else ch->time0 = htons ((u_short) (t >> 16)); ch->time1 = htons ((u_short) t); +#endif if (debug) log(LOG_DEBUG, @@ -2168,7 +2182,11 @@ if (magic == ~sp->lcp.magic) { if (debug) addlog("magic glitch "); +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + read_random((char*)&sp->lcp.magic, sizeof sp->lcp.magic); +#else sp->lcp.magic += time.tv_sec + time.tv_usec; +#endif } else { sp->lcp.magic = magic; if (debug) @@ -2328,7 +2346,11 @@ if (sp->lcp.opts & (1 << LCP_OPT_MAGIC)) { if (! sp->lcp.magic) +#if defined(__FreeBSD__) && __FreeBSD__ >= 3 + read_random((char*)&sp->lcp.magic, sizeof sp->lcp.magic); +#else sp->lcp.magic = time.tv_sec + time.tv_usec; +#endif opt[i++] = LCP_OPT_MAGIC; opt[i++] = 6; opt[i++] = sp->lcp.magic >> 24; @@ -2584,7 +2606,7 @@ continue; } else { if (desiredaddr == hisaddr || - (hisaddr == 1 && desiredaddr != 0)) { + hisaddr == 1 && desiredaddr != 0) { /* * Peer's address is same as our value, * this is agreeable. Gonna conf-ack To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isdn" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804041441.QAA00351>