3 ** Copyright 2007, The Android Open Source Project
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.
10 #ifndef _UTILS_LOGGER_H
11 #define _UTILS_LOGGER_H
16 * The userspace structure for version 1 of the logger_entry ABI.
17 * This structure is returned to userspace by the kernel logger
18 * driver unless an upgrade to a newer ABI version is requested.
21 uint16_t len
; /* length of the payload */
22 uint16_t __pad
; /* no matter what, we get 2 bytes of padding */
23 int32_t pid
; /* generating process's pid */
24 int32_t tid
; /* generating process's tid */
25 int32_t sec
; /* seconds since Epoch */
26 int32_t nsec
; /* nanoseconds */
27 char msg
[0]; /* the entry's payload */
31 * The userspace structure for version 2 of the logger_entry ABI.
32 * This structure is returned to userspace if ioctl(LOGGER_SET_VERSION)
33 * is called with version==2
35 struct logger_entry_v2
{
36 uint16_t len
; /* length of the payload */
37 uint16_t hdr_size
; /* sizeof(struct logger_entry_v2) */
38 int32_t pid
; /* generating process's pid */
39 int32_t tid
; /* generating process's tid */
40 int32_t sec
; /* seconds since Epoch */
41 int32_t nsec
; /* nanoseconds */
42 uint32_t euid
; /* effective UID of logger */
43 char msg
[0]; /* the entry's payload */
46 #define LOGGER_LOG_MAIN "alog/main"
47 #define LOGGER_LOG_RADIO "alog/radio"
48 #define LOGGER_LOG_EVENTS "alog/events"
49 #define LOGGER_LOG_SYSTEM "alog/system"
52 * The maximum size of the log entry payload that can be
53 * written to the kernel logger driver. An attempt to write
54 * more than this amount to /dev/log/* will result in a
55 * truncated log entry.
57 #define LOGGER_ENTRY_MAX_PAYLOAD 4076
60 * The maximum size of a log entry which can be read from the
61 * kernel logger driver. An attempt to read less than this amount
62 * may result in read() returning EINVAL.
64 #define LOGGER_ENTRY_MAX_LEN (5*1024)
68 #include <sys/ioctl.h>
70 #define __LOGGERIO 0xAE
72 #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */
73 #define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */
74 #define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */
75 #define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */
76 #define LOGGER_GET_VERSION _IO(__LOGGERIO, 5) /* abi version */
77 #define LOGGER_SET_VERSION _IO(__LOGGERIO, 6) /* abi version */
81 #endif /* _UTILS_LOGGER_H */