Changeset fafc1ff for tools/tracesplit


Ignore:
Timestamp:
09/02/07 01:30:22 (14 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
cd1fd75
Parents:
d5760c3
Message:

Cleanup when we receive a signal to abort.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/tracesplit/tracesplit.c

    rcbce651 rfafc1ff  
    4343}
    4444
    45 int done=0;
     45volatile int done=0;
    4646
    4747static void cleanup_signal(int sig)
     
    5252int main(int argc, char *argv[])
    5353{
     54        /* All these variables are getting silly */
    5455        struct libtrace_filter_t *filter=NULL;
    5556        struct libtrace_out_t *output = NULL;
    5657        struct libtrace_t *input;
    5758        struct libtrace_packet_t *packet = trace_create_packet();
     59        struct sigaction sigact;
    5860        uint64_t count=UINT64_MAX;
    5961        uint64_t bytes=UINT64_MAX;
     
    128130        }
    129131
     132        sigact.sa_handler = cleanup_signal;
     133        sigact.sa_mask = 0;
     134        sigact.sa_flags = SA_RESTART;
     135
     136        sigaction(SIGINT, &sigact, NULL);
     137        sigaction(SIGTERM, &sigact, NULL);
     138
    130139        output=NULL;
    131140        input=trace_create(argv[optind]);
Note: See TracChangeset for help on using the changeset viewer.