> The question is this sample is programed to exit from loop > when the program received TERM signal. Could you please > teach me the way to program to exit right after line 16. > The problem of this sample is even if program received > TERM signal, pcap_dispatch() blockes until libpcap > recognize the next packet. I would like to make a program > unblock pcap_dispatch() when the program received TERM > signal. If you know the better way to exit the program > right after receiving TERM signal without receiving next > packet.
There's no way to unblock "pcap_dispatch()"; in order that it "not choke when we get ptraced", to quote the comment in the "pcap-bpf.c", "pcap-dlpi.c", and "pcap-snoop.c" code, "pcap_read()" ignores the EINTR that would be delivered by the TERM signal. That's why tcpdump's signal handler prints the capture summary if capturing from a device, and exits, rather than setting a flag and returning. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe
