libc_hidden_proto (svc_getreq_poll)
extern void __svc_accept_failed (void) attribute_hidden;
+extern void __svc_wait_on_error (void) attribute_hidden;
# endif /* !_ISOMAC */
#endif
}
libc_hidden_nolink_sunrpc (svc_getreq_common, GLIBC_2_2)
+void
+__svc_wait_on_error (void)
+{
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
+ __nanosleep (&ts, NULL);
+}
+
/* If there are no file descriptors available, then accept will fail.
We want to delay here so the connection request can be dequeued;
otherwise we can bounce between polling and accepting, never giving the
{
if (errno == EMFILE)
{
- struct timespec ts = { .tv_sec = 0, .tv_nsec = 50000000 };
- __nanosleep (&ts, NULL);
+ __svc_wait_on_error ();
}
}
* make a new transporter (re-uses xprt)
*/
xprt = makefd_xprt (sock, r->sendsize, r->recvsize);
+
+ /* If we are out of memory, makefd_xprt has already dumped an error. */
+ if (xprt == NULL)
+ {
+ __svc_wait_on_error ();
+ return FALSE;
+ }
+
memcpy (&xprt->xp_raddr, &addr, sizeof (addr));
xprt->xp_addrlen = len;
return FALSE; /* there is never an rpc msg to be processed */
memset (&in_addr, '\0', sizeof (in_addr));
in_addr.sin_family = AF_UNIX;
xprt = makefd_xprt (sock, r->sendsize, r->recvsize);
+
+ /* If we are out of memory, makefd_xprt has already dumped an error. */
+ if (xprt == NULL)
+ {
+ __svc_wait_on_error ();
+ return FALSE;
+ }
+
memcpy (&xprt->xp_raddr, &in_addr, sizeof (in_addr));
xprt->xp_addrlen = len;
return FALSE; /* there is never an rpc msg to be processed */