Set EPOLL_CLOEXEC to prevent fd leakage for command executation
This is for the same reason #38
This commit is contained in:
parent
979640b074
commit
277743914b
|
@ -18,6 +18,9 @@ import core.sys.linux.epoll;
|
||||||
|
|
||||||
alias EpollEventDriver = PosixEventDriver!EpollEventLoop;
|
alias EpollEventDriver = PosixEventDriver!EpollEventLoop;
|
||||||
|
|
||||||
|
static if (!is(typeof(SOCK_CLOEXEC)))
|
||||||
|
enum SOCK_CLOEXEC = 0x80000;
|
||||||
|
|
||||||
final class EpollEventLoop : PosixEventLoop {
|
final class EpollEventLoop : PosixEventLoop {
|
||||||
@safe: nothrow:
|
@safe: nothrow:
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ final class EpollEventLoop : PosixEventLoop {
|
||||||
|
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
m_epoll = () @trusted { return epoll_create1(0); } ();
|
m_epoll = () @trusted { return epoll_create1(SOCK_CLOEXEC); } ();
|
||||||
m_events.length = 100;
|
m_events.length = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue