Lines Matching refs: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()
207 if (rc->rc_tls && newclient != NULL) { in clnt_reconnect_connect()
209 stat = rpctls_connect(newclient, rc->rc_tlscertname, so, in clnt_reconnect_connect()
232 if (newclient != NULL && rc->rc_reconcall != NULL) in clnt_reconnect_connect()
233 (*rc->rc_reconcall)(newclient, rc->rc_reconarg, in clnt_reconnect_connect()
234 rc->rc_ucred); in clnt_reconnect_connect()
240 rc->rc_err = rpc_createerr.cf_error; in clnt_reconnect_connect()
246 CLNT_CONTROL(newclient, CLSET_TIMEOUT, &rc->rc_timeout); in clnt_reconnect_connect()
247 CLNT_CONTROL(newclient, CLSET_RETRY_TIMEOUT, &rc->rc_retry); in clnt_reconnect_connect()
248 CLNT_CONTROL(newclient, CLSET_WAITCHAN, rc->rc_waitchan); in clnt_reconnect_connect()
249 CLNT_CONTROL(newclient, CLSET_INTERRUPTIBLE, &rc->rc_intr); in clnt_reconnect_connect()
250 if (rc->rc_backchannel != NULL) in clnt_reconnect_connect()
251 CLNT_CONTROL(newclient, CLSET_BACKCHANNEL, rc->rc_backchannel); in clnt_reconnect_connect()
255 mtx_lock(&rc->rc_lock); in clnt_reconnect_connect()
256 KASSERT(rc->rc_client == NULL, ("rc_client not null")); in clnt_reconnect_connect()
257 if (!rc->rc_closed) { in clnt_reconnect_connect()
258 rc->rc_client = newclient; in clnt_reconnect_connect()
261 rc->rc_connecting = FALSE; in clnt_reconnect_connect()
262 wakeup(rc); in clnt_reconnect_connect()
263 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
288 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_call() local
295 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
296 if (rc->rc_closed) { in clnt_reconnect_call()
297 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
301 if (!rc->rc_client) { in clnt_reconnect_call()
302 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
306 rc->rc_intr ? PCATCH : 0, "rpccon", hz); in clnt_reconnect_call()
310 if (tries >= rc->rc_retries) in clnt_reconnect_call()
316 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
319 if (!rc->rc_client) { in clnt_reconnect_call()
320 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
324 CLNT_ACQUIRE(rc->rc_client); in clnt_reconnect_call()
325 client = rc->rc_client; in clnt_reconnect_call()
326 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
332 CLNT_GETERR(client, &rc->rc_err); in clnt_reconnect_call()
340 if ((rc->rc_timeout.tv_sec == 0 in clnt_reconnect_call()
341 && rc->rc_timeout.tv_usec == 0) in clnt_reconnect_call()
342 || (rc->rc_timeout.tv_sec == -1 in clnt_reconnect_call()
353 if (tries >= rc->rc_retries) { in clnt_reconnect_call()
362 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
371 if (rc->rc_client == client) { in clnt_reconnect_call()
372 rc->rc_client = NULL; in clnt_reconnect_call()
373 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
376 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
394 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_geterr() local
396 *errp = rc->rc_err; in clnt_reconnect_geterr()
406 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_freeres() local
408 return (CLNT_FREERES(rc->rc_client, xdr_res, res_ptr)); in clnt_reconnect_freeres()
424 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_control() local
434 rc->rc_timeout = *(struct timeval *)info; in clnt_reconnect_control()
435 if (rc->rc_client) in clnt_reconnect_control()
436 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
440 *(struct timeval *)info = rc->rc_timeout; in clnt_reconnect_control()
444 rc->rc_retry = *(struct timeval *)info; in clnt_reconnect_control()
445 if (rc->rc_client) in clnt_reconnect_control()
446 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
450 *(struct timeval *)info = rc->rc_retry; in clnt_reconnect_control()
454 *(uint32_t *)info = rc->rc_vers; in clnt_reconnect_control()
458 rc->rc_vers = *(uint32_t *) info; in clnt_reconnect_control()
459 if (rc->rc_client) in clnt_reconnect_control()
460 CLNT_CONTROL(rc->rc_client, CLSET_VERS, info); in clnt_reconnect_control()
464 *(uint32_t *)info = rc->rc_prog; in clnt_reconnect_control()
468 rc->rc_prog = *(uint32_t *) info; in clnt_reconnect_control()
469 if (rc->rc_client) in clnt_reconnect_control()
470 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
474 rc->rc_waitchan = (char *)info; in clnt_reconnect_control()
475 if (rc->rc_client) in clnt_reconnect_control()
476 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
480 *(const char **) info = rc->rc_waitchan; in clnt_reconnect_control()
484 rc->rc_intr = *(int *) info; in clnt_reconnect_control()
485 if (rc->rc_client) in clnt_reconnect_control()
486 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
490 *(int *) info = rc->rc_intr; in clnt_reconnect_control()
494 rc->rc_retries = *(int *) info; in clnt_reconnect_control()
498 *(int *) info = rc->rc_retries; in clnt_reconnect_control()
502 rc->rc_privport = *(int *) info; in clnt_reconnect_control()
506 *(int *) info = rc->rc_privport; in clnt_reconnect_control()
512 rc->rc_backchannel = info; in clnt_reconnect_control()
516 rc->rc_tls = true; in clnt_reconnect_control()
529 rc->rc_tlscertname = mem_alloc(slen); in clnt_reconnect_control()
530 strlcpy(rc->rc_tlscertname, info, slen); in clnt_reconnect_control()
535 rc->rc_reconcall = upcp->call; in clnt_reconnect_control()
536 rc->rc_reconarg = upcp->arg; in clnt_reconnect_control()
549 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_close() local
552 mtx_lock(&rc->rc_lock); in clnt_reconnect_close()
554 if (rc->rc_closed) { in clnt_reconnect_close()
555 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
559 rc->rc_closed = TRUE; in clnt_reconnect_close()
560 client = rc->rc_client; in clnt_reconnect_close()
561 rc->rc_client = NULL; in clnt_reconnect_close()
563 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
574 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_destroy() local
577 if (rc->rc_client) in clnt_reconnect_destroy()
578 CLNT_DESTROY(rc->rc_client); in clnt_reconnect_destroy()
579 if (rc->rc_backchannel) { in clnt_reconnect_destroy()
580 xprt = (SVCXPRT *)rc->rc_backchannel; in clnt_reconnect_destroy()
586 crfree(rc->rc_ucred); in clnt_reconnect_destroy()
587 mtx_destroy(&rc->rc_lock); in clnt_reconnect_destroy()
588 mem_free(rc->rc_tlscertname, 0); /* 0 ok, since arg. ignored. */ in clnt_reconnect_destroy()
589 mem_free(rc->rc_reconarg, 0); in clnt_reconnect_destroy()
590 mem_free(rc, sizeof(*rc)); in clnt_reconnect_destroy()