logger.h revision dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0
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
29#define LOGGER_ENTRY_MAX_LEN		(4*1024)
30#define LOGGER_ENTRY_MAX_PAYLOAD	\
31	(LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))
32
33#ifdef HAVE_IOCTL
34
35#include <sys/ioctl.h>
36
37#define __LOGGERIO	0xAE
38
39#define LOGGER_GET_LOG_BUF_SIZE		_IO(__LOGGERIO, 1) /* size of log */
40#define LOGGER_GET_LOG_LEN		_IO(__LOGGERIO, 2) /* used log len */
41#define LOGGER_GET_NEXT_ENTRY_LEN	_IO(__LOGGERIO, 3) /* next entry len */
42#define LOGGER_FLUSH_LOG		_IO(__LOGGERIO, 4) /* flush log */
43
44#endif // HAVE_IOCTL
45
46#endif /* _UTILS_LOGGER_H */
47