|
|
@ -2016,7 +2016,8 @@ static void *logger(__maybe_unused void *arg) |
|
|
|
K_ITEM *lq_item; |
|
|
|
K_ITEM *lq_item; |
|
|
|
LOGQUEUE *lq; |
|
|
|
LOGQUEUE *lq; |
|
|
|
char buf[128]; |
|
|
|
char buf[128]; |
|
|
|
tv_t now; |
|
|
|
tv_t now, then; |
|
|
|
|
|
|
|
int count; |
|
|
|
|
|
|
|
|
|
|
|
pthread_detach(pthread_self()); |
|
|
|
pthread_detach(pthread_self()); |
|
|
|
|
|
|
|
|
|
|
@ -2051,18 +2052,26 @@ static void *logger(__maybe_unused void *arg) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
K_WLOCK(logqueue_free); |
|
|
|
K_WLOCK(logqueue_free); |
|
|
|
|
|
|
|
count = logqueue_store->count; |
|
|
|
setnow(&now); |
|
|
|
setnow(&now); |
|
|
|
snprintf(buf, sizeof(buf), "logstopping.%d.%ld,%ld", |
|
|
|
snprintf(buf, sizeof(buf), "logstopping.%d.%ld,%ld", |
|
|
|
logqueue_store->count, |
|
|
|
count, now.tv_sec, now.tv_usec); |
|
|
|
now.tv_sec, now.tv_usec); |
|
|
|
|
|
|
|
LOGFILE(buf); |
|
|
|
LOGFILE(buf); |
|
|
|
if (logqueue_store->count) |
|
|
|
if (count) |
|
|
|
LOGERR("%s", buf); |
|
|
|
LOGERR("%s", buf); |
|
|
|
lq_item = logqueue_store->head; |
|
|
|
lq_item = logqueue_store->head; |
|
|
|
|
|
|
|
copy_tv(&then, &now); |
|
|
|
while (lq_item) { |
|
|
|
while (lq_item) { |
|
|
|
DATA_LOGQUEUE(lq, lq_item); |
|
|
|
DATA_LOGQUEUE(lq, lq_item); |
|
|
|
LOGFILE(lq->msg); |
|
|
|
LOGFILE(lq->msg); |
|
|
|
free(lq->msg); |
|
|
|
free(lq->msg); |
|
|
|
|
|
|
|
count--; |
|
|
|
|
|
|
|
setnow(&now); |
|
|
|
|
|
|
|
if ((now.tv_sec - then.tv_sec) > 10) { |
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "logging ... %d", count); |
|
|
|
|
|
|
|
LOGERR("%s", buf); |
|
|
|
|
|
|
|
copy_tv(&then, &now); |
|
|
|
|
|
|
|
} |
|
|
|
lq_item = lq_item->next; |
|
|
|
lq_item = lq_item->next; |
|
|
|
} |
|
|
|
} |
|
|
|
K_WUNLOCK(logqueue_free); |
|
|
|
K_WUNLOCK(logqueue_free); |
|
|
@ -2073,6 +2082,7 @@ static void *logger(__maybe_unused void *arg) |
|
|
|
snprintf(buf, sizeof(buf), "logstop.%ld,%ld", |
|
|
|
snprintf(buf, sizeof(buf), "logstop.%ld,%ld", |
|
|
|
now.tv_sec, now.tv_usec); |
|
|
|
now.tv_sec, now.tv_usec); |
|
|
|
LOGFILE(buf); |
|
|
|
LOGFILE(buf); |
|
|
|
|
|
|
|
LOGWARNING("%s", buf); |
|
|
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|