]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Filesize before check for broken events increased, SIGHUP caught, sy mt
authorhadaq <hadaq>
Sat, 14 Apr 2007 21:49:37 +0000 (21:49 +0000)
committerhadaq <hadaq>
Sat, 14 Apr 2007 21:49:37 +0000 (21:49 +0000)
hadaq/evtbuild.c
hadaq/hldread.c
hadaq/worker.c
hadaq/worker.h

index 6fdec46be9a7f56c3057f5dcd64ee25d9c85ba11..41459572285b5d492a5bcd1d8ee3de1add3a7acc 100644 (file)
@@ -1,5 +1,5 @@
 static char *rcsId =
-  "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.76 2007-01-30 19:24:11 hadaq Exp $";
+  "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.77 2007-04-14 21:49:37 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -98,6 +98,8 @@ typedef struct TheStatsS
 
 static jmp_buf terminateJmp;
 
+
+
 void
 sigHandler (int sig)
 {
@@ -697,16 +699,17 @@ storeInfoStop (const char *n, time_t t, Worker * w)
 
 int 
 is_mismatch_enough_to_stop(TheArgs * theArgs, TheStats * my) {
-  unsigned long filesize_enough = (theArgs->maxFileSz) * 0.02;
+  /*unsigned long filesize_enough = (theArgs->maxFileSz) * 0.02;*/
+  unsigned long filesize_enough = (theArgs->maxFileSz) * 0.1;
   unsigned long discarded_enough = (*my->evtsComplete) * 0.03;
   unsigned long tagerror_enough = (*my->evtsComplete) * 0.03;
   if ((*my->bytesWritten) >= filesize_enough)
   {
     if ((*my->evtsDiscarded) > discarded_enough) 
     {
-     printf("Too many events is broken.\n");
+     printf("Too many events are broken.\n");
      printf("Debug Inf: filesize_enough: %u,fileWrittem: %u, DISCARDED_enough: %u, discarded: %u, all_events: %u\n",filesize_enough , (*my->bytesWritten),discarded_enough, (*my->evtsDiscarded), (*my->evtsComplete));
-     syslog (LOG_ERR, "Too many events is broken.\n");
+     syslog (LOG_ERR, "Too many events are broken.\n");
      syslog (LOG_ERR, "Debug Inf: filesize_enough: %u,fileWrittem: %u, DISCARDED_enough: %u, discarded: %u, all_events: %u\n",filesize_enough , (*my->bytesWritten),discarded_enough, (*my->evtsDiscarded), (*my->evtsComplete));
 #if BEAM
      system ("echo tagerror | netcat -w1 hadesdaq 12122");
@@ -715,9 +718,9 @@ is_mismatch_enough_to_stop(TheArgs * theArgs, TheStats * my) {
     }
     if ((*my->evtsTagError) > tagerror_enough) 
     {
-     printf("Too many TagError.\n");
+     printf("Too many TagErrors.\n");
      printf("Debug Inf: filesize_enough: %u,fileWrittem: %u, TAGERROR_enough: %u, tag_error: %u, all_events: %u\n",filesize_enough , (*my->bytesWritten),tagerror_enough, (*my->evtsTagError), (*my->evtsComplete));
-     syslog(LOG_ERR, "Too many TagError.\n");
+     syslog(LOG_ERR, "Too many TagErrors.\n");
      syslog(LOG_ERR, "Debug Inf: filesize_enough: %u,fileWrittem: %u, TAGERROR_enough: %u, tag_error: %u, all_events: %u\n",filesize_enough , (*my->bytesWritten),tagerror_enough, (*my->evtsTagError), (*my->evtsComplete));
 #if BEAM
      system ("echo tagerror | netcat -w1 hadesdaq 12122");
@@ -1309,6 +1312,11 @@ main (int argc, char *argv[])
   uint32_t currTrigTag;
   uint32_t currId;
 
+  signal(SIGINT, sigHandler);
+  signal(SIGTERM, sigHandler);
+  signal(SIGHUP, sigHandler);
+
+
   openlog (argv[0], LOG_PID | LOG_PERROR, LOG_LOCAL0);
   setlogmask (LOG_UPTO (LOG_INFO));
 
@@ -1393,8 +1401,10 @@ main (int argc, char *argv[])
   theStats->evtsDataError = Worker_addStatistic (worker, "evtsDataError");
   theStats->evtsTagError = Worker_addStatistic (worker, "evtsTagError");
   theStats->bytesWritten = Worker_addStatistic (worker, "bytesWritten");
+
   unsigned long *retVal = NULL;
-  theStats->evtsRes = &retVal;
+
+  theStats->evtsRes = (unsigned long *) &retVal;
   for (i = 0; i < NEVTIDS; i++)
     {
       char buf[WORKER_MAX_NAME_LEN];
index 51e108c7ae31b4f023c845d9060c4d953b7b52d4..4260809c596f515e2b9d4b8c989326c71b73748b 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/hldread.c,v 6.8 2003-05-14 13:54:43 muench Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/hldread.c,v 6.9 2007-04-14 21:49:37 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -48,11 +48,16 @@ static void atexit0(void)
        syslog(LOG_INFO, "%5u events processed %-30s", processedEvts, "");
 }
 
+
+
+
+
 void sigHandler(int sig)
 {
        exit(128 + sig);
 }
 
+
 void alarmHandler(int x)
 {
        signal(SIGALRM, alarmHandler);
@@ -140,6 +145,7 @@ int main(int argc, char *argv[])
 
        signal(SIGINT, sigHandler);
        signal(SIGTERM, sigHandler);
+       signal(SIGHUP, sigHandler);
 
        signal(SIGALRM, alarmHandler);
        alarm(timeout);
index 93d94a9cd34402c18fdd6d5825b100d5140c5ae9..c7ad44d0c3a040b155496197619acfdc6d9c8bbe 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.28 2006-05-02 17:17:36 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.29 2007-04-14 21:49:37 hadaq Exp $";
 
 #define WORKER_NEW_PROTOCOL
 
@@ -123,11 +123,12 @@ static int closeStatShm(Worker *my)
 
 static int removeSigHandlers(Worker *my)
 {
-       return sigaction(my->signal0, my->oldSigAction0, NULL)
-               | sigaction(my->signal1, my->oldSigAction1, NULL);
+  return sigaction(my->signal0, my->oldSigAction0, NULL)
+    | sigaction(my->signal1, my->oldSigAction1, NULL) 
+    | sigaction(my->signal2, my->oldSigAction2, NULL);
 }
 
-static int installSigHandlers(Worker *my, int s0, int s1, void (*sigHandler) (int))
+static int installSigHandlers(Worker *my, int s0, int s1, int s2, void (*sigHandler) (int))
 {
        int retVal;
        struct sigaction actS, *act = &actS;
@@ -148,7 +149,15 @@ static int installSigHandlers(Worker *my, int s0, int s1, void (*sigHandler) (in
                syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
                my->oldSigAction1 = NULL;
        }
-       if (my->oldSigAction0 == NULL || my->oldSigAction1 == NULL) {
+
+       my->signal2 = s2;
+       my->oldSigAction2 = &my->oldSigAction2S;
+       if (0 > sigaction(my->signal2, act, my->oldSigAction2)) {
+               syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
+               my->oldSigAction2 = NULL;
+       }
+
+       if (my->oldSigAction0 == NULL || my->oldSigAction1 == NULL || my->oldSigAction2 == NULL) {
                removeSigHandlers(my);
                retVal = -1;
        } else {
@@ -171,7 +180,7 @@ Worker *Worker_initBegin(const char *name, void (*sigHandler) (int), int priorit
        my->pid = getpid();
        my->isStandalone = isStandalone;
 
-       if (-1 == installSigHandlers(my, SIGINT, SIGTERM, sigHandler)) {
+       if (-1 == installSigHandlers(my, SIGINT, SIGTERM, SIGHUP, sigHandler)) {
                syslog(LOG_DEBUG, "%s:%d: %s", __FILE__, __LINE__, strerror(errno));
                Worker_fini(my);
                retVal = NULL;
@@ -232,7 +241,7 @@ int Worker_start(const char *path, char *const argv[])
        strcpy(my->name, argv[0]);
 #ifndef WORKER_NEW_PROTOCOL
 
-       installSigHandlers(my, SIGCHLD, SIGUSR1, noopHandler);
+       installSigHandlers(my, SIGCHLD, SIGUSR1, SIGHUP , noopHandler);
 
 #endif
        my->pid = fork();
index 435f143076cfdcafd21e10153191661e2dce0909..5523389f1fe712b484abbbe7c83d453f8868b40a 100644 (file)
@@ -21,10 +21,13 @@ typedef struct WorkerS {
        char name[_POSIX_PATH_MAX];
        int signal0;
        int signal1;
+       int signal2;
        struct sigaction oldSigAction0S;
        struct sigaction *oldSigAction0;
        struct sigaction oldSigAction1S;
        struct sigaction *oldSigAction1;
+       struct sigaction oldSigAction2S;
+       struct sigaction *oldSigAction2;
        PsxShm *shm;
        Statistic *statistics;
        pid_t pid;