5 * @file us_manager/sspt/sspt_proc.h
6 * @author Vyacheslav Cherkashin <v.cherkashin@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Copyright (C) Samsung Electronics, 2013
27 #include <linux/types.h>
28 #include "sspt_file.h"
36 /** Flags for sspt_*_uninstall() */
38 US_UNREGS_PROBE, /**< probes remove and disarm */
39 US_DISARM, /**< probes disarm */
40 US_UNINSTALL /**< probes remove from list install */
45 * @breaf Image of process for specified process
48 struct list_head list; /**< For global process list */
49 pid_t tgid; /**< Thread group ID */
50 struct task_struct *task; /**< Ptr to the task */
51 struct mm_struct *__mm;
52 struct task_struct *__task;
53 unsigned long r_state_addr; /**< address of r_state */
54 struct slot_manager *sm; /**< Ptr to the manager slot */
55 struct list_head file_list; /**< For sspt_file */
57 struct list_head filter_list; /**< Filter list */
58 unsigned first_install:1; /**< Install flag */
59 struct sspt_feature *feature; /**< Ptr to the feature */
62 /* FIXME: for preload (remove those fields) */
63 void *private_data; /**< Process private data */
67 void *(*priv_create)(struct sspt_proc *);
68 void (*priv_destroy)(struct sspt_proc *, void *);
72 struct list_head *sspt_proc_list(void);
74 struct sspt_proc *sspt_proc_create(struct task_struct *task);
75 void sspt_proc_cleanup(struct sspt_proc *proc);
76 struct sspt_proc *sspt_proc_get(struct sspt_proc *proc);
77 void sspt_proc_put(struct sspt_proc *proc);
79 void on_each_proc_no_lock(void (*func)(struct sspt_proc *, void *),
81 void on_each_proc(void (*func)(struct sspt_proc *, void *), void *data);
83 struct sspt_proc *sspt_proc_get_by_task(struct task_struct *task);
84 struct sspt_proc *sspt_proc_get_by_task_no_lock(struct task_struct *task);
85 struct sspt_proc *sspt_proc_get_by_task_or_new(struct task_struct *task);
86 void sspt_proc_free_all(void);
88 struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc,
89 struct dentry *dentry);
90 struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc,
91 struct dentry *dentry);
93 void sspt_proc_install_probe(struct sspt_proc *proc, unsigned long vaddr,
94 struct probe_info *probe_i);
95 void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr);
96 void sspt_proc_install(struct sspt_proc *proc);
97 int sspt_proc_uninstall(struct sspt_proc *proc,
98 struct task_struct *task,
101 int sspt_proc_get_files_by_region(struct sspt_proc *proc,
102 struct list_head *head,
103 unsigned long start, size_t len);
104 void sspt_proc_insert_files(struct sspt_proc *proc, struct list_head *head);
106 void sspt_proc_read_lock(void);
107 void sspt_proc_read_unlock(void);
108 void sspt_proc_write_lock(void);
109 void sspt_proc_write_unlock(void);
111 void sspt_proc_add_filter(struct sspt_proc *proc, struct pf_group *pfg);
112 void sspt_proc_del_filter(struct sspt_proc *proc, struct pf_group *pfg);
113 void sspt_proc_del_all_filters(struct sspt_proc *proc);
114 bool sspt_proc_is_filter_new(struct sspt_proc *proc, struct pf_group *pfg);
116 void sspt_proc_on_each_filter(struct sspt_proc *proc,
117 void (*func)(struct sspt_filter *, void *),
120 void sspt_proc_on_each_ip(struct sspt_proc *proc,
121 void (*func)(struct us_ip *, void *), void *data);
123 bool sspt_proc_is_send_event(struct sspt_proc *proc);
125 int sspt_proc_cb_set(struct sspt_proc_cb *cb);
126 void sspt_proc_priv_create(struct sspt_proc *proc);
127 void sspt_proc_priv_destroy(struct sspt_proc *proc);
129 #endif /* __SSPT_PROC__ */