1 /* $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $ */
4 * Copyright (c) 2009, Sun Microsystems, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * - Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * - Neither the name of Sun Microsystems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
31 #if defined(LIBC_SCCS) && !defined(lint)
32 static char *sccsid2 = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
33 static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
39 * svc_vc.c, Server side for Connection Oriented based RPC.
41 * Actually implements two flavors of transporter -
42 * a tcp rendezvouser (a listner and connection establisher)
43 * and a record/tcp stream.
46 #include <sys/param.h>
47 #include <sys/limits.h>
49 #include <sys/kernel.h>
50 #include <sys/malloc.h>
52 #include <sys/mutex.h>
54 #include <sys/protosw.h>
55 #include <sys/queue.h>
56 #include <sys/socket.h>
57 #include <sys/socketvar.h>
59 #include <sys/systm.h>
64 #include <netinet/tcp.h>
69 #include <rpc/rpc_com.h>
71 #include <security/mac/mac_framework.h>
73 static bool_t svc_vc_rendezvous_recv(SVCXPRT *, struct rpc_msg *,
74 struct sockaddr **, struct mbuf **);
75 static enum xprt_stat svc_vc_rendezvous_stat(SVCXPRT *);
76 static void svc_vc_rendezvous_destroy(SVCXPRT *);
77 static bool_t svc_vc_null(void);
78 static void svc_vc_destroy(SVCXPRT *);
79 static enum xprt_stat svc_vc_stat(SVCXPRT *);
80 static bool_t svc_vc_ack(SVCXPRT *, uint32_t *);
81 static bool_t svc_vc_recv(SVCXPRT *, struct rpc_msg *,
82 struct sockaddr **, struct mbuf **);
83 static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *,
84 struct sockaddr *, struct mbuf *, uint32_t *seq);
85 static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in);
86 static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq,
88 static void svc_vc_backchannel_destroy(SVCXPRT *);
89 static enum xprt_stat svc_vc_backchannel_stat(SVCXPRT *);
90 static bool_t svc_vc_backchannel_recv(SVCXPRT *, struct rpc_msg *,
91 struct sockaddr **, struct mbuf **);
92 static bool_t svc_vc_backchannel_reply(SVCXPRT *, struct rpc_msg *,
93 struct sockaddr *, struct mbuf *, uint32_t *);
94 static bool_t svc_vc_backchannel_control(SVCXPRT *xprt, const u_int rq,
96 static SVCXPRT *svc_vc_create_conn(SVCPOOL *pool, struct socket *so,
97 struct sockaddr *raddr);
98 static int svc_vc_accept(struct socket *head, struct socket **sop);
99 static int svc_vc_soupcall(struct socket *so, void *arg, int waitflag);
101 static struct xp_ops svc_vc_rendezvous_ops = {
102 .xp_recv = svc_vc_rendezvous_recv,
103 .xp_stat = svc_vc_rendezvous_stat,
104 .xp_reply = (bool_t (*)(SVCXPRT *, struct rpc_msg *,
105 struct sockaddr *, struct mbuf *, uint32_t *))svc_vc_null,
106 .xp_destroy = svc_vc_rendezvous_destroy,
107 .xp_control = svc_vc_rendezvous_control
110 static struct xp_ops svc_vc_ops = {
111 .xp_recv = svc_vc_recv,
112 .xp_stat = svc_vc_stat,
113 .xp_ack = svc_vc_ack,
114 .xp_reply = svc_vc_reply,
115 .xp_destroy = svc_vc_destroy,
116 .xp_control = svc_vc_control
119 static struct xp_ops svc_vc_backchannel_ops = {
120 .xp_recv = svc_vc_backchannel_recv,
121 .xp_stat = svc_vc_backchannel_stat,
122 .xp_reply = svc_vc_backchannel_reply,
123 .xp_destroy = svc_vc_backchannel_destroy,
124 .xp_control = svc_vc_backchannel_control
129 * xprt = svc_vc_create(sock, send_buf_size, recv_buf_size);
131 * Creates, registers, and returns a (rpc) tcp based transporter.
132 * Once *xprt is initialized, it is registered as a transporter
133 * see (svc.h, xprt_register). This routine returns
134 * a NULL if a problem occurred.
136 * The filedescriptor passed in is expected to refer to a bound, but
137 * not yet connected socket.
139 * Since streams do buffered io similar to stdio, the caller can specify
140 * how big the send and receive buffers are via the second and third parms;
141 * 0 => use the system default.
144 svc_vc_create(SVCPOOL *pool, struct socket *so, size_t sendsize,
152 if (so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED)) {
154 error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa);
157 xprt = svc_vc_create_conn(pool, so, sa);
163 xprt = svc_xprt_alloc();
164 sx_init(&xprt->xp_lock, "xprt->xp_lock");
165 xprt->xp_pool = pool;
166 xprt->xp_socket = so;
169 xprt->xp_ops = &svc_vc_rendezvous_ops;
171 error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
173 goto cleanup_svc_vc_create;
176 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
181 solisten(so, -1, curthread);
183 SOCKBUF_LOCK(&so->so_rcv);
184 xprt->xp_upcallset = 1;
185 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt);
186 SOCKBUF_UNLOCK(&so->so_rcv);
190 cleanup_svc_vc_create:
191 sx_destroy(&xprt->xp_lock);
198 * Create a new transport for a socket optained via soaccept().
201 svc_vc_create_conn(SVCPOOL *pool, struct socket *so, struct sockaddr *raddr)
205 struct sockaddr* sa = NULL;
210 bzero(&opt, sizeof(struct sockopt));
211 opt.sopt_dir = SOPT_SET;
212 opt.sopt_level = SOL_SOCKET;
213 opt.sopt_name = SO_KEEPALIVE;
215 opt.sopt_valsize = sizeof(one);
216 error = sosetopt(so, &opt);
221 if (so->so_proto->pr_protocol == IPPROTO_TCP) {
222 bzero(&opt, sizeof(struct sockopt));
223 opt.sopt_dir = SOPT_SET;
224 opt.sopt_level = IPPROTO_TCP;
225 opt.sopt_name = TCP_NODELAY;
227 opt.sopt_valsize = sizeof(one);
228 error = sosetopt(so, &opt);
234 cd = mem_alloc(sizeof(*cd));
235 cd->strm_stat = XPRT_IDLE;
237 xprt = svc_xprt_alloc();
238 sx_init(&xprt->xp_lock, "xprt->xp_lock");
239 xprt->xp_pool = pool;
240 xprt->xp_socket = so;
243 xprt->xp_ops = &svc_vc_ops;
246 * See http://www.connectathon.org/talks96/nfstcp.pdf - client
247 * has a 5 minute timer, server has a 6 minute timer.
249 xprt->xp_idletimeout = 6 * 60;
251 memcpy(&xprt->xp_rtaddr, raddr, raddr->sa_len);
253 error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
255 goto cleanup_svc_vc_create;
257 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
262 SOCKBUF_LOCK(&so->so_rcv);
263 xprt->xp_upcallset = 1;
264 soupcall_set(so, SO_RCV, svc_vc_soupcall, xprt);
265 SOCKBUF_UNLOCK(&so->so_rcv);
268 * Throw the transport into the active list in case it already
269 * has some data buffered.
271 sx_xlock(&xprt->xp_lock);
273 sx_xunlock(&xprt->xp_lock);
276 cleanup_svc_vc_create:
277 sx_destroy(&xprt->xp_lock);
279 mem_free(cd, sizeof(*cd));
285 * Create a new transport for a backchannel on a clnt_vc socket.
288 svc_vc_create_backchannel(SVCPOOL *pool)
290 SVCXPRT *xprt = NULL;
291 struct cf_conn *cd = NULL;
293 cd = mem_alloc(sizeof(*cd));
294 cd->strm_stat = XPRT_IDLE;
296 xprt = svc_xprt_alloc();
297 sx_init(&xprt->xp_lock, "xprt->xp_lock");
298 xprt->xp_pool = pool;
299 xprt->xp_socket = NULL;
302 xprt->xp_ops = &svc_vc_backchannel_ops;
307 * This does all of the accept except the final call to soaccept. The
308 * caller will call soaccept after dropping its locks (soaccept may
312 svc_vc_accept(struct socket *head, struct socket **sop)
317 if ((head->so_options & SO_ACCEPTCONN) == 0) {
322 error = mac_socket_check_accept(curthread->td_ucred, head);
327 if (TAILQ_EMPTY(&head->so_comp)) {
332 so = TAILQ_FIRST(&head->so_comp);
333 KASSERT(!(so->so_qstate & SQ_INCOMP), ("svc_vc_accept: so SQ_INCOMP"));
334 KASSERT(so->so_qstate & SQ_COMP, ("svc_vc_accept: so not SQ_COMP"));
337 * Before changing the flags on the socket, we have to bump the
338 * reference count. Otherwise, if the protocol calls sofree(),
339 * the socket will be released due to a zero refcount.
340 * XXX might not need soref() since this is simpler than kern_accept.
342 SOCK_LOCK(so); /* soref() and so_state update */
343 soref(so); /* file descriptor reference */
345 TAILQ_REMOVE(&head->so_comp, so, so_list);
347 so->so_state |= (head->so_state & SS_NBIO);
348 so->so_qstate &= ~SQ_COMP;
356 /* connection has been removed from the listen queue */
357 KNOTE_UNLOCKED(&head->so_rcv.sb_sel.si_note, 0);
364 svc_vc_rendezvous_recv(SVCXPRT *xprt, struct rpc_msg *msg,
365 struct sockaddr **addrp, struct mbuf **mp)
367 struct socket *so = NULL;
368 struct sockaddr *sa = NULL;
373 * The socket upcall calls xprt_active() which will eventually
374 * cause the server to call us here. We attempt to accept a
375 * connection from the socket and turn it into a new
376 * transport. If the accept fails, we have drained all pending
377 * connections so we call xprt_inactive().
379 sx_xlock(&xprt->xp_lock);
381 error = svc_vc_accept(xprt->xp_socket, &so);
383 if (error == EWOULDBLOCK) {
385 * We must re-test for new connections after taking
386 * the lock to protect us in the case where a new
387 * connection arrives after our call to accept fails
391 if (TAILQ_EMPTY(&xprt->xp_socket->so_comp))
392 xprt_inactive_self(xprt);
394 sx_xunlock(&xprt->xp_lock);
399 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv);
400 if (xprt->xp_upcallset) {
401 xprt->xp_upcallset = 0;
402 soupcall_clear(xprt->xp_socket, SO_RCV);
404 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
405 xprt_inactive_self(xprt);
406 sx_xunlock(&xprt->xp_lock);
410 sx_xunlock(&xprt->xp_lock);
413 error = soaccept(so, &sa);
417 * XXX not sure if I need to call sofree or soclose here.
425 * svc_vc_create_conn will call xprt_register - we don't need
426 * to do anything with the new connection except derefence it.
428 new_xprt = svc_vc_create_conn(xprt->xp_pool, so, sa);
432 SVC_RELEASE(new_xprt);
437 return (FALSE); /* there is never an rpc msg to be processed */
441 static enum xprt_stat
442 svc_vc_rendezvous_stat(SVCXPRT *xprt)
449 svc_vc_destroy_common(SVCXPRT *xprt)
451 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv);
452 if (xprt->xp_upcallset) {
453 xprt->xp_upcallset = 0;
454 soupcall_clear(xprt->xp_socket, SO_RCV);
456 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
459 (void)soclose(xprt->xp_socket);
462 (void) mem_free(xprt->xp_netid, strlen(xprt->xp_netid) + 1);
467 svc_vc_rendezvous_destroy(SVCXPRT *xprt)
470 svc_vc_destroy_common(xprt);
474 svc_vc_destroy(SVCXPRT *xprt)
476 struct cf_conn *cd = (struct cf_conn *)xprt->xp_p1;
478 svc_vc_destroy_common(xprt);
483 m_freem(cd->mpending);
484 mem_free(cd, sizeof(*cd));
488 svc_vc_backchannel_destroy(SVCXPRT *xprt)
490 struct cf_conn *cd = (struct cf_conn *)xprt->xp_p1;
500 mem_free(cd, sizeof(*cd));
505 svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in)
511 svc_vc_rendezvous_control(SVCXPRT *xprt, const u_int rq, void *in)
518 svc_vc_backchannel_control(SVCXPRT *xprt, const u_int rq, void *in)
524 static enum xprt_stat
525 svc_vc_stat(SVCXPRT *xprt)
529 cd = (struct cf_conn *)(xprt->xp_p1);
531 if (cd->strm_stat == XPRT_DIED)
534 if (cd->mreq != NULL && cd->resid == 0 && cd->eor)
535 return (XPRT_MOREREQS);
537 if (soreadable(xprt->xp_socket))
538 return (XPRT_MOREREQS);
544 svc_vc_ack(SVCXPRT *xprt, uint32_t *ack)
547 *ack = atomic_load_acq_32(&xprt->xp_snt_cnt);
548 *ack -= xprt->xp_socket->so_snd.sb_cc;
552 static enum xprt_stat
553 svc_vc_backchannel_stat(SVCXPRT *xprt)
557 cd = (struct cf_conn *)(xprt->xp_p1);
559 if (cd->mreq != NULL)
560 return (XPRT_MOREREQS);
566 * If we have an mbuf chain in cd->mpending, try to parse a record from it,
567 * leaving the result in cd->mreq. If we don't have a complete record, leave
568 * the partial result in cd->mreq and try to read more from the socket.
571 svc_vc_process_pending(SVCXPRT *xprt)
573 struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1;
574 struct socket *so = xprt->xp_socket;
578 * If cd->resid is non-zero, we have part of the
579 * record already, otherwise we are expecting a record
582 if (!cd->resid && cd->mpending) {
584 * See if there is enough data buffered to
585 * make up a record marker. Make sure we can
586 * handle the case where the record marker is
587 * split across more than one mbuf.
593 while (n < sizeof(uint32_t) && m) {
597 if (n < sizeof(uint32_t)) {
598 so->so_rcv.sb_lowat = sizeof(uint32_t) - n;
601 m_copydata(cd->mpending, 0, sizeof(header),
603 header = ntohl(header);
604 cd->eor = (header & 0x80000000) != 0;
605 cd->resid = header & 0x7fffffff;
606 m_adj(cd->mpending, sizeof(uint32_t));
610 * Start pulling off mbufs from cd->mpending
611 * until we either have a complete record or
612 * we run out of data. We use m_split to pull
613 * data - it will pull as much as possible and
614 * split the last mbuf if necessary.
616 while (cd->mpending && cd->resid) {
618 if (cd->mpending->m_next
619 || cd->mpending->m_len > cd->resid)
620 cd->mpending = m_split(cd->mpending,
621 cd->resid, M_WAITOK);
625 m_last(cd->mreq)->m_next = m;
629 cd->resid -= m->m_len;
635 * Block receive upcalls if we have more data pending,
636 * otherwise report our need.
639 so->so_rcv.sb_lowat = INT_MAX;
641 so->so_rcv.sb_lowat =
642 imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2));
647 svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg,
648 struct sockaddr **addrp, struct mbuf **mp)
650 struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1;
653 struct socket* so = xprt->xp_socket;
658 * Serialise access to the socket and our own record parsing
661 sx_xlock(&xprt->xp_lock);
664 /* If we have no request ready, check pending queue. */
665 while (cd->mpending &&
666 (cd->mreq == NULL || cd->resid != 0 || !cd->eor)) {
667 if (!svc_vc_process_pending(xprt))
671 /* Process and return complete request in cd->mreq. */
672 if (cd->mreq != NULL && cd->resid == 0 && cd->eor) {
674 xdrmbuf_create(&xdrs, cd->mreq, XDR_DECODE);
677 /* Check for next request in a pending queue. */
678 svc_vc_process_pending(xprt);
679 if (cd->mreq == NULL || cd->resid != 0) {
680 SOCKBUF_LOCK(&so->so_rcv);
682 xprt_inactive_self(xprt);
683 SOCKBUF_UNLOCK(&so->so_rcv);
686 sx_xunlock(&xprt->xp_lock);
688 if (! xdr_callmsg(&xdrs, msg)) {
694 *mp = xdrmbuf_getall(&xdrs);
701 * The socket upcall calls xprt_active() which will eventually
702 * cause the server to call us here. We attempt to
703 * read as much as possible from the socket and put
704 * the result in cd->mpending. If the read fails,
705 * we have drained both cd->mpending and the socket so
706 * we can call xprt_inactive().
708 uio.uio_resid = 1000000000;
709 uio.uio_td = curthread;
711 rcvflag = MSG_DONTWAIT;
712 error = soreceive(so, NULL, &uio, &m, NULL, &rcvflag);
714 if (error == EWOULDBLOCK) {
716 * We must re-test for readability after
717 * taking the lock to protect us in the case
718 * where a new packet arrives on the socket
719 * after our call to soreceive fails with
722 SOCKBUF_LOCK(&so->so_rcv);
724 xprt_inactive_self(xprt);
725 SOCKBUF_UNLOCK(&so->so_rcv);
726 sx_xunlock(&xprt->xp_lock);
731 SOCKBUF_LOCK(&so->so_rcv);
732 if (xprt->xp_upcallset) {
733 xprt->xp_upcallset = 0;
734 soupcall_clear(so, SO_RCV);
736 SOCKBUF_UNLOCK(&so->so_rcv);
737 xprt_inactive_self(xprt);
738 cd->strm_stat = XPRT_DIED;
739 sx_xunlock(&xprt->xp_lock);
745 * EOF - the other end has closed the socket.
747 xprt_inactive_self(xprt);
748 cd->strm_stat = XPRT_DIED;
749 sx_xunlock(&xprt->xp_lock);
754 m_last(cd->mpending)->m_next = m;
761 svc_vc_backchannel_recv(SVCXPRT *xprt, struct rpc_msg *msg,
762 struct sockaddr **addrp, struct mbuf **mp)
764 struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1;
769 sx_xlock(&xprt->xp_lock);
770 ct = (struct ct_data *)xprt->xp_p2;
772 sx_xunlock(&xprt->xp_lock);
775 mtx_lock(&ct->ct_lock);
778 xprt_inactive_self(xprt);
779 mtx_unlock(&ct->ct_lock);
780 sx_xunlock(&xprt->xp_lock);
783 cd->mreq = m->m_nextpkt;
784 mtx_unlock(&ct->ct_lock);
785 sx_xunlock(&xprt->xp_lock);
787 xdrmbuf_create(&xdrs, m, XDR_DECODE);
788 if (! xdr_callmsg(&xdrs, msg)) {
793 *mp = xdrmbuf_getall(&xdrs);
799 svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg,
800 struct sockaddr *addr, struct mbuf *m, uint32_t *seq)
808 * Leave space for record mark.
810 MGETHDR(mrep, M_WAIT, MT_DATA);
812 mrep->m_data += sizeof(uint32_t);
814 xdrmbuf_create(&xdrs, mrep, XDR_ENCODE);
816 if (msg->rm_reply.rp_stat == MSG_ACCEPTED &&
817 msg->rm_reply.rp_acpt.ar_stat == SUCCESS) {
818 if (!xdr_replymsg(&xdrs, msg))
821 xdrmbuf_append(&xdrs, m);
823 stat = xdr_replymsg(&xdrs, msg);
830 * Prepend a record marker containing the reply length.
832 M_PREPEND(mrep, sizeof(uint32_t), M_WAIT);
833 len = mrep->m_pkthdr.len;
834 *mtod(mrep, uint32_t *) =
835 htonl(0x80000000 | (len - sizeof(uint32_t)));
836 atomic_add_acq_32(&xprt->xp_snd_cnt, len);
837 error = sosend(xprt->xp_socket, NULL, NULL, mrep, NULL,
840 atomic_add_rel_32(&xprt->xp_snt_cnt, len);
842 *seq = xprt->xp_snd_cnt;
845 atomic_subtract_32(&xprt->xp_snd_cnt, len);
857 svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg,
858 struct sockaddr *addr, struct mbuf *m, uint32_t *seq)
867 * Leave space for record mark.
869 MGETHDR(mrep, M_WAITOK, MT_DATA);
871 mrep->m_data += sizeof(uint32_t);
873 xdrmbuf_create(&xdrs, mrep, XDR_ENCODE);
875 if (msg->rm_reply.rp_stat == MSG_ACCEPTED &&
876 msg->rm_reply.rp_acpt.ar_stat == SUCCESS) {
877 if (!xdr_replymsg(&xdrs, msg))
880 xdrmbuf_append(&xdrs, m);
882 stat = xdr_replymsg(&xdrs, msg);
889 * Prepend a record marker containing the reply length.
891 M_PREPEND(mrep, sizeof(uint32_t), M_WAITOK);
892 *mtod(mrep, uint32_t *) =
893 htonl(0x80000000 | (mrep->m_pkthdr.len
894 - sizeof(uint32_t)));
895 sx_xlock(&xprt->xp_lock);
896 ct = (struct ct_data *)xprt->xp_p2;
898 error = sosend(ct->ct_socket, NULL, NULL, mrep, NULL,
902 sx_xunlock(&xprt->xp_lock);
923 svc_vc_soupcall(struct socket *so, void *arg, int waitflag)
925 SVCXPRT *xprt = (SVCXPRT *) arg;
927 if (soreadable(xprt->xp_socket))
934 * Get the effective UID of the sending process. Used by rpcbind, keyserv
935 * and rpc.yppasswdd on AF_LOCAL.
938 __rpc_get_local_uid(SVCXPRT *transp, uid_t *uid) {
944 sock = transp->xp_fd;
945 sa = (struct sockaddr *)transp->xp_rtaddr;
946 if (sa->sa_family == AF_LOCAL) {
947 ret = getpeereid(sock, &euid, &egid);