Add helper functions to clear/restore syserror
* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
New prototypes.
* syscall.c (saved_u_error): New variable.
(temporarily_clear_syserror, restore_cleared_syserror): New functions.
* aio.c (sys_io_getevents): Use temporarily_clear_syserror
and restore_cleared_syserror.
* mq.c (sys_mq_timedreceive): Likewise.
* signal.c (sys_rt_sigtimedwait): Likewise.
diff --git a/syscall.c b/syscall.c
index b59388b..aaa44ea 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1131,6 +1131,21 @@
trace_syscall_exiting(tcp) : trace_syscall_entering(tcp);
}
+static int saved_u_error;
+
+void
+temporarily_clear_syserror(struct tcb *tcp)
+{
+ saved_u_error = tcp->u_error;
+ tcp->u_error = 0;
+}
+
+void
+restore_cleared_syserror(struct tcb *tcp)
+{
+ tcp->u_error = saved_u_error;
+}
+
/*
* Cannot rely on __kernel_[u]long_t being defined,
* it is quite a recent feature of <asm/posix_types.h>.