数字电视-流媒体androidfans.blog.chinaunix.net
androidfans
我在互联网世界等候各位。。。。。
全部博文(26)
2015年(1)
2011年(4)
2010年(2)
2009年(19)
shanggua
xy1121
cynthia
xhlnb
boy_li
lypzpt
stuman
觋-拂晓
beatbupt
cracker
分类:
2009-11-10 20:22:00
static void readLogLines(int logfd) { char buffer[256] = {0}; while (1) { unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1] __attribute__((aligned(4))); struct logger_entry *entry = (struct logger_entry *) buf; int ret; ret = read(logfd, entry, LOGGER_ENTRY_MAX_LEN); if (ret < 0) { if (errno == EINTR) continue; if (errno == EAGAIN) break; perror("logcat read"); exit(EXIT_FAILURE); } else if (!ret) { fprintf(stderr, "read: Unexpected EOF!\n"); exit(EXIT_FAILURE); } /* NOTE: driver guarantees we read exactly one full entry */ entry->msg[entry->len] = '\0'; if (g_printBinary) { printBinary(entry); } else { (void) processBuffer(entry); } /*读入内核调试信息*/ if((ret = klogctl(9, buffer, sizeof(buffer))) > 0) { if((ret = klogctl(2, buffer, sizeof(buffer))) > 0) { entry->tid = 0; entry->pid = getpid(); /*priority*/ entry->msg[0] = ANDROID_LOG_INFO; /*tag*/ strcpy(entry->msg+1, KERNEL_TAG); /*message*/ strncpy(entry->msg+1+sizeof(KERNEL_TAG), buffer, ret); entry->len = 1 + sizeof(KERNEL_TAG) + ret + 1; entry->msg[entry->len] = '\0'; if (g_printBinary) { printBinary(entry); } else { (void) processBuffer(entry); } } } } }
上一篇:加快Android单模块编译
下一篇:Android IPC 机制详解
登录 注册