SHA256
1
0
forked from pool/glibc

Accepting request 75668 from home:a_jaeger:branches:openSUSE:Factory

Update glibc-2.2-sunrpc.diff patch.

OBS-URL: https://build.opensuse.org/request/show/75668
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=80
This commit is contained in:
Andreas Jaeger 2011-07-07 14:52:52 +00:00 committed by Git OBS Bridge
parent 6ee4ab0938
commit 6129e0af30
4 changed files with 100 additions and 67 deletions

View File

@ -1,82 +1,104 @@
The following patch was not accepted upstream, see:
For details see:
http://sourceware.org/bugzilla/show_bug.cgi?id=5379
It needs rework.
Index: sunrpc/clnt_udp.c
===================================================================
--- sunrpc/clnt_udp.c.orig
+++ sunrpc/clnt_udp.c
@@ -301,6 +301,7 @@ clntudp_call (cl, proc, xargs, argsp, xr
XDR *xdrs;
int outlen = 0;
--- sunrpc/clnt_udp.c.orig 2008-10-10 14:42:04.000000000 -0400
+++ sunrpc/clnt_udp.c 2008-10-10 16:15:33.000000000 -0400
@@ -38,6 +38,7 @@
*/
#include <stdio.h>
+#include <stdint.h>
#include <unistd.h>
#include <libintl.h>
#include <rpc/rpc.h>
@@ -266,8 +267,7 @@
int inlen;
+ int pollresult;
socklen_t fromlen;
struct pollfd fd;
int milliseconds = (cu->cu_wait.tv_sec * 1000) +
@@ -371,37 +372,36 @@ send_again:
- int milliseconds = (cu->cu_wait.tv_sec * 1000) +
- (cu->cu_wait.tv_usec / 1000);
+ int milliseconds;
struct sockaddr_in from;
struct rpc_msg reply_msg;
XDR reply_xdrs;
@@ -275,6 +275,8 @@
bool_t ok;
int nrefreshes = 2; /* number of times to refresh cred */
struct timeval timeout;
+ uint64_t start_time, end_time;
+ struct timeval tmp_tv;
int anyup; /* any network interface up */
if (cu->cu_total.tv_usec == -1)
@@ -332,6 +334,18 @@
fd.fd = cu->cu_sock;
fd.events = POLLIN;
anyup = 0;
+
+ poll_again:
+ milliseconds = (cu->cu_wait.tv_sec * 1000) +
+ (cu->cu_wait.tv_usec / 1000);
+ if (gettimeofday(&tmp_tv, NULL) != 0)
+ {
+ /* XXX: What is the correct return here? */
+ return (cu->cu_error.re_status = RPC_CANTRECV);
+ }
+ start_time = (uint64_t)tmp_tv.tv_sec * 1000 +
+ (uint64_t)tmp_tv.tv_usec / 1000;
+
for (;;)
{
- switch (__poll (&fd, 1, milliseconds))
+ switch (pollresult = __poll (&fd, 1, milliseconds))
{
-
case 0:
- if (anyup == 0)
- {
- anyup = is_network_up (cu->cu_sock);
- if (!anyup)
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
-
- time_waited.tv_sec += cu->cu_wait.tv_sec;
- time_waited.tv_usec += cu->cu_wait.tv_usec;
- while (time_waited.tv_usec >= 1000000)
- {
- time_waited.tv_sec++;
- time_waited.tv_usec -= 1000000;
- }
- if ((time_waited.tv_sec < timeout.tv_sec) ||
- ((time_waited.tv_sec == timeout.tv_sec) &&
- (time_waited.tv_usec < timeout.tv_usec)))
- goto send_again;
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
-
- /*
- * buggy in other cases because time_waited is not being
- * updated.
- */
switch (__poll (&fd, 1, milliseconds))
@@ -364,7 +378,28 @@
*/
case -1:
- if (errno == EINTR)
if (errno == EINTR)
- continue;
+ if (pollresult == 0 || errno == EINTR) {
+ if (anyup == 0)
+ {
+ anyup = is_network_up (cu->cu_sock);
+ if (!anyup)
+ {
+ /* Decrement time already spent polling. */
+ if (gettimeofday(&tmp_tv, NULL) != 0)
+ {
+ return (cu->cu_error.re_status = RPC_CANTRECV);
+ }
+ }
+
+ time_waited.tv_sec += cu->cu_wait.tv_sec;
+ time_waited.tv_usec += cu->cu_wait.tv_usec;
+ while (time_waited.tv_usec >= 1000000)
+ {
+ time_waited.tv_sec++;
+ time_waited.tv_usec -= 1000000;
+ }
+ if ((time_waited.tv_sec < timeout.tv_sec) ||
+ ((time_waited.tv_sec == timeout.tv_sec) &&
+ (time_waited.tv_usec < timeout.tv_usec)))
+ if (pollresult == 0)
+ goto send_again;
+ end_time = (uint64_t)tmp_tv.tv_sec * 1000 +
+ (uint64_t)tmp_tv.tv_usec / 1000;
+
+ if ((end_time - start_time) > (uint64_t)milliseconds)
+ {
+ milliseconds = 0;
+ }
+ else
+ continue;
+ return (cu->cu_error.re_status = RPC_TIMEDOUT);
+ }
+ {
+ milliseconds -= (int)(end_time - start_time);
+ }
+ start_time = end_time;
+
+ /* errno != EINTR */
+ continue;
+ }
cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV);
}
@@ -420,19 +455,19 @@
if (inlen < 0)
{
if (errno == EWOULDBLOCK)
- continue;
+ goto poll_again;
cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV);
}
if (inlen < 4)
- continue;
+ goto poll_again;
/* see if reply transaction id matches sent id.
Don't do this if we only wait for a replay */
if (xargs != NULL
&& (*((u_int32_t *) (cu->cu_inbuf))
!= *((u_int32_t *) (cu->cu_outbuf))))
- continue;
+ goto poll_again;
/* we now assume we have the proper reply */
break;
}

View File

@ -1,3 +1,8 @@
Refused by Ulrich Drepper:
http://sourceware.org/ml/libc-alpha/2011-07/msg00046.html
We have to keep it until gcc handles this better.
2009-11-06 Petr Baudis <pasky@suse.cz>
* include/sys/uio.h: Change __vector to __iovec to avoid clash

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jul 7 14:50:15 UTC 2011 - aj@suse.de
- Update glibc-2.2-sunrpc.diff with newer patch from sourceware
bugzilla (bs#bso#5379).
-------------------------------------------------------------------
Wed Jul 6 08:24:45 UTC 2011 - lnussel@suse.de

View File

@ -146,7 +146,7 @@ Patch24: glibc-2.3.5-nscd-zeronegtimeout.diff
Patch25: glibc-2.3.90-langpackdir.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch27: glibc-2.6-configure.diff
# PATCH-FIX-OPENSUSE Fix hangs in UDP RPC calls bso#5379
# PATCH-FIX-OPENSUSE Fix hangs in UDP RPC calls bso#5379 bnc#257745 aj@suse.de
Patch28: glibc-2.2-sunrpc.diff
# PATCH-FIX-OPENSUSE Do not generate hardlink for getconf
Patch29: glibc-2.8-getconf.diff
@ -164,7 +164,7 @@ Patch37: glibc-2.10-nscd-nostack.diff
Patch38: glibc-cpusetsize.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch40: libm-x86-64-exceptions.diff
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
# PATCH-FIX-OPENSUSE - Allow compilation with -altivec aj@suse.de
Patch41: glibc-uio-cell.diff
# PATCH-FIX-UPSTREAM -- add missing includes aj@suse.de
Patch43: missing-include-build-fix.diff