summaryrefslogtreecommitdiffstats
path: root/libc/inet/rpc/svc_udp.c
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-02-25 04:03:33 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-02-25 04:03:33 +0000
commitcb6a88484ce0b5ffba2fe98a40e2d51f4af92eb8 (patch)
tree520f8e8d113184cfa7954ebd274564b8c255fa9a /libc/inet/rpc/svc_udp.c
parente4461be66e2655058aef358b00050bc70ac72861 (diff)
downloaduClibc-alpine-cb6a88484ce0b5ffba2fe98a40e2d51f4af92eb8.tar.bz2
uClibc-alpine-cb6a88484ce0b5ffba2fe98a40e2d51f4af92eb8.tar.xz
Merge from trunk. Going pretty good so far. Kind of. Okay, not really.
Diffstat (limited to 'libc/inet/rpc/svc_udp.c')
-rw-r--r--libc/inet/rpc/svc_udp.c81
1 files changed, 46 insertions, 35 deletions
diff --git a/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c
index 82f279814..53ef7ab35 100644
--- a/libc/inet/rpc/svc_udp.c
+++ b/libc/inet/rpc/svc_udp.c
@@ -39,23 +39,7 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#define xprt_register __xprt_register
-#define xprt_unregister __xprt_unregister
-#define xdrmem_create __xdrmem_create
-#define xdr_callmsg __xdr_callmsg
-#define xdr_replymsg __xdr_replymsg
-#define getsockname __getsockname
-#define setsockopt __setsockopt
-#define bind __bind
-#define bindresvport __bindresvport
-#define recvfrom __recvfrom
-#define sendto __sendto
-#define recvmsg __recvmsg
-#define sendmsg __sendmsg
-#define fputs __fputs
-
#define __FORCE_GLIBC
-#define _GNU_SOURCE
#include <features.h>
#include <stdio.h>
@@ -73,8 +57,32 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
# include <wchar.h>
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
+libc_hidden_proto(fwprintf)
#endif
+libc_hidden_proto(memcmp)
+libc_hidden_proto(memcpy)
+libc_hidden_proto(memset)
+libc_hidden_proto(perror)
+libc_hidden_proto(socket)
+libc_hidden_proto(close)
+libc_hidden_proto(xprt_register)
+libc_hidden_proto(xprt_unregister)
+libc_hidden_proto(xdrmem_create)
+libc_hidden_proto(xdr_callmsg)
+libc_hidden_proto(xdr_replymsg)
+libc_hidden_proto(getsockname)
+libc_hidden_proto(setsockopt)
+libc_hidden_proto(bind)
+libc_hidden_proto(bindresvport)
+libc_hidden_proto(recvfrom)
+libc_hidden_proto(sendto)
+libc_hidden_proto(recvmsg)
+libc_hidden_proto(sendmsg)
+libc_hidden_proto(fputs)
+libc_hidden_proto(fprintf)
+libc_hidden_proto(stderr)
+
#define rpc_buffer(xprt) ((xprt)->xp_p1)
#ifndef MAX
#define MAX(a, b) ((a > b) ? a : b)
@@ -127,8 +135,9 @@ struct svcudp_data
* see (svc.h, xprt_register).
* The routines returns NULL if a problem occurred.
*/
-SVCXPRT attribute_hidden *
-__svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
+libc_hidden_proto(svcudp_bufcreate)
+SVCXPRT *
+svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
{
bool_t madesock = FALSE;
SVCXPRT *xprt;
@@ -140,14 +149,14 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
if (sock == RPC_ANYSOCK)
{
- if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
- __perror (_("svcudp_create: socket creation problem"));
+ perror (_("svcudp_create: socket creation problem"));
return (SVCXPRT *) NULL;
}
madesock = TRUE;
}
- __memset ((char *) &addr, 0, sizeof (addr));
+ memset ((char *) &addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
if (bindresvport (sock, &addr))
{
@@ -156,9 +165,9 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
}
if (getsockname (sock, (struct sockaddr *) &addr, &len) != 0)
{
- __perror (_("svcudp_create - cannot getsockname"));
+ perror (_("svcudp_create - cannot getsockname"));
if (madesock)
- (void) __close (sock);
+ (void) close (sock);
return (SVCXPRT *) NULL;
}
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
@@ -168,7 +177,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
{
#ifdef USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
+ (void) fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
else
#endif
(void) fputs (_("svcudp_create: out of memory\n"), stderr);
@@ -194,7 +203,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
{
# ifdef USE_IN_LIBIO
if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
+ (void) fwprintf (stderr, L"%s",
_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
else
# endif
@@ -211,20 +220,21 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
#endif
/* Clear the padding. */
pad = 0;
- __memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad));
+ memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad));
xprt_register (xprt);
return xprt;
}
-strong_alias(__svcudp_bufcreate,svcudp_bufcreate)
+libc_hidden_def(svcudp_bufcreate)
-SVCXPRT attribute_hidden *
-__svcudp_create (int sock)
+libc_hidden_proto(svcudp_create)
+SVCXPRT *
+svcudp_create (int sock)
{
- return __svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE);
+ return svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE);
}
-strong_alias(__svcudp_create,svcudp_create)
+libc_hidden_def(svcudp_create)
static enum xprt_stat
svcudp_stat (xprt)
@@ -387,7 +397,7 @@ svcudp_destroy (xprt)
struct svcudp_data *su = su_data (xprt);
xprt_unregister (xprt);
- (void) __close (xprt->xp_sock);
+ (void) close (xprt->xp_sock);
XDR_DESTROY (&(su->su_xdrs));
mem_free (rpc_buffer (xprt), su->su_iosz);
mem_free ((caddr_t) su, sizeof (struct svcudp_data));
@@ -420,7 +430,7 @@ svcudp_destroy (xprt)
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
#define BZERO(addr, type, size) \
- __memset((char *) addr, 0, sizeof(type) * (int) (size))
+ memset((char *) addr, 0, sizeof(type) * (int) (size))
/*
* An entry in the cache
@@ -476,6 +486,7 @@ struct udp_cache
* Enable use of the cache.
* Note: there is no disable.
*/
+int svcudp_enablecache (SVCXPRT *transp, u_long size);
int
svcudp_enablecache (SVCXPRT *transp, u_long size)
{
@@ -598,7 +609,7 @@ cache_get (xprt, msg, replyp, replylenp)
struct svcudp_data *su = su_data (xprt);
struct udp_cache *uc = (struct udp_cache *) su->su_cache;
-#define EQADDR(a1, a2) (__memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
+#define EQADDR(a1, a2) (memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
loc = CACHE_LOC (xprt, su->su_xid);
for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next)
@@ -621,6 +632,6 @@ cache_get (xprt, msg, replyp, replylenp)
uc->uc_proc = msg->rm_call.cb_proc;
uc->uc_vers = msg->rm_call.cb_vers;
uc->uc_prog = msg->rm_call.cb_prog;
- __memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr));
+ memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr));
return 0;
}