//update the fields of the current event and go to the next event
err = skipEvent(t);
- if(err == ENOENT) return NULL;
+ if(err == ENOMEM) return NULL;
+ if(err == ENOENT) return lttEvent;
if(err == ERANGE) g_error("event id is out of range\n");
if(err)g_error("Can not read tracefile\n");
* 0 : success
* EINVAL : lseek fail
* EIO : can not read from the file
- * ENOENT : end of file
+ * ENOMEM : end of file
+ * ENOENT : last event
* ERANGE : event id is out of range
****************************************************************************/
void * evData;
LttEventType * evT;
LttField * rootFld;
+ static int evCount = 0;
+
+ if(evCount){
+ if(t->which_block == t->block_number &&
+ evCount == t->which_event){
+ return ENOMEM;
+ }else evCount = 0;
+ }
evId = (int)(*(uint16_t *)(t->cur_event_pos));
evData = t->cur_event_pos + EVENT_HEADER_SIZE;
//the next event is in the next block
if(evId == TRACE_BLOCK_END){
- if(t->which_block == t->block_number) return ENOENT;
+ if(t->which_block == t->block_number){
+ t->which_event++;
+ evCount = t->which_event;
+ return ENOENT;
+ }
err = readBlock(t, t->which_block + 1);
if(err) return err;
}else{