This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-variable-monitor/source/module/monitor_kernel.h

34 lines
980 B
C
Raw Normal View History

2023-11-16 17:39:26 +08:00
#include "monitor_kallsyms.h"
#include "monitor_mem.h"
2023-11-27 22:22:30 -05:00
#include "monitor_proc.h"
2023-11-16 17:39:26 +08:00
#include "monitor_timer.h"
#include "monitor_trace.h"
2023-11-16 13:17:49 +08:00
2023-12-05 00:48:37 -05:00
#include <linux/ioctl.h> // for ioctl
2023-11-27 20:59:18 -05:00
// ioctl
2023-12-05 00:48:37 -05:00
#define IOCTL_MAGIC_NUMBER 'k'
2023-11-27 20:51:25 -05:00
#define IOCTL_WATCH_VARIABLE 0
#define IOCTL_DUMP_LOG 1
2023-12-05 00:48:37 -05:00
#define IOCTL_PID _IOWR(IOCTL_MAGIC_NUMBER, 2, int)
2023-12-05 02:42:07 -05:00
#define IOCTL_TGID _IOWR(IOCTL_MAGIC_NUMBER, 3, int)
2023-11-27 20:51:25 -05:00
2023-11-27 22:22:30 -05:00
// default value
extern int def_interval_ns;
extern int dump_reset_sec;
2023-11-16 17:39:26 +08:00
extern mm_tree mm_tree_struct;
2023-11-27 15:16:35 +08:00
extern struct diag_variant_buffer load_monitor_variant_buffer; // global buffer
2023-12-12 11:50:10 +08:00
#define LOAD_MONITOR_BUFFER_SIZE 256 * 1024 * 1024 // 10MB
2023-11-16 13:17:49 +08:00
2023-11-27 22:22:30 -05:00
int monitor_init(void); // monitor init
2023-11-27 15:16:35 +08:00
void monitor_exit(void); // monitor exit
2023-11-16 13:17:49 +08:00
2023-11-27 15:16:35 +08:00
int start_watch_variable(watch_arg warg); // for open
2023-11-27 22:22:30 -05:00
void clear_watch(pid_t pid); // for release
2023-11-16 21:15:51 -05:00
2023-11-27 22:22:30 -05:00
enum hrtimer_restart
check_variable_cb(struct hrtimer *timer); // hrtimer callback
2023-11-23 00:29:21 -05:00
2023-12-05 02:42:07 -05:00
int diag_pid(int id); // for test
int diag_tgid(int id); // for test