syscall: Implement a convinience function restart_syscall
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 13 May 2009 16:55:10 +0000 (16:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 May 2009 05:15:56 +0000 (22:15 -0700)
Currently when we have a signal pending we have the functionality
to restart that the current system call.  There are other cases
such as nasty lock ordering issues where it makes sense to have
a simple fix that uses try lock and restarts the system call.
Buying time to figure out how to rework the locking strategy.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sched.h

index b4c38bc8049cbbea17e0ca4f929f35df9cddbe1f..d853f6bb0baf4c4b72ad0800be09e3d4fbc31210 100644 (file)
@@ -2178,6 +2178,12 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
        return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
 }
 
+static inline int restart_syscall(void)
+{
+       set_tsk_thread_flag(current, TIF_SIGPENDING);
+       return -ERESTARTNOINTR;
+}
+
 static inline int signal_pending(struct task_struct *p)
 {
        return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));