Deleted Added
full compact
svc_dg.c (193272) svc_dg.c (196503)
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 193272 2009-06-01 21:17:03Z jhb $");
40__FBSDID("$FreeBSD: head/sys/rpc/svc_dg.c 196503 2009-08-24 10:09:30Z zec $");
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>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/mutex.h>
52#include <sys/protosw.h>
53#include <sys/queue.h>
54#include <sys/socket.h>
55#include <sys/socketvar.h>
56#include <sys/sx.h>
57#include <sys/systm.h>
58#include <sys/uio.h>
59
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>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/mutex.h>
52#include <sys/protosw.h>
53#include <sys/queue.h>
54#include <sys/socket.h>
55#include <sys/socketvar.h>
56#include <sys/sx.h>
57#include <sys/systm.h>
58#include <sys/uio.h>
59
60#include <net/vnet.h>
61
60#include <rpc/rpc.h>
61
62#include <rpc/rpc_com.h>
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 *,

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

96svc_dg_create(SVCPOOL *pool, struct socket *so, size_t sendsize,
97 size_t recvsize)
98{
99 SVCXPRT *xprt;
100 struct __rpc_sockinfo si;
101 struct sockaddr* sa;
102 int error;
103
62#include <rpc/rpc.h>
63
64#include <rpc/rpc_com.h>
65
66static enum xprt_stat svc_dg_stat(SVCXPRT *);
67static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *,
68 struct sockaddr **, struct mbuf **);
69static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *,

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

98svc_dg_create(SVCPOOL *pool, struct socket *so, size_t sendsize,
99 size_t recvsize)
100{
101 SVCXPRT *xprt;
102 struct __rpc_sockinfo si;
103 struct sockaddr* sa;
104 int error;
105
106 CURVNET_SET(so->so_vnet);
104 if (!__rpc_socket2sockinfo(so, &si)) {
105 printf(svc_dg_str, svc_dg_err1);
107 if (!__rpc_socket2sockinfo(so, &si)) {
108 printf(svc_dg_str, svc_dg_err1);
109 CURVNET_RESTORE();
106 return (NULL);
107 }
108 /*
109 * Find the receive and the send size
110 */
111 sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
112 recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
113 if ((sendsize == 0) || (recvsize == 0)) {
114 printf(svc_dg_str, svc_dg_err2);
110 return (NULL);
111 }
112 /*
113 * Find the receive and the send size
114 */
115 sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
116 recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
117 if ((sendsize == 0) || (recvsize == 0)) {
118 printf(svc_dg_str, svc_dg_err2);
119 CURVNET_RESTORE();
115 return (NULL);
116 }
117
118 xprt = svc_xprt_alloc();
119 sx_init(&xprt->xp_lock, "xprt->xp_lock");
120 xprt->xp_pool = pool;
121 xprt->xp_socket = so;
122 xprt->xp_p1 = NULL;
123 xprt->xp_p2 = NULL;
124 xprt->xp_ops = &svc_dg_ops;
125
126 error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
120 return (NULL);
121 }
122
123 xprt = svc_xprt_alloc();
124 sx_init(&xprt->xp_lock, "xprt->xp_lock");
125 xprt->xp_pool = pool;
126 xprt->xp_socket = so;
127 xprt->xp_p1 = NULL;
128 xprt->xp_p2 = NULL;
129 xprt->xp_ops = &svc_dg_ops;
130
131 error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
132 CURVNET_RESTORE();
127 if (error)
128 goto freedata;
129
130 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
131 free(sa, M_SONAME);
132
133 xprt_register(xprt);
134

--- 170 unchanged lines hidden ---
133 if (error)
134 goto freedata;
135
136 memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
137 free(sa, M_SONAME);
138
139 xprt_register(xprt);
140

--- 170 unchanged lines hidden ---