Lines Matching refs:xprt
35 * There are two sets of procedures here. The xprt routines are
77 SVCXPRT *xprt;
106 void svc_dispatch(registered_server *svc, SVCXPRT *xprt);
110 SVCXPRT *xprt = (SVCXPRT *)__u;
114 while(xprt->num_servers) {
115 rfds = xprt->fdset;
117 n = select(xprt->max_fd + 1, (fd_set *)&rfds, NULL, NULL, &tv);
124 for (n = 0; n <= xprt->max_fd; n++) {
129 registered_server *trav = xprt->servers;
138 svc_dispatch(trav, xprt);
152 SVCXPRT *xprt;
156 xprt = the_xprt;
158 xprt = calloc(1, sizeof(SVCXPRT));
159 if (xprt) {
160 FD_ZERO(&xprt->fdset);
161 xprt->max_fd = 0;
162 pthread_attr_init(&xprt->thread_attr);
163 pthread_attr_setdetachstate(&xprt->thread_attr,
165 pthread_mutexattr_init(&xprt->lock_attr);
166 // pthread_mutexattr_settype(&xprt->lock_attr,
168 pthread_mutex_init(&xprt->lock, &xprt->lock_attr);
172 return xprt;
175 void svc_destroy(SVCXPRT *xprt)
180 /* NOTE: this function must always be called with the xprt->lock held! */
181 static registered_server* svc_find_nosync(SVCXPRT *xprt,
186 trav = xprt->servers;
196 registered_server* svc_find(SVCXPRT *xprt,
199 pthread_mutex_lock(&xprt->lock);
200 registered_server *svc = svc_find_nosync(xprt, prog, vers, NULL);
201 pthread_mutex_unlock(&xprt->lock);
205 bool_t svc_register (SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
212 pthread_mutex_lock(&xprt->lock);
216 svc = svc_find_nosync(xprt, prog, vers, NULL);
220 pthread_mutex_unlock(&xprt->lock);
247 pthread_mutex_unlock(&xprt->lock);
262 pthread_mutex_unlock(&xprt->lock);
266 FD_SET(svc->xdr->fd, &xprt->fdset);
267 if (svc->xdr->fd > xprt->max_fd) xprt->max_fd = svc->xdr->fd;
273 svc->next = xprt->servers;
274 xprt->servers = svc;
275 xprt->num_servers++;
277 (uint32_t)prog, (int)vers, xprt->num_servers);
278 svc->xprt = xprt;
279 if (xprt->num_servers == 1) {
281 pthread_create(&xprt->svc_thread,
282 &xprt->thread_attr,
283 svc_context, xprt);
285 pthread_mutex_unlock(&xprt->lock);
289 void svc_unregister (SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers) {
291 pthread_mutex_lock(&xprt->lock);
292 found = svc_find_nosync(xprt, prog, vers, &prev);
303 xprt->servers = found->next;
311 /* don't bother decreasing the xprt->max_fd to the previous
323 FD_CLR(found->xdr->fd, &xprt->fdset);
336 xprt->num_servers--;
338 (unsigned)prog, (unsigned)vers, xprt->num_servers);
340 pthread_mutex_unlock(&xprt->lock);
362 void svc_dispatch(registered_server *svc, SVCXPRT *xprt)
398 req.rq_xprt = xprt;
417 void xprt_register(SVCXPRT *xprt)
420 if (!the_xprt || (xprt && (xprt == the_xprt))) {
422 the_xprt = xprt;
429 void xprt_unregister (SVCXPRT *xprt)
432 if (xprt && xprt == the_xprt) {
438 pthread_attr_destroy(&xprt->thread_attr);
439 pthread_mutexattr_destroy(&xprt->lock_attr);
440 pthread_mutex_destroy(&xprt->lock);
441 /* Make sure the thread has existed before we free the xprt
446 pthread_join(xprt->svc_thread, NULL);
447 free(xprt);
458 XDR of the server that they refer to. The xprt pointer is actually a
463 bool_t svc_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
465 registered_server *serv = (registered_server *)xprt;
474 bool_t svc_freeargs (SVCXPRT * xprt, xdrproc_t xdr_args, caddr_t args_ptr)
476 registered_server *serv = (registered_server *)xprt;
486 svc_sendreply (SVCXPRT *xprt, xdrproc_t xdr_results,
489 registered_server *serv = (registered_server *)xprt;
520 void svcerr_decode (SVCXPRT *xprt)
522 registered_server *serv = (registered_server *)xprt;
535 void svcerr_systemerr (SVCXPRT *xprt)
537 registered_server *serv = (registered_server *)xprt;
550 void svcerr_noproc(SVCXPRT *xprt)
552 registered_server *serv = (registered_server *)xprt;