File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1453,12 +1453,19 @@ impl std::iter::Iterator for TasksIter {
14531453///
14541454/// If a process can't be constructed for some reason, it won't be returned in the iterator.
14551455pub fn all_processes ( ) -> ProcResult < ProcessesIter > {
1456- let root = PathBuf :: from ( "/proc" ) ;
1456+ all_processes_with_root ( "/proc" )
1457+ }
1458+
1459+ /// Return a list of all processes based on a specified `/proc` path
1460+ ///
1461+ /// If a process can't be constructed for some reason, it won't be returned in the list.
1462+ pub fn all_processes_with_root ( root : impl AsRef < Path > ) -> ProcResult < ProcessesIter > {
1463+ let root = root. as_ref ( ) ;
14571464 let dir = wrap_io_error ! (
14581465 root,
14591466 rustix:: fs:: openat(
14601467 & rustix:: fs:: cwd( ) ,
1461- & root,
1468+ root,
14621469 OFlags :: RDONLY | OFlags :: DIRECTORY | OFlags :: CLOEXEC ,
14631470 Mode :: empty( )
14641471 )
You can’t perform that action at this time.
0 commit comments