Commit 929872d4 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pie: paresite -- Print error codes from syscalls

In case if we hit error returned from syscall, better
to print error code for easier understanding of the
protblem.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f0a86437
...@@ -90,7 +90,7 @@ static int dump_sigact(struct parasite_dump_sa_args *da) ...@@ -90,7 +90,7 @@ static int dump_sigact(struct parasite_dump_sa_args *da)
ret = sys_sigaction(sig, NULL, &da->sas[i], sizeof(k_rtsigset_t)); ret = sys_sigaction(sig, NULL, &da->sas[i], sizeof(k_rtsigset_t));
if (ret < 0) { if (ret < 0) {
pr_err("sys_sigaction failed\n"); pr_err("sys_sigaction failed (%d)\n", ret);
break; break;
} }
} }
...@@ -109,7 +109,7 @@ static int dump_itimers(struct parasite_dump_itimers_args *args) ...@@ -109,7 +109,7 @@ static int dump_itimers(struct parasite_dump_itimers_args *args)
ret = sys_getitimer(ITIMER_PROF, &args->prof); ret = sys_getitimer(ITIMER_PROF, &args->prof);
if (ret) if (ret)
pr_err("getitimer failed\n"); pr_err("getitimer failed (%d)\n", ret);
return ret; return ret;
} }
...@@ -122,13 +122,13 @@ static int dump_posix_timers(struct parasite_dump_posix_timers_args *args) ...@@ -122,13 +122,13 @@ static int dump_posix_timers(struct parasite_dump_posix_timers_args *args)
for(i = 0; i < args->timer_n; i++){ for(i = 0; i < args->timer_n; i++){
ret = sys_timer_gettime(args->timer[i].it_id, &args->timer[i].val); ret = sys_timer_gettime(args->timer[i].it_id, &args->timer[i].val);
if (ret < 0) { if (ret < 0) {
pr_err("sys_timer_gettime failed\n"); pr_err("sys_timer_gettime failed (%d)\n", ret);
return ret; return ret;
} }
args->timer[i].overrun = sys_timer_getoverrun(args->timer[i].it_id); args->timer[i].overrun = sys_timer_getoverrun(args->timer[i].it_id);
ret = args->timer[i].overrun; ret = args->timer[i].overrun;
if (ret < 0) { if (ret < 0) {
pr_err("sys_timer_getoverrun failed\n"); pr_err("sys_timer_getoverrun failed (%d)\n", ret);
return ret; return ret;
} }
} }
...@@ -201,7 +201,7 @@ static int drain_fds(struct parasite_drain_fd *args) ...@@ -201,7 +201,7 @@ static int drain_fds(struct parasite_drain_fd *args)
ret = send_fds(tsock, NULL, 0, ret = send_fds(tsock, NULL, 0,
args->fds, args->nr_fds, true); args->fds, args->nr_fds, true);
if (ret) if (ret)
pr_err("send_fds failed\n"); pr_err("send_fds failed (%d)\n", ret);
return ret; return ret;
} }
...@@ -220,7 +220,7 @@ static int parasite_get_proc_fd() ...@@ -220,7 +220,7 @@ static int parasite_get_proc_fd()
ret = sys_readlink("/proc/self", buf, sizeof(buf)); ret = sys_readlink("/proc/self", buf, sizeof(buf));
if (ret < 0 && ret != -ENOENT) { if (ret < 0 && ret != -ENOENT) {
pr_err("Can't readlink /proc/self\n"); pr_err("Can't readlink /proc/self (%d)\n", ret);
return ret; return ret;
} }
...@@ -230,13 +230,15 @@ static int parasite_get_proc_fd() ...@@ -230,13 +230,15 @@ static int parasite_get_proc_fd()
goto out_send_fd; goto out_send_fd;
} }
if (sys_mkdir(proc_mountpoint, 0700)) { ret = sys_mkdir(proc_mountpoint, 0700);
pr_err("Can't create a directory\n"); if (ret) {
pr_err("Can't create a directory (%d)\n", ret);
return -1; return -1;
} }
if (sys_mount("proc", proc_mountpoint, "proc", MS_MGC_VAL, NULL)) { ret = sys_mount("proc", proc_mountpoint, "proc", MS_MGC_VAL, NULL);
pr_err("mount failed\n"); if (ret) {
pr_err("mount failed (%d)\n", ret);
sys_rmdir(proc_mountpoint); sys_rmdir(proc_mountpoint);
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