version(linux)
void EnumProcessesLinux(void delegate(long) forEach) {
        import std.file;
        import std.algorithm;
        import std.ascii;
        import std.conv;
foreach(string name; dirEntries("/proc/", SpanMode.shallow)) {
                name = name["/proc/".length .. $];
                if(all!isDigit(name))
                        forEach(to!long(name));
        }
}

void main() {
        import std.stdio;
        EnumProcessesLinux((n) => writeln(n));
}


Not the same signature as the Windows function (the windows one is weird imo) but the same functionality - this will print the process ID of everything on the system.

Reply via email to