MCPcopy Create free account
hub / github.com/3rdparty/libprocess / cloexec

Function cloexec

src/posix/subprocess.hpp:186–210  ·  view source on GitHub ↗

This function will invoke `os::cloexec` on all specified file descriptors that are valid (i.e., not `None` and >= 0).

Source from the content-addressed store, hash-verified

184// This function will invoke `os::cloexec` on all specified file
185// descriptors that are valid (i.e., not `None` and >= 0).
186inline Try<Nothing> cloexec(
187 const InputFileDescriptors& stdinfds,
188 const OutputFileDescriptors& stdoutfds,
189 const OutputFileDescriptors& stderrfds)
190{
191 hashset<int> fds = {
192 stdinfds.read,
193 stdinfds.write.getOrElse(-1),
194 stdoutfds.read.getOrElse(-1),
195 stdoutfds.write,
196 stderrfds.read.getOrElse(-1),
197 stderrfds.write
198 };
199
200 foreach (int fd, fds) {
201 if (fd >= 0) {
202 Try<Nothing> cloexec = os::cloexec(fd);
203 if (cloexec.isError()) {
204 return Error(cloexec.error());
205 }
206 }
207 }
208
209 return Nothing();
210}
211
212
213// The main entry of the child process.

Callers 9

readFunction · 0.85
writeFunction · 0.85
redirectFunction · 0.85
subprocessFunction · 0.85
createMethod · 0.85
foreachFunction · 0.85
acceptMethod · 0.85
sendfileMethod · 0.85
listenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected