#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <vector>
#include <dirent.h>
#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>
#define BUFF_SIZE 1024
static void GetAllFDs(std::vector<int> &fds)
{
DIR *dir = opendir("/proc/self/fd");
int dfd = dirfd(dir);
struct dirent *dp;
while (nullptr != (dp = readdir(dir)))
{
if (0 == strcmp(dp->d_name, ".") || 0 == strcmp(dp->d_name, "..") || 0 == strcmp(dp->d_name, "0") || 0 == strcmp(dp->d_name, "1") || 0 == strcmp(dp->d_name, "2"))
{
continue;
}
int
c++读写子进程
于 2021-08-16 00:35:35 首次发布