tcpdump mailing list archives

Pcap with multiple processes


From: Anuradha Ratnaweera <ARatnaweera () virtusa com>
Date: Tue, 11 Feb 2003 10:04:47 +0600


I have a multi-process applicataion which fork()s after a
pcap_open_live() (something similar to Apache 1.3).  It works fine, but
I wonder if things at kernel space still runs single threaded, thus
becoming a bottleneck.

Here is a simplified version of the code.  Error handling not shown.


    handle = pcap_open_live(interface_name, snaplen, 1, 0, errbuf));

    for (i = 0; i < num_children; i++)
        if ((pid = fork() == 0))
            break;

    /* Parent exits. */
    if (pid) return 0;

    pcap_loop(handle, 0, got_packet, NULL);


The question is, when the event handler got_packet() of one process is
running, can pcap_loop() of _another_ process call _its_ got_packet()?

Thanks in advance.

        Anuradha

-- 

Debian GNU/Linux (kernel 2.4.21-pre4)

One cannot make an omelette without breaking eggs -- but it is amazing
how many eggs one can break without making a decent omelette.
                -- Professor Charles P. Issawi

-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: