Merge pull request #39 from kubo39/epoll-cloexec
Set EPOLL_CLOEXEC to prevent fd leakage for command executation
This commit is contained in:
commit
c3fa500c3b
|
@ -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