*: Convert thread_timer_remain_XXX to event_timer_remain_XXX

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-12-11 08:19:00 -05:00
parent 8c1186d38e
commit 4f830a0799
25 changed files with 85 additions and 87 deletions

View file

@ -2408,7 +2408,7 @@ DEFPY(show_bmp,
uptime[0] = '\0'; uptime[0] = '\0';
if (ba->t_timer) { if (ba->t_timer) {
long trem = thread_timer_remain_second( long trem = event_timer_remain_second(
ba->t_timer); ba->t_timer);
peer_uptime(monotime(NULL) - trem, peer_uptime(monotime(NULL) - trem,

View file

@ -1046,7 +1046,7 @@ void bgp_adjust_routeadv(struct peer *peer)
* (MRAI - m) < r * (MRAI - m) < r
*/ */
if (peer->t_routeadv) if (peer->t_routeadv)
remain = thread_timer_remain_second(peer->t_routeadv); remain = event_timer_remain_second(peer->t_routeadv);
else else
remain = peer->v_routeadv; remain = peer->v_routeadv;
diff = peer->v_routeadv - diff; diff = peer->v_routeadv - diff;

View file

@ -11105,7 +11105,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (path->peer->t_gr_restart && if (path->peer->t_gr_restart &&
CHECK_FLAG(path->flags, BGP_PATH_STALE)) { CHECK_FLAG(path->flags, BGP_PATH_STALE)) {
unsigned long gr_remaining = unsigned long gr_remaining =
thread_timer_remain_second(path->peer->t_gr_restart); event_timer_remain_second(path->peer->t_gr_restart);
if (json_paths) { if (json_paths) {
json_object_int_add(json_path, json_object_int_add(json_path,
@ -11121,7 +11121,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
bgp_attr_get_community(attr) && bgp_attr_get_community(attr) &&
community_include(bgp_attr_get_community(attr), community_include(bgp_attr_get_community(attr),
COMMUNITY_LLGR_STALE)) { COMMUNITY_LLGR_STALE)) {
unsigned long llgr_remaining = thread_timer_remain_second( unsigned long llgr_remaining = event_timer_remain_second(
path->peer->t_llgr_stale[afi][safi]); path->peer->t_llgr_stale[afi][safi]);
if (json_paths) { if (json_paths) {

View file

@ -12330,7 +12330,7 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
if (peer->t_gr_stale != NULL) { if (peer->t_gr_stale != NULL) {
json_object_int_add(json_timer, json_object_int_add(json_timer,
"stalePathTimerRemaining", "stalePathTimerRemaining",
thread_timer_remain_second( event_timer_remain_second(
peer->t_gr_stale)); peer->t_gr_stale));
} }
@ -12351,7 +12351,7 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
json_object_int_add( json_object_int_add(
json_timer, json_timer,
"selectionDeferralTimerRemaining", "selectionDeferralTimerRemaining",
thread_timer_remain_second( event_timer_remain_second(
peer->bgp->gr_info[afi][safi] peer->bgp->gr_info[afi][safi]
.t_select_deferral)); .t_select_deferral));
} }
@ -12364,7 +12364,7 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
if (peer->t_gr_stale != NULL) if (peer->t_gr_stale != NULL)
vty_out(vty, vty_out(vty,
" Stale Path Remaining(sec): %ld\n", " Stale Path Remaining(sec): %ld\n",
thread_timer_remain_second( event_timer_remain_second(
peer->t_gr_stale)); peer->t_gr_stale));
/* Display Configured Selection /* Display Configured Selection
* Deferral only when when * Deferral only when when
@ -12379,7 +12379,7 @@ static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
NULL) NULL)
vty_out(vty, vty_out(vty,
" Selection Deferral Time Remaining(sec): %ld\n", " Selection Deferral Time Remaining(sec): %ld\n",
thread_timer_remain_second( event_timer_remain_second(
peer->bgp->gr_info[afi][safi] peer->bgp->gr_info[afi][safi]
.t_select_deferral)); .t_select_deferral));
} }
@ -12413,7 +12413,7 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
if (p->t_gr_restart != NULL) if (p->t_gr_restart != NULL)
json_object_int_add( json_object_int_add(
json_timer, "restartTimerRemaining", json_timer, "restartTimerRemaining",
thread_timer_remain_second(p->t_gr_restart)); event_timer_remain_second(p->t_gr_restart));
json_object_object_add(json, "timers", json_timer); json_object_object_add(json, "timers", json_timer);
} else { } else {
@ -12426,10 +12426,10 @@ static void bgp_show_neighbor_graceful_restart_time(struct vty *vty,
p->v_gr_restart); p->v_gr_restart);
if (p->t_gr_restart != NULL) if (p->t_gr_restart != NULL)
vty_out(vty, " Restart Time Remaining(sec): %ld\n", vty_out(vty, " Restart Time Remaining(sec): %ld\n",
thread_timer_remain_second(p->t_gr_restart)); event_timer_remain_second(p->t_gr_restart));
if (p->t_gr_restart != NULL) { if (p->t_gr_restart != NULL) {
vty_out(vty, " Restart Time Remaining(sec): %ld\n", vty_out(vty, " Restart Time Remaining(sec): %ld\n",
thread_timer_remain_second(p->t_gr_restart)); event_timer_remain_second(p->t_gr_restart));
} }
} }
} }
@ -13464,7 +13464,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_object_int_add( json_object_int_add(
json_neigh, json_neigh,
"bgpTimerUntilConditionalAdvertisementsSec", "bgpTimerUntilConditionalAdvertisementsSec",
thread_timer_remain_second( event_timer_remain_second(
bgp->t_condition_check)); bgp->t_condition_check));
} else { } else {
/* Administrative shutdown. */ /* Administrative shutdown. */
@ -13544,7 +13544,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
if (thread_is_scheduled(bgp->t_condition_check)) if (thread_is_scheduled(bgp->t_condition_check))
vty_out(vty, vty_out(vty,
" Time until conditional advertisements begin is %lu seconds\n", " Time until conditional advertisements begin is %lu seconds\n",
thread_timer_remain_second( event_timer_remain_second(
bgp->t_condition_check)); bgp->t_condition_check));
} }
/* Capability. */ /* Capability. */
@ -14481,13 +14481,13 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
if (p->t_gr_restart) if (p->t_gr_restart)
json_object_int_add( json_object_int_add(
json_grace, "gracefulRestartTimerMsecs", json_grace, "gracefulRestartTimerMsecs",
thread_timer_remain_second(p->t_gr_restart) * event_timer_remain_second(p->t_gr_restart) *
1000); 1000);
if (p->t_gr_stale) if (p->t_gr_stale)
json_object_int_add( json_object_int_add(
json_grace, "gracefulStalepathTimerMsecs", json_grace, "gracefulStalepathTimerMsecs",
thread_timer_remain_second(p->t_gr_stale) * event_timer_remain_second(p->t_gr_stale) *
1000); 1000);
/* more gr info in new format */ /* more gr info in new format */
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, json_grace); BGP_SHOW_PEER_GR_CAPABILITY(vty, p, json_grace);
@ -14528,12 +14528,12 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
if (p->t_gr_restart) if (p->t_gr_restart)
vty_out(vty, vty_out(vty,
" The remaining time of restart timer is %ld\n", " The remaining time of restart timer is %ld\n",
thread_timer_remain_second(p->t_gr_restart)); event_timer_remain_second(p->t_gr_restart));
if (p->t_gr_stale) if (p->t_gr_stale)
vty_out(vty, vty_out(vty,
" The remaining time of stalepath timer is %ld\n", " The remaining time of stalepath timer is %ld\n",
thread_timer_remain_second(p->t_gr_stale)); event_timer_remain_second(p->t_gr_stale));
/* more gr info in new format */ /* more gr info in new format */
BGP_SHOW_PEER_GR_CAPABILITY(vty, p, NULL); BGP_SHOW_PEER_GR_CAPABILITY(vty, p, NULL);
@ -14767,13 +14767,14 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_neigh, "reducePrefixNumFrom"); json_neigh, "reducePrefixNumFrom");
json_object_int_add(json_neigh, json_object_int_add(json_neigh,
"restartInTimerMsec", "restartInTimerMsec",
thread_timer_remain_second( event_timer_remain_second(
p->t_pmax_restart) p->t_pmax_restart) *
* 1000); 1000);
} else } else
vty_out(vty, vty_out(vty,
" Reduce the no. of prefix from %s, will restart in %ld seconds\n", " Reduce the no. of prefix from %s, will restart in %ld seconds\n",
p->host, thread_timer_remain_second( p->host,
event_timer_remain_second(
p->t_pmax_restart)); p->t_pmax_restart));
} else { } else {
if (use_json) if (use_json)
@ -14926,19 +14927,18 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
if (p->t_start) if (p->t_start)
json_object_int_add( json_object_int_add(
json_neigh, "nextStartTimerDueInMsecs", json_neigh, "nextStartTimerDueInMsecs",
thread_timer_remain_second(p->t_start) * 1000); event_timer_remain_second(p->t_start) * 1000);
if (p->t_connect) if (p->t_connect)
json_object_int_add( json_object_int_add(
json_neigh, "nextConnectTimerDueInMsecs", json_neigh, "nextConnectTimerDueInMsecs",
thread_timer_remain_second(p->t_connect) event_timer_remain_second(p->t_connect) * 1000);
* 1000);
if (p->t_routeadv) { if (p->t_routeadv) {
json_object_int_add(json_neigh, "mraiInterval", json_object_int_add(json_neigh, "mraiInterval",
p->v_routeadv); p->v_routeadv);
json_object_int_add( json_object_int_add(
json_neigh, "mraiTimerExpireInMsecs", json_neigh, "mraiTimerExpireInMsecs",
thread_timer_remain_second(p->t_routeadv) event_timer_remain_second(p->t_routeadv) *
* 1000); 1000);
} }
if (p->password) if (p->password)
json_object_int_add(json_neigh, "authenticationEnabled", json_object_int_add(json_neigh, "authenticationEnabled",
@ -14967,15 +14967,15 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
} }
if (p->t_start) if (p->t_start)
vty_out(vty, "Next start timer due in %ld seconds\n", vty_out(vty, "Next start timer due in %ld seconds\n",
thread_timer_remain_second(p->t_start)); event_timer_remain_second(p->t_start));
if (p->t_connect) if (p->t_connect)
vty_out(vty, "Next connect timer due in %ld seconds\n", vty_out(vty, "Next connect timer due in %ld seconds\n",
thread_timer_remain_second(p->t_connect)); event_timer_remain_second(p->t_connect));
if (p->t_routeadv) if (p->t_routeadv)
vty_out(vty, vty_out(vty,
"MRAI (interval %u) timer expires in %ld seconds\n", "MRAI (interval %u) timer expires in %ld seconds\n",
p->v_routeadv, p->v_routeadv,
thread_timer_remain_second(p->t_routeadv)); event_timer_remain_second(p->t_routeadv));
if (p->password) if (p->password)
vty_out(vty, "Peer Authentication Enabled\n"); vty_out(vty, "Peer Authentication Enabled\n");
@ -18798,7 +18798,7 @@ static void bgp_config_end(void)
#define BGP_POST_CONFIG_DELAY_SECONDS 1 #define BGP_POST_CONFIG_DELAY_SECONDS 1
uint32_t bgp_post_config_delay = uint32_t bgp_post_config_delay =
thread_is_scheduled(bm->t_rmap_update) thread_is_scheduled(bm->t_rmap_update)
? thread_timer_remain_second(bm->t_rmap_update) ? event_timer_remain_second(bm->t_rmap_update)
: BGP_POST_CONFIG_DELAY_SECONDS; : BGP_POST_CONFIG_DELAY_SECONDS;
/* If BGP config processing thread isn't running, then /* If BGP config processing thread isn't running, then

View file

@ -743,7 +743,7 @@ static void rfapiMonitorTimerExpire(struct event *t)
static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m) static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m)
{ {
unsigned long remain = thread_timer_remain_second(m->timer); unsigned long remain = event_timer_remain_second(m->timer);
/* unexpected case, but avoid wraparound problems below */ /* unexpected case, but avoid wraparound problems below */
if (remain > m->rfd->response_lifetime) if (remain > m->rfd->response_lifetime)
@ -1051,7 +1051,7 @@ static void rfapiMonitorEthTimerExpire(struct event *t)
static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m) static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m)
{ {
unsigned long remain = thread_timer_remain_second(m->timer); unsigned long remain = event_timer_remain_second(m->timer);
/* unexpected case, but avoid wraparound problems below */ /* unexpected case, but avoid wraparound problems below */
if (remain > m->rfd->response_lifetime) if (remain > m->rfd->response_lifetime)

View file

@ -518,7 +518,7 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
&& bpi->extra->vnc.import.timer) { && bpi->extra->vnc.import.timer) {
struct event *t = (struct event *)bpi->extra->vnc.import.timer; struct event *t = (struct event *)bpi->extra->vnc.import.timer;
r = snprintf(p, REMAIN, " [%4lu] ", r = snprintf(p, REMAIN, " [%4lu] ",
thread_timer_remain_second(t)); event_timer_remain_second(t));
INCP; INCP;
} else { } else {
@ -909,7 +909,7 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match)
fp(out, "%-15s %-15s", "", ""); fp(out, "%-15s %-15s", "", "");
buf_remain[0] = 0; buf_remain[0] = 0;
rfapiFormatSeconds( rfapiFormatSeconds(
thread_timer_remain_second(m->timer), event_timer_remain_second(m->timer),
buf_remain, BUFSIZ); buf_remain, BUFSIZ);
fp(out, " %-15s %-10s\n", fp(out, " %-15s %-10s\n",
inet_ntop(m->p.family, &m->p.u.prefix, inet_ntop(m->p.family, &m->p.u.prefix,
@ -982,7 +982,7 @@ int rfapiShowVncQueries(void *stream, struct prefix *pfx_match)
} else } else
fp(out, "%-15s %-15s", "", ""); fp(out, "%-15s %-15s", "", "");
buf_remain[0] = 0; buf_remain[0] = 0;
rfapiFormatSeconds(thread_timer_remain_second( rfapiFormatSeconds(event_timer_remain_second(
mon_eth->timer), mon_eth->timer),
buf_remain, BUFSIZ); buf_remain, BUFSIZ);
fp(out, " %-17s %10d %-10s\n", fp(out, " %-17s %10d %-10s\n",
@ -1114,7 +1114,7 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
char buf_age[BUFSIZ]; char buf_age[BUFSIZ];
struct event *t = (struct event *)bpi->extra->vnc.import.timer; struct event *t = (struct event *)bpi->extra->vnc.import.timer;
remaining = thread_timer_remain_second(t); remaining = event_timer_remain_second(t);
#ifdef RFAPI_REGISTRATIONS_REPORT_AGE #ifdef RFAPI_REGISTRATIONS_REPORT_AGE
/* /*

View file

@ -192,7 +192,7 @@ void show_ip_eigrp_neighbor_sub(struct vty *vty, struct eigrp_neighbor *nbr,
vty_out(vty, "%-3u %-17pI4 %-21s", 0, &nbr->src, IF_NAME(nbr->ei)); vty_out(vty, "%-3u %-17pI4 %-21s", 0, &nbr->src, IF_NAME(nbr->ei));
if (nbr->t_holddown) if (nbr->t_holddown)
vty_out(vty, "%-7lu", vty_out(vty, "%-7lu",
thread_timer_remain_second(nbr->t_holddown)); event_timer_remain_second(nbr->t_holddown));
else else
vty_out(vty, "- "); vty_out(vty, "- ");
vty_out(vty, "%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME); vty_out(vty, "%-8u %-6u %-5u", 0, 0, EIGRP_PACKET_RETRANS_TIME);

View file

@ -575,8 +575,8 @@ static void isis_circuit_ldp_sync_print_vty(struct isis_circuit *circuit,
break; break;
case LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP: case LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP:
if (ldp_sync_info->t_holddown != NULL) { if (ldp_sync_info->t_holddown != NULL) {
struct timeval remain = thread_timer_remain( struct timeval remain =
ldp_sync_info->t_holddown); event_timer_remain(ldp_sync_info->t_holddown);
vty_out(vty, vty_out(vty,
" Holddown timer is running %lld.%03lld remaining\n", " Holddown timer is running %lld.%03lld remaining\n",
(long long)remain.tv_sec, (long long)remain.tv_sec,

View file

@ -1603,7 +1603,7 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level,
* Note: in case of a BFD 'down' message the refresh is * Note: in case of a BFD 'down' message the refresh is
* scheduled once again just to be sure * scheduled once again just to be sure
*/ */
struct timeval remain = thread_timer_remain( struct timeval remain = event_timer_remain(
area->t_lsp_refresh[lvl - 1]); area->t_lsp_refresh[lvl - 1]);
sched_debug( sched_debug(
"ISIS (%s): Regeneration is already pending, nothing todo. (Due in %lld.%03lld seconds)", "ISIS (%s): Regeneration is already pending, nothing todo. (Due in %lld.%03lld seconds)",
@ -1986,7 +1986,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level)
} }
if (circuit->lsp_regenerate_pending[lvl - 1]) { if (circuit->lsp_regenerate_pending[lvl - 1]) {
struct timeval remain = thread_timer_remain( struct timeval remain = event_timer_remain(
circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]);
sched_debug( sched_debug(
"ISIS (%s): Regenerate is already pending, nothing todo. (Due in %lld.%03lld seconds)", "ISIS (%s): Regenerate is already pending, nothing todo. (Due in %lld.%03lld seconds)",

View file

@ -2053,7 +2053,7 @@ static void _send_hello_sched(struct isis_circuit *circuit,
struct event **threadp, int level, long delay) struct event **threadp, int level, long delay)
{ {
if (*threadp) { if (*threadp) {
if (thread_timer_remain_msec(*threadp) < (unsigned long)delay) if (event_timer_remain_msec(*threadp) < (unsigned long)delay)
return; return;
THREAD_OFF(*threadp); THREAD_OFF(*threadp);

View file

@ -2250,7 +2250,7 @@ static void isis_spf_ietf_common(struct vty *vty, struct isis *isis)
vty_out(vty, " Level-%d:\n", level); vty_out(vty, " Level-%d:\n", level);
vty_out(vty, " SPF delay status: "); vty_out(vty, " SPF delay status: ");
if (area->spf_timer[level - 1]) { if (area->spf_timer[level - 1]) {
struct timeval remain = thread_timer_remain( struct timeval remain = event_timer_remain(
area->spf_timer[level - 1]); area->spf_timer[level - 1]);
vty_out(vty, "Pending, due in %lld msec\n", vty_out(vty, "Pending, due in %lld msec\n",
(long long)remain.tv_sec * 1000 (long long)remain.tv_sec * 1000

View file

@ -375,7 +375,7 @@ adj_to_ctl(struct adj *adj)
} }
actl.holdtime = adj->holdtime; actl.holdtime = adj->holdtime;
actl.holdtime_remaining = actl.holdtime_remaining =
thread_timer_remain_second(adj->inactivity_timer); event_timer_remain_second(adj->inactivity_timer);
actl.trans_addr = adj->trans_addr; actl.trans_addr = adj->trans_addr;
actl.ds_tlv = adj->ds_tlv; actl.ds_tlv = adj->ds_tlv;

View file

@ -533,7 +533,7 @@ ldp_sync_to_ctl(struct iface *iface)
ictl.timer_running = iface->ldp_sync.wait_for_sync_timer ? true : false; ictl.timer_running = iface->ldp_sync.wait_for_sync_timer ? true : false;
ictl.wait_time_remaining = ictl.wait_time_remaining =
thread_timer_remain_second(iface->ldp_sync.wait_for_sync_timer); event_timer_remain_second(iface->ldp_sync.wait_for_sync_timer);
memset(&ictl.peer_ldp_id, 0, sizeof(ictl.peer_ldp_id)); memset(&ictl.peer_ldp_id, 0, sizeof(ictl.peer_ldp_id));

View file

@ -835,7 +835,7 @@ nbr_to_ctl(struct nbr *nbr)
nctl.flags = nbr->flags; nctl.flags = nbr->flags;
nctl.max_pdu_len = nbr->max_pdu_len; nctl.max_pdu_len = nbr->max_pdu_len;
nctl.hold_time_remaining = nctl.hold_time_remaining =
thread_timer_remain_second(nbr->keepalive_timer); event_timer_remain_second(nbr->keepalive_timer);
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
if (nbr->state == NBR_STA_OPER) { if (nbr->state == NBR_STA_OPER) {

View file

@ -733,7 +733,7 @@ void thread_master_free(struct thread_master *m)
} }
/* Return remain time in milliseconds. */ /* Return remain time in milliseconds. */
unsigned long thread_timer_remain_msec(struct event *thread) unsigned long event_timer_remain_msec(struct event *thread)
{ {
int64_t remain; int64_t remain;
@ -748,12 +748,12 @@ unsigned long thread_timer_remain_msec(struct event *thread)
} }
/* Return remain time in seconds. */ /* Return remain time in seconds. */
unsigned long thread_timer_remain_second(struct event *thread) unsigned long event_timer_remain_second(struct event *thread)
{ {
return thread_timer_remain_msec(thread) / 1000LL; return event_timer_remain_msec(thread) / 1000LL;
} }
struct timeval thread_timer_remain(struct event *thread) struct timeval event_timer_remain(struct event *thread)
{ {
struct timeval remain; struct timeval remain;
frr_with_mutex (&thread->mtx) { frr_with_mutex (&thread->mtx) {
@ -783,8 +783,7 @@ static int time_hhmmss(char *buf, int buf_size, long sec)
char *thread_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer) char *thread_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer)
{ {
if (t_timer) { if (t_timer) {
time_hhmmss(buf, buf_size, time_hhmmss(buf, buf_size, event_timer_remain_second(t_timer));
thread_timer_remain_second(t_timer));
} else { } else {
snprintf(buf, buf_size, "--:--:--"); snprintf(buf, buf_size, "--:--:--");
} }

View file

@ -251,9 +251,9 @@ extern void event_cancel_event_ready(struct thread_master *m, void *arg);
extern void event_cancel_event(struct thread_master *m, void *arg); extern void event_cancel_event(struct thread_master *m, void *arg);
extern struct event *event_fetch(struct thread_master *, struct event *event); extern struct event *event_fetch(struct thread_master *, struct event *event);
extern void event_call(struct event *event); extern void event_call(struct event *event);
extern unsigned long thread_timer_remain_second(struct event *event); extern unsigned long event_timer_remain_second(struct event *event);
extern struct timeval thread_timer_remain(struct event *event); extern struct timeval event_timer_remain(struct event *event);
extern unsigned long thread_timer_remain_msec(struct event *event); extern unsigned long event_timer_remain_msec(struct event *event);
extern int thread_should_yield(struct event *event); extern int thread_should_yield(struct event *event);
/* set yield time for thread */ /* set yield time for thread */
extern void thread_set_yield_time(struct event *event, unsigned long); extern void thread_set_yield_time(struct event *event, unsigned long);

View file

@ -204,8 +204,7 @@ void spf_backoff_show(struct spf_backoff *backoff, struct vty *vty,
vty_out(vty, "%sHolddown timer: %ld msec\n", prefix, vty_out(vty, "%sHolddown timer: %ld msec\n", prefix,
backoff->holddown); backoff->holddown);
if (backoff->t_holddown) { if (backoff->t_holddown) {
struct timeval remain = struct timeval remain = event_timer_remain(backoff->t_holddown);
thread_timer_remain(backoff->t_holddown);
vty_out(vty, "%s Still runs for %lld msec\n", vty_out(vty, "%s Still runs for %lld msec\n",
prefix, prefix,
(long long)remain.tv_sec * 1000 (long long)remain.tv_sec * 1000
@ -218,7 +217,7 @@ void spf_backoff_show(struct spf_backoff *backoff, struct vty *vty,
backoff->timetolearn); backoff->timetolearn);
if (backoff->t_timetolearn) { if (backoff->t_timetolearn) {
struct timeval remain = struct timeval remain =
thread_timer_remain(backoff->t_timetolearn); event_timer_remain(backoff->t_timetolearn);
vty_out(vty, "%s Still runs for %lld msec\n", vty_out(vty, "%s Still runs for %lld msec\n",
prefix, prefix,
(long long)remain.tv_sec * 1000 (long long)remain.tv_sec * 1000

View file

@ -833,7 +833,7 @@ static void show_ospfv6_gr_helper_per_nbr(struct vty *vty, json_object *json,
vty_out(vty, " Actual Grace period : %d(in seconds)\n", vty_out(vty, " Actual Grace period : %d(in seconds)\n",
nbr->gr_helper_info.actual_grace_period); nbr->gr_helper_info.actual_grace_period);
vty_out(vty, " Remaining GraceTime:%ld(in seconds).\n", vty_out(vty, " Remaining GraceTime:%ld(in seconds).\n",
thread_timer_remain_second( event_timer_remain_second(
nbr->gr_helper_info.t_grace_timer)); nbr->gr_helper_info.t_grace_timer));
vty_out(vty, " Graceful Restart reason: %s.\n\n", vty_out(vty, " Graceful Restart reason: %s.\n\n",
ospf6_restart_reason_desc[nbr->gr_helper_info ospf6_restart_reason_desc[nbr->gr_helper_info
@ -850,7 +850,7 @@ static void show_ospfv6_gr_helper_per_nbr(struct vty *vty, json_object *json,
json_object_int_add(json_neigh, "actualGraceInterval", json_object_int_add(json_neigh, "actualGraceInterval",
nbr->gr_helper_info.actual_grace_period); nbr->gr_helper_info.actual_grace_period);
json_object_int_add(json_neigh, "remainGracetime", json_object_int_add(json_neigh, "remainGracetime",
thread_timer_remain_second( event_timer_remain_second(
nbr->gr_helper_info.t_grace_timer)); nbr->gr_helper_info.t_grace_timer));
json_object_string_add(json_neigh, "restartReason", json_object_string_add(json_neigh, "restartReason",
ospf6_restart_reason_desc[ ospf6_restart_reason_desc[

View file

@ -10136,7 +10136,7 @@ static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf,
.actual_grace_period); .actual_grace_period);
vty_out(vty, vty_out(vty,
" Remaining GraceTime:%ld(in seconds).\n", " Remaining GraceTime:%ld(in seconds).\n",
thread_timer_remain_second( event_timer_remain_second(
nbr->gr_helper_info nbr->gr_helper_info
.t_grace_timer)); .t_grace_timer));
vty_out(vty, vty_out(vty,
@ -10169,7 +10169,7 @@ static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf,
.actual_grace_period); .actual_grace_period);
json_object_int_add( json_object_int_add(
json_neigh, "remainGracetime", json_neigh, "remainGracetime",
thread_timer_remain_second( event_timer_remain_second(
nbr->gr_helper_info nbr->gr_helper_info
.t_grace_timer)); .t_grace_timer));
json_object_string_add( json_object_string_add(

View file

@ -1208,7 +1208,7 @@ static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg,
if (sg->t_sg_expire) { if (sg->t_sg_expire) {
struct timeval remain; struct timeval remain;
remain = thread_timer_remain(sg->t_sg_expire); remain = event_timer_remain(sg->t_sg_expire);
if (timercmp(&remain, &expire_wait, <=)) if (timercmp(&remain, &expire_wait, <=))
return; return;
@ -1316,7 +1316,7 @@ static void gm_handle_q_group(struct gm_if *gm_ifp,
if (pend) { if (pend) {
struct timeval remain; struct timeval remain;
remain = thread_timer_remain(pend->t_expire); remain = event_timer_remain(pend->t_expire);
if (timercmp(&remain, &timers->expire_wait, <=)) if (timercmp(&remain, &timers->expire_wait, <=))
return; return;

View file

@ -896,7 +896,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr,
previously received join message with holdtime=0xFFFF. previously received join message with holdtime=0xFFFF.
*/ */
if (ch->t_ifjoin_expiry_timer) { if (ch->t_ifjoin_expiry_timer) {
unsigned long remain = thread_timer_remain_second( unsigned long remain = event_timer_remain_second(
ch->t_ifjoin_expiry_timer); ch->t_ifjoin_expiry_timer);
if (remain > holdtime) { if (remain > holdtime) {
/* /*
@ -964,7 +964,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr,
pim_ifchannel_ifjoin_handler(ch, pim_ifp); pim_ifchannel_ifjoin_handler(ch, pim_ifp);
if (ch->t_ifjoin_expiry_timer) { if (ch->t_ifjoin_expiry_timer) {
unsigned long remain = thread_timer_remain_second( unsigned long remain = event_timer_remain_second(
ch->t_ifjoin_expiry_timer); ch->t_ifjoin_expiry_timer);
if (remain > holdtime) if (remain > holdtime)
@ -1087,7 +1087,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream,
* Join/Prune message. * Join/Prune message.
*/ */
if (ch->t_ifjoin_expiry_timer) { if (ch->t_ifjoin_expiry_timer) {
unsigned long rem = thread_timer_remain_second( unsigned long rem = event_timer_remain_second(
ch->t_ifjoin_expiry_timer); ch->t_ifjoin_expiry_timer);
if (rem > holdtime) if (rem > holdtime)

View file

@ -125,7 +125,7 @@ void pim_time_timer_to_mmss(char *buf, int buf_size, struct event *t_timer)
{ {
if (t_timer) { if (t_timer) {
pim_time_mmss(buf, buf_size, pim_time_mmss(buf, buf_size,
thread_timer_remain_second(t_timer)); event_timer_remain_second(t_timer));
} else { } else {
snprintf(buf, buf_size, "--:--"); snprintf(buf, buf_size, "--:--");
} }
@ -135,7 +135,7 @@ void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer)
{ {
if (t_timer) { if (t_timer) {
pim_time_hhmmss(buf, buf_size, pim_time_hhmmss(buf, buf_size,
thread_timer_remain_second(t_timer)); event_timer_remain_second(t_timer));
} else { } else {
snprintf(buf, buf_size, "--:--:--"); snprintf(buf, buf_size, "--:--:--");
} }
@ -160,5 +160,5 @@ long pim_time_timer_remain_msec(struct event *t_timer)
{ {
/* no timer thread running means timer has expired: return 0 */ /* no timer thread running means timer has expired: return 0 */
return t_timer ? thread_timer_remain_msec(t_timer) : 0; return t_timer ? event_timer_remain_msec(t_timer) : 0;
} }

View file

@ -2926,12 +2926,12 @@ static void rip_vty_out_uptime(struct vty *vty, struct rip_info *rinfo)
struct event *thread; struct event *thread;
if ((thread = rinfo->t_timeout) != NULL) { if ((thread = rinfo->t_timeout) != NULL) {
clock = thread_timer_remain_second(thread); clock = event_timer_remain_second(thread);
gmtime_r(&clock, &tm); gmtime_r(&clock, &tm);
strftime(timebuf, TIME_BUF, "%M:%S", &tm); strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf); vty_out(vty, "%5s", timebuf);
} else if ((thread = rinfo->t_garbage_collect) != NULL) { } else if ((thread = rinfo->t_garbage_collect) != NULL) {
clock = thread_timer_remain_second(thread); clock = event_timer_remain_second(thread);
gmtime_r(&clock, &tm); gmtime_r(&clock, &tm);
strftime(timebuf, TIME_BUF, "%M:%S", &tm); strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf); vty_out(vty, "%5s", timebuf);
@ -3106,7 +3106,7 @@ DEFUN (show_ip_rip_status,
vty_out(vty, " Sending updates every %u seconds with +/-50%%,", vty_out(vty, " Sending updates every %u seconds with +/-50%%,",
rip->update_time); rip->update_time);
vty_out(vty, " next due in %lu seconds\n", vty_out(vty, " next due in %lu seconds\n",
thread_timer_remain_second(rip->t_update)); event_timer_remain_second(rip->t_update));
vty_out(vty, " Timeout after %u seconds,", rip->timeout_time); vty_out(vty, " Timeout after %u seconds,", rip->timeout_time);
vty_out(vty, " garbage collect after %u seconds\n", rip->garbage_time); vty_out(vty, " garbage collect after %u seconds\n", rip->garbage_time);

View file

@ -877,18 +877,18 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from,
* but * but
* highly recommended". * highly recommended".
*/ */
if (!ripng->ecmp && !same && rinfo->metric == rte->metric if (!ripng->ecmp && !same && rinfo->metric == rte->metric &&
&& rinfo->t_timeout rinfo->t_timeout &&
&& (thread_timer_remain_second(rinfo->t_timeout) (event_timer_remain_second(rinfo->t_timeout) <
< (ripng->timeout_time / 2))) { (ripng->timeout_time / 2))) {
ripng_ecmp_replace(ripng, &newinfo); ripng_ecmp_replace(ripng, &newinfo);
} }
/* Next, compare the metrics. If the datagram is from the same /* Next, compare the metrics. If the datagram is from the same
router as the existing route, and the new metric is different router as the existing route, and the new metric is different
than the old one; or, if the new metric is lower than the old than the old one; or, if the new metric is lower than the old
one; do the following actions: */ one; do the following actions: */
else if ((same && rinfo->metric != rte->metric) else if ((same && rinfo->metric != rte->metric) ||
|| rte->metric < rinfo->metric) { rte->metric < rinfo->metric) {
if (listcount(list) == 1) { if (listcount(list) == 1) {
if (newinfo.metric != RIPNG_METRIC_INFINITY) if (newinfo.metric != RIPNG_METRIC_INFINITY)
ripng_ecmp_replace(ripng, &newinfo); ripng_ecmp_replace(ripng, &newinfo);
@ -1934,12 +1934,12 @@ static void ripng_vty_out_uptime(struct vty *vty, struct ripng_info *rinfo)
struct event *thread; struct event *thread;
if ((thread = rinfo->t_timeout) != NULL) { if ((thread = rinfo->t_timeout) != NULL) {
clock = thread_timer_remain_second(thread); clock = event_timer_remain_second(thread);
gmtime_r(&clock, &tm); gmtime_r(&clock, &tm);
strftime(timebuf, TIME_BUF, "%M:%S", &tm); strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf); vty_out(vty, "%5s", timebuf);
} else if ((thread = rinfo->t_garbage_collect) != NULL) { } else if ((thread = rinfo->t_garbage_collect) != NULL) {
clock = thread_timer_remain_second(thread); clock = event_timer_remain_second(thread);
gmtime_r(&clock, &tm); gmtime_r(&clock, &tm);
strftime(timebuf, TIME_BUF, "%M:%S", &tm); strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf); vty_out(vty, "%5s", timebuf);
@ -2128,7 +2128,7 @@ DEFUN (show_ipv6_ripng_status,
vty_out(vty, " Sending updates every %u seconds with +/-50%%,", vty_out(vty, " Sending updates every %u seconds with +/-50%%,",
ripng->update_time); ripng->update_time);
vty_out(vty, " next due in %lu seconds\n", vty_out(vty, " next due in %lu seconds\n",
thread_timer_remain_second(ripng->t_update)); event_timer_remain_second(ripng->t_update));
vty_out(vty, " Timeout after %u seconds,", ripng->timeout_time); vty_out(vty, " Timeout after %u seconds,", ripng->timeout_time);
vty_out(vty, " garbage collect after %u seconds\n", vty_out(vty, " garbage collect after %u seconds\n",
ripng->garbage_time); ripng->garbage_time);

View file

@ -1148,7 +1148,7 @@ static void zebra_show_stale_client_detail(struct vty *vty,
if (info->t_stale_removal) { if (info->t_stale_removal) {
vty_out(vty, vty_out(vty,
"Stale delete timer: %ld sec\n", "Stale delete timer: %ld sec\n",
thread_timer_remain_second( event_timer_remain_second(
info->t_stale_removal)); info->t_stale_removal));
} }
} }