src/dbs/atrshmlogreaderd_db.c
int read_fetch_and_transfer(mb_t* nb,
			    atrshmlog_int32_t i_version)
{
  int read_result ;
	      
  
  atrshmlog_int32_t fn;

  char* transferbuffer = nb->ob;

  atrshmlog_io_head_t* h = &nb->head;
  
  h->order[0] = (ATRSHMLOG_H_ORDER_IS_N_ORDER) ? 0 : 1;
  h->order[1] = (ATRSHMLOG_H_ORDER_IS_N_ORDER) ? 1 : 0;

  h->version = i_version;
  
  h->tlen = 0;

  volatile const void *a = ATRSHMLOG_GET_AREA();
  
  read_result = ATRSHMLOG_READ_FETCH(a,
				     &h->buffernumber,
				     transferbuffer,
				     &h->tlen,
				     &h->pid,
				     &h->tid,
				     &h->inittime,
				     &h->inittsc_before,
				     &h->inittsc_after,
				     &h->lasttime,
				     &h->lasttsc_before,
				     &h->lasttsc_after,
				     &h->difftimetransfer,
				     &h->starttransfer,
				     &h->acquiretime,
				     &h->id,
				     &h->number_dispatched,
				     &h->counter_write0,
				     &h->counter_write0_discard,
				     &h->counter_write0_wait,
				     &h->counter_write0_adaptive,
				     &h->counter_write0_adaptive_fast,
				     &h->counter_write0_adaptive_very_fast,
				     &h->counter_write1,
				     &h->counter_write1_discard,
				     &h->counter_write1_wait,
				     &h->counter_write1_adaptive,
				     &h->counter_write1_adaptive_fast,
				     &h->counter_write1_adaptive_very_fast,
				     &h->counter_write2,
				     &h->counter_write2_discard,
				     &h->counter_write2_wait,
				     &h->counter_write2_adaptive,
				     &h->counter_write2_adaptive_fast,
				     &h->counter_write2_adaptive_very_fast);
			       
  
  
  if (read_result < 0)
    {
      return -1;
    }

  if (read_result > 0 )
    {
      /* we had nothing to do, no buffers */
      return 1;
    }
  
  if (h->tlen > 0)
    {
      size_t lcount;

      lcount = (size_t)h->tlen;
          
      size_t maxbuffersize = ATRSHMLOG_GET_BUFFER_MAX_SIZE();

      if (lcount > 0 && lcount <=  maxbuffersize)
	{
	  h->filenumber = filenumber++;
  
	  return 0;
  
	}
      else
	{
	  return -2;
	}
    }
  else
    {
      // we signal all was ok, but nothing to do 
      return 1;
    }
}
/**
 * ok. we give it a free buffer. if it is successfull 
 * the buffer is used and it returns a value 0
 * if it was nothing there a 1 is given
 * if it is < 0 anerror hapens, the buffer is not used
 */
ok. we give it a free buffer. if it is successfull
the buffer is used and it returns a value 0
if it was nothing there a 1 is given
if it is < 0 anerror hapens, the buffer is not used
ok . we give it a free buffer . if it is successfull the buffer is used and it returns a value 0 if it was nothing there a 1 is given if it is < 0 anerror hapens the buffer is not used
int read_fetch_and_transfer(mb_t* nb,
			    atrshmlog_int32_t i_version)
{
  int read_result ;
  atrshmlog_int32_t fn;
  char* transferbuffer = nb->ob;
  atrshmlog_io_head_t* h = &nb->head;
  h->order[0] = (ATRSHMLOG_H_ORDER_IS_N_ORDER) ? 0 : 1;
  h->order[1] = (ATRSHMLOG_H_ORDER_IS_N_ORDER) ? 1 : 0;
  h->version = i_version;
  h->tlen = 0;
  volatile const void *a = ATRSHMLOG_GET_AREA();
  read_result = ATRSHMLOG_READ_FETCH(a,
				     &h->buffernumber,
				     transferbuffer,
				     &h->tlen,
				     &h->pid,
				     &h->tid,
				     &h->inittime,
				     &h->inittsc_before,
				     &h->inittsc_after,
				     &h->lasttime,
				     &h->lasttsc_before,
				     &h->lasttsc_after,
				     &h->difftimetransfer,
				     &h->starttransfer,
				     &h->acquiretime,
				     &h->id,
				     &h->number_dispatched,
				     &h->counter_write0,
				     &h->counter_write0_discard,
				     &h->counter_write0_wait,
				     &h->counter_write0_adaptive,
				     &h->counter_write0_adaptive_fast,
				     &h->counter_write0_adaptive_very_fast,
				     &h->counter_write1,
				     &h->counter_write1_discard,
				     &h->counter_write1_wait,
				     &h->counter_write1_adaptive,
				     &h->counter_write1_adaptive_fast,
				     &h->counter_write1_adaptive_very_fast,
				     &h->counter_write2,
				     &h->counter_write2_discard,
				     &h->counter_write2_wait,
				     &h->counter_write2_adaptive,
				     &h->counter_write2_adaptive_fast,
				     &h->counter_write2_adaptive_very_fast);
  if (read_result < 0)
    {
      return -1;
    }
  if (read_result > 0 )
    {
      return 1;
    }
  if (h->tlen > 0)
    {
      size_t lcount;
      lcount = (size_t)h->tlen;
      size_t maxbuffersize = ATRSHMLOG_GET_BUFFER_MAX_SIZE();
      if (lcount > 0 && lcount <=  maxbuffersize)
	{
	  h->filenumber = filenumber++;
	  return 0;
	}
      else
	{
	  return -2;
	}
    }
  else
    {
      return 1;
    }
}
int read_fetch_and_transfer ( mb_t * nb , atrshmlog_int32_t i_version ) { int read_result ; atrshmlog_int32_t fn ; char * transferbuffer = nb -> ob ; atrshmlog_io_head_t * h = & nb -> head ; h -> order [ 0 ] = ( ATRSHMLOG_H_ORDER_IS_N_ORDER ) ? 0 : 1 ; h -> order [ 1 ] = ( ATRSHMLOG_H_ORDER_IS_N_ORDER ) ? 1 : 0 ; h -> version = i_version ; h -> tlen = 0 ; volatile const void * a = ATRSHMLOG_GET_AREA ( ) ; read_result = ATRSHMLOG_READ_FETCH ( a , & h -> buffernumber , transferbuffer , & h -> tlen , & h -> pid , & h -> tid , & h -> inittime , & h -> inittsc_before , & h -> inittsc_after , & h -> lasttime , & h -> lasttsc_before , & h -> lasttsc_after , & h -> difftimetransfer , & h -> starttransfer , & h -> acquiretime , & h -> id , & h -> number_dispatched , & h -> counter_write0 , & h -> counter_write0_discard , & h -> counter_write0_wait , & h -> counter_write0_adaptive , & h -> counter_write0_adaptive_fast , & h -> counter_write0_adaptive_very_fast , & h -> counter_write1 , & h -> counter_write1_discard , & h -> counter_write1_wait , & h -> counter_write1_adaptive , & h -> counter_write1_adaptive_fast , & h -> counter_write1_adaptive_very_fast , & h -> counter_write2 , & h -> counter_write2_discard , & h -> counter_write2_wait , & h -> counter_write2_adaptive , & h -> counter_write2_adaptive_fast , & h -> counter_write2_adaptive_very_fast ) ; if ( read_result < 0 ) { return -1 ; } if ( read_result > 0 ) { return 1 ; } if ( h -> tlen > 0 ) { size_t lcount ; lcount = ( size_t ) h -> tlen ; size_t maxbuffersize = ATRSHMLOG_GET_BUFFER_MAX_SIZE ( ) ; if ( lcount > 0 && lcount <= maxbuffersize ) { h -> filenumber = filenumber ++ ; return 0 ; } else { return -2 ; } } else { return 1 ; } }
ok. we give it a free buffer.
ok . we give it a free buffer .
/* we had nothing to do, no buffers */ // we signal all was ok, but nothing to do 