svc_dg.c (184588) | svc_dg.c (193272) |
---|---|
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> | 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 184588 2008-11-03 10:38:00Z dfr $"); | 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 *); | 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 void svc_dg_soupcall(struct socket *so, void *arg, int waitflag); | 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); | 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 so->so_upcallarg = xprt; 137 so->so_upcall = svc_dg_soupcall; 138 so->so_rcv.sb_flags |= SB_UPCALL; | 136 soupcall_set(so, SO_RCV, svc_dg_soupcall, xprt); |
139 SOCKBUF_UNLOCK(&so->so_rcv); 140 141 return (xprt); 142freedata: 143 (void) printf(svc_dg_str, __no_mem_str); 144 if (xprt) { 145 svc_xprt_free(xprt); 146 } --- 53 unchanged lines hidden (view full) --- 200 xprt_inactive_locked(xprt); 201 mtx_unlock(&xprt->xp_pool->sp_lock); 202 sx_xunlock(&xprt->xp_lock); 203 return (FALSE); 204 } 205 206 if (error) { 207 SOCKBUF_LOCK(&xprt->xp_socket->so_rcv); | 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); |
208 xprt->xp_socket->so_upcallarg = NULL; 209 xprt->xp_socket->so_upcall = NULL; 210 xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; | 206 soupcall_clear(xprt->xp_socket, SO_RCV); |
211 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 212 xprt_inactive(xprt); 213 sx_xunlock(&xprt->xp_lock); 214 return (FALSE); 215 } 216 217 sx_xunlock(&xprt->xp_lock); 218 --- 51 unchanged lines hidden (view full) --- 270 return (stat); 271} 272 273static void 274svc_dg_destroy(SVCXPRT *xprt) 275{ 276 277 SOCKBUF_LOCK(&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); |
278 xprt->xp_socket->so_upcallarg = NULL; 279 xprt->xp_socket->so_upcall = NULL; 280 xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL; | 274 soupcall_clear(xprt->xp_socket, SO_RCV); |
281 SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); 282 283 sx_destroy(&xprt->xp_lock); 284 if (xprt->xp_socket) 285 (void)soclose(xprt->xp_socket); 286 287 if (xprt->xp_netid) 288 (void) mem_free(xprt->xp_netid, strlen(xprt->xp_netid) + 1); --- 6 unchanged lines hidden (view full) --- 295 SVCXPRT *xprt; 296 const u_int rq; 297 void *in; 298{ 299 300 return (FALSE); 301} 302 | 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 |
303static void | 297static int |
304svc_dg_soupcall(struct socket *so, void *arg, int waitflag) 305{ 306 SVCXPRT *xprt = (SVCXPRT *) arg; 307 308 xprt_active(xprt); | 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); |
|
309} | 304} |