사용
ps -o user,pid,ppid,command -ax | grep <process name>
모든 자식 프로세스 정보를 얻을 수 있습니다. 사실 popen()은 pipe()를 사용하여 명령을 실행합니다. 상기 매뉴얼 페이지
popen() 것은 명확는 popen이는 popen() 함수를 처리 execl 함수와 파이프와 포크를 사용한다는 통계
The environment of the executed command will be as if a
child process were created within the popen() call using
fork(2). If the application is standard-conforming (see
standards(5)), the child is invoked with the call:
execl("/usr/xpg4/bin/sh", "sh", "-c",command, (char *)0);
otherwise, the child is invoked with the call:
execl("/usr/bin/sh", "sh", "-c",command, (char *)0);
The pclose() function closes a stream opened by popen() by
closing the pipe. It waits for the associated process to
terminate and returns the termination status of the process
running the command language interpreter. This is the value
returned by waitpid(3C).
을 매뉴얼 페이지를 참조. 그래서 ps와 aux를 사용하여 모든 자식 프로세스 정보를 얻을 수 있습니다. 내 프로젝트가 많은 경우
아니 사람이 갈등한다 같은 이름을 가진 자식 프로세스. – quanrock
C/C++ 코드에서 명령을 실행하면 exec()와 함께 fork()를 사용해야합니다. – Saravanan