[parisc-linux] definition of EWOULDBLOCK in /usr/include/asm/errno.h

Randolph Chung Randolph Chung <randolph@tausq.org>
Mon, 9 Sep 2002 15:04:49 -0700


> 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/