static long runId = 0;
static long runIdOld = 0;
- long timeoffset = 1200000000; /* seconds */
- long sizelimit = 100; /* bytes (MB) */
- int fileSize = 0;
+ long timeoffset = 1200000000; /* seconds */
+ unsigned long maxFileSize = 1500; /* MBytes */
+ long currentFileSize = 0;
int status = 0;
struct timeval tv;
}
else{
- fileSize = psub->a; /* size (MB) of the data file written by event builder */
+ currentFileSize = psub->a; /* size (MB) of the data file written by event builder */
status = (int) psub->b; /* status of the event buidler (1=on/0=off) */
if( status == 0 ) {
if( genrunidDebug ) {
printf( "<D> genrunid.c: Event Builder is off, status: %d\n", status );
- printf( "<D> genrunid.c: You might check permissions of EB shared memory segment.\n");
+ printf( "<D> genrunid.c: You might need to check permissions of EB shared memory segment.\n");
/*
* One of the reasons for this message might be closed permissions
* for (/dev/shm/daq_evtbuild.shm) shared memory access.
runId = 0;
}
+ /* Get max file size limit in MBytes */
+ maxFileSize = strtoul(getenv("FILESIZE"), NULL, 0);
+
if( genrunidDebug )
- printf( "<D> genrunid.c: received file size: %d\n", fileSize );
+ printf( "<D> genrunid.c: bytes written to a file: %lu\n", maxFileSize );
- if( fileSize < sizelimit ){
+ if( currentFileSize <= maxFileSize ){
runIdOld = runId;
}
/* Generate RUN Id: time (in sec from 1970) minus timeoffset */
if( (runId == 0 && status) ||
- (fileSize > sizelimit && runIdOld == runId && runId > 0 && status) ) {
+ (currentFileSize > maxFileSize && runIdOld == runId && runId > 0 && status) ) {
/*
* The following line is executed only ONCE