The new std.process is ready for review
Lars T. Kyllingstad
public at kyllingen.net
Sat Mar 9 10:46:58 PST 2013
On Saturday, 9 March 2013 at 18:44:45 UTC, Lars T. Kyllingstad
wrote:
> On Saturday, 9 March 2013 at 18:35:25 UTC, Steven Schveighoffer
> wrote:
>> How do you loop over all open ones? Just curious :)
>
> You don't. That is why I said solution (3) sucks too. :) You
> have to loop over all possible non-std file descriptors, i.e.
> from 3 to the maximum number of open files. (On my Ubuntu
> installation, this is by default 1024, but may be as much as
> 4096. I don't know about other *NIXes)
>
> Here is how to do it:
>
> import core.sys.posix.unistd, core.sys.posix.sys.resource;
> rlimit r;
> getrlimit(RLIMIT_NOFILE, &r);
> for (int i = 0; i < r.rlim_cur; ++i)
> close(i);
BTW, core.sys.posix.sys.resource currently doesn't exist, we have
to create it.
Lars
More information about the Digitalmars-d
mailing list