[parisc-linux] pppd, pthread and hppa-linux question?

Joel Soete jsoe0708@tiscali.be
Tue, 11 Feb 2003 20:00:06 +0100


Hi all,

>
>>
>>On Mon, Feb 10, 2003 at 08:13:04AM -0800, Randolph Chung wrote:
>>> > All seems to work fine, never the less I notice some pppd messages
which
>>> > I do not noticed on my i386 Debian GNU/Linux box:
>>> > ...
>>> > Feb 10 17:34:57 fw01 pppd[1543]: read: Resource temporarily unavailable
>>> > Feb 10 17:34:57 fw01 pppd[1543]: read /dev/ppp: Resource temporarily
>>unavailable
>>> 
>>> this probably comes from apps that assume EAGAIN==EWOULDBLOCK. we need
>>> to probably fix this in glibc.... let's add it to Carlos' todo list!
:-)
>>
>>It's already in my TODO :)
>>
>>-- snip --
>>- EWOULDBLOCK emulation
>>        = Is EWOULDBLOCK emulation required?
>>        = What happens if we alias EWOULDBLOCK as EAGAIN
>>        = from the kernel hearders?
>>        - Break HPUX compat?
>>-- snip --
>>
>>As JDA notes we still have broken atomic functions in atomicity. Which
>>we are planning to fix with a light weight syscall.
>>
Awaiting this Carlos work, I suggest following workaround:

--- ppp-2.4.1.uus.orig/pppd/sys-linux.c
+++ ppp-2.4.1.uus/pppd/sys-linux.c
@@ -929,7 +933,7 @@
 	    fd = ppp_dev_fd;
     }
     if (write(fd, p, len) < 0) {
-	if (errno == EWOULDBLOCK || errno == ENOBUFS
+	if (errno == EWOULDBLOCK || errno == EAGAIN || errno == ENOBUFS
 	    || errno == ENXIO || errno == EIO || errno == EINTR)
 	    warn("write: warning: %m (%d)", errno);
 	else
@@ -993,7 +997,8 @@
     nr = -1;
     if (ppp_fd >= 0) {
 	nr = read(ppp_fd, buf, len);
-	if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR)
+	if (nr < 0 && errno != EWOULDBLOCK && errno !=EAGAIN \
+                   && errno != EIO && errno != EINTR)
 	    error("read: %m");
 	if (nr < 0 && errno == ENXIO)
 	    return 0;
@@ -1001,7 +1006,8 @@
     if (nr < 0 && new_style_driver && ifunit >= 0) {
 	/* N.B. we read ppp_fd first since LCP packets come in there. */
 	nr = read(ppp_dev_fd, buf, len);
-	if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR)
+	if (nr < 0 && errno != EWOULDBLOCK && errno !=EAGAIN \
+                   && errno != EIO && errno != EINTR)
 	    error("read /dev/ppp: %m");
 	if (nr < 0 && errno == ENXIO)
 	    return 0;
@@ -1035,7 +1041,7 @@
     if (n == 0)
 	fatal("eof on loopback");
 
-    if (errno != EWOULDBLOCK)
+    if (errno != EWOULDBLOCK && errno != EAGAIN)
 	fatal("read from loopback: %m(%d)", errno);
 
     return rv;

It seems to me to avoid to much annoying messages.

Do you think I woul have to open a pr near debian maintainer pkg?

Joel


---------------------------------
Vous surfez avec une ligne classique ?
Faites des economies avec Tiscali Complete
... Plus d'info sur http://complete.tiscali.be