How to list all process directories under /proc/
Ky-Anh Huynh
saigon at example.net
Sun Sep 17 08:15:58 UTC 2017
Hi,
I want to list all processes by scanning /proc/. The following
code doesn't work
[code]
foreach (string fstatm; dirEntries("/proc/", "[0-9]*",
SpanMode.shallow)) {
writefln("pid %s", fstatm);
}
[/code]
as it only list a few entries before exiting
[code]
pid /proc/9
pid /proc/935
pid /proc/9146
pid /proc/9149
pid /proc/9150
pid /proc/9151
pid /proc/9756
pid /proc/9759
pid /proc/9760
pid /proc/9761
[/code]
I don't want to use `SpanMode.depth` or `SpanMode.breadth`
because it will scan so deeply and there would be a permission
problem.
Any ideas?
Thanks a lot
More information about the Digitalmars-d-learn
mailing list