summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorajs <ajs>2005-02-17 20:02:49 +0000
committerajs <ajs>2005-02-17 20:02:49 +0000
commitd7e2a8188f6e9eaccb5e1c1bd7b9d5af79429c0c (patch)
tree6abb03907d0eeaa5f343e3927ef6d9e619e6f079
parent038163fa87d5b41503c721bb097faea6b25661c9 (diff)
2005-02-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* 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.
-rw-r--r--lib/ChangeLog6
-rw-r--r--lib/network.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index ac05baba..40e73ff7 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * 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.
+
2005-02-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* stream.h: Declare new function stream_read_try suitable for use
diff --git a/lib/network.h b/lib/network.h
index 589b80e9..9333ef81 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 */