13 #include <boost/iterator/counting_iterator.hpp>
14 #include <boost/range/counting_range.hpp>
15 #include <boost/range/adaptor/filtered.hpp>
16 #include <boost/range/algorithm/for_each.hpp>
21 #ifndef BOOST_PROCESS_POSIX_MAX_FD
22 # define BOOST_PROCESS_POSIX_MAX_FD 32
28 template <
class Predicate>
32 static void close(
int fd)
34 ::fcntl(fd, F_SETFD, FD_CLOEXEC);
40 template <
class PosixExecutor>
44 boost::adaptors::filter(
45 boost::counting_range(0, upper_bound()),
53 static int upper_bound()
59 up = ::fcntl(0, F_MAXFD);
61 while (up == -1 && errno == EINTR);
64 up = ::sysconf(_SC_OPEN_MAX);
75 template <
class Predicate>