Commit 04f36aed authored by Andrey Vagin's avatar Andrey Vagin Committed by Cyrill Gorcunov

Set descriptors to restart a current syscall

If a task is sleep in syscall, it should be restared.
This logic is moved from kernel do_signal().
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 5a49b9e2
......@@ -556,6 +556,23 @@ static int get_task_regs(pid_t pid, struct core_entry *core)
jerr(ptrace(PTRACE_GETREGS, pid, NULL, &regs), err);
jerr(ptrace(PTRACE_GETFPREGS, pid, NULL, &fpregs), err);
/* Did we come from a system call? */
if (regs.orig_ax >= 0)
/* Restart the system call */
switch (regs.ax) {
case -ERESTARTNOHAND:
case -ERESTARTSYS:
case -ERESTARTNOINTR:
regs.ax = regs.orig_ax;
regs.ip -= 2;
break;
case -ERESTART_RESTARTBLOCK:
regs.ax = __NR_restart_syscall;
regs.ip -= 2;
break;
}
assign_reg(core->u.arch.gpregs, regs, r15);
assign_reg(core->u.arch.gpregs, regs, r14);
assign_reg(core->u.arch.gpregs, regs, r13);
......
......@@ -31,6 +31,7 @@
#define __NR_futex 202
#define __NR_set_thread_area 205
#define __NR_get_thread_area 211
#define __NR_restart_syscall 219
#else /* CONFIG_X86_64 */
# error x86-32 bit mode not yet implemented
......
......@@ -76,6 +76,11 @@
#define SIGMAX 32
#define ERESTARTSYS 512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514
#define ERESTART_RESTARTBLOCK 516
typedef uint64_t u64;
typedef int64_t s64;
typedef unsigned int u32;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment