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 | PBDRY : 0, "rpccon",
255 if (tries >= rc->rc_retries)
261 mtx_lock(&rc->rc_lock);
264 if (!rc->rc_client) {
265 mtx_unlock(&rc->rc_lock);
269 CLNT_ACQUIRE(rc->rc_client);
270 client = rc->rc_client;
271 mtx_unlock(&rc->rc_lock);
277 CLNT_GETERR(client, &rc->rc_err);
285 if ((rc->rc_timeout.tv_sec == 0
286 && rc->rc_timeout.tv_usec == 0)
287 || (rc->rc_timeout.tv_sec == -1
298 if (tries >= rc->rc_retries) {
307 mtx_lock(&rc->rc_lock);
316 if (rc->rc_client == client) {
317 rc->rc_client = NULL;
318 mtx_unlock(&rc->rc_lock);
321 mtx_unlock(&rc->rc_lock);
339 struct rc_data *rc = (struct rc_data *)cl->cl_private;
341 *errp = rc->rc_err;
351 struct rc_data *rc = (struct rc_data *)cl->cl_private;
353 return (CLNT_FREERES(rc->rc_client, xdr_res, res_ptr));
369 struct rc_data *rc = (struct rc_data *)cl->cl_private;
377 rc->rc_timeout = *(struct timeval *)info;
378 if (rc->rc_client)
379 CLNT_CONTROL(rc->rc_client, request, info);
383 *(struct timeval *)info = rc->rc_timeout;
387 rc->rc_retry = *(struct timeval *)info;
388 if (rc->rc_client)
389 CLNT_CONTROL(rc->rc_client, request, info);
393 *(struct timeval *)info = rc->rc_retry;
397 *(uint32_t *)info = rc->rc_vers;
401 rc->rc_vers = *(uint32_t *) info;
402 if (rc->rc_client)
403 CLNT_CONTROL(rc->rc_client, CLSET_VERS, info);
407 *(uint32_t *)info = rc->rc_prog;
411 rc->rc_prog = *(uint32_t *) info;
412 if (rc->rc_client)
413 CLNT_CONTROL(rc->rc_client, request, info);
417 rc->rc_waitchan = (char *)info;
418 if (rc->rc_client)
419 CLNT_CONTROL(rc->rc_client, request, info);
423 *(const char **) info = rc->rc_waitchan;
427 rc->rc_intr = *(int *) info;
428 if (rc->rc_client)
429 CLNT_CONTROL(rc->rc_client, request, info);
433 *(int *) info = rc->rc_intr;
437 rc->rc_retries = *(int *) info;
441 *(int *) info = rc->rc_retries;
445 rc->rc_privport = *(int *) info;
449 *(int *) info = rc->rc_privport;
456 rc->rc_backchannel = info;
469 struct rc_data *rc = (struct rc_data *)cl->cl_private;
472 mtx_lock(&rc->rc_lock);
474 if (rc->rc_closed) {
475 mtx_unlock(&rc->rc_lock);
479 rc->rc_closed = TRUE;
480 client = rc->rc_client;
481 rc->rc_client = NULL;
483 mtx_unlock(&rc->rc_lock);
494 struct rc_data *rc = (struct rc_data *)cl->cl_private;
497 if (rc->rc_client)
498 CLNT_DESTROY(rc->rc_client);
499 if (rc->rc_backchannel) {
500 xprt = (SVCXPRT *)rc->rc_backchannel;
504 crfree(rc->rc_ucred);
505 mtx_destroy(&rc->rc_lock);
506 mem_free(rc, sizeof(*rc));