Lines Matching refs:tp

358 	struct tim_tim *tp;  in timodopen()  local
371 tp = kmem_zalloc(sizeof (struct tim_tim), KM_SLEEP); in timodopen()
373 tp->tim_cpid = -1; in timodopen()
374 tp->tim_saved_prim = -1; in timodopen()
376 mutex_init(&tp->tim_mutex, NULL, MUTEX_DEFAULT, NULL); in timodopen()
378 q->q_ptr = (caddr_t)tp; in timodopen()
379 WR(q)->q_ptr = (caddr_t)tp; in timodopen()
381 tilogp("timodopen: Allocated for tp %lx\n", (uintptr_t)tp); in timodopen()
387 tp->tim_provinfo = tpi_findprov(q); in timodopen()
396 if (tp->tim_provinfo->tpi_myname != PI_YES) { in timodopen()
398 tp->tim_flags |= DO_MYNAME; in timodopen()
401 if (tp->tim_provinfo->tpi_peername != PI_YES) { in timodopen()
403 tp->tim_flags |= DO_PEERNAME; in timodopen()
417 tp->tim_acceptor = (t_uscalar_t)RD(driverq); in timodopen()
420 tp->tim_acceptor = (t_uscalar_t)getminor(*devp); in timodopen()
426 tim_addlink(tp); in timodopen()
447 struct tim_tim *tp = (struct tim_tim *)q->q_ptr; in tim_timer() local
449 ASSERT(tp); in tim_timer()
452 ASSERT(tp->tim_rtimoutid); in tim_timer()
453 tp->tim_rtimoutid = 0; in tim_timer()
455 ASSERT(tp->tim_wtimoutid); in tim_timer()
456 tp->tim_wtimoutid = 0; in tim_timer()
466 struct tim_tim *tp = (struct tim_tim *)q->q_ptr; in tim_buffer() local
468 ASSERT(tp); in tim_buffer()
471 ASSERT(tp->tim_rbufcid); in tim_buffer()
472 tp->tim_rbufcid = 0; in tim_buffer()
474 ASSERT(tp->tim_wbufcid); in tim_buffer()
475 tp->tim_wbufcid = 0; in tim_buffer()
492 struct tim_tim *tp; in timodclose() local
498 tp = (struct tim_tim *)q->q_ptr; in timodclose()
501 ASSERT(tp != NULL); in timodclose()
503 tilogp("timodclose: Entered for tp %lx\n", (uintptr_t)tp); in timodclose()
507 tim_dellink(tp); in timodclose()
513 if (tp->tim_wbufcid) { in timodclose()
514 qunbufcall(q, tp->tim_wbufcid); in timodclose()
515 tp->tim_wbufcid = 0; in timodclose()
517 if (tp->tim_rbufcid) { in timodclose()
518 qunbufcall(q, tp->tim_rbufcid); in timodclose()
519 tp->tim_rbufcid = 0; in timodclose()
521 if (tp->tim_wtimoutid) { in timodclose()
522 (void) quntimeout(q, tp->tim_wtimoutid); in timodclose()
523 tp->tim_wtimoutid = 0; in timodclose()
525 if (tp->tim_rtimoutid) { in timodclose()
526 (void) quntimeout(q, tp->tim_rtimoutid); in timodclose()
527 tp->tim_rtimoutid = 0; in timodclose()
530 if (tp->tim_tcap_timoutid != 0) { in timodclose()
531 (void) quntimeout(q, tp->tim_tcap_timoutid); in timodclose()
532 tp->tim_tcap_timoutid = 0; in timodclose()
535 if (tp->tim_iocsave != NULL) in timodclose()
536 freemsg(tp->tim_iocsave); in timodclose()
537 mp = tp->tim_consave; in timodclose()
544 ASSERT(tp->tim_mymaxlen >= 0); in timodclose()
545 if (tp->tim_mymaxlen != 0) in timodclose()
546 kmem_free(tp->tim_myname, (size_t)tp->tim_mymaxlen); in timodclose()
547 ASSERT(tp->tim_peermaxlen >= 0); in timodclose()
548 if (tp->tim_peermaxlen != 0) in timodclose()
549 kmem_free(tp->tim_peername, (size_t)tp->tim_peermaxlen); in timodclose()
553 mutex_destroy(&tp->tim_mutex); in timodclose()
555 if (tp->tim_peercred != NULL) in timodclose()
556 crfree(tp->tim_peercred); in timodclose()
558 kmem_free(tp, sizeof (struct tim_tim)); in timodclose()
644 struct tim_tim *tp; in timodrsrv() local
648 tp = (struct tim_tim *)q->q_ptr; in timodrsrv()
649 if (!tp) in timodrsrv()
670 timodprocessinfo(queue_t *q, struct tim_tim *tp, struct T_info_ack *tia) in timodprocessinfo() argument
677 tp->tim_flags = (tp->tim_flags & ~CLTS) | COTS; in timodprocessinfo()
679 tp->tim_flags = (tp->tim_flags & ~COTS) | CLTS; in timodprocessinfo()
687 struct tim_tim *tp; in timodrproc() local
692 tp = (struct tim_tim *)q->q_ptr; in timodrproc()
700 TILOG("timodrproc: Got M_ERROR, flags = %x\n", tp->tim_flags); in timodrproc()
719 if ((tp->tim_provinfo->tpi_capability == PI_DONTKNOW) && in timodrproc()
720 ((tp->tim_flags & TI_CAP_RECVD) != 0)) { in timodrproc()
726 PI_PROVLOCK(tp->tim_provinfo); in timodrproc()
727 if (tp->tim_provinfo->tpi_capability == PI_DONTKNOW) in timodrproc()
728 tp->tim_provinfo->tpi_capability = PI_NO; in timodrproc()
729 PI_PROVUNLOCK(tp->tim_provinfo); in timodrproc()
730 if (tp->tim_tcap_timoutid != 0) { in timodrproc()
731 (void) quntimeout(q, tp->tim_tcap_timoutid); in timodrproc()
732 tp->tim_tcap_timoutid = 0; in timodrproc()
789 tp->tim_flags); in timodrproc()
791 if ((tp->tim_flags & WAIT_CONNRESACK) && in timodrproc()
792 tp->tim_saved_prim == pptr->error_ack.ERROR_prim) { in timodrproc()
793 tp->tim_flags &= in timodrproc()
795 freemsg(tp->tim_iocsave); in timodrproc()
796 tp->tim_iocsave = NULL; in timodrproc()
797 tp->tim_saved_prim = -1; in timodrproc()
799 } else if (tp->tim_flags & WAITIOCACK) { in timodrproc()
800 tim_send_ioc_error_ack(q, tp, mp); in timodrproc()
816 tp->tim_mylen = 0; in timodrproc()
818 if ((tp->tim_flags & WAIT_CONNRESACK) && in timodrproc()
819 tp->tim_saved_prim == pptr->ok_ack.CORRECT_prim) { in timodrproc()
827 tp->tim_iocsave->b_rptr; in timodrproc()
836 msg_getcred(tp->tim_iocsave->b_cont, in timodrproc()
847 tp->tim_iocsave->b_cont->b_rptr; in timodrproc()
878 tp->tim_flags &= in timodrproc()
880 freemsg(tp->tim_iocsave); in timodrproc()
881 tp->tim_iocsave = NULL; in timodrproc()
882 tp->tim_saved_prim = -1; in timodrproc()
885 tim_send_reply(q, mp, tp, pptr->ok_ack.CORRECT_prim); in timodrproc()
900 tp->tim_backlog = ackp->CONIND_number; in timodrproc()
902 if (((tp->tim_flags & WAITIOCACK) == 0) || in timodrproc()
903 ((tp->tim_saved_prim != O_T_BIND_REQ) && in timodrproc()
904 (tp->tim_saved_prim != T_BIND_REQ))) { in timodrproc()
908 ASSERT(tp->tim_iocsave != NULL); in timodrproc()
910 if (tp->tim_flags & DO_MYNAME) { in timodrproc()
919 if (ackp->ADDR_length > tp->tim_mymaxlen) { in timodrproc()
931 ASSERT(tp->tim_mymaxlen >= 0); in timodrproc()
932 if (tp->tim_mymaxlen != 0) { in timodrproc()
933 kmem_free(tp->tim_myname, in timodrproc()
934 tp->tim_mymaxlen); in timodrproc()
936 tp->tim_myname = p; in timodrproc()
937 tp->tim_mymaxlen = ackp->ADDR_length; in timodrproc()
939 tp->tim_mylen = ackp->ADDR_length; in timodrproc()
941 tp->tim_myname, tp->tim_mylen); in timodrproc()
943 tim_ioctl_send_reply(q, tp->tim_iocsave, mp); in timodrproc()
944 tp->tim_iocsave = NULL; in timodrproc()
945 tp->tim_saved_prim = -1; in timodrproc()
946 tp->tim_flags &= ~(WAITIOCACK | WAIT_IOCINFOACK | in timodrproc()
958 if (((tp->tim_flags & WAITIOCACK) == 0) || in timodrproc()
959 ((tp->tim_saved_prim != T_SVR4_OPTMGMT_REQ) && in timodrproc()
960 (tp->tim_saved_prim != T_OPTMGMT_REQ))) { in timodrproc()
963 ASSERT(tp->tim_iocsave != NULL); in timodrproc()
964 tim_ioctl_send_reply(q, tp->tim_iocsave, mp); in timodrproc()
965 tp->tim_iocsave = NULL; in timodrproc()
966 tp->tim_saved_prim = -1; in timodrproc()
967 tp->tim_flags &= ~(WAITIOCACK | in timodrproc()
985 tp->tim_flags); in timodrproc()
987 timodprocessinfo(q, tp, tia); in timodrproc()
989 TILOG("timodrproc: flags = %x\n", tp->tim_flags); in timodrproc()
990 if ((tp->tim_flags & WAITIOCACK) != 0) { in timodrproc()
1001 if (!(tp->tim_flags & WAIT_IOCINFOACK)) { in timodrproc()
1005 ASSERT(tp->tim_iocsave != NULL); in timodrproc()
1007 iocbp = (struct iocblk *)tp->tim_iocsave->b_rptr; in timodrproc()
1022 if ((tp->tim_flags & in timodrproc()
1051 tp->tim_flags &= ~(WAITIOCACK | in timodrproc()
1054 tim_ioctl_send_reply(q, tp->tim_iocsave, mp); in timodrproc()
1055 tp->tim_iocsave = NULL; in timodrproc()
1056 tp->tim_saved_prim = -1; in timodrproc()
1109 tim_send_ioc_error_ack(q, tp, mp); in timodrproc()
1145 tsap->tsa_qlen = tp->tim_backlog; in timodrproc()
1147 if (tp->tim_flags & PEEK_RDQ_EXPIND) { in timodrproc()
1161 tp->tim_flags &= in timodrproc()
1166 tim_ioctl_send_reply(q, tp->tim_iocsave, mp); in timodrproc()
1167 tp->tim_iocsave = NULL; in timodrproc()
1168 tp->tim_saved_prim = -1; in timodrproc()
1169 tp->tim_flags &= ~(WAITIOCACK | WAIT_IOCINFOACK | in timodrproc()
1180 tim_send_reply(q, mp, tp, T_ADDR_REQ); in timodrproc()
1193 nbp->b_next = tp->tim_consave; in timodrproc()
1194 tp->tim_consave = nbp; in timodrproc()
1208 mutex_enter(&tp->tim_mutex); in timodrproc()
1209 if (tp->tim_peercred != NULL) in timodrproc()
1210 crfree(tp->tim_peercred); in timodrproc()
1211 tp->tim_peercred = msg_getcred(mp, &tp->tim_cpid); in timodrproc()
1212 if (tp->tim_peercred != NULL) in timodrproc()
1213 crhold(tp->tim_peercred); in timodrproc()
1214 mutex_exit(&tp->tim_mutex); in timodrproc()
1218 tp->tim_flags &= ~CONNWAIT; in timodrproc()
1240 tp->tim_flags &= ~(CONNWAIT|LOCORDREL|REMORDREL); in timodrproc()
1241 tim_clear_peer(tp); in timodrproc()
1242 for (nbp = tp->tim_consave; nbp; nbp = nbp->b_next) { in timodrproc()
1252 tp->tim_consave = nbp->b_next; in timodrproc()
1264 if (tp->tim_flags & LOCORDREL) { in timodrproc()
1265 tp->tim_flags &= ~(LOCORDREL|REMORDREL); in timodrproc()
1266 tim_clear_peer(tp); in timodrproc()
1268 tp->tim_flags |= REMORDREL; in timodrproc()
1297 PI_PROVLOCK(tp->tim_provinfo); in timodrproc()
1298 if (tp->tim_provinfo->tpi_capability != PI_YES) in timodrproc()
1299 tp->tim_provinfo->tpi_capability = PI_YES; in timodrproc()
1300 PI_PROVUNLOCK(tp->tim_provinfo); in timodrproc()
1303 if (tp->tim_tcap_timoutid != 0) { in timodrproc()
1304 (void) quntimeout(q, tp->tim_tcap_timoutid); in timodrproc()
1305 tp->tim_tcap_timoutid = 0; in timodrproc()
1311 timodprocessinfo(q, tp, &tca->INFO_ack); in timodrproc()
1313 tim_send_reply(q, mp, tp, T_CAPABILITY_REQ); in timodrproc()
1343 if ((tp->tim_flags & DO_MYNAME) != 0) { in timodrproc()
1344 tp->tim_flags &= ~DO_MYNAME; in timodrproc()
1345 PI_PROVLOCK(tp->tim_provinfo); in timodrproc()
1346 tp->tim_provinfo->tpi_myname = PI_YES; in timodrproc()
1347 PI_PROVUNLOCK(tp->tim_provinfo); in timodrproc()
1350 ASSERT(tp->tim_mymaxlen >= 0); in timodrproc()
1351 if (tp->tim_mymaxlen != 0) { in timodrproc()
1352 kmem_free(tp->tim_myname, (size_t)tp->tim_mymaxlen); in timodrproc()
1353 tp->tim_myname = NULL; in timodrproc()
1354 tp->tim_mymaxlen = 0; in timodrproc()
1357 if (tp->tim_saved_prim == -1) { in timodrproc()
1358 freemsg(tp->tim_iocsave); in timodrproc()
1359 tp->tim_iocsave = NULL; in timodrproc()
1368 if ((tp->tim_flags & DO_PEERNAME) != 0) { in timodrproc()
1369 tp->tim_flags &= ~DO_PEERNAME; in timodrproc()
1370 PI_PROVLOCK(tp->tim_provinfo); in timodrproc()
1371 tp->tim_provinfo->tpi_peername = PI_YES; in timodrproc()
1372 PI_PROVUNLOCK(tp->tim_provinfo); in timodrproc()
1375 mutex_enter(&tp->tim_mutex); in timodrproc()
1376 ASSERT(tp->tim_peermaxlen >= 0); in timodrproc()
1377 clearit = tp->tim_peermaxlen != 0; in timodrproc()
1379 kmem_free(tp->tim_peername, tp->tim_peermaxlen); in timodrproc()
1380 tp->tim_peername = NULL; in timodrproc()
1381 tp->tim_peermaxlen = 0; in timodrproc()
1382 tp->tim_peerlen = 0; in timodrproc()
1384 mutex_exit(&tp->tim_mutex); in timodrproc()
1388 bp = tp->tim_consave; in timodrproc()
1395 tp->tim_consave = NULL; in timodrproc()
1398 if (tp->tim_saved_prim == -1) { in timodrproc()
1399 freemsg(tp->tim_iocsave); in timodrproc()
1400 tp->tim_iocsave = NULL; in timodrproc()
1414 PI_PROVLOCK(tp->tim_provinfo); in timodrproc()
1416 if (tp->tim_provinfo->tpi_myname == PI_DONTKNOW) in timodrproc()
1417 tp->tim_provinfo->tpi_myname = PI_NO; in timodrproc()
1419 if (tp->tim_provinfo->tpi_peername == PI_DONTKNOW) in timodrproc()
1420 tp->tim_provinfo->tpi_peername = PI_NO; in timodrproc()
1422 PI_PROVUNLOCK(tp->tim_provinfo); in timodrproc()
1424 if ((tp->tim_iocsave != NULL) && in timodrproc()
1425 (tp->tim_saved_prim == -1)) { in timodrproc()
1427 mp = tp->tim_iocsave; in timodrproc()
1428 tp->tim_iocsave = NULL; in timodrproc()
1429 tp->tim_flags |= NAMEPROC; in timodrproc()
1431 tp->tim_flags &= ~NAMEPROC; in timodrproc()
1455 struct tim_tim *tp; in timodwput() local
1489 tp = (struct tim_tim *)q->q_ptr; in timodwput()
1490 ASSERT(tp); in timodwput()
1491 if (tp->tim_flags & CLTS) { in timodwput()
1511 tp = (struct tim_tim *)q->q_ptr; in timodwput()
1512 ASSERT(tp); in timodwput()
1513 if (tp->tim_flags & CLTS) { in timodwput()
1587 struct tim_tim *tp; in timodwproc() local
1593 tp = (struct tim_tim *)q->q_ptr; in timodwproc()
1601 if (tp->tim_flags & CLTS) { in timodwproc()
1630 if (tp->tim_flags & WAITIOCACK) { in timodwproc()
1646 if ((tp->tim_flags & COTS) == 0) { in timodwproc()
1652 mutex_enter(&tp->tim_mutex); in timodwproc()
1655 (tp->tim_flags & in timodwproc()
1657 tp->tim_peercred != NULL && in timodwproc()
1661 crhold(kp->pc_cr = tp->tim_peercred); in timodwproc()
1662 kp->pc_cpid = tp->tim_cpid; in timodwproc()
1664 mutex_exit(&tp->tim_mutex); in timodwproc()
1688 tim_send_ioctl_tpi_msg(q, mp, tp, iocbp); in timodwproc()
1698 tp->tim_flags |= WAIT_IOCINFOACK; in timodwproc()
1699 tim_send_ioctl_tpi_msg(q, mp, tp, iocbp); in timodwproc()
1734 tim_answer_ti_sync(q, mp, tp, in timodwproc()
1754 tp->tim_flags |= PEEK_RDQ_EXPIND; in timodwproc()
1767 tp->tim_flags |= WAIT_IOCINFOACK; in timodwproc()
1768 tim_send_ioctl_tpi_msg(q, mp, tp, iocbp); in timodwproc()
1794 switch (tp->tim_provinfo->tpi_capability) { in timodwproc()
1797 tim_send_ioctl_tpi_msg(q, mp, tp, iocbp); in timodwproc()
1807 ASSERT(tp->tim_tcap_timoutid == 0); in timodwproc()
1809 tp->tim_flags |= TI_CAP_RECVD; in timodwproc()
1811 tp->tim_flags |= (TI_CAP_RECVD | in timodwproc()
1815 tp->tim_tcap_timoutid = qtimeout(q, in timodwproc()
1817 tim_send_ioctl_tpi_msg(q, mp, tp, iocbp); in timodwproc()
1827 tp->tim_flags |= (TI_CAP_RECVD | in timodwproc()
1831 tp->tim_flags); in timodwproc()
1841 tim_send_ioctl_tpi_msg(q, mp, tp, in timodwproc()
1862 tp->tim_flags &= ~(WAITIOCACK | TI_CAP_RECVD | in timodwproc()
1872 if (tp->tim_iocsave != NULL) { in timodwproc()
1873 freemsg(tp->tim_iocsave); in timodwproc()
1874 tp->tim_iocsave = NULL; in timodwproc()
1875 tp->tim_saved_prim = -1; in timodwproc()
1882 "%d\n", tp->tim_provinfo->tpi_capability); in timodwproc()
1892 if (tp->tim_provinfo->tpi_myname == PI_YES) { in timodwproc()
1902 if (tp->tim_provinfo->tpi_peername == PI_YES) { in timodwproc()
1915 freemsg(tp->tim_iocsave); in timodwproc()
1916 tp->tim_iocsave = mp; in timodwproc()
1917 tp->tim_saved_prim = -1; in timodwproc()
1925 if (tp->tim_flags & NAMEPROC) { in timodwproc()
1927 tp->tim_flags &= ~NAMEPROC; in timodwproc()
1959 if (tp->tim_flags & CLTS) { in timodwproc()
1988 if (tp->tim_flags & DO_PEERNAME) { in timodwproc()
1995 mutex_enter(&tp->tim_mutex); in timodwproc()
1996 if (reqp->DEST_length > tp->tim_peermaxlen) { in timodwproc()
2000 mutex_exit(&tp->tim_mutex); in timodwproc()
2008 if (tp->tim_peermaxlen) in timodwproc()
2009 kmem_free(tp->tim_peername, in timodwproc()
2010 tp->tim_peermaxlen); in timodwproc()
2011 tp->tim_peername = p; in timodwproc()
2012 tp->tim_peermaxlen = reqp->DEST_length; in timodwproc()
2014 tp->tim_peerlen = reqp->DEST_length; in timodwproc()
2016 bcopy(p, tp->tim_peername, tp->tim_peerlen); in timodwproc()
2017 mutex_exit(&tp->tim_mutex); in timodwproc()
2019 if (tp->tim_flags & COTS) in timodwproc()
2020 tp->tim_flags |= CONNWAIT; in timodwproc()
2035 (tp->tim_flags & WAITIOCACK)) { in timodwproc()
2041 for (tmp = tp->tim_consave; tmp != NULL; in timodwproc()
2060 tp->tim_consave = tmp->b_next; in timodwproc()
2073 freemsg(tp->tim_iocsave); in timodwproc()
2074 tp->tim_iocsave = nbp; in timodwproc()
2075 tp->tim_saved_prim = pptr->type; in timodwproc()
2076 tp->tim_flags |= WAIT_CONNRESACK | WAITIOCACK; in timodwproc()
2094 tp->tim_flags &= ~(CONNWAIT|LOCORDREL|REMORDREL); in timodwproc()
2095 tim_clear_peer(tp); in timodwproc()
2101 for (tmp = tp->tim_consave; tmp; tmp = tmp->b_next) { in timodwproc()
2111 tp->tim_consave = tmp->b_next; in timodwproc()
2120 if (tp->tim_flags & REMORDREL) { in timodwproc()
2121 tp->tim_flags &= ~(LOCORDREL|REMORDREL); in timodwproc()
2122 tim_clear_peer(tp); in timodwproc()
2124 tp->tim_flags |= LOCORDREL; in timodwproc()
2227 struct tim_tim *tp = q->q_ptr; in ti_doname() local
2278 mutex_enter(&tp->tim_mutex); in ti_doname()
2284 if (tp->tim_peerlen == 0) { in ti_doname()
2287 } else if (tp->tim_peerlen > in ti_doname()
2289 mutex_exit(&tp->tim_mutex); in ti_doname()
2295 STRUCT_FSET(sb, len, tp->tim_peerlen); in ti_doname()
2298 if (tp->tim_mylen == 0) { in ti_doname()
2301 } else if (tp->tim_mylen > in ti_doname()
2309 STRUCT_FSET(sb, len, tp->tim_mylen); in ti_doname()
2322 STRUCT_FSET(sb, len, tp->tim_peerlen); in ti_doname()
2324 STRUCT_FSET(sb, len, tp->tim_mylen); in ti_doname()
2327 mutex_exit(&tp->tim_mutex); in ti_doname()
2370 mutex_exit(&tp->tim_mutex); in ti_doname()
2382 bcopy(tp->tim_peername, bp->b_rptr, in ti_doname()
2384 mutex_exit(&tp->tim_mutex); in ti_doname()
2386 bcopy(tp->tim_myname, bp->b_rptr, STRUCT_FGET(sb, len)); in ti_doname()
2417 struct tim_tim *tp; in tim_filladdr() local
2422 tp = (struct tim_tim *)q->q_ptr; in tim_filladdr()
2424 mutex_enter(&tp->tim_mutex); in tim_filladdr()
2425 bp = allocb(sizeof (struct T_unitdata_req) + tp->tim_peerlen, in tim_filladdr()
2431 up->DEST_length = tp->tim_peerlen; in tim_filladdr()
2436 if (tp->tim_peerlen > 0) { in tim_filladdr()
2437 bcopy(tp->tim_peername, bp->b_wptr, in tim_filladdr()
2438 tp->tim_peerlen); in tim_filladdr()
2439 bp->b_wptr += tp->tim_peerlen; in tim_filladdr()
2449 mutex_enter(&tp->tim_mutex); in tim_filladdr()
2451 tp->tim_peerlen, BPRI_MED); in tim_filladdr()
2456 nup->DEST_length = plen = tp->tim_peerlen; in tim_filladdr()
2460 bcopy(tp->tim_peername, bp->b_wptr, plen); in tim_filladdr()
2463 mutex_exit(&tp->tim_mutex); in tim_filladdr()
2481 ASSERT(MUTEX_HELD(&tp->tim_mutex)); in tim_filladdr()
2484 sizeof (struct T_unitdata_req) + tp->tim_peerlen); in tim_filladdr()
2486 mutex_exit(&tp->tim_mutex); in tim_filladdr()
2491 tim_addlink(struct tim_tim *tp) in tim_addlink() argument
2496 tpp = &tim_hash[TIM_HASH(tp->tim_acceptor)]; in tim_addlink()
2500 next->tim_ptpn = &tp->tim_next; in tim_addlink()
2501 tp->tim_next = next; in tim_addlink()
2502 tp->tim_ptpn = tpp; in tim_addlink()
2503 *tpp = tp; in tim_addlink()
2511 tim_dellink(struct tim_tim *tp) in tim_dellink() argument
2517 if ((next = tp->tim_next) != NULL) in tim_dellink()
2518 next->tim_ptpn = tp->tim_ptpn; in tim_dellink()
2519 *(tp->tim_ptpn) = next; in tim_dellink()
2529 struct tim_tim *tp; in tim_findlink() local
2533 for (tp = tim_hash[TIM_HASH(id)]; tp != NULL; tp = tp->tim_next) { in tim_findlink()
2534 if (tp->tim_acceptor == id) { in tim_findlink()
2538 return (tp); in tim_findlink()
2544 struct tim_tim *tp; in tim_recover() local
2548 tp = (struct tim_tim *)q->q_ptr; in tim_recover()
2562 if (tp->tim_rtimoutid || tp->tim_rbufcid) in tim_recover()
2565 if (tp->tim_wtimoutid || tp->tim_wbufcid) in tim_recover()
2571 tp->tim_rtimoutid = tid; in tim_recover()
2573 tp->tim_wtimoutid = tid; in tim_recover()
2576 tp->tim_rbufcid = bid; in tim_recover()
2578 tp->tim_wbufcid = bid; in tim_recover()
2590 struct tim_tim *tp; in tim_ioctl_retry() local
2592 tp = (struct tim_tim *)q->q_ptr; in tim_ioctl_retry()
2597 if (tp->tim_wtimoutid || tp->tim_wbufcid) in tim_ioctl_retry()
2600 tp->tim_wtimoutid = qtimeout(RD(q), tim_timer, q, TIMIOCWAIT); in tim_ioctl_retry()
2655 struct tim_tim *tp = (struct tim_tim *)q->q_ptr; in tim_tcap_timer() local
2657 ASSERT(tp != NULL && tp->tim_tcap_timoutid != 0); in tim_tcap_timer()
2658 ASSERT((tp->tim_flags & TI_CAP_RECVD) != 0); in tim_tcap_timer()
2660 tp->tim_tcap_timoutid = 0; in tim_tcap_timer()
2662 tim_tcap_genreply(q, tp); in tim_tcap_timer()
2671 tim_tcap_genreply(queue_t *q, struct tim_tim *tp) in tim_tcap_genreply() argument
2673 mblk_t *mp = tp->tim_iocsave; in tim_tcap_genreply()
2678 ASSERT(tp == (struct tim_tim *)q->q_ptr); in tim_tcap_genreply()
2688 PI_PROVLOCK(tp->tim_provinfo); in tim_tcap_genreply()
2689 if (tp->tim_provinfo->tpi_capability == PI_DONTKNOW) in tim_tcap_genreply()
2690 tp->tim_provinfo->tpi_capability = PI_NO; in tim_tcap_genreply()
2691 PI_PROVUNLOCK(tp->tim_provinfo); in tim_tcap_genreply()
2693 if (tp->tim_tcap_timoutid != 0) { in tim_tcap_genreply()
2694 (void) quntimeout(q, tp->tim_tcap_timoutid); in tim_tcap_genreply()
2695 tp->tim_tcap_timoutid = 0; in tim_tcap_genreply()
2698 if ((tp->tim_flags & CAP_WANTS_INFO) != 0) { in tim_tcap_genreply()
2706 tp->tim_flags |= WAIT_IOCINFOACK; in tim_tcap_genreply()
2711 tp->tim_iocsave = NULL; in tim_tcap_genreply()
2712 tp->tim_saved_prim = -1; in tim_tcap_genreply()
2713 tp->tim_flags &= ~(TI_CAP_RECVD | WAITIOCACK | in tim_tcap_genreply()
2729 tp->tim_iocsave = NULL; in tim_tcap_genreply()
2730 tp->tim_saved_prim = -1; in tim_tcap_genreply()
2731 tp->tim_flags &= ~(WAITIOCACK | WAIT_IOCINFOACK | in tim_tcap_genreply()
2736 tp->tim_iocsave = NULL; in tim_tcap_genreply()
2737 tp->tim_saved_prim = -1; in tim_tcap_genreply()
2738 tp->tim_flags &= ~(TI_CAP_RECVD | WAITIOCACK | in tim_tcap_genreply()
2787 tim_send_ioc_error_ack(queue_t *q, struct tim_tim *tp, mblk_t *mp) in tim_send_ioc_error_ack() argument
2796 ASSERT(tp->tim_iocsave != NULL); in tim_send_ioc_error_ack()
2797 ASSERT(tp->tim_iocsave->b_cont != mp); in tim_send_ioc_error_ack()
2802 TILOG("tim_send_ioc_error_ack: prim = %d\n", tp->tim_saved_prim); in tim_send_ioc_error_ack()
2804 if (tp->tim_saved_prim != error_prim) { in tim_send_ioc_error_ack()
2808 ASSERT(tp->tim_iocsave->b_cont == NULL); in tim_send_ioc_error_ack()
2810 tim_tcap_genreply(q, tp); in tim_send_ioc_error_ack()
2813 struct iocblk *iocbp = (struct iocblk *)tp->tim_iocsave->b_rptr; in tim_send_ioc_error_ack()
2817 ASSERT(tp->tim_iocsave->b_cont == NULL); in tim_send_ioc_error_ack()
2845 tp->tim_iocsave->b_datap->db_type = M_IOCACK; in tim_send_ioc_error_ack()
2847 putnext(q, tp->tim_iocsave); in tim_send_ioc_error_ack()
2848 tp->tim_iocsave = NULL; in tim_send_ioc_error_ack()
2849 tp->tim_saved_prim = -1; in tim_send_ioc_error_ack()
2850 tp->tim_flags &= ~(WAITIOCACK | TI_CAP_RECVD | in tim_send_ioc_error_ack()
2862 tim_send_reply(queue_t *q, mblk_t *mp, struct tim_tim *tp, t_scalar_t prim) in tim_send_reply() argument
2864 ASSERT(mp != NULL && q != NULL && tp != NULL); in tim_send_reply()
2870 if (((tp->tim_flags & WAITIOCACK) == 0) || (tp->tim_saved_prim != prim)) in tim_send_reply()
2873 ASSERT(tp->tim_iocsave != NULL); in tim_send_reply()
2874 tim_ioctl_send_reply(q, tp->tim_iocsave, mp); in tim_send_reply()
2875 tp->tim_iocsave = NULL; in tim_send_reply()
2876 tp->tim_saved_prim = -1; in tim_send_reply()
2877 tp->tim_flags &= ~(WAITIOCACK | WAIT_IOCINFOACK | in tim_send_reply()
2886 tim_answer_ti_sync(queue_t *q, mblk_t *mp, struct tim_tim *tp, in tim_answer_ti_sync() argument
2911 tsap->tsa_qlen = tp->tim_backlog; in tim_answer_ti_sync()
2923 tp->tim_iocsave = NULL; in tim_answer_ti_sync()
2924 tp->tim_saved_prim = -1; in tim_answer_ti_sync()
2925 tp->tim_flags &= ~(WAITIOCACK | WAIT_IOCINFOACK | in tim_answer_ti_sync()
2934 tim_send_ioctl_tpi_msg(queue_t *q, mblk_t *mp, struct tim_tim *tp, in tim_send_ioctl_tpi_msg() argument
2940 ASSERT(q != NULL && mp != NULL && tp != NULL); in tim_send_ioctl_tpi_msg()
2944 tp->tim_iocsave = mp; in tim_send_ioctl_tpi_msg()
2948 tp->tim_flags |= WAITIOCACK; in tim_send_ioctl_tpi_msg()
2949 tp->tim_saved_prim = ((union T_primitives *)tmp->b_rptr)->type; in tim_send_ioctl_tpi_msg()
2972 TILOG("timodwproc: sending down %d\n", tp->tim_saved_prim); in tim_send_ioctl_tpi_msg()
2977 tim_clear_peer(struct tim_tim *tp) in tim_clear_peer() argument
2979 mutex_enter(&tp->tim_mutex); in tim_clear_peer()
2980 if (tp->tim_peercred != NULL) { in tim_clear_peer()
2981 crfree(tp->tim_peercred); in tim_clear_peer()
2982 tp->tim_peercred = NULL; in tim_clear_peer()
2984 tp->tim_peerlen = 0; in tim_clear_peer()
2985 mutex_exit(&tp->tim_mutex); in tim_clear_peer()