* Server side for UDP/IP based RPC. (Does some caching in the hopes of
* achieving execute-at-most-once semantics.)
*
+ * Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ * This file is part of the GNU C Library.
+ *
+ * The GNU C Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * The GNU C Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the GNU C Library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ *
* Copyright (c) 2010, Oracle America, Inc.
*
* Redistribution and use in source and binary forms, with or without
#include <wchar.h>
#include <libio/iolibio.h>
+#include <shlib-compat.h>
#define rpc_buffer(xprt) ((xprt)->xp_p1)
#ifndef MAX
* The routines returns NULL if a problem occurred.
*/
SVCXPRT *
-svcudp_bufcreate (sock, sendsz, recvsz)
- int sock;
- u_int sendsz, recvsz;
+svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
{
bool_t madesock = FALSE;
SVCXPRT *xprt;
}
madesock = TRUE;
}
- __bzero ((char *) &addr, sizeof (addr));
+ memset ((char *) &addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
if (bindresvport (sock, &addr))
{
#endif
SVCXPRT *
-svcudp_create (sock)
- int sock;
+svcudp_create (int sock)
{
return svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE);
}
#endif
static enum xprt_stat
-svcudp_stat (xprt)
- SVCXPRT *xprt;
+svcudp_stat (SVCXPRT *xprt)
{
return XPRT_IDLE;
}
static bool_t
-svcudp_recv (xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svcudp_recv (SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svcudp_data *su = su_data (xprt);
XDR *xdrs = &(su->su_xdrs);
(int) su->su_iosz, 0,
(struct sockaddr *) &(xprt->xp_raddr), &len);
xprt->xp_addrlen = len;
- if (rlen == -1 && errno == EINTR)
- goto again;
+ if (rlen == -1)
+ {
+ if (errno == EINTR)
+ goto again;
+ __svc_accept_failed ();
+ }
if (rlen < 16) /* < 4 32-bit ints? */
return FALSE;
xdrs->x_op = XDR_DECODE;
}
static bool_t
-svcudp_reply (xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svcudp_reply (SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svcudp_data *su = su_data (xprt);
XDR *xdrs = &(su->su_xdrs);
}
static bool_t
-svcudp_getargs (xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
+svcudp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
return (*xdr_args) (&(su_data (xprt)->su_xdrs), args_ptr);
}
static bool_t
-svcudp_freeargs (xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
+svcudp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
XDR *xdrs = &(su_data (xprt)->su_xdrs);
}
static void
-svcudp_destroy (xprt)
- SVCXPRT *xprt;
+svcudp_destroy (SVCXPRT *xprt)
{
struct svcudp_data *su = su_data (xprt);
* return 1 if found, 0 if not found
*/
static int
-cache_get (xprt, msg, replyp, replylenp)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
- char **replyp;
- u_long *replylenp;
+cache_get (SVCXPRT *xprt, struct rpc_msg *msg, char **replyp,
+ u_long *replylenp)
{
u_int loc;
cache_ptr ent;