X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fmainloop.c;h=aeb79de479b0aa0cf0eb6f930c997116f2c13c15;hb=c4bf633211b0424492b5a3937d6a6d2e0d79a4cf;hp=99c8c872c5734c6069f54a2cfadb15ebb8258dc2;hpb=74f5c944644a9952717d49b7627127ec5d5a62f6;p=libucw.git diff --git a/lib/mainloop.c b/lib/mainloop.c index 99c8c872..aeb79de4 100644 --- a/lib/mainloop.c +++ b/lib/mainloop.c @@ -40,7 +40,7 @@ main_get_time(void) gettimeofday(&tv, NULL); main_now_seconds = tv.tv_sec; main_now = (timestamp_t)tv.tv_sec * 1000 + tv.tv_usec / 1000; - // DBG("It's %Ld o'clock", (long long) main_now); + // DBG("It's %lld o'clock", (long long) main_now); } void @@ -60,7 +60,7 @@ void timer_add(struct main_timer *tm, timestamp_t expires) { if (expires) - DBG("MAIN: Setting timer %p (expire at now+%Ld)", tm, (long long)(expires-main_now)); + DBG("MAIN: Setting timer %p (expire at now+%lld)", tm, (long long)(expires-main_now)); else DBG("MAIN: Clearing timer %p", tm); if (tm->expires) @@ -101,7 +101,7 @@ file_add(struct main_file *fi) main_file_cnt++; main_poll_table_obsolete = 1; if (fcntl(fi->fd, F_SETFL, O_NONBLOCK) < 0) - log(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd); + msg(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd); } void @@ -283,7 +283,6 @@ process_del(struct main_process *mp) int process_fork(struct main_process *mp) { - ASSERT(!mp->pid); pid_t pid = fork(); if (pid < 0) { @@ -308,25 +307,25 @@ void main_debug(void) { #ifdef CONFIG_DEBUG - log(L_DEBUG, "### Main loop status on %Ld", (long long)main_now); - log(L_DEBUG, "\tActive timers:"); + msg(L_DEBUG, "### Main loop status on %lld", (long long)main_now); + msg(L_DEBUG, "\tActive timers:"); struct main_timer *tm; CLIST_WALK(tm, main_timer_list) - log(L_DEBUG, "\t\t%p (expires %Ld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data); + msg(L_DEBUG, "\t\t%p (expires %lld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data); struct main_file *fi; - log(L_DEBUG, "\tActive files:"); + msg(L_DEBUG, "\tActive files:"); CLIST_WALK(fi, main_file_list) - log(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %Ld, data %p)", + msg(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %lld, data %p)", fi, fi->fd, fi->read_handler, fi->write_handler, fi->error_handler, (long long)(fi->timer.expires ? fi->timer.expires-main_now : 999999), fi->data); - log(L_DEBUG, "\tActive hooks:"); + msg(L_DEBUG, "\tActive hooks:"); struct main_hook *ho; CLIST_WALK(ho, main_hook_list) - log(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data); - log(L_DEBUG, "\tActive processes:"); + msg(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data); + msg(L_DEBUG, "\tActive processes:"); struct main_process *pr; CLIST_WALK(pr, main_process_list) - log(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data); + msg(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data); #endif } @@ -373,7 +372,7 @@ main_loop(void) timestamp_t wake = main_now + 1000000000; while ((tm = clist_head(&main_timer_list)) && tm->expires <= main_now) { - DBG("MAIN: Timer %p expired at now-%Ld", tm, (long long)(main_now - tm->expires)); + DBG("MAIN: Timer %p expired at now-%lld", tm, (long long)(main_now - tm->expires)); tm->handler(tm); } int hook_min = HOOK_RETRY;