* [parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h
@ 2002-09-09 21:46 Jochen Friedrich
2002-09-09 22:04 ` Randolph Chung
0 siblings, 1 reply; 4+ messages in thread
From: Jochen Friedrich @ 2002-09-09 21:46 UTC (permalink / raw)
To: HP900 PARISC mailing list
Hi,
because of the unusual definition of EWOULDBLOCK, zebra currently doesn't
work (zebra checks for EWOULDBLOCK in zebra/rt_netlink.c and will loop if
it gets EAGAIN instead and both are not the same).
I'm not sure what's the correct fix for this, change errno.h to match the
definition of the other archs or change zebra to check for EAGAIN as
well...
Cheers,
--jochen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h
2002-09-09 21:46 [parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h Jochen Friedrich
@ 2002-09-09 22:04 ` Randolph Chung
2002-09-10 16:18 ` [parisc-linux] HPUX guru needed -> " Carlos O'Donell
2002-09-10 20:22 ` [parisc-linux] " Jochen Friedrich
0 siblings, 2 replies; 4+ messages in thread
From: Randolph Chung @ 2002-09-09 22:04 UTC (permalink / raw)
To: Jochen Friedrich; +Cc: HP900 PARISC mailing list
> because of the unusual definition of EWOULDBLOCK, zebra currently doesn't
> work (zebra checks for EWOULDBLOCK in zebra/rt_netlink.c and will loop if
> it gets EAGAIN instead and both are not the same).
>
> I'm not sure what's the correct fix for this, change errno.h to match the
> definition of the other archs or change zebra to check for EAGAIN as
> well...
I assume you are refering to this bit of code:
status = recvmsg (nl->sock, &msg, 0);
if (status < 0)
{
if (errno == EINTR)
continue;
if (errno == EWOULDBLOCK)
break;
zlog (NULL, LOG_ERR, "%s recvmsg overrun", nl->name);
continue;
}
On some SysV systems EAGAIN != EWOULDBLOCK. I think we inherited the
errno definitions from HPUX...
glibc's documentation says:
Portability Note: In many older Unix systems, this condition was indicated by EWOULDBLOCK, which was a distinct error code different from EAGAIN. To make your program portable, you should check for both codes and treat them the same.
sounds like good advice to me.. :-)
it does say, however, that for glibc EWOULDBLOCK and EAGAIN should have
the same value though, so i guess ours is wrong... i wonder if we'll
break things if we changed it.
randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [parisc-linux] HPUX guru needed -> definition of EWOULDBLOCK in /usr/include/asm/errno.h
2002-09-09 22:04 ` Randolph Chung
@ 2002-09-10 16:18 ` Carlos O'Donell
2002-09-10 20:22 ` [parisc-linux] " Jochen Friedrich
1 sibling, 0 replies; 4+ messages in thread
From: Carlos O'Donell @ 2002-09-10 16:18 UTC (permalink / raw)
To: Randolph Chung; +Cc: Jochen Friedrich, HP900 PARISC mailing list
>
> On some SysV systems EAGAIN != EWOULDBLOCK. I think we inherited the
> errno definitions from HPUX...
>
> glibc's documentation says:
>
> Portability Note: In many older Unix systems, this condition was indicated by EWOULDBLOCK, which was a distinct error code different from EAGAIN. To make your program portable, you should check for both codes and treat them the same.
>
> sounds like good advice to me.. :-)
>
> it does say, however, that for glibc EWOULDBLOCK and EAGAIN should have
> the same value though, so i guess ours is wrong... i wonder if we'll
> break things if we changed it.
>
> randolph
I agree with randolph, you should change the code to check for EAGAIN aswell.
On the other hand...
We have to do both of the following in order to maintain backwards compatibility.
I'm all for ignoring that and just doing 'b' :}
a. Emulate EWOULDBLOCK == EAGAIN in assembly during syscall errors.
- Added code to glibc :(
See:
glibc-2.2.5/sysdeps/unix/i386/sysdep.S
glibc-2.2.5/sysdeps/unix/sparc/sysdep.S
glibc-2.2.5/sysdeps/unix/x86_64/sysdep.S
glibc-2.2.5/sysdeps/unix/arm/sysdep.S
...
b. Just change the kernel header to alias EWOULDBLOCK as EAGAIN.
--- linux/include/asm-parisc/errno.h 1999-12-24 12:05:04.000000000 -0500
+++ linux/include/asm-parisc/errno.h.new 2002-09-10 12:09:52.000000000 -0400
@@ -134,7 +134,7 @@
#define EALREADY 244 /* Operation already in progress */
#define EINPROGRESS 245 /* Operation now in progress */
-#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */
+#define EWOULDBLOCK EAGAIN /* Operation would block (Linux returns EAGAIN) */
#define ENOTEMPTY 247 /* Directory not empty */
#define ENAMETOOLONG 248 /* File name too long */
#define ELOOP 249 /* Too many symbolic links encountered */
This seems best since I don't really see any code in ioctl32.c that returns
EWOULDBLOCK :) We just confuse the applicaiton by providing a different value.
Does this have anything to do with HPUX compatibility? Would an HPUX application
expect different semantic meansings from these two values?
c.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h
2002-09-09 22:04 ` Randolph Chung
2002-09-10 16:18 ` [parisc-linux] HPUX guru needed -> " Carlos O'Donell
@ 2002-09-10 20:22 ` Jochen Friedrich
1 sibling, 0 replies; 4+ messages in thread
From: Jochen Friedrich @ 2002-09-10 20:22 UTC (permalink / raw)
To: Randolph Chung; +Cc: HP900 PARISC mailing list
Hi Randolph,
> Portability Note: In many older Unix systems, this condition was indicated by EWOULDBLOCK, which was a distinct error code different from EAGAIN. To make your program portable, you should check for both codes and treat them the same.
>
> sounds like good advice to me.. :-)
It's fixed this way in current zebra CVS. However, there might be other
applications which might be hit by this, as well.
Cheers,
--jochen
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-09-10 20:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-09 21:46 [parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h Jochen Friedrich
2002-09-09 22:04 ` Randolph Chung
2002-09-10 16:18 ` [parisc-linux] HPUX guru needed -> " Carlos O'Donell
2002-09-10 20:22 ` [parisc-linux] " Jochen Friedrich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.