Lines Matching refs:rc

81 	struct rc_data *rc = NULL;	/* private data */
89 rc = mem_alloc(sizeof (*rc));
90 mtx_init(&rc->rc_lock, "rc->rc_lock", NULL, MTX_DEF);
91 (void) memcpy(&rc->rc_addr, svcaddr, (size_t)svcaddr->sa_len);
92 rc->rc_nconf = nconf;
93 rc->rc_prog = program;
94 rc->rc_vers = version;
95 rc->rc_sendsz = sendsz;
96 rc->rc_recvsz = recvsz;
97 rc->rc_timeout.tv_sec = -1;
98 rc->rc_timeout.tv_usec = -1;
99 rc->rc_retry.tv_sec = 3;
100 rc->rc_retry.tv_usec = 0;
101 rc->rc_retries = INT_MAX;
102 rc->rc_privport = FALSE;
103 rc->rc_waitchan = "rpcrecv";
104 rc->rc_intr = 0;
105 rc->rc_connecting = FALSE;
106 rc->rc_closed = FALSE;
107 rc->rc_ucred = crdup(curthread->td_ucred);
108 rc->rc_client = NULL;
112 cl->cl_private = (caddr_t)(void *)rc;
123 struct rc_data *rc = (struct rc_data *)cl->cl_private;
131 mtx_lock(&rc->rc_lock);
132 while (rc->rc_connecting) {
133 error = msleep(rc, &rc->rc_lock,
134 rc->rc_intr ? PCATCH : 0, "rpcrecon", 0);
136 mtx_unlock(&rc->rc_lock);
140 if (rc->rc_closed) {
141 mtx_unlock(&rc->rc_lock);
144 if (rc->rc_client) {
145 mtx_unlock(&rc->rc_lock);
155 rc->rc_connecting = TRUE;
156 mtx_unlock(&rc->rc_lock);
159 td->td_ucred = rc->rc_ucred;
160 so = __rpc_nconf2socket(rc->rc_nconf);
168 if (rc->rc_privport)
171 if (rc->rc_nconf->nc_semantics == NC_TPI_CLTS)
173 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers,
174 rc->rc_sendsz, rc->rc_recvsz);
177 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers,
178 rc->rc_sendsz, rc->rc_recvsz, rc->rc_intr);
183 rc->rc_err = rpc_createerr.cf_error;
190 CLNT_CONTROL(newclient, CLSET_TIMEOUT, &rc->rc_timeout);
191 CLNT_CONTROL(newclient, CLSET_RETRY_TIMEOUT, &rc->rc_retry);
192 CLNT_CONTROL(newclient, CLSET_WAITCHAN, rc->rc_waitchan);
193 CLNT_CONTROL(newclient, CLSET_INTERRUPTIBLE, &rc->rc_intr);
194 if (rc->rc_backchannel != NULL)
195 CLNT_CONTROL(newclient, CLSET_BACKCHANNEL, rc->rc_backchannel);
199 mtx_lock(&rc->rc_lock);
200 KASSERT(rc->rc_client == NULL, ("rc_client not null"));
201 if (!rc->rc_closed) {
202 rc->rc_client = newclient;
205 rc->rc_connecting = FALSE;
206 wakeup(rc);
207 mtx_unlock(&rc->rc_lock);
232 struct rc_data *rc = (struct rc_data *)cl->cl_private;
239 mtx_lock(&rc->rc_lock);
240 if (rc->rc_closed) {
241 mtx_unlock(&rc->rc_lock);
245 if (!rc->rc_client) {
246 mtx_unlock(&rc->rc_lock);
250 rc->rc_intr ? PCATCH : 0, "rpccon", hz);
254 if (tries >= rc->rc_retries)
260 mtx_lock(&rc->rc_lock);
263 if (!rc->rc_client) {
264 mtx_unlock(&rc->rc_lock);
268 CLNT_ACQUIRE(rc->rc_client);
269 client = rc->rc_client;
270 mtx_unlock(&rc->rc_lock);
276 CLNT_GETERR(client, &rc->rc_err);
284 if ((rc->rc_timeout.tv_sec == 0
285 && rc->rc_timeout.tv_usec == 0)
286 || (rc->rc_timeout.tv_sec == -1
297 if (tries >= rc->rc_retries) {
306 mtx_lock(&rc->rc_lock);
315 if (rc->rc_client == client) {
316 rc->rc_client = NULL;
317 mtx_unlock(&rc->rc_lock);
320 mtx_unlock(&rc->rc_lock);
338 struct rc_data *rc = (struct rc_data *)cl->cl_private;
340 *errp = rc->rc_err;
350 struct rc_data *rc = (struct rc_data *)cl->cl_private;
352 return (CLNT_FREERES(rc->rc_client, xdr_res, res_ptr));
368 struct rc_data *rc = (struct rc_data *)cl->cl_private;
376 rc->rc_timeout = *(struct timeval *)info;
377 if (rc->rc_client)
378 CLNT_CONTROL(rc->rc_client, request, info);
382 *(struct timeval *)info = rc->rc_timeout;
386 rc->rc_retry = *(struct timeval *)info;
387 if (rc->rc_client)
388 CLNT_CONTROL(rc->rc_client, request, info);
392 *(struct timeval *)info = rc->rc_retry;
396 *(uint32_t *)info = rc->rc_vers;
400 rc->rc_vers = *(uint32_t *) info;
401 if (rc->rc_client)
402 CLNT_CONTROL(rc->rc_client, CLSET_VERS, info);
406 *(uint32_t *)info = rc->rc_prog;
410 rc->rc_prog = *(uint32_t *) info;
411 if (rc->rc_client)
412 CLNT_CONTROL(rc->rc_client, request, info);
416 rc->rc_waitchan = (char *)info;
417 if (rc->rc_client)
418 CLNT_CONTROL(rc->rc_client, request, info);
422 *(const char **) info = rc->rc_waitchan;
426 rc->rc_intr = *(int *) info;
427 if (rc->rc_client)
428 CLNT_CONTROL(rc->rc_client, request, info);
432 *(int *) info = rc->rc_intr;
436 rc->rc_retries = *(int *) info;
440 *(int *) info = rc->rc_retries;
444 rc->rc_privport = *(int *) info;
448 *(int *) info = rc->rc_privport;
454 rc->rc_backchannel = info;
467 struct rc_data *rc = (struct rc_data *)cl->cl_private;
470 mtx_lock(&rc->rc_lock);
472 if (rc->rc_closed) {
473 mtx_unlock(&rc->rc_lock);
477 rc->rc_closed = TRUE;
478 client = rc->rc_client;
479 rc->rc_client = NULL;
481 mtx_unlock(&rc->rc_lock);
492 struct rc_data *rc = (struct rc_data *)cl->cl_private;
495 if (rc->rc_client)
496 CLNT_DESTROY(rc->rc_client);
497 if (rc->rc_backchannel) {
498 xprt = (SVCXPRT *)rc->rc_backchannel;
502 crfree(rc->rc_ucred);
503 mtx_destroy(&rc->rc_lock);
504 mem_free(rc, sizeof(*rc));