[CRIU] [PATCH 4/6] restore: Open /proc/sys/kernel/ns_last_pid via helpers
Pavel Emelyanov
xemul at parallels.com
Thu Jun 5 09:16:41 PDT 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-check.c | 2 +-
cr-restore.c | 4 ++--
include/crtools.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cr-check.c b/cr-check.c
index 605c655..875fe45 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -109,7 +109,7 @@ static int check_ns_last_pid(void)
{
int ret;
- ret = access(LAST_PID_PATH, W_OK);
+ ret = access("/proc/" LAST_PID_PATH, W_OK);
if (!ret)
return 0;
diff --git a/cr-restore.c b/cr-restore.c
index 9bc7791..37985d7 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -940,7 +940,7 @@ static inline int fork_with_pid(struct pstree_item *item)
if (!(ca.clone_flags & CLONE_NEWPID)) {
char buf[32];
- ca.fd = open(LAST_PID_PATH, O_RDWR);
+ ca.fd = open_proc_rw(PROC_GEN, LAST_PID_PATH);
if (ca.fd < 0) {
pr_perror("%d: Can't open %s", pid, LAST_PID_PATH);
goto err;
@@ -2608,7 +2608,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
* Open the last_pid syscl early, since restorer (maybe) lives
* in chroot and has no access to "/proc/..." paths.
*/
- task_args->fd_last_pid = open(LAST_PID_PATH, O_RDWR);
+ task_args->fd_last_pid = open_proc_rw(PROC_GEN, LAST_PID_PATH);
if (task_args->fd_last_pid < 0) {
pr_perror("Can't open sys.ns_last_pid");
goto err;
diff --git a/include/crtools.h b/include/crtools.h
index 06dd9c2..c4ae580 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -13,7 +13,7 @@ extern int check_img_inventory(void);
extern int write_img_inventory(void);
extern void kill_inventory(void);
-#define LAST_PID_PATH "/proc/sys/kernel/ns_last_pid"
+#define LAST_PID_PATH "sys/kernel/ns_last_pid"
extern int cr_dump_tasks(pid_t pid);
extern int cr_pre_dump_tasks(pid_t pid);
--
1.8.4.2
More information about the CRIU
mailing list