Commit 3659d60a authored by Pavel Emelyanov's avatar Pavel Emelyanov

restore: Open /proc/sys/kernel/ns_last_pid via helpers

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
parent 0066d5e8
...@@ -109,7 +109,7 @@ static int check_ns_last_pid(void) ...@@ -109,7 +109,7 @@ static int check_ns_last_pid(void)
{ {
int ret; int ret;
ret = access(LAST_PID_PATH, W_OK); ret = access("/proc/" LAST_PID_PATH, W_OK);
if (!ret) if (!ret)
return 0; return 0;
......
...@@ -940,7 +940,7 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -940,7 +940,7 @@ static inline int fork_with_pid(struct pstree_item *item)
if (!(ca.clone_flags & CLONE_NEWPID)) { if (!(ca.clone_flags & CLONE_NEWPID)) {
char buf[32]; 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) { if (ca.fd < 0) {
pr_perror("%d: Can't open %s", pid, LAST_PID_PATH); pr_perror("%d: Can't open %s", pid, LAST_PID_PATH);
goto err; goto err;
...@@ -2608,7 +2608,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core) ...@@ -2608,7 +2608,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
* Open the last_pid syscl early, since restorer (maybe) lives * Open the last_pid syscl early, since restorer (maybe) lives
* in chroot and has no access to "/proc/..." paths. * 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) { if (task_args->fd_last_pid < 0) {
pr_perror("Can't open sys.ns_last_pid"); pr_perror("Can't open sys.ns_last_pid");
goto err; goto err;
......
...@@ -13,7 +13,7 @@ extern int check_img_inventory(void); ...@@ -13,7 +13,7 @@ extern int check_img_inventory(void);
extern int write_img_inventory(void); extern int write_img_inventory(void);
extern void kill_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_dump_tasks(pid_t pid);
extern int cr_pre_dump_tasks(pid_t pid); extern int cr_pre_dump_tasks(pid_t pid);
......
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