Deleted Added
sdiff udiff text old ( 184588 ) new ( 193272 )
full compact
1/* $NetBSD: svc_dg.c,v 1.4 2000/07/06 03:10:35 christos Exp $ */
2
3/*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or

--- 23 unchanged lines hidden (view full) ---

32/*
33 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
34 */
35
36#if defined(LIBC_SCCS) && !defined(lint)
37#ident "@(#)svc_dg.c 1.17 94/04/24 SMI"
38#endif
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/sys/rpc/svc_dg.c 193272 2009-06-01 21:17:03Z jhb $");
41
42/*
43 * svc_dg.c, Server side for connectionless RPC.
44 */
45
46#include <sys/param.h>
47#include <sys/lock.h>
48#include <sys/kernel.h>

--- 14 unchanged lines hidden (view full) ---

63
64static enum xprt_stat svc_dg_stat(SVCXPRT *);
65static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *,
66 struct sockaddr **, struct mbuf **);
67static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *,
68 struct sockaddr *, struct mbuf *);
69static void svc_dg_destroy(SVCXPRT *);
70static bool_t svc_dg_control(SVCXPRT *, const u_int, void *);
71static int svc_dg_soupcall(struct socket *so, void *arg, int waitflag);
72
73static struct xp_ops svc_dg_ops = {
74 .xp_recv = svc_dg_recv,
75 .xp_stat = svc_dg_stat,
76 .xp_reply = svc_dg_reply,
77 .xp_destroy = svc_dg_destroy,
78 .xp_control = svc_dg_control,
79};

--- 48 unchanged lines hidden (view full) ---

128 goto freedata;
129
130 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
131 free(sa, M_SONAME);
132
133 xprt_register(xprt);
134
135 SOCKBUF_LOCK(&so->so_rcv);
136 soupcall_set(so, SO_RCV, svc_dg_soupcall, xprt);
137 SOCKBUF_UNLOCK(&so->so_rcv);
138
139 return (xprt);
140freedata:
141 (void) printf(svc_dg_str, __no_mem_str);
142 if (xprt) {
143 svc_xprt_free(xprt);
144 }

--- 53 unchanged lines hidden (view full) ---

198 xprt_inactive_locked(xprt);
199 mtx_unlock(&xprt->xp_pool->sp_lock);
200 sx_xunlock(&xprt->xp_lock);
201 return (FALSE);
202 }
203
204 if (error) {
205 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv);
206 soupcall_clear(xprt->xp_socket, SO_RCV);
207 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
208 xprt_inactive(xprt);
209 sx_xunlock(&xprt->xp_lock);
210 return (FALSE);
211 }
212
213 sx_xunlock(&xprt->xp_lock);
214

--- 51 unchanged lines hidden (view full) ---

266 return (stat);
267}
268
269static void
270svc_dg_destroy(SVCXPRT *xprt)
271{
272
273 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv);
274 soupcall_clear(xprt->xp_socket, SO_RCV);
275 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
276
277 sx_destroy(&xprt->xp_lock);
278 if (xprt->xp_socket)
279 (void)soclose(xprt->xp_socket);
280
281 if (xprt->xp_netid)
282 (void) mem_free(xprt->xp_netid, strlen(xprt->xp_netid) + 1);

--- 6 unchanged lines hidden (view full) ---

289 SVCXPRT *xprt;
290 const u_int rq;
291 void *in;
292{
293
294 return (FALSE);
295}
296
297static int
298svc_dg_soupcall(struct socket *so, void *arg, int waitflag)
299{
300 SVCXPRT *xprt = (SVCXPRT *) arg;
301
302 xprt_active(xprt);
303 return (SU_OK);
304}