]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
filesize option works properly now. Sergey.
authorhadaq <hadaq>
Fri, 23 Jul 2010 13:45:02 +0000 (13:45 +0000)
committerhadaq <hadaq>
Fri, 23 Jul 2010 13:45:02 +0000 (13:45 +0000)
hadaq/evtbuild.c

index e1fbac239a6b172be1dbe9338c0916027a9f8523..9a59044941f6f3a0f8f07930a4bdcc07d7e3b403 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.122 2010-07-19 14:31:30 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.123 2010-07-23 13:45:02 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -581,7 +581,7 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
                        my->multiDisks = 1;
                        break;
                case 'z':                               /* from MBytes to Bytes */
-                       my->maxFileSz = (1024 * 1024UL * strtoul(optarg, NULL, 0));
+                       my->maxFileSz = (strtoul(optarg, NULL, 0) * 1024 * 1024UL - 1);
                        break;
                case 'e':                               /* need resnumevents & respath */
                        my->resdownscale = strtoul(optarg, NULL, 0);
@@ -669,7 +669,7 @@ static int argsCheck(TheArgs *my)
         */
 
        /* check my->maxFileSz */
-       if ((strcmp(my->outDev, "null") != 0) && (my->maxFileSz <= 0 || my->maxFileSz >= 1024 * 1024UL * 2000)) {
+       if ((strcmp(my->outDev, "null") != 0) && (my->maxFileSz <= 0 || my->maxFileSz >= 2 * 1024 * 1024 * 1024UL)) {
                fprintf(stderr, "<E> evtbuild.c, argsCheck(): --filesize must be >0MB and <2000MB\n");
                return 1;
        }
@@ -2367,7 +2367,7 @@ int main(int argc, char *argv[])
                 *           Something went wrong with sinchronization of Event Builders,
                 *           close the file.
                 */
-               if ((!(theArgs->epicsCtrl) && (*theStats->bytesWritten) >= ((theArgs->maxFileSz) - (theArgs->queueSize[0]))) ||
+               if ((!(theArgs->epicsCtrl) && (*theStats->bytesWritten) >= theArgs->maxFileSz) ||
                        (theArgs->epicsCtrl && runNr < newRunId) ||
                        (theArgs->epicsCtrl && (*theStats->bytesWritten) >= 1900000000) || (theArgs->epicsCtrl && newRunId == 0)) {
                        evt = newEvt(EvtDecoding_64bitAligned, EvtId_runStop);