logger.h revision e2bf2ea4d2846031edfc52b942ad53e5467243f6
1/* utils/logger.h 2** 3** Copyright 2007, The Android Open Source Project 4** 5** This file is dual licensed. It may be redistributed and/or modified 6** under the terms of the Apache 2.0 License OR version 2 of the GNU 7** General Public License. 8*/ 9 10#ifndef _UTILS_LOGGER_H 11#define _UTILS_LOGGER_H 12 13#include <stdint.h> 14 15struct logger_entry { 16 uint16_t len; /* length of the payload */ 17 uint16_t __pad; /* no matter what, we get 2 bytes of padding */ 18 int32_t pid; /* generating process's pid */ 19 int32_t tid; /* generating process's tid */ 20 int32_t sec; /* seconds since Epoch */ 21 int32_t nsec; /* nanoseconds */ 22 char msg[0]; /* the entry's payload */ 23}; 24 25#define LOGGER_LOG_MAIN "log/main" 26#define LOGGER_LOG_RADIO "log/radio" 27#define LOGGER_LOG_EVENTS "log/events" 28#define LOGGER_LOG_SYSTEM "log/system" 29 30#define LOGGER_ENTRY_MAX_LEN (4*1024) 31#define LOGGER_ENTRY_MAX_PAYLOAD \ 32 (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry)) 33 34#ifdef HAVE_IOCTL 35 36#include <sys/ioctl.h> 37 38#define __LOGGERIO 0xAE 39 40#define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ 41#define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */ 42#define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */ 43#define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */ 44 45#endif // HAVE_IOCTL 46 47#endif /* _UTILS_LOGGER_H */ 48