Lines Matching refs:hp
71 slp_handle_impl_t *hp; member
127 void slp_uc_tcp_send(slp_handle_impl_t *hp, slp_target_t *target, in slp_uc_tcp_send() argument
133 if (!hp->tcp_lock) { in slp_uc_tcp_send()
134 if (!(hp->tcp_lock = malloc(sizeof (*(hp->tcp_lock))))) { in slp_uc_tcp_send()
139 (void) mutex_init(hp->tcp_lock, NULL, NULL); in slp_uc_tcp_send()
141 if (!hp->tcp_wait) { in slp_uc_tcp_send()
142 if (!(hp->tcp_wait = malloc(sizeof (*(hp->tcp_wait))))) { in slp_uc_tcp_send()
147 (void) cond_init(hp->tcp_wait, NULL, NULL); in slp_uc_tcp_send()
149 (void) mutex_lock(hp->tcp_lock); in slp_uc_tcp_send()
150 (hp->tcp_ref_cnt)++; in slp_uc_tcp_send()
151 (void) mutex_unlock(hp->tcp_lock); in slp_uc_tcp_send()
163 rqst->hp = hp; in slp_uc_tcp_send()
175 void slp_tcp_wait(slp_handle_impl_t *hp) { in slp_tcp_wait() argument
176 (void) mutex_lock(hp->tcp_lock); in slp_tcp_wait()
177 while (hp->tcp_ref_cnt > 0) in slp_tcp_wait()
178 (void) cond_wait(hp->tcp_wait, hp->tcp_lock); in slp_tcp_wait()
179 (void) mutex_unlock(hp->tcp_lock); in slp_tcp_wait()
191 void slp_uc_udp_send(slp_handle_impl_t *hp, slp_target_t *target, in slp_uc_udp_send() argument
206 if (make_header(hp, header, scopes) != SLP_OK) in slp_uc_udp_send()
229 udp_make_msghdr(sin, hp->msg.iov, hp->msg.iovlen, msg); in slp_uc_udp_send()
242 !hp->cancel; in slp_uc_udp_send()
306 if (!ctarg || hp->cancel) { in slp_uc_udp_send()
317 (void) slp_enqueue(hp->q, reply); in slp_uc_udp_send()
321 hp, ctarg, scopes, SLP_FALSE, slp_get_xid(header)); in slp_uc_udp_send()
334 void slp_mc_send(slp_handle_impl_t *hp, const char *scopes) { in slp_mc_send() argument
347 if (make_header(hp, header, scopes) != SLP_OK) in slp_mc_send()
351 if (make_mc_target(hp, sin, header, &pfd, &nfds, &bcifs) != SLP_OK) in slp_mc_send()
353 udp_make_msghdr(sin, hp->msg.iov, hp->msg.iovlen, msg); in slp_mc_send()
371 !hp->cancel; in slp_mc_send()
381 mc_recvmsg(pfd, nfds, hp, scopes, header, &collator, final_to, in slp_mc_send()
465 slp_handle_impl_t *hp; in tcp_thread() local
481 hp = rqst->hp; in tcp_thread()
490 if (hp->cancel) in tcp_thread()
494 if (make_header(hp, header, scopes) != SLP_OK) { in tcp_thread()
503 ctarg && !hp->cancel; in tcp_thread()
528 if (writev(tcp_sockfd, hp->msg.iov, hp->msg.iovlen) in tcp_thread()
548 if (hp->cancel) { in tcp_thread()
554 (void) slp_enqueue(hp->q, reply); in tcp_thread()
560 (void) mutex_lock(hp->tcp_lock); in tcp_thread()
561 if (--(hp->tcp_ref_cnt) == 0) in tcp_thread()
562 (void) cond_signal(hp->tcp_wait); in tcp_thread()
563 (void) mutex_unlock(hp->tcp_lock); in tcp_thread()
637 static SLPError make_header(slp_handle_impl_t *hp, char *header, in make_header() argument
646 msgLen = slp_hdrlang_length(hp); in make_header()
647 hp->msg.iov[0].iov_base = header; in make_header()
648 hp->msg.iov[0].iov_len = msgLen; /* now the length of the hdr */ in make_header()
651 hp->msg.prlist->iov_base = header + msgLen; in make_header()
653 for (i = 1; i < hp->msg.iovlen; i++) { in make_header()
654 msgLen += hp->msg.iov[i].iov_len; in make_header()
659 if ((err = slp_add_header(hp->locale, header, mtu, in make_header()
660 hp->fid, msgLen, &off)) != SLP_OK) in make_header()
664 hp->msg.prlist->iov_len = 0; in make_header()
668 if ((err = slp_add_sht((char *)hp->msg.scopeslen.iov_base, in make_header()
672 hp->msg.scopes->iov_base = (caddr_t)scopes; in make_header()
673 hp->msg.scopes->iov_len = slen; in make_header()
699 static SLPError make_mc_target(slp_handle_impl_t *hp, in make_mc_target() argument
822 hp, given_ifs, num_givenifs, bcifs)) in make_mc_target()
898 static SLPError make_bc_target(slp_handle_impl_t *hp, in make_bc_target() argument
904 if ((err = slp_broadcast_addrs(hp, given_ifs, num_givenifs, in make_bc_target()
1006 static void mc_recvmsg(struct pollfd *pfd, nfds_t nfds, slp_handle_impl_t *hp, in mc_recvmsg() argument
1019 for (; !hp->cancel; ) { in mc_recvmsg()
1031 for (i = 0; !hp->cancel && i < nfds; i++) { in mc_recvmsg()
1052 tcp_handoff(hp, scopes, in mc_recvmsg()
1065 tcp_handoff(hp, scopes, in mc_recvmsg()
1072 if (add2pr_list(&(hp->msg), &responder, collator)) { in mc_recvmsg()
1073 (void) slp_enqueue(hp->q, reply); in mc_recvmsg()
1123 static void tcp_handoff(slp_handle_impl_t *hp, const char *scopes, in tcp_handoff() argument
1128 slp_uc_tcp_send(hp, target, scopes, SLP_TRUE, xid); in tcp_handoff()