version 1.39, 2013/12/20 02:04:09 |
version 1.40, 2013/12/24 22:26:20 |
|
|
kfind_tcb(int sock) |
kfind_tcb(int sock) |
{ |
{ |
struct inpcbtable tcbtab; |
struct inpcbtable tcbtab; |
struct inpcb *head, *next, *prev; |
struct inpcb *next, *prev; |
struct inpcb inpcb; |
struct inpcb inpcb; |
struct tcpcb tcpcb; |
struct tcpcb tcpcb; |
|
|
|
|
fprintf(stderr, "Using PCB table at %lu\n", ptb->ktcbtab); |
fprintf(stderr, "Using PCB table at %lu\n", ptb->ktcbtab); |
retry: |
retry: |
kget(ptb->ktcbtab, &tcbtab, sizeof(tcbtab)); |
kget(ptb->ktcbtab, &tcbtab, sizeof(tcbtab)); |
prev = head = (struct inpcb *)&TAILQ_FIRST( |
prev = NULL; |
&((struct inpcbtable *)ptb->ktcbtab)->inpt_queue); |
|
next = TAILQ_FIRST(&tcbtab.inpt_queue); |
next = TAILQ_FIRST(&tcbtab.inpt_queue); |
|
|
if (ptb->vflag >= 2) |
if (ptb->vflag >= 2) |
fprintf(stderr, "PCB head at %p\n", head); |
fprintf(stderr, "PCB start at %p\n", next); |
while (next != head) { |
while (next != NULL) { |
if (ptb->vflag >= 2) |
if (ptb->vflag >= 2) |
fprintf(stderr, "Checking PCB %p\n", next); |
fprintf(stderr, "Checking PCB %p\n", next); |
kget((u_long)next, &inpcb, sizeof(inpcb)); |
kget((u_long)next, &inpcb, sizeof(inpcb)); |
if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) { |
|
if (nretry--) { |
|
warnx("pcb prev pointer insane"); |
|
goto retry; |
|
} else |
|
errx(1, "pcb prev pointer insane," |
|
" all attempts exausted"); |
|
} |
|
prev = next; |
prev = next; |
next = TAILQ_NEXT(&inpcb, inp_queue); |
next = TAILQ_NEXT(&inpcb, inp_queue); |
|
|