Skip to content

Commit

Permalink
Add event-processing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Prindeville committed Jan 21, 2024
1 parent 4ee7ce8 commit 7d19e17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/clixon/clixon_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#define CLIXON_DBG_NACM 0x000040 /* NACM processing */
#define CLIXON_DBG_PROC 0x000080 /* Process handling */
#define CLIXON_DBG_DATASTORE 0x000100 /* Datastore management */
#define CLIXON_DBG_EVENT 0x000200 /* Event processing */
#define CLIXON_DBG_SMASK 0x00ffff /* Subject mask */

/*
Expand Down
16 changes: 8 additions & 8 deletions lib/src/clixon_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ clixon_event_reg_fd(int fd,
e->e_type = EVENT_FD;
e->e_next = ee;
ee = e;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "registering %s", e->e_string);
clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "registering %s", e->e_string);
return 0;
}

Expand Down Expand Up @@ -293,7 +293,7 @@ clixon_event_reg_timeout(struct timeval t,
}
e->e_next = e1;
*e_prev = e;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", str);
clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "%s", str);
retval = 0;
done:
return retval;
Expand Down Expand Up @@ -409,7 +409,7 @@ clixon_event_loop(clixon_handle h)
* New select loop is called
* (3) Other signals result in an error and return -1.
*/
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "select: %s", strerror(errno));
clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "select: %s", strerror(errno));
if (clixon_exit_get() == 1){
clixon_err(OE_EVENTS, errno, "select");
retval = 0;
Expand All @@ -435,7 +435,7 @@ clixon_event_loop(clixon_handle h)
if (n==0){ /* Timeout */
e = ee_timers;
ee_timers = ee_timers->e_next;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "timeout: %s", e->e_string);
clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "timeout: %s", e->e_string);
if ((*e->e_fn)(0, e->e_arg) < 0){
free(e);
goto err;
Expand All @@ -449,9 +449,9 @@ clixon_event_loop(clixon_handle h)
}
e_next = e->e_next;
if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "FD_ISSET: %s", e->e_string);
clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "FD_ISSET: %s", e->e_string);
if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", e->e_string);
clixon_debug(CLIXON_DBG_EVENT, "Error in: %s", e->e_string);
goto err;
}
if (_ee_unreg){
Expand All @@ -463,12 +463,12 @@ clixon_event_loop(clixon_handle h)
clixon_exit_decr(); /* If exit is set and > 1, decrement it (and exit when 1) */
continue;
err:
clixon_debug(CLIXON_DBG_DEFAULT, "err");
clixon_debug(CLIXON_DBG_EVENT, "err");
break;
}
if (clixon_exit_get() == 1)
retval = 0;
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval);
clixon_debug(CLIXON_DBG_EVENT, "retval:%d", retval);
return retval;
}

Expand Down

0 comments on commit 7d19e17

Please sign in to comment.