Commit 8133ab41 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

parasite-syscall: Use pr_perror on prctl call failure

This prints more detailed error report.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 6f5859ec
...@@ -67,7 +67,7 @@ int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t * ...@@ -67,7 +67,7 @@ int __parasite_execute(struct parasite_ctl *ctl, pid_t pid, user_regs_struct_t *
again: again:
if (ptrace(PTRACE_SETREGS, pid, NULL, regs)) { if (ptrace(PTRACE_SETREGS, pid, NULL, regs)) {
pr_err("Can't set registers (pid: %d)\n", pid); pr_perror("Can't set registers (pid: %d)", pid);
goto err; goto err;
} }
...@@ -77,12 +77,12 @@ again: ...@@ -77,12 +77,12 @@ again:
*/ */
if (ptrace(PTRACE_CONT, pid, NULL, NULL)) { if (ptrace(PTRACE_CONT, pid, NULL, NULL)) {
pr_err("Can't continue (pid: %d)\n", pid); pr_perror("Can't continue (pid: %d)", pid);
goto err; goto err;
} }
if (wait4(pid, &status, __WALL, NULL) != pid) { if (wait4(pid, &status, __WALL, NULL) != pid) {
pr_err("Waited pid mismatch (pid: %d)\n", pid); pr_perror("Waited pid mismatch (pid: %d)", pid);
goto err; goto err;
} }
...@@ -92,12 +92,12 @@ again: ...@@ -92,12 +92,12 @@ again:
} }
if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo)) { if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo)) {
pr_err("Can't get siginfo (pid: %d)\n", pid); pr_perror("Can't get siginfo (pid: %d)", pid);
goto err; goto err;
} }
if (ptrace(PTRACE_GETREGS, pid, NULL, regs)) { if (ptrace(PTRACE_GETREGS, pid, NULL, regs)) {
pr_err("Can't obtain registers (pid: %d)\n", pid); pr_perror("Can't obtain registers (pid: %d)", pid);
goto err; goto err;
} }
...@@ -125,22 +125,22 @@ retry_signal: ...@@ -125,22 +125,22 @@ retry_signal:
*/ */
if (ptrace(PTRACE_SETREGS, pid, NULL, &ctl->regs_orig)) { if (ptrace(PTRACE_SETREGS, pid, NULL, &ctl->regs_orig)) {
pr_err("Can't set registers (pid: %d)\n", pid); pr_perror("Can't set registers (pid: %d)", pid);
goto err; goto err;
} }
if (ptrace(PTRACE_INTERRUPT, pid, NULL, NULL)) { if (ptrace(PTRACE_INTERRUPT, pid, NULL, NULL)) {
pr_err("Can't interrupt (pid: %d)\n", pid); pr_perror("Can't interrupt (pid: %d)", pid);
goto err; goto err;
} }
if (ptrace(PTRACE_CONT, pid, NULL, (void *)(unsigned long)siginfo.si_signo)) { if (ptrace(PTRACE_CONT, pid, NULL, (void *)(unsigned long)siginfo.si_signo)) {
pr_err("Can't continue (pid: %d)\n", pid); pr_perror("Can't continue (pid: %d)", pid);
goto err; goto err;
} }
if (wait4(pid, &status, __WALL, NULL) != pid) { if (wait4(pid, &status, __WALL, NULL) != pid) {
pr_err("Waited pid mismatch (pid: %d)\n", pid); pr_perror("Waited pid mismatch (pid: %d)", pid);
goto err; goto err;
} }
...@@ -150,7 +150,7 @@ retry_signal: ...@@ -150,7 +150,7 @@ retry_signal:
} }
if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo)) { if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo)) {
pr_err("Can't get siginfo (pid: %d)\n", pid); pr_perror("Can't get siginfo (pid: %d)", pid);
goto err; goto err;
} }
...@@ -164,7 +164,7 @@ retry_signal: ...@@ -164,7 +164,7 @@ retry_signal:
{ {
user_regs_struct_t r; user_regs_struct_t r;
if (ptrace(PTRACE_GETREGS, pid, NULL, &r)) { if (ptrace(PTRACE_GETREGS, pid, NULL, &r)) {
pr_err("Can't obtain registers (pid: %d)\n", pid); pr_perror("Can't obtain registers (pid: %d)", pid);
goto err; goto err;
} }
ctl->regs_orig = r; ctl->regs_orig = r;
...@@ -202,7 +202,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p ...@@ -202,7 +202,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
regs = ctl->regs_orig; regs = ctl->regs_orig;
else { else {
if (ptrace(PTRACE_GETREGS, pid, NULL, &regs_orig)) { if (ptrace(PTRACE_GETREGS, pid, NULL, &regs_orig)) {
pr_err("Can't obtain registers (pid: %d)\n", pid); pr_perror("Can't obtain registers (pid: %d)", pid);
return -1; return -1;
} }
regs = regs_orig; regs = regs_orig;
...@@ -221,7 +221,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p ...@@ -221,7 +221,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
if (ctl->pid != pid) if (ctl->pid != pid)
if (ptrace(PTRACE_SETREGS, pid, NULL, &regs_orig)) { if (ptrace(PTRACE_SETREGS, pid, NULL, &regs_orig)) {
pr_err("Can't restore registers (pid: %d)\n", ctl->pid); pr_perror("Can't restore registers (pid: %d)", ctl->pid);
return -1; return -1;
} }
......
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