Use /proc/self/mount instead of /proc/mounts, which is a symbolic link
to the former. The symbolic link creation can be traced back to Linux
Kernel commit
59c7572e82d6 ("proc: remove fs/proc/proc_misc.c"). Also,
the /proc/mounts are not available in the cases where the /proc is
mounted with subset=pid option.
As per kernel docs filesystems/procs.rst:
"subset=pid hides all top level files and directories in the procfs that
are not related to tasks."
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
}
/*
- * Reads /proc/mounts and populates the cgroup v1/v2 mount points into the
+ * Reads /proc/self/mounts and populates the cgroup v1/v2 mount points into the
* global cg_mount_table.
* This function should be called with cg_mount_table_lock taken.
*/
FILE *proc_mount;
int ret = 0;
- proc_mount = fopen("/proc/mounts", "re");
+ proc_mount = fopen("/proc/self/mounts", "re");
if (proc_mount == NULL) {
- cgroup_err("cannot open /proc/mounts: %s\n", strerror(errno));
+ cgroup_err("cannot open /proc/self/mounts: %s\n", strerror(errno));
last_errno = errno;
ret = ECGOTHER;
goto err;
FILE *proc_mount = NULL;
int ret = 1;
- proc_mount = fopen("/proc/mounts", "re");
+ proc_mount = fopen("/proc/self/mounts", "re");
if (proc_mount == NULL)
return 0;