Changeset 2cf30f6 for tools/tracestats


Ignore:
Timestamp:
09/02/07 01:44:31 (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:
52656ed
Parents:
cd1fd75
Message:

Add signal handling to more programs that could use it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/tracestats/tracestats.c

    rd242ea8 r2cf30f6  
    5151#include <getopt.h>
    5252#include <inttypes.h>
     53#include <signal.h>
    5354
    5455#include "libtrace.h"
     
    5960
    6061struct libtrace_t *trace;
     62
     63volatile static int done=0;
     64
     65static void cleanup_signal(int signal)
     66{
     67        done=1;
     68}
    6169
    6270struct filter_t {
     
    98106                        break;
    99107                }
     108               
     109                if (done)
     110                        break;
    100111
    101112                for(i=0;i<filter_count;++i) {
     
    138149
    139150        int i;
     151        struct sigaction sigact;
    140152
    141153        while(1) {
     
    173185        }
    174186
     187        sigact.sa_handler = cleanup_signal;
     188        sigemptyset(&sigact.sa_mask);
     189        sigact.sa_flags = SA_RESTART;
     190
     191        sigaction(SIGINT, &sigact, NULL);
     192        sigaction(SIGTERM, &sigact, NULL);
     193
    175194        for(i=optind;i<argc;++i) {
    176195                run_trace(argv[i]);
Note: See TracChangeset for help on using the changeset viewer.