stat-util: add simpler helper for checking if /proc/ is mounted

This commit is contained in:
Lennart Poettering
2020-04-23 14:51:08 +02:00
parent 6d965610bd
commit 883fff25f4
2 changed files with 14 additions and 0 deletions
+12
View File
@@ -376,3 +376,15 @@ int device_path_parse_major_minor(const char *path, mode_t *ret_mode, dev_t *ret
return 0;
}
int proc_mounted(void) {
int r;
/* A quick check of procfs is properly mounted */
r = path_is_fs_type("/proc/", PROC_SUPER_MAGIC);
if (r == -ENOENT) /* not mounted at all */
return false;
return r;
}