[CRIU] [PATCH] proc: Use fopen_proc instead of fopen("/proc...")

Pavel Emelyanov xemul at parallels.com
Wed Sep 17 05:41:31 PDT 2014


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 arch/aarch64/vdso.c | 2 +-
 arch/x86/vdso.c     | 2 +-
 proc_parse.c        | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/aarch64/vdso.c b/arch/aarch64/vdso.c
index 6a9c597..43d9637 100644
--- a/arch/aarch64/vdso.c
+++ b/arch/aarch64/vdso.c
@@ -214,7 +214,7 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
 
 	*s = (struct vdso_symtable)VDSO_SYMTABLE_INIT;
 
-	maps = fopen("/proc/self/maps", "r");
+	maps = fopen_proc(PROC_SELF, "maps");
 	if (!maps) {
 		pr_perror("Can't open self-vma");
 		return -1;
diff --git a/arch/x86/vdso.c b/arch/x86/vdso.c
index ac47a1e..c692cd6 100644
--- a/arch/x86/vdso.c
+++ b/arch/x86/vdso.c
@@ -208,7 +208,7 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
 
 	*s = (struct vdso_symtable)VDSO_SYMTABLE_INIT;
 
-	maps = fopen("/proc/self/maps", "r");
+	maps = fopen_proc(PROC_SELF, "maps");
 	if (!maps) {
 		pr_perror("Can't open self-vma");
 		return -1;
diff --git a/proc_parse.c b/proc_parse.c
index 24e3bc4..cd96e55 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -47,7 +47,7 @@ int parse_cpuinfo_features(int (*handler)(char *tok))
 {
 	FILE *cpuinfo;
 
-	cpuinfo = fopen("/proc/cpuinfo", "r");
+	cpuinfo = fopen_proc(PROC_GEN, "cpuinfo");
 	if (!cpuinfo) {
 		pr_perror("Can't open cpuinfo file");
 		return -1;
@@ -1477,7 +1477,7 @@ int parse_file_locks(void)
 	int	ret = 0;
 	bool	is_blocked;
 
-	fl_locks = fopen("/proc/locks", "r");
+	fl_locks = fopen_proc(PROC_GEN, "locks");
 	if (!fl_locks) {
 		pr_perror("Can't open file locks file!");
 		return -1;
@@ -1763,7 +1763,7 @@ int parse_cgroups(struct list_head *cgroups, unsigned int *n_cgroups)
 	int heirarchy, ret = 0;
 	struct cg_controller *cur = NULL;
 
-	f = fopen("/proc/cgroups", "r");
+	f = fopen_proc(PROC_GEN, "cgroups");
 	if (!f) {
 		pr_perror("failed opening /proc/cgroups");
 		return -1;
-- 
1.8.4.2




More information about the CRIU mailing list