stat-util: add simpler helper for checking if /proc/ is mounted
This commit is contained in:
parent
6d965610bd
commit
883fff25f4
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -87,3 +87,5 @@ int fd_verify_directory(int fd);
|
|||
int device_path_make_major_minor(mode_t mode, dev_t devno, char **ret);
|
||||
int device_path_make_canonical(mode_t mode, dev_t devno, char **ret);
|
||||
int device_path_parse_major_minor(const char *path, mode_t *ret_mode, dev_t *ret_devno);
|
||||
|
||||
int proc_mounted(void);
|
||||
|
|
Loading…
Reference in New Issue