Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 1 | /* include/linux/logger.h |
| 2 | * |
| 3 | * Copyright (C) 2007-2008 Google, Inc. |
| 4 | * Author: Robert Love <rlove@android.com> |
| 5 | * |
| 6 | * This software is licensed under the terms of the GNU General Public |
| 7 | * License version 2, as published by the Free Software Foundation, and |
| 8 | * may be copied, distributed, and modified under those terms. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #ifndef _LINUX_LOGGER_H |
| 18 | #define _LINUX_LOGGER_H |
| 19 | |
| 20 | #include <linux/types.h> |
| 21 | #include <linux/ioctl.h> |
| 22 | |
Cruz Julian Bishop | adb9136 | 2012-08-01 14:54:17 +1000 | [diff] [blame] | 23 | /** |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 24 | * struct user_logger_entry_compat - defines a single entry that is given to a logger |
Cruz Julian Bishop | adb9136 | 2012-08-01 14:54:17 +1000 | [diff] [blame] | 25 | * @len: The length of the payload |
| 26 | * @__pad: Two bytes of padding that appear to be required |
| 27 | * @pid: The generating process' process ID |
| 28 | * @tid: The generating process' thread ID |
| 29 | * @sec: The number of seconds that have elapsed since the Epoch |
| 30 | * @nsec: The number of nanoseconds that have elapsed since @sec |
| 31 | * @msg: The message that is to be logged |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 32 | * |
| 33 | * The userspace structure for version 1 of the logger_entry ABI. |
| 34 | * This structure is returned to userspace unless the caller requests |
| 35 | * an upgrade to a newer ABI version. |
Cruz Julian Bishop | adb9136 | 2012-08-01 14:54:17 +1000 | [diff] [blame] | 36 | */ |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 37 | struct user_logger_entry_compat { |
Cruz Julian Bishop | adb9136 | 2012-08-01 14:54:17 +1000 | [diff] [blame] | 38 | __u16 len; |
| 39 | __u16 __pad; |
| 40 | __s32 pid; |
| 41 | __s32 tid; |
| 42 | __s32 sec; |
| 43 | __s32 nsec; |
| 44 | char msg[0]; |
Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 45 | }; |
| 46 | |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 47 | /** |
| 48 | * struct logger_entry - defines a single entry that is given to a logger |
| 49 | * @len: The length of the payload |
| 50 | * @hdr_size: sizeof(struct logger_entry_v2) |
| 51 | * @pid: The generating process' process ID |
| 52 | * @tid: The generating process' thread ID |
| 53 | * @sec: The number of seconds that have elapsed since the Epoch |
| 54 | * @nsec: The number of nanoseconds that have elapsed since @sec |
| 55 | * @euid: Effective UID of logger |
| 56 | * @msg: The message that is to be logged |
| 57 | * |
| 58 | * The structure for version 2 of the logger_entry ABI. |
| 59 | * This structure is returned to userspace if ioctl(LOGGER_SET_VERSION) |
| 60 | * is called with version >= 2 |
| 61 | */ |
| 62 | struct logger_entry { |
| 63 | __u16 len; |
| 64 | __u16 hdr_size; |
| 65 | __s32 pid; |
| 66 | __s32 tid; |
| 67 | __s32 sec; |
| 68 | __s32 nsec; |
Xiong Zhou | bd47125 | 2013-05-08 18:52:48 +0800 | [diff] [blame] | 69 | kuid_t euid; |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 70 | char msg[0]; |
| 71 | }; |
| 72 | |
Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 73 | #define LOGGER_LOG_RADIO "log_radio" /* radio-related messages */ |
| 74 | #define LOGGER_LOG_EVENTS "log_events" /* system/hardware events */ |
San Mehat | 3537cda | 2010-02-23 16:09:47 -0800 | [diff] [blame] | 75 | #define LOGGER_LOG_SYSTEM "log_system" /* system/framework messages */ |
Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 76 | #define LOGGER_LOG_MAIN "log_main" /* everything else */ |
| 77 | |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 78 | #define LOGGER_ENTRY_MAX_PAYLOAD 4076 |
Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 79 | |
| 80 | #define __LOGGERIO 0xAE |
| 81 | |
| 82 | #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ |
| 83 | #define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */ |
| 84 | #define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */ |
| 85 | #define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */ |
Nick Kralevich | 0441bcf | 2013-02-26 22:07:37 -0800 | [diff] [blame] | 86 | #define LOGGER_GET_VERSION _IO(__LOGGERIO, 5) /* abi version */ |
| 87 | #define LOGGER_SET_VERSION _IO(__LOGGERIO, 6) /* abi version */ |
Greg Kroah-Hartman | 355b050 | 2011-11-30 20:18:14 +0900 | [diff] [blame] | 88 | |
| 89 | #endif /* _LINUX_LOGGER_H */ |