示例#1
0
 void pre_fork_parent(executor& e) const
 {
     {
         int pipe_fds[2] = {-1, -1};
         
         ::pipe(pipe_fds);
         
          m_read_end = ensure_user_fd_index(pipe_fds[0]); if( m_read_end != pipe_fds[0]) close(pipe_fds[0]);
         m_write_end = ensure_user_fd_index(pipe_fds[1]); if(m_write_end != pipe_fds[1]) close(pipe_fds[1]);
     }
     
     signal(SIGPIPE, SIG_IGN); // Who's to say this doesn't change elsewhere
     
     fcntl( m_read_end, F_SETFD, FD_CLOEXEC|fcntl( m_read_end, F_GETFD, 0)); 
     fcntl(m_write_end, F_SETFD, FD_CLOEXEC|fcntl(m_write_end, F_GETFD, 0));
     
     e.set_in_use(m_write_end); 
 }
示例#2
0
            void pre_fork_parent(executor& e) const
            {
                {
                    int pipe_fds[2] = {-1, -1};
                    
                    if(!::pipe(pipe_fds))
                    {
                        throw boost::system::system_error(boost::system::error_code(errno, boost::system::system_category()));
                    }

                     m_read_end = ensure_user_fd_index(pipe_fds[0]); if( m_read_end != pipe_fds[0]) close(pipe_fds[0]);
                    m_write_end = ensure_user_fd_index(pipe_fds[1]); if(m_write_end != pipe_fds[1]) close(pipe_fds[1]);
                }
                
                signal(SIGPIPE, SIG_IGN); // Who's to say this doesn't change elsewhere
                
                fcntl( m_read_end, F_SETFD, FD_CLOEXEC|fcntl( m_read_end, F_GETFD, 0)); 
                fcntl(m_write_end, F_SETFD, FD_CLOEXEC|fcntl(m_write_end, F_GETFD, 0));
                
                e.set_in_use(m_write_end); 
            }
示例#3
0
 void set_std_err(file_descriptor_type fd) { m_dupd_parent_std_err = ensure_user_fd_index(fd); }