xref: /csrg-svn/sys/netinet/tcp_usrreq.c (revision 4682)
1*4682Swnj /* tcp_usrreq.c 1.20 81/10/30 */
24567Swnj 
34497Swnj #include "../h/param.h"
44567Swnj #include "../h/systm.h"
54664Swnj #include "../h/mbuf.h"
64664Swnj #include "../h/socket.h"
74664Swnj #include "../inet/inet.h"
84664Swnj #include "../inet/inet_systm.h"
94664Swnj #include "../inet/imp.h"
104664Swnj #include "../inet/ip.h"
114664Swnj #include "../inet/tcp.h"
124567Swnj #define TCPFSTAB
134584Swnj #ifdef TCPDEBUG
144584Swnj #define TCPSTATES
154584Swnj #endif
164664Swnj #include "../inet/tcp_fsm.h"
174497Swnj 
184567Swnj tcp_timeo()
194497Swnj {
204567Swnj 	register struct tcb *tp;
214567Swnj 	int s = splnet();
224567Swnj COUNT(TCP_TIMEO);
234497Swnj 
244567Swnj 	/*
254567Swnj 	 * Search through tcb's and update active timers.
264567Swnj 	 */
27*4682Swnj 	for (tp = tcb.tcb_next; tp != (struct tcb *)&tcb; tp = tp->tcb_next) {
284567Swnj 		if (tp->t_init != 0 && --tp->t_init == 0)
294567Swnj 			tcp_usrreq(ISTIMER, TINIT, tp, 0);
304567Swnj 		if (tp->t_rexmt != 0 && --tp->t_rexmt == 0)
314567Swnj 			tcp_usrreq(ISTIMER, TREXMT, tp, 0);
324567Swnj 		if (tp->t_rexmttl != 0 && --tp->t_rexmttl == 0)
334567Swnj 			tcp_usrreq(ISTIMER, TREXMTTL, tp, 0);
344567Swnj 		if (tp->t_persist != 0 && --tp->t_persist == 0)
354567Swnj 			tcp_usrreq(ISTIMER, TPERSIST, tp, 0);
364567Swnj 		if (tp->t_finack != 0 && --tp->t_finack == 0)
374567Swnj 			tcp_usrreq(ISTIMER, TFINACK, tp, 0);
384567Swnj 		tp->t_xmt++;
394567Swnj 	}
404664Swnj 	tcp_iss += ISSINCR;		/* increment iss */
414567Swnj 	timeout(tcp_timeo, 0, hz);      /* reschedule every second */
424567Swnj 	splx(s);
434497Swnj }
444497Swnj 
454584Swnj tcp_usrreq(input, timertype, tp, mp)
464584Swnj 	int input, timertype;
474567Swnj 	register struct tcb *tp;
484584Swnj 	struct mbuf *mp;
494497Swnj {
504567Swnj 	int s = splnet();
514567Swnj 	register int nstate;
524584Swnj #ifdef TCPDEBUG
534584Swnj 	struct tcp_debug tdb;
544584Swnj #endif
554567Swnj COUNT(TCP_USRREQ);
564497Swnj 
574567Swnj 	nstate = tp->t_state;
584576Swnj 	tp->tc_flags &= ~TC_NET_KEEP;
594567Swnj 	acounts[nstate][input]++;
604584Swnj #ifdef TCPDEBUG
614584Swnj 	if ((tp->t_ucb->uc_flags & UDEBUG) || tcpconsdebug) {
624605Swnj 		tdb_setup(tp, (struct th *)0, input, &tdb);
634584Swnj 		tdb.td_tim = timertype;
644584Swnj 	} else
654584Swnj 		tdb.td_tod = 0;
664584Swnj #endif
674567Swnj 	switch (tcp_fstab[nstate][input]) {
684497Swnj 
694567Swnj 	default:
704567Swnj 		printf("tcp: bad state: tcb=%x state=%d input=%d\n",
714567Swnj 		    tp, tp->t_state, input);
724567Swnj 		nstate = EFAILEC;
734567Swnj 		break;
744497Swnj 
754567Swnj 	case LIS_CLS:				/* 1 */
764676Swnj 		tcp_open(tp, PASSIVE);
774567Swnj 		nstate = LISTEN;
784567Swnj 		break;
794497Swnj 
804567Swnj 	case SYS_CLS:				/* 2 */
814676Swnj 		tcp_open(tp, ACTIVE);
824676Swnj 		tcp_sndctl(tp);
834567Swnj 		nstate = SYN_SENT;
844567Swnj 		break;
854497Swnj 
864567Swnj 	case CLS_OPN:				/* 10 */
874676Swnj 		tcp_close(tp, UCLOSED);
884567Swnj 		nstate = CLOSED;
894567Swnj 		break;
904497Swnj 
914567Swnj 	case CL2_CLW:				/* 10 */
924576Swnj 		tp->tc_flags |= TC_SND_FIN;
934676Swnj 		tcp_sndctl(tp);
944576Swnj 		tp->tc_flags |= TC_USR_CLOSED;
954567Swnj 		nstate = CLOSING2;
964567Swnj 		break;
974497Swnj 
984567Swnj 	case TIMERS:				/* 14,17,34,35,36,37,38 */
994584Swnj 		nstate = tcp_timers(tp, timertype);
1004567Swnj 		break;
1014497Swnj 
1024567Swnj 	case CLS_RWT:				/* 20 */
1034567Swnj 		present_data(tp);
1044567Swnj 		if (rcv_empty(tp)) {
1054676Swnj 			tcp_close(tp, UCLOSED);
1064567Swnj 			nstate = CLOSED;
1074567Swnj 		} else
1084567Swnj 			nstate = RCV_WAIT;
1094567Swnj 		break;
1104497Swnj 
1114567Swnj 	case FW1_SYR:				/* 24,25 */
1124576Swnj 		tp->tc_flags |= TC_SND_FIN;
1134676Swnj 		tcp_sndctl(tp);
1144576Swnj 		tp->tc_flags |= TC_USR_CLOSED;
1154567Swnj 		nstate = FIN_W1;
1164567Swnj 		break;
1174567Swnj 
1184567Swnj 	case SSS_SND:				/* 40,41 */
1194678Swnj 		nstate = tcp_usrsend(tp, mp);
1204567Swnj 		break;
1214567Swnj 
1224567Swnj 	case SSS_RCV:				/* 42 */
1234676Swnj 		tcp_sndwin(tp);		/* send new window */
1244567Swnj 		present_data(tp);
1254567Swnj 		break;
1264567Swnj 
1274567Swnj 	case CLS_NSY:				/* 44 */
1284676Swnj 		tcp_close(tp, UABORT);
1294567Swnj 		nstate = CLOSED;
1304567Swnj 		break;
1314567Swnj 
1324567Swnj 	case CLS_SYN:				/* 45 */
1334576Swnj 		tp->tc_flags |= TC_SND_RST;
1344676Swnj 		tcp_sndnull(tp);
1354676Swnj 		tcp_close(tp, UABORT);
1364567Swnj 		nstate = CLOSED;
1374567Swnj 		break;
1384567Swnj 
1394567Swnj 	case CLS_ACT:				/* 47 */
1404676Swnj 		tcp_close(tp, UNETDWN);
1414567Swnj 		nstate = CLOSED;
1424567Swnj 		break;
1434567Swnj 
1444567Swnj 	case NOP:
1454567Swnj 		break;
1464567Swnj 
1474567Swnj 	case CLS_ERR:
1484567Swnj 		to_user(tp->t_ucb, UCLSERR);
1494567Swnj 		break;
1504567Swnj 	}
1514567Swnj #ifdef TCPDEBUG
1524605Swnj 	if (tdb.td_tod)
1534605Swnj 		tdb_stuff(&tdb, nstate);
1544567Swnj #endif
1554567Swnj 	/* YECH */
1564567Swnj 	switch (nstate) {
1574567Swnj 
1584584Swnj 	case CLOSED:
1594567Swnj 	case SAME:
1604567Swnj 		break;
1614567Swnj 
1624567Swnj 	case EFAILEC:
1634584Swnj 		if (mp)
1644584Swnj 			m_freem(dtom(mp));
1654567Swnj 		break;
1664567Swnj 
1674567Swnj 	default:
1684567Swnj 		tp->t_state = nstate;
1694567Swnj 		break;
1704567Swnj 	}
1714567Swnj 	splx(s);
1724497Swnj }
1734497Swnj 
174*4682Swnj /*
175*4682Swnj  * Open routine, called to initialize newly created tcb fields.
176*4682Swnj  */
177*4682Swnj tcp_open(tp, mode)
1784567Swnj 	register struct tcb *tp;
1794567Swnj 	int mode;
1804497Swnj {
181*4682Swnj 	register struct ucb *up = tp->t_ucb;
182*4682Swnj COUNT(TCP_OPEN);
1834497Swnj 
184*4682Swnj 	/*
185*4682Swnj 	 * Link in tcb queue and make
186*4682Swnj 	 * initialize empty reassembly queue.
187*4682Swnj 	 */
188*4682Swnj 	tp->tcb_next = tcb.tcb_next;
189*4682Swnj 	tcb.tcb_next->tcb_prev = tp;
190*4682Swnj 	tp->tcb_prev = (struct tcb *)&tcb;
191*4682Swnj 	tcb.tcb_next = tp;
192*4682Swnj 	tp->t_rcv_next = tp->t_rcv_prev = (struct th *)tp;
1934497Swnj 
194*4682Swnj 	/*
195*4682Swnj 	 * Initialize sequence numbers and
196*4682Swnj 	 * round trip retransmit timer.
197*4682Swnj 	 * (Other fields were init'd to zero when tcb allocated.)
198*4682Swnj 	 */
1994567Swnj 	tp->t_xmtime = T_REXMT;
200*4682Swnj 	tp->snd_end = tp->seq_fin = tp->snd_nxt = tp->snd_hi = tp->snd_una =
201*4682Swnj 	    tp->iss = tcp_iss;
2024567Swnj 	tp->snd_off = tp->iss + 1;
2034664Swnj 	tcp_iss += (ISSINCR >> 1) + 1;
2044567Swnj 
205*4682Swnj 	/*
206*4682Swnj 	 * Set timeout for open.
207*4682Swnj 	 * SHOULD THIS BE A HIGHER LEVEL FUNCTION!?! THINK SO.
208*4682Swnj 	 */
209*4682Swnj 	if (up->uc_timeo)
210*4682Swnj 		tp->t_init = up->uc_timeo;
211*4682Swnj 	else if (mode == ACTIVE)
212*4682Swnj 		tp->t_init = T_INIT;
213*4682Swnj 	/* else
214*4682Swnj 		tp->t_init = 0; */
215*4682Swnj 	up->uc_timeo = 0;				/* ### */
2164497Swnj }
2174497Swnj 
218*4682Swnj /*
219*4682Swnj  * Internal close of a connection, shutting down the tcb.
220*4682Swnj  */
2214676Swnj tcp_close(tp, state)
2224567Swnj 	register struct tcb *tp;
2234567Swnj 	short state;
2244497Swnj {
225*4682Swnj 	register struct ucb *up = tp->t_ucb;
2264567Swnj 	register struct th *t;
2274567Swnj 	register struct mbuf *m;
228*4682Swnj COUNT(TCP_CLOSE);
2294497Swnj 
230*4682Swnj 	/*
231*4682Swnj 	 * Cancel all timers.
232*4682Swnj 	 * SHOULD LOOP HERE !?!
233*4682Swnj 	 */
2344567Swnj 	tp->t_init = tp->t_rexmt = tp->t_rexmttl = tp->t_persist =
2354567Swnj 	    tp->t_finack = 0;
2364497Swnj 
237*4682Swnj 	/*
238*4682Swnj 	 * Remque the tcb
239*4682Swnj 	 */
240*4682Swnj 	tp->tcb_prev->tcb_next = tp->tcb_next;
241*4682Swnj 	tp->tcb_next->tcb_prev = tp->tcb_prev;
2424567Swnj 
243*4682Swnj 	/*
244*4682Swnj 	 * Discard all buffers...
245*4682Swnj 	 *
246*4682Swnj 	 * SHOULD COUNT EACH RESOURCE TO 0 AND PANIC IF CONFUSED
247*4682Swnj 	 */
2484567Swnj 	for (t = tp->t_rcv_next; t != (struct th *)tp; t = t->t_next)
2494567Swnj 		m_freem(dtom(t));
2504567Swnj 	if (up->uc_rbuf != NULL) {
2514567Swnj 		m_freem(up->uc_rbuf);
2524567Swnj 		up->uc_rbuf = NULL;
2534567Swnj 	}
2544657Swnj 	up->uc_rcc = 0;
2554567Swnj 	if (up->uc_sbuf != NULL) {
2564567Swnj 		m_freem(up->uc_sbuf);
2574567Swnj 		up->uc_sbuf = NULL;
2584567Swnj 	}
2594592Swnj 	up->uc_ssize = 0;
2604567Swnj 	for (m = tp->t_rcv_unack; m != NULL; m = m->m_act) {
2614567Swnj 		m_freem(m);
2624567Swnj 		tp->t_rcv_unack = NULL;
2634567Swnj 	}
264*4682Swnj 
265*4682Swnj 	/*
266*4682Swnj 	 * Free tcp send template.
267*4682Swnj 	 */
2684664Swnj 	if (up->uc_template) {
2694664Swnj 		m_free(dtom(up->uc_template));
2704664Swnj 		up->uc_template = 0;
2714664Swnj 	}
272*4682Swnj 
273*4682Swnj 	/*
274*4682Swnj 	 * Free the tcb
275*4682Swnj 	 * WOULD THIS BETTER BE DONE AT USER CLOSE?
276*4682Swnj 	 */
2774670Swnj 	wmemfree((caddr_t)tp, 1024);
2784567Swnj 	up->uc_tcb = NULL;
2794567Swnj 
280*4682Swnj 	/*
281*4682Swnj 	 * Lower buffer allocation.
282*4682Swnj 	 * SHOULD BE A M_ROUTINE CALL.
283*4682Swnj 	 */
2844664Swnj 	mbstat.m_lowat -= up->uc_snd + (up->uc_rhiwat/MSIZE) + 2;
2854664Swnj 	mbstat.m_hiwat = 2 * mbstat.m_lowat;
286*4682Swnj 
287*4682Swnj 	/*
288*4682Swnj 	 * Free routing table entry.
289*4682Swnj 	 */
2904567Swnj 	if (up->uc_host != NULL) {
2914567Swnj 		h_free(up->uc_host);
2924567Swnj 		up->uc_host = NULL;
2934567Swnj 	}
2944567Swnj 
295*4682Swnj 	/*
296*4682Swnj 	 * If user has initiated close (via close call), delete ucb
297*4682Swnj 	 * entry, otherwise just wakeup so user can issue close call
298*4682Swnj 	 */
2994576Swnj 	if (tp->tc_flags&TC_USR_ABORT)
3004567Swnj         	up->uc_proc = NULL;
3014567Swnj 	else
302*4682Swnj         	to_user(up, state);			/* ### */
3034497Swnj }
3044497Swnj 
305*4682Swnj /*
306*4682Swnj  * User routine to send data queue headed by m0 into the protocol.
307*4682Swnj  */
3084678Swnj tcp_usrsend(tp, m0)
3094584Swnj 	register struct tcb *tp;
3104584Swnj 	struct mbuf *m0;
3114497Swnj {
3124497Swnj 	register struct mbuf *m, *n;
3134584Swnj 	register struct ucb *up = tp->t_ucb;
3144497Swnj 	register off;
3154574Swnj 	seq_t last;
316*4682Swnj COUNT(TCP_USRSEND);
3174497Swnj 
3184497Swnj 	last = tp->snd_off;
3194584Swnj 	for (m = n = m0; m != NULL; m = m->m_next) {
3204497Swnj 		up->uc_ssize++;
3214591Swnj 		if (m->m_off > MMAXOFF)
3224588Swnj 			up->uc_ssize += NMBPG;
3234497Swnj 		last += m->m_len;
3244497Swnj 	}
3254588Swnj 	if ((m = up->uc_sbuf) == NULL)
3264588Swnj 		up->uc_sbuf = n;
3274588Swnj 	else {
3284588Swnj 		while (m->m_next != NULL) {
3294497Swnj 			m = m->m_next;
3304497Swnj 			last += m->m_len;
3314497Swnj 		}
3324591Swnj 		if (m->m_off <= MMAXOFF) {
3334588Swnj 			last += m->m_len;
3344588Swnj 			off = m->m_off + m->m_len;
3354591Swnj 			while (n && n->m_off <= MMAXOFF &&
3364591Swnj 			    (MMAXOFF - off) >= n->m_len) {
3374588Swnj 				bcopy((caddr_t)((int)n + n->m_off),
3384588Swnj 				      (caddr_t)((int)m + off), n->m_len);
3394588Swnj 				m->m_len += n->m_len;
3404588Swnj 				off += n->m_len;
3414588Swnj 				up->uc_ssize--;
3424588Swnj 				n = m_free(n);
3434588Swnj 			}
3444497Swnj 		}
3454497Swnj 		m->m_next = n;
3464588Swnj 	}
3474588Swnj 	if (up->uc_flags & UEOL)
3484497Swnj 		tp->snd_end = last;
3494588Swnj 	if (up->uc_flags & UURG) {
3504497Swnj 		tp->snd_urp = last+1;
3514576Swnj 		tp->tc_flags |= TC_SND_URG;
3524567Swnj 	}
3534678Swnj 	tcp_send(tp);
3544567Swnj 	return (SAME);
3554497Swnj }
3564497Swnj 
357*4682Swnj /*
358*4682Swnj  * TCP timer went off processing.
359*4682Swnj  */
3604584Swnj tcp_timers(tp, timertype)
3614584Swnj 	register struct tcb *tp;
3624584Swnj 	int timertype;
3634497Swnj {
3644497Swnj 
3654567Swnj COUNT(TCP_TIMERS);
3664584Swnj 	switch (timertype) {
3674497Swnj 
3684567Swnj 	case TINIT:		/* initialization timer */
3694576Swnj 		if ((tp->tc_flags&TC_SYN_ACKED) == 0) {		/* 35 */
3704676Swnj 			tcp_close(tp, UINTIMO);
3714567Swnj 			return (CLOSED);
3724567Swnj 		}
3734567Swnj 		return (SAME);
3744497Swnj 
3754567Swnj 	case TFINACK:		/* fin-ack timer */
3764567Swnj 		switch (tp->t_state) {
3774497Swnj 
3784567Swnj 		case TIME_WAIT:
3794567Swnj 			/*
3804567Swnj 			 * We can be sure our ACK of foreign FIN was rcvd,
3814567Swnj 			 * and can close if no data left for user.
3824567Swnj 			 */
3834567Swnj 			if (rcv_empty(tp)) {
3844676Swnj 				tcp_close(tp, UCLOSED);		/* 14 */
3854567Swnj 				return (CLOSED);
3864567Swnj 			}
3874567Swnj 			return (RCV_WAIT);			/* 17 */
3884497Swnj 
3894567Swnj 		case CLOSING1:
3904576Swnj 			tp->tc_flags |= TC_WAITED_2_ML;
3914567Swnj 			return (SAME);
3924497Swnj 
3934567Swnj 		default:
3944567Swnj 			return (SAME);
3954567Swnj 		}
3964497Swnj 
3974567Swnj 	case TREXMT:		/* retransmission timer */
3984567Swnj 		if (tp->t_rexmt_val > tp->snd_una) {	 	/* 34 */
3994567Swnj 			/*
4004567Swnj 			 * Set up for a retransmission, increase rexmt time
4014567Swnj 			 * in case of multiple retransmissions.
4024567Swnj 			 */
4034567Swnj 			tp->snd_nxt = tp->snd_una;
4044576Swnj 			tp->tc_flags |= TC_REXMT;
4054567Swnj 			tp->t_xmtime = tp->t_xmtime << 1;
4064567Swnj 			if (tp->t_xmtime > T_REMAX)
4074567Swnj 				tp->t_xmtime = T_REMAX;
4084678Swnj 			tcp_send(tp);
4094567Swnj 		}
4104567Swnj 		return (SAME);
4114497Swnj 
4124567Swnj 	case TREXMTTL:		/* retransmit too long */
4134567Swnj 		if (tp->t_rtl_val > tp->snd_una)		/* 36 */
4144567Swnj 			to_user(tp->t_ucb, URXTIMO);
4154567Swnj 		/*
4164567Swnj 		 * If user has already closed, abort the connection.
4174567Swnj 		 */
4184576Swnj 		if (tp->tc_flags & TC_USR_CLOSED) {
4194676Swnj 			tcp_close(tp, URXTIMO);
4204567Swnj 			return (CLOSED);
4214567Swnj 		}
4224567Swnj 		return (SAME);
4234497Swnj 
4244567Swnj 	case TPERSIST:		/* persist timer */
4254567Swnj 		/*
4264567Swnj 		 * Force a byte send through closed window.
4274567Swnj 		 */
4284576Swnj 		tp->tc_flags |= TC_FORCE_ONE;
4294678Swnj 		tcp_send(tp);
4304567Swnj 		return (SAME);
4314567Swnj 	}
4324567Swnj 	panic("tcp_timers");
4334497Swnj }
4344497Swnj 
4354567Swnj /* THIS ROUTINE IS A CROCK */
4364567Swnj to_user(up, state)
4374567Swnj 	register struct ucb *up;
4384567Swnj 	register short state;
4394497Swnj {
4404567Swnj COUNT(TO_USER);
4414497Swnj 
4424567Swnj 	up->uc_state |= state;
4434567Swnj 	netwakeup(up);
4444567Swnj   	if (state == UURGENT)
4454567Swnj 		psignal(up->uc_proc, SIGURG);
4464497Swnj }
4474584Swnj 
4484584Swnj #ifdef TCPDEBUG
449*4682Swnj /*
450*4682Swnj  * TCP debugging utility subroutines.
451*4682Swnj  * THE NAMES OF THE FIELDS USED BY THESE ROUTINES ARE STUPID.
452*4682Swnj  */
4534670Swnj tdb_setup(tp, n, input, tdp)
4544670Swnj 	struct tcb *tp;
4554670Swnj 	register struct th *n;
4564670Swnj 	int input;
4574670Swnj 	register struct tcp_debug *tdp;
4584670Swnj {
4594670Swnj 
460*4682Swnj COUNT(TDB_SETUP);
4614670Swnj 	tdp->td_tod = time;
4624670Swnj 	tdp->td_tcb = tp;
4634670Swnj 	tdp->td_old = tp->t_state;
4644670Swnj 	tdp->td_inp = input;
4654670Swnj 	tdp->td_tim = 0;
4664670Swnj 	tdp->td_new = -1;
4674670Swnj 	if (n) {
4684670Swnj 		tdp->td_sno = n->t_seq;
4694670Swnj 		tdp->td_ano = n->t_ackno;
4704670Swnj 		tdp->td_wno = n->t_win;
4714670Swnj 		tdp->td_lno = n->t_len;
4724670Swnj 		tdp->td_flg = n->th_flags;
4734670Swnj 	} else
4744670Swnj 		tdp->td_sno = tdp->td_ano = tdp->td_wno = tdp->td_lno =
4754670Swnj 		    tdp->td_flg = 0;
4764670Swnj }
4774670Swnj 
4784670Swnj tdb_stuff(tdp, nstate)
4794670Swnj 	struct tcp_debug *tdp;
4804670Swnj 	int nstate;
4814670Swnj {
482*4682Swnj COUNT(TDB_STUFF);
4834670Swnj 
4844670Swnj 	tdp->td_new = nstate;
4854670Swnj 	tcp_debug[tdbx++ % TDBSIZE] = *tdp;
4864670Swnj 	if (tcpconsdebug & 2)
4874670Swnj 		tcp_prt(tdp);
4884670Swnj }
489*4682Swnj 
490*4682Swnj /* BETTER VERSION OF THIS ROUTINE? */
491*4682Swnj tcp_prt(tdp)
492*4682Swnj 	register struct tcp_debug *tdp;
493*4682Swnj {
494*4682Swnj COUNT(TCP_PRT);
495*4682Swnj 
496*4682Swnj 	printf("TCP(%x) %s x %s",
497*4682Swnj 	    tdp->td_tcb, tcpstates[tdp->td_old], tcpinputs[tdp->td_inp]);
498*4682Swnj 	if (tdp->td_inp == ISTIMER)
499*4682Swnj 		printf("(%s)", tcptimers[tdp->td_tim]);
500*4682Swnj 	printf(" --> %s",
501*4682Swnj 	    tcpstates[(tdp->td_new > 0) ? tdp->td_new : tdp->td_old]);
502*4682Swnj 	/* GROSS... DEPENDS ON SIGN EXTENSION OF CHARACTERS */
503*4682Swnj 	if (tdp->td_new < 0)
504*4682Swnj 		printf(" (FAILED)");
505*4682Swnj 	if (tdp->td_sno) {
506*4682Swnj 		printf(" sno %x ano %x win %d len %d flags %x",
507*4682Swnj 		    tdp->td_sno, tdp->td_ano, tdp->td_wno,
508*4682Swnj 		    tdp->td_lno, tdp->td_flg);
509*4682Swnj 	}
510*4682Swnj 	printf("\n");
511*4682Swnj }
5124670Swnj #endif
513