2012-04-13 4 views
0

안녕을 dpli_common.h 없습니다/SYS 내가이 프로그램을 컴파일하려고 :치명적인 오류가 : 그런 파일

#include <sys/types.h> 
    #include <sys/dlpi_ether.h> 
    #include <sys/dlpi_common.h> 
    #include <stropts.h> 
    #include <unistd.h> 

    int main(int argc,char *argv[]) 
{ 
    int fd, status; 
    struct strioctl strcmd; 
    unsigned char addr[6]; 
      fd = open(argv[1],0,0); 
    if (fd == -1) { 
     perror("enaddr: open"); 
     exit(1); 
    } 

    strcmd.ic_cmd = DLIOCGENADDR; 
    strcmd.ic_timout = 0; 
    strcmd.ic_len = sizeof(addr); 
    strcmd.ic_dp = addr; 

    status = ioctl(fd,I_STR,&strcmd); 
    if (status == -1) { 
     perror("enaddr: ioctl"); 
     exit(1); 
    } 

    printf("%02.2x:%02.2x:%02.2x:%02.2x:%02.2x:%02.2x\n",addr[0],addr[1],addr[2],addr[3],addr[4],addr[5]); 
} 

그리고 터미널 수익률이 치명적인 오류 :

prova.c : 3 : 30 : 치명적인 오류 : sys/dlpi_common.h : 해당 파일이나 디렉터리가 없습니다. 컴파일이 종료되었습니다.

왜? 이 도서관은 어디에 있습니까?

+0

'dlpi' 구성 요소가 시스템에 설치되어 있습니까? – wallyk

답변

0

은 시스템에서 불평하지 않는 dlpi_ether.h과 같은 위치에 있어야합니다.

C 자체보다는 오히려 당신이 작업하고있는 환경에 크게 의존하기 때문에 C 질문이 아닙니다. 우리가 말할 수있는 것은 그 헤더 파일이 없다는 것입니다. 당신이 OS와 같은 UNIX에서 경우

, 당신은 같은 그것을 찾고 갈 수 있습니다 : 그 헤더 파일이 아니라 기반으로, 모든 리눅스하지 않을 수 있습니다 것으로 나타

find /usr/include -name 'dlpi*.h' 

on this link 오라클 :

The code to read raw Ethernet is quite different between the Solaris OS and Linux (libpcap can also be used to examine the differences with other systems, such as FreeBSD, HP-UX, and AIX).

The applicable code in libpcap is at pcap-linux.c and pcap-dlpi.c. The DLPI code is used for Solaris, HP-UX, AIX, and other operating systems. Linux provides a mechanism for reading raw socket packets via the standard socket calls. The Solaris OS uses the getmsg(2) and putmsg(2) calls to receive and send DLPI packets.

+0

나는 민트 12가 있고 나는 이것을 가지고 있지 않다! – user1307697

관련 문제