Lines Matching full:rc

83 	struct rc_data *rc = NULL;	/* private data */  in clnt_reconnect_create()  local
91 rc = mem_alloc(sizeof (*rc)); in clnt_reconnect_create()
92 mtx_init(&rc->rc_lock, "rc->rc_lock", NULL, MTX_DEF); in clnt_reconnect_create()
93 (void) memcpy(&rc->rc_addr, svcaddr, (size_t)svcaddr->sa_len); in clnt_reconnect_create()
94 rc->rc_nconf = nconf; in clnt_reconnect_create()
95 rc->rc_prog = program; in clnt_reconnect_create()
96 rc->rc_vers = version; in clnt_reconnect_create()
97 rc->rc_sendsz = sendsz; in clnt_reconnect_create()
98 rc->rc_recvsz = recvsz; in clnt_reconnect_create()
99 rc->rc_timeout.tv_sec = -1; in clnt_reconnect_create()
100 rc->rc_timeout.tv_usec = -1; in clnt_reconnect_create()
101 rc->rc_retry.tv_sec = 3; in clnt_reconnect_create()
102 rc->rc_retry.tv_usec = 0; in clnt_reconnect_create()
103 rc->rc_retries = INT_MAX; in clnt_reconnect_create()
104 rc->rc_privport = FALSE; in clnt_reconnect_create()
105 rc->rc_waitchan = "rpcrecv"; in clnt_reconnect_create()
106 rc->rc_intr = 0; in clnt_reconnect_create()
107 rc->rc_connecting = FALSE; in clnt_reconnect_create()
108 rc->rc_closed = FALSE; in clnt_reconnect_create()
109 rc->rc_ucred = crdup(curthread->td_ucred); in clnt_reconnect_create()
110 rc->rc_client = NULL; in clnt_reconnect_create()
111 rc->rc_tls = false; in clnt_reconnect_create()
112 rc->rc_tlscertname = NULL; in clnt_reconnect_create()
113 rc->rc_reconcall = NULL; in clnt_reconnect_create()
114 rc->rc_reconarg = NULL; in clnt_reconnect_create()
118 cl->cl_private = (caddr_t)(void *)rc; in clnt_reconnect_create()
129 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_connect() local
138 mtx_lock(&rc->rc_lock); in clnt_reconnect_connect()
139 while (rc->rc_connecting) { in clnt_reconnect_connect()
140 error = msleep(rc, &rc->rc_lock, in clnt_reconnect_connect()
141 rc->rc_intr ? PCATCH : 0, "rpcrecon", 0); in clnt_reconnect_connect()
143 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
147 if (rc->rc_closed) { in clnt_reconnect_connect()
148 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
151 if (rc->rc_client) { in clnt_reconnect_connect()
152 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
162 rc->rc_connecting = TRUE; in clnt_reconnect_connect()
163 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
166 td->td_ucred = rc->rc_ucred; in clnt_reconnect_connect()
167 so = __rpc_nconf2socket(rc->rc_nconf); in clnt_reconnect_connect()
175 if (rc->rc_privport) in clnt_reconnect_connect()
178 if (rc->rc_nconf->nc_semantics == NC_TPI_CLTS) in clnt_reconnect_connect()
180 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, in clnt_reconnect_connect()
181 rc->rc_sendsz, rc->rc_recvsz); in clnt_reconnect_connect()
188 if (rc->rc_timeout.tv_sec > 0 && rc->rc_timeout.tv_usec >= 0) { in clnt_reconnect_connect()
190 &rc->rc_timeout, sizeof(struct timeval)); in clnt_reconnect_connect()
199 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, in clnt_reconnect_connect()
200 rc->rc_sendsz, rc->rc_recvsz, rc->rc_intr); in clnt_reconnect_connect()
201 if (rc->rc_tls && newclient != NULL) { in clnt_reconnect_connect()
203 stat = rpctls_connect(newclient, rc->rc_tlscertname, so, in clnt_reconnect_connect()
226 if (newclient != NULL && rc->rc_reconcall != NULL) in clnt_reconnect_connect()
227 (*rc->rc_reconcall)(newclient, rc->rc_reconarg, in clnt_reconnect_connect()
228 rc->rc_ucred); in clnt_reconnect_connect()
234 rc->rc_err = rpc_createerr.cf_error; in clnt_reconnect_connect()
241 CLNT_CONTROL(newclient, CLSET_TIMEOUT, &rc->rc_timeout); in clnt_reconnect_connect()
242 CLNT_CONTROL(newclient, CLSET_RETRY_TIMEOUT, &rc->rc_retry); in clnt_reconnect_connect()
243 CLNT_CONTROL(newclient, CLSET_WAITCHAN, rc->rc_waitchan); in clnt_reconnect_connect()
244 CLNT_CONTROL(newclient, CLSET_INTERRUPTIBLE, &rc->rc_intr); in clnt_reconnect_connect()
245 if (rc->rc_backchannel != NULL) in clnt_reconnect_connect()
246 CLNT_CONTROL(newclient, CLSET_BACKCHANNEL, rc->rc_backchannel); in clnt_reconnect_connect()
250 mtx_lock(&rc->rc_lock); in clnt_reconnect_connect()
251 KASSERT(rc->rc_client == NULL, ("rc_client not null")); in clnt_reconnect_connect()
252 if (!rc->rc_closed) { in clnt_reconnect_connect()
253 rc->rc_client = newclient; in clnt_reconnect_connect()
256 rc->rc_connecting = FALSE; in clnt_reconnect_connect()
257 wakeup(rc); in clnt_reconnect_connect()
258 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
283 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_call() local
290 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
291 if (rc->rc_closed) { in clnt_reconnect_call()
292 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
296 if (!rc->rc_client) { in clnt_reconnect_call()
297 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
301 rc->rc_intr ? PCATCH : 0, "rpccon", hz); in clnt_reconnect_call()
305 if (tries >= rc->rc_retries) in clnt_reconnect_call()
311 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
314 if (!rc->rc_client) { in clnt_reconnect_call()
315 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
319 CLNT_ACQUIRE(rc->rc_client); in clnt_reconnect_call()
320 client = rc->rc_client; in clnt_reconnect_call()
321 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
327 CLNT_GETERR(client, &rc->rc_err); in clnt_reconnect_call()
335 if ((rc->rc_timeout.tv_sec == 0 in clnt_reconnect_call()
336 && rc->rc_timeout.tv_usec == 0) in clnt_reconnect_call()
337 || (rc->rc_timeout.tv_sec == -1 in clnt_reconnect_call()
348 if (tries >= rc->rc_retries) { in clnt_reconnect_call()
357 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
366 if (rc->rc_client == client) { in clnt_reconnect_call()
367 rc->rc_client = NULL; in clnt_reconnect_call()
368 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
371 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
389 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_geterr() local
391 *errp = rc->rc_err; in clnt_reconnect_geterr()
401 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_freeres() local
403 return (CLNT_FREERES(rc->rc_client, xdr_res, res_ptr)); in clnt_reconnect_freeres()
419 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_control() local
429 rc->rc_timeout = *(struct timeval *)info; in clnt_reconnect_control()
430 if (rc->rc_client) in clnt_reconnect_control()
431 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
435 *(struct timeval *)info = rc->rc_timeout; in clnt_reconnect_control()
439 rc->rc_retry = *(struct timeval *)info; in clnt_reconnect_control()
440 if (rc->rc_client) in clnt_reconnect_control()
441 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
445 *(struct timeval *)info = rc->rc_retry; in clnt_reconnect_control()
449 *(uint32_t *)info = rc->rc_vers; in clnt_reconnect_control()
453 rc->rc_vers = *(uint32_t *) info; in clnt_reconnect_control()
454 if (rc->rc_client) in clnt_reconnect_control()
455 CLNT_CONTROL(rc->rc_client, CLSET_VERS, info); in clnt_reconnect_control()
459 *(uint32_t *)info = rc->rc_prog; in clnt_reconnect_control()
463 rc->rc_prog = *(uint32_t *) info; in clnt_reconnect_control()
464 if (rc->rc_client) in clnt_reconnect_control()
465 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
469 rc->rc_waitchan = (char *)info; in clnt_reconnect_control()
470 if (rc->rc_client) in clnt_reconnect_control()
471 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
475 *(const char **) info = rc->rc_waitchan; in clnt_reconnect_control()
479 rc->rc_intr = *(int *) info; in clnt_reconnect_control()
480 if (rc->rc_client) in clnt_reconnect_control()
481 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
485 *(int *) info = rc->rc_intr; in clnt_reconnect_control()
489 rc->rc_retries = *(int *) info; in clnt_reconnect_control()
493 *(int *) info = rc->rc_retries; in clnt_reconnect_control()
497 rc->rc_privport = *(int *) info; in clnt_reconnect_control()
501 *(int *) info = rc->rc_privport; in clnt_reconnect_control()
507 rc->rc_backchannel = info; in clnt_reconnect_control()
511 rc->rc_tls = true; in clnt_reconnect_control()
524 rc->rc_tlscertname = mem_alloc(slen); in clnt_reconnect_control()
525 strlcpy(rc->rc_tlscertname, info, slen); in clnt_reconnect_control()
530 rc->rc_reconcall = upcp->call; in clnt_reconnect_control()
531 rc->rc_reconarg = upcp->arg; in clnt_reconnect_control()
544 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_close() local
547 mtx_lock(&rc->rc_lock); in clnt_reconnect_close()
549 if (rc->rc_closed) { in clnt_reconnect_close()
550 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
554 rc->rc_closed = TRUE; in clnt_reconnect_close()
555 client = rc->rc_client; in clnt_reconnect_close()
556 rc->rc_client = NULL; in clnt_reconnect_close()
558 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
569 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_destroy() local
572 if (rc->rc_client) in clnt_reconnect_destroy()
573 CLNT_DESTROY(rc->rc_client); in clnt_reconnect_destroy()
574 if (rc->rc_backchannel) { in clnt_reconnect_destroy()
575 xprt = (SVCXPRT *)rc->rc_backchannel; in clnt_reconnect_destroy()
581 crfree(rc->rc_ucred); in clnt_reconnect_destroy()
582 mtx_destroy(&rc->rc_lock); in clnt_reconnect_destroy()
583 mem_free(rc->rc_tlscertname, 0); /* 0 ok, since arg. ignored. */ in clnt_reconnect_destroy()
584 mem_free(rc->rc_reconarg, 0); in clnt_reconnect_destroy()
585 mem_free(rc, sizeof(*rc)); in clnt_reconnect_destroy()