Changeset 2cf30f6 for tools/tracemerge


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/tracemerge/tracemerge.c

    re2d49d5 r2cf30f6  
    55#include <stdbool.h>
    66#include <getopt.h>
     7#include <signal.h>
    78
    89static void usage(char *argv0)
     
    1516        ,argv0);
    1617        exit(1);
     18}
     19
     20volatile int done=0;
     21
     22static void cleanup_signal(int sig)
     23{
     24        done=1;
    1725}
    1826
     
    2836        int i=0;
    2937        uint64_t last_ts=0;
     38        struct sigaction sigact;
    3039
    3140        while (1) {
     
    7281        }
    7382
     83        sigact.sa_handler = cleanup_signal;
     84        sigemptyset(&sigact.sa_mask);
     85        sigact.sa_flags = SA_RESTART;
     86
     87        sigaction(SIGINT,&sigact,NULL);
     88        sigaction(SIGTERM,&sigact,NULL);
     89
    7490        input=calloc((size_t)(argc-optind),sizeof(struct libtrace_t *));
    7591        packet=calloc((size_t)(argc-optind),sizeof(struct libtrace_packet_t *));
     
    97113                uint64_t oldest_ts=0;
    98114                int oldest=-1;
     115                if (done)
     116                        break;
    99117                for(i=0;i<argc-optind;++i) {
    100118                        if (!live[i] && input[i]) {
Note: See TracChangeset for help on using the changeset viewer.