abrt  2.10.3.22.gde64.dirty
A tool to inform users about various problems on the running system
libabrt.h
Go to the documentation of this file.
1 /*
2  * Utility routines.
3  *
4  * Licensed under GPLv2, see file COPYING in this tarball for details.
5  */
6 
9 #ifndef LIBABRT_H_
10 #define LIBABRT_H_
11 
12 #include <regex.h>
13 
14 #include <gio/gio.h> /* dbus */
15 #include "abrt-dbus.h"
16 /* libreport's internal functions we use: */
17 #include <libreport/internal_libreport.h>
18 #include "hooklib.h"
19 
20 #undef ARRAY_SIZE
21 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Some libc's forget to declare these, do it ourself */
28 extern char **environ;
29 #if defined(__GLIBC__) && __GLIBC__ < 2
30 int vdprintf(int d, const char *format, va_list ap);
31 #endif
32 
33 
34 #define low_free_space abrt_low_free_space
35 
41 int low_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location);
42 
43 #define trim_problem_dirs abrt_trim_problem_dirs
44 void trim_problem_dirs(const char *dirname, double cap_size, const char *exclude_path);
45 #define ensure_writable_dir_id abrt_ensure_writable_dir_uid_git
46 void ensure_writable_dir_uid_gid(const char *dir, mode_t mode, uid_t uid, gid_t gid);
47 #define ensure_writable_dir abrt_ensure_writable_dir
48 void ensure_writable_dir(const char *dir, mode_t mode, const char *user);
49 #define ensure_writable_dir_group abrt_ensure_writable_dir_group
50 void ensure_writable_dir_group(const char *dir, mode_t mode, const char *user, const char *group);
51 #define run_unstrip_n abrt_run_unstrip_n
52 char *run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec);
53 #define get_backtrace abrt_get_backtrace
54 char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char *debuginfo_dirs);
55 
56 #define dir_is_in_dump_location abrt_dir_is_in_dump_location
57 bool dir_is_in_dump_location(const char *dir_name);
58 
59 enum {
60  DD_PERM_EVENTS = 1 << 0,
61  DD_PERM_DAEMONS = 1 << 1,
62 };
63 #define dir_has_correct_permissions abrt_dir_has_correct_permissions
64 bool dir_has_correct_permissions(const char *dir_name, int flags);
65 #define allowed_new_user_problem_entry abrt_allowed_new_user_problem_entry
66 bool allowed_new_user_problem_entry(uid_t uid, const char *name, const char *value);
67 
68 #define g_settings_nMaxCrashReportsSize abrt_g_settings_nMaxCrashReportsSize
69 extern unsigned int g_settings_nMaxCrashReportsSize;
70 #define g_settings_sWatchCrashdumpArchiveDir abrt_g_settings_sWatchCrashdumpArchiveDir
71 extern char * g_settings_sWatchCrashdumpArchiveDir;
72 #define g_settings_dump_location abrt_g_settings_dump_location
73 extern char * g_settings_dump_location;
74 #define g_settings_delete_uploaded abrt_g_settings_delete_uploaded
75 extern bool g_settings_delete_uploaded;
76 #define g_settings_autoreporting abrt_g_settings_autoreporting
77 extern bool g_settings_autoreporting;
78 #define g_settings_autoreporting_event abrt_g_settings_autoreporting_event
79 extern char * g_settings_autoreporting_event;
80 #define g_settings_shortenedreporting abrt_g_settings_shortenedreporting
81 extern bool g_settings_shortenedreporting;
82 #define g_settings_explorechroots abrt_g_settings_explorechroots
83 extern bool g_settings_explorechroots;
84 #define g_settings_debug_level abrt_g_settings_debug_level
85 extern unsigned int g_settings_debug_level;
86 
87 
88 #define load_abrt_conf abrt_load_abrt_conf
89 int load_abrt_conf(void);
90 #define free_abrt_conf_data abrt_free_abrt_conf_data
91 void free_abrt_conf_data(void);
92 
93 #define load_abrt_conf_file abrt_load_abrt_conf_file
94 int load_abrt_conf_file(const char *file, map_string_t *settings);
95 
96 #define load_abrt_plugin_conf_file abrt_load_abrt_plugin_conf_file
97 int load_abrt_plugin_conf_file(const char *file, map_string_t *settings);
98 
99 #define save_abrt_conf_file abrt_save_abrt_conf_file
100 int save_abrt_conf_file(const char *file, map_string_t *settings);
101 
102 #define save_abrt_plugin_conf_file abrt_save_abrt_plugin_conf_file
103 int save_abrt_plugin_conf_file(const char *file, map_string_t *settings);
104 
105 
106 void migrate_to_xdg_dirs(void);
107 
108 int check_recent_crash_file(const char *filename, const char *executable);
109 
110 /* Returns 1 if abrtd daemon is running, 0 otherwise. */
111 #define daemon_is_ok abrt_daemon_is_ok
112 int daemon_is_ok(void);
113 
119 #define notify_new_path abrt_notify_new_path
120 void notify_new_path(const char *path);
121 
130 #define notify_new_path_with_response abrt_notify_new_path_with_response
131 int notify_new_path_with_response(const char *path, char **message);
132 
133 /* Note: should be public since unit tests need to call it */
134 #define koops_extract_version abrt_koops_extract_version
135 char *koops_extract_version(const char *line);
136 #define kernel_tainted_short abrt_kernel_tainted_short
137 char *kernel_tainted_short(const char *kernel_bt);
138 #define kernel_tainted_long abrt_kernel_tainted_long
139 char *kernel_tainted_long(const char *tainted_short);
140 #define koops_hash_str_ext abrt_koops_hash_str_ext
141 int koops_hash_str_ext(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *oops_buf, int frame_count, int duphas_flags);
142 #define koops_hash_str abrt_koops_hash_str
143 int koops_hash_str(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *oops_buf);
144 
145 
146 #define koops_line_skip_level abrt_koops_line_skip_level
147 int koops_line_skip_level(const char **c);
148 #define koops_line_skip_jiffies abrt_koops_line_skip_jiffies
149 void koops_line_skip_jiffies(const char **c);
150 
151 /*
152  * extract_oops tries to find oops signatures in a log
153  */
155  char *ptr;
156  int level;
157 };
158 
159 #define koops_extract_oopses_from_lines abrt_koops_extract_oopses_from_lines
160 void koops_extract_oopses_from_lines(GList **oops_list, const struct abrt_koops_line_info *lines_info, int lines_info_size);
161 #define koops_extract_oopses abrt_koops_extract_oopses
162 void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen);
163 #define koops_suspicious_strings_list abrt_koops_suspicious_strings_list
164 GList *koops_suspicious_strings_list(void);
165 #define koops_suspicious_strings_blacklist abrt_koops_suspicious_strings_blacklist
166 GList *koops_suspicious_strings_blacklist(void);
167 #define koops_print_suspicious_strings abrt_koops_print_suspicious_strings
168 void koops_print_suspicious_strings(void);
175 #define koops_print_suspicious_strings_filtered abrt_koops_print_suspicious_strings_filtered
176 void koops_print_suspicious_strings_filtered(const regex_t **filterout);
177 
178 /* dbus client api */
179 
187 int chown_dir_over_dbus(const char *problem_dir_path);
188 
196 int test_exist_over_dbus(const char *problem_id, const char *element_name);
197 
205 int dbus_problem_is_complete(const char *problem_id);
206 
214 char *load_text_over_dbus(const char *problem_id, const char *element_name);
215 
224 int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
225 
231 int fill_problem_data_over_dbus(const char *problem_dir_path, const char **elements, problem_data_t *problem_data);
232 
238 problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
239 
245 problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
246 
254 GList *get_problems_over_dbus(bool authorize);
255 
260 typedef struct ignored_problems ignored_problems_t;
261 
269 ignored_problems_t *ignored_problems_new(char *file_path);
270 
280 
289 void ignored_problems_add(ignored_problems_t *set, const char *problem_id);
290 
299 void ignored_problems_remove(ignored_problems_t *set, const char *problem_id);
300 
311 bool ignored_problems_contains(ignored_problems_t *set, const char *problem_id);
312 
321 void ignored_problems_add_problem_data(ignored_problems_t *set, problem_data_t *pd);
322 
331 void ignored_problems_remove_problem_data(ignored_problems_t *set, problem_data_t *pd);
332 
343 bool ignored_problems_contains_problem_data(ignored_problems_t *set, problem_data_t *pd);
344 
345 #ifdef __cplusplus
346 }
347 #endif
348 
349 #endif
#define notify_new_path_with_response
Sends notification to abrtd that a new problem has been detected and wait for the reply...
Definition: libabrt.h:130
int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
Delets multiple problems specified by their id (as returned from problem_data_save) ...
void ignored_problems_add_problem_data(ignored_problems_t *set, problem_data_t *pd)
Adds a problem defined by its data to the ignored problems.
GList * get_problems_over_dbus(bool authorize)
Fetches all problems from problem database.
An opaque structure holding a list of ignored problems.
void ignored_problems_remove(ignored_problems_t *set, const char *problem_id)
Removes a problem from the ignored problems.
bool ignored_problems_contains_problem_data(ignored_problems_t *set, problem_data_t *pd)
Checks if a problem defined its data is in the ignored problems.
bool ignored_problems_contains(ignored_problems_t *set, const char *problem_id)
Checks if a problem is in the ignored problems.
int test_exist_over_dbus(const char *problem_id, const char *element_name)
Checks whether the given element name exists.
ignored_problems_t * ignored_problems_new(char *file_path)
Initializes a new instance of ignored problems.
problem_data_t * get_full_problem_data_over_dbus(const char *problem_dir_path)
Fetches full problem data for specified problem id.
int fill_problem_data_over_dbus(const char *problem_dir_path, const char **elements, problem_data_t *problem_data)
Fetches given problem elements for specified problem id.
#define notify_new_path
Sends notification to abrtd that a new problem has been detected.
Definition: libabrt.h:119
int dbus_problem_is_complete(const char *problem_id)
Checks whether the problem corresponding to the given ID is complete.
char * load_text_over_dbus(const char *problem_id, const char *element_name)
void ignored_problems_remove_problem_data(ignored_problems_t *set, problem_data_t *pd)
Removes a problem defined by its data from the ignored problems.
problem_data_t * get_problem_data_dbus(const char *problem_dir_path)
Fetches problem information for specified problem id.
#define koops_print_suspicious_strings_filtered
Definition: libabrt.h:175
void ignored_problems_free(ignored_problems_t *set)
Destroys an instance of ignored problems.
void ignored_problems_add(ignored_problems_t *set, const char *problem_id)
Adds a problem to the ignored problems.
int low_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location)
Checks if there is enough free space to store the problem data.
int chown_dir_over_dbus(const char *problem_dir_path)
Changes the access rights of the problem specified by problem id.