You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now when I try to recvmsg from a unix socket to get file descriptors, they can be inherited by child processes. The only way to prevent that is to set CLOEXEC on them, but that is later than recovering them. I would like to be able to use MSG_CMSG_CLOEXEC as a MsgFlag when calling recvmsg( ), so that the file descriptors are not prone to race conditions.
(_addr, bs, cmsgs, flags) <- recvMsg sock 4096512memptylet newFds =concat [fs | c <- cmsgs, cmsgId c ==CmsgIdFds, Just fs <- [decodeCmsg c ::Maybe [Fd]]]
-- If another thread spawns a process at this timing, it will inherit the open file descriptors
forM_ newFds $\(Fd c) -> setCloseOnExecIfNeeded c
Activity