* Copyright (c) 1988, 1990 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
"@(#) Copyright (c) 1988, 1990 The Regents of the University of California.\n\
static char sccsid
[] = "@(#)tpcb.c 7.2 (Berkeley) 7/23/92";
#include <sys/socketvar.h>
#include <netiso/tp_param.h>
#include <netiso/tp_user.h>
#include <netiso/tp_pcb.h>
#include <netiso/tp_events.h>
#include <netiso/tp_states.h>
* This is a kernel debugging aid.
#define mem(e) (((struct tp_pcb *)0)->e)
#define Offsetof(e) ((int)&mem(e))
#define Sizeof(e) sizeof mem(e)
#if defined(__STDC__) || defined(__cplusplus)
#define Entry(n, e) { #n , Offsetof(e), Sizeof(e), }
#define Entry(n, e) { "n" , Offsetof(e), Sizeof(e), }
char *vmunix
= _PATH_UNIX
;
(kvm_read((void *)(p), &(d), sizeof (d)))
if ((argc
> 0) && strcmp("-k", argv
[0]) == 0) {
if (kvm_openfiles(vmunix
, kmemf
, NULL
) == -1) {
fprintf(stderr
, "tpcb: kvm_openfiles: %s\n", kvm_geterr());
if (kvm_nlist(nl
) < 0 || nl
[0].n_type
== 0) {
fprintf(stderr
, "%s: no namelist\n", vmunix
);
doall(nl
[TP_REFINFO
].n_value
);
sscanf(argv
[0], "%x", &loc
);
#define kdata(t) (data = *(t *)(ti->offset + (char *)&tp_pcb))
struct tp_refinfo tp_refinfo
;
register struct tp_pcb
**tpp
, **tpplim
;
char *tpr_base
, *malloc();
kget(refinfo_off
, tp_refinfo
);
n
= tp_refinfo
.tpr_size
* sizeof(struct tp_pcb
*);
if (tp_refinfo
.tpr_base
&& (tpr_base
= malloc(n
))) {
tpp
= (struct tp_pcb
**)tpr_base
;
tpplim
= tpp
+ tp_refinfo
.tpr_maxopen
;
kvm_read(tp_refinfo
.tpr_base
, tpr_base
, n
);
for (n
= 0; tpp
<= tpplim
; tpp
++)
if (Sflag
== 0 || tp_pcb
.tp_state
== TP_OPEN
) {
printf("\n\npcb at 0x%x:\n", *tpp
);
if (n
!= tp_refinfo
.tpr_numopen
)
printf("\nFound %d of %d expected tpcb's\n",
n
, tp_refinfo
.tpr_numopen
);
register struct tpcb_info
*ti
;
case 1: kdata(u_char
); break;
case 2: kdata(u_short
); break;
case 4: kdata(u_long
); break;
column
+= printf("%s 0x%x, ", ti
->name
, data
);
if (column
> 65 || Sflag
) {
register struct tpcb_info
*ti
;
for (; argc
-- > 0; argv
++)
for (ti
= tpcb_info
; ti
->name
; ti
++)
if (strcmp(ti
->name
, *argv
) == 0) {
for (ti
= tpcb_info
; ti
->name
; ti
++)
struct tpcb_info tpcb_info
[] = {
Entry(nextlisten
, tp_nextlisten
),
Entry(retrans
, tp_retrans
),
Entry(nlproto
, tp_nlproto
),
Entry(seqmask
, tp_seqmask
),
Entry(seqbit
, tp_seqbit
),
Entry(seqhalf
, tp_seqhalf
),
Entry(ucddata
, tp_ucddata
),
Entry(cebit_off
, tp_cebit_off
),
Entry(oktonagle
, tp_oktonagle
),
Entry(fcredit
, tp_fcredit
),
Entry(maxfcredit
, tp_maxfcredit
),
Entry(dupacks
, tp_dupacks
),
Entry(cong_win
, tp_cong_win
),
Entry(ssthresh
, tp_ssthresh
),
Entry(snduna
, tp_snduna
),
Entry(sndnew
, tp_sndnew
),
Entry(sndnum
, tp_sndnum
),
Entry(sndnxt
, tp_sndnxt
),
Entry(sndnxt_m
, tp_sndnxt_m
),
Entry(Nwindow
, tp_Nwindow
),
Entry(rcvnxt
, tp_rcvnxt
),
Entry(sent_lcdt
, tp_sent_lcdt
),
Entry(sent_uwe
, tp_sent_uwe
),
Entry(sent_rcvnxt
, tp_sent_rcvnxt
),
Entry(lcredit
, tp_lcredit
),
Entry(maxlcredit
, tp_maxlcredit
),
Entry(rhiwat
, tp_rhiwat
),
Entry(rsycnt
, tp_rsycnt
),
Entry(win_recv
, tp_win_recv
),
Entry(l_tpdusize
, tp_l_tpdusize
),
Entry(rttseq
, tp_rttseq
),
Entry(rttemit
, tp_rttemit
),
Entry(rxtcur
, tp_rxtcur
),
Entry(rxtshift
, tp_rxtshift
),
Entry(domain
, tp_domain
),
Entry(fsuffixlen
, tp_fsuffixlen
),
Entry(fsuffix
, tp_fsuffix
[0]),
Entry(lsuffixlen
, tp_lsuffixlen
),
Entry(lsuffix
, tp_lsuffix
[0]),
{ "fport", Offsetof(tp_fsuffix
[0]), sizeof(short), },
{ "lport", Offsetof(tp_lsuffix
[0]), sizeof(short), },
Entry(peer_acktime
, tp_peer_acktime
),
Entry(refstate
, tp_refstate
),
Entry(fasttimeo
, tp_fasttimeo
),
Entry(inact
, tp_timer
[TM_inact
]),
Entry(retrans
, tp_timer
[TM_retrans
]),
Entry(sendack
, tp_timer
[TM_sendack
]),
Entry(data_retrans
, tp_timer
[TM_data_retrans
]),
Entry(reference
, tp_timer
[TM_reference
]),
Entry(Xsndnxt
, tp_Xsndnxt
),
Entry(Xrcvnxt
, tp_Xrcvnxt
),
Entry(s_subseq
, tp_s_subseq
),
Entry(r_subseq
, tp_r_subseq
),
Entry(dt_ticks
, tp_dt_ticks
),
Entry(inact_ticks
, tp_inact_ticks
),
Entry(keepalive_ticks
, tp_keepalive_ticks
),
Entry(cr_ticks
, tp_cr_ticks
),
Entry(xpd_ticks
, tp_xpd_ticks
),