From d7e2a8188f6e9eaccb5e1c1bd7b9d5af79429c0c Mon Sep 17 00:00:00 2001 From: ajs Date: Thu, 17 Feb 2005 20:02:49 +0000 Subject: 2005-02-17 Andrew J. Schorr * network.h: Define a new ERRNO_IO_RETRY macro to test whether an I/O operation should be retried. This eliminates the need to duplicate the same logic testing for EAGAIN or EINTR in multiple places. --- lib/network.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/network.h') diff --git a/lib/network.h b/lib/network.h index 589b80e9c..9333ef81d 100644 --- a/lib/network.h +++ b/lib/network.h @@ -33,4 +33,8 @@ int writen (int, const u_char *, int); -1 on error. */ extern int set_nonblocking(int fd); +/* Does the I/O error indicate that the operation should be retried later? */ +#define ERRNO_IO_RETRY(EN) \ + (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR)) + #endif /* _ZEBRA_NETWORK_H */ -- cgit v1.2.3