summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'liblog/logd_reader.c')
-rw-r--r--liblog/logd_reader.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/liblog/logd_reader.c b/liblog/logd_reader.c
index 600f4bb0b..603ba2469 100644
--- a/liblog/logd_reader.c
+++ b/liblog/logd_reader.c
@@ -590,20 +590,30 @@ static int logdRead(struct android_log_logger_list* logger_list,
590 590
591 memset(log_msg, 0, sizeof(*log_msg)); 591 memset(log_msg, 0, sizeof(*log_msg));
592 592
593 unsigned int new_alarm = 0;
593 if (logger_list->mode & ANDROID_LOG_NONBLOCK) { 594 if (logger_list->mode & ANDROID_LOG_NONBLOCK) {
595 if ((logger_list->mode & ANDROID_LOG_WRAP) &&
596 (logger_list->start.tv_sec || logger_list->start.tv_nsec)) {
597 /* b/64143705 */
598 new_alarm = (ANDROID_LOG_WRAP_DEFAULT_TIMEOUT * 11) / 10 + 10;
599 logger_list->mode &= ~ANDROID_LOG_WRAP;
600 } else {
601 new_alarm = 30;
602 }
603
594 memset(&ignore, 0, sizeof(ignore)); 604 memset(&ignore, 0, sizeof(ignore));
595 ignore.sa_handler = caught_signal; 605 ignore.sa_handler = caught_signal;
596 sigemptyset(&ignore.sa_mask); 606 sigemptyset(&ignore.sa_mask);
597 /* particularily useful if tombstone is reporting for logd */ 607 /* particularily useful if tombstone is reporting for logd */
598 sigaction(SIGALRM, &ignore, &old_sigaction); 608 sigaction(SIGALRM, &ignore, &old_sigaction);
599 old_alarm = alarm(30); 609 old_alarm = alarm(new_alarm);
600 } 610 }
601 611
602 /* NOTE: SOCK_SEQPACKET guarantees we read exactly one full entry */ 612 /* NOTE: SOCK_SEQPACKET guarantees we read exactly one full entry */
603 ret = recv(ret, log_msg, LOGGER_ENTRY_MAX_LEN, 0); 613 ret = recv(ret, log_msg, LOGGER_ENTRY_MAX_LEN, 0);
604 e = errno; 614 e = errno;
605 615
606 if (logger_list->mode & ANDROID_LOG_NONBLOCK) { 616 if (new_alarm) {
607 if ((ret == 0) || (e == EINTR)) { 617 if ((ret == 0) || (e == EINTR)) {
608 e = EAGAIN; 618 e = EAGAIN;
609 ret = -1; 619 ret = -1;