예제 #1
0
/*      Get number of events gotten by attachment     */
int et_attach_geteventsget(et_sys_id id, et_att_id att_id, uint64_t *events)
{
  et_id *etid = (et_id *) id;
  
  if (etid->locality == ET_REMOTE) {
      return etr_attach_geteventsget(id, att_id, events);
  }
  
  if (!et_alive(id)) {
      return ET_ERROR_DEAD;
  }
  
  /* Protection from (local) et_close() unmapping shared memory */
  et_memRead_lock(etid);

  /* Has caller already called et_close()? */
  if (etid->closed) {
      et_mem_unlock(etid);
      if (etid->debug >= ET_DEBUG_ERROR) {
          et_logmsg("ERROR", "et_attach_geteventsget, et id is closed\n");
      }
      return ET_ERROR_CLOSED;
  }
  
  if ((att_id < 0) || (att_id >= etid->sys->config.nattachments)) {
      et_mem_unlock(etid);
      if (etid->debug >= ET_DEBUG_ERROR) {
          et_logmsg("ERROR", "et_attach_geteventsget, bad attachment id\n");
      }
      return ET_ERROR;
  }
  
  if (events != NULL) {
      *events = etid->sys->attach[att_id].events_get;
  }
  
  et_mem_unlock(etid);
  return ET_OK;
}
예제 #2
0
/*      Get number of events gotten by attachment     */
int et_attach_geteventsget(et_sys_id id, et_att_id att_id,
                           uint64_t *events)
{
    return etr_attach_geteventsget(id, att_id, events);
}