summaryrefslogtreecommitdiff
path: root/src/include/os.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/os.h')
-rw-r--r--src/include/os.h43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/include/os.h b/src/include/os.h
index dd9b96f73a8..7a8e47ed81f 100644
--- a/src/include/os.h
+++ b/src/include/os.h
@@ -6,28 +6,32 @@
* See the file LICENSE for redistribution information.
*/
+#define WT_SYSCALL(call, ret) do { \
+ /* \
+ * A call returning 0 indicates success; any call where \
+ * 0 is not the only successful return must provide an \
+ * expression evaluating to 0 in all successful cases. \
+ */ \
+ if (((ret) = (call)) == 0) \
+ break; \
+ /* \
+ * The call's error was either returned by the call or \
+ * is in errno, and there are cases where it depends on \
+ * the software release as to which it is (for example, \
+ * posix_fadvise on FreeBSD and OS X). Failing calls \
+ * must either return a non-zero error value, or -1 if \
+ * the error value is in errno. (The WiredTiger errno \
+ * function returns WT_ERROR if errno is 0, which isn't \
+ * ideal but won't discard the failure.) \
+ */ \
+ if ((ret) == -1) \
+ (ret) = __wt_errno(); \
+} while (0)
+
#define WT_SYSCALL_RETRY(call, ret) do { \
int __retry; \
for (__retry = 0; __retry < 10; ++__retry) { \
- /* \
- * A call returning 0 indicates success; any call where \
- * 0 is not the only successful return must provide an \
- * expression evaluating to 0 in all successful cases. \
- */ \
- if (((ret) = (call)) == 0) \
- break; \
- /* \
- * The call's error was either returned by the call or \
- * is in errno, and there are cases where it depends on \
- * the software release as to which it is (for example, \
- * posix_fadvise on FreeBSD and OS X). Failing calls \
- * must either return a non-zero error value, or -1 if \
- * the error value is in errno. (The WiredTiger errno \
- * function returns WT_ERROR if errno is 0, which isn't \
- * ideal but won't discard the failure.) \
- */ \
- if ((ret) == -1) \
- (ret) = __wt_errno(); \
+ WT_SYSCALL(call, ret); \
switch (ret) { \
case EAGAIN: \
case EBUSY: \
@@ -132,7 +136,6 @@ struct __wt_file_handle_inmem {
TAILQ_ENTRY(__wt_file_handle_inmem) q; /* internal queue, hash queue */
TAILQ_ENTRY(__wt_file_handle_inmem) hashq;
- size_t off; /* Read/write offset */
WT_ITEM buf; /* Data */
u_int ref; /* Reference count */
};