Linux에 익숙하지 않습니다. 자식 프로세스를 기다리기 위해 waitid()를 사용하려고합니다. 나는 gcc를 사용하여 다음 줄을 포함하여 파일을 컴파일 할 때 다음 오류가 생성 된waitid() 및 P_PID로 컴파일 할 수 없습니다.
id_t cpid = fork();
siginfo_t status;
waitid(P_PID, cpid, &status, WEXITED);
을 :
error: ‘P_PID’ undeclared (first use in this function)
나는 다음과 같은 라이브러리를 포함
:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <time.h>
내가습니까을 뭔가보고 싶니?
WIFSIGNALED()
을 사용하여 siginfo_t
에서 정보를 검색하려면 어떻게해야합니까?
['waitid' 참고서 (http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitid.html)를 읽고 싶을 수도 있습니다. 올바른 헤더 파일을 포함하고 있지 않습니다. –
waitid()의 매뉴얼 페이지에 따르면 waitid()의 첫 번째 인수는 P_PID 또는 P_ALL 또는 P_GID 여야하며 waitid()의 사용법을 오해 했습니까? – user3545752
@ user3545752 :'#include ' –
Haris