abrt  2.2.1
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 run_unstrip_n abrt_run_unstrip_n
46 char *run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec);
47 #define get_backtrace abrt_get_backtrace
48 char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char *debuginfo_dirs);
49 
50 
51 #define g_settings_nMaxCrashReportsSize abrt_g_settings_nMaxCrashReportsSize
52 extern unsigned int g_settings_nMaxCrashReportsSize;
53 #define g_settings_sWatchCrashdumpArchiveDir abrt_g_settings_sWatchCrashdumpArchiveDir
54 extern char * g_settings_sWatchCrashdumpArchiveDir;
55 #define g_settings_dump_location abrt_g_settings_dump_location
56 extern char * g_settings_dump_location;
57 #define g_settings_delete_uploaded abrt_g_settings_delete_uploaded
58 extern bool g_settings_delete_uploaded;
59 #define g_settings_autoreporting abrt_g_settings_autoreporting
60 extern bool g_settings_autoreporting;
61 #define g_settings_autoreporting_event abrt_g_settings_autoreporting_event
62 extern char * g_settings_autoreporting_event;
63 #define g_settings_shortenedreporting abrt_g_settings_shortenedreporting
64 extern bool g_settings_shortenedreporting;
65 
66 
67 #define load_abrt_conf abrt_load_abrt_conf
68 int load_abrt_conf(void);
69 #define free_abrt_conf_data abrt_free_abrt_conf_data
70 void free_abrt_conf_data(void);
71 
72 #define load_abrt_conf_file abrt_load_abrt_conf_file
73 int load_abrt_conf_file(const char *file, map_string_t *settings);
74 
75 #define load_abrt_plugin_conf_file abrt_load_abrt_plugin_conf_file
76 int load_abrt_plugin_conf_file(const char *file, map_string_t *settings);
77 
78 #define save_abrt_conf_file abrt_save_abrt_conf_file
79 int save_abrt_conf_file(const char *file, map_string_t *settings);
80 
81 #define save_abrt_plugin_conf_file abrt_save_abrt_plugin_conf_file
82 int save_abrt_plugin_conf_file(const char *file, map_string_t *settings);
83 
84 
85 void migrate_to_xdg_dirs(void);
86 
87 int check_recent_crash_file(const char *filename, const char *executable);
88 
89 /* Returns 1 if abrtd daemon is running, 0 otherwise. */
90 #define daemon_is_ok abrt_daemon_is_ok
91 int daemon_is_ok(void);
92 
98 #define notify_new_path abrt_notify_new_path
99 void notify_new_path(const char *path);
100 
101 /* Note: should be public since unit tests need to call it */
102 #define koops_extract_version abrt_koops_extract_version
103 char *koops_extract_version(const char *line);
104 #define kernel_tainted_short abrt_kernel_tainted_short
105 char *kernel_tainted_short(const char *kernel_bt);
106 #define kernel_tainted_long abrt_kernel_tainted_long
107 char *kernel_tainted_long(const char *tainted_short);
108 #define koops_hash_str abrt_koops_hash_str
109 int koops_hash_str(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *oops_buf);
110 #define koops_extract_oopses abrt_koops_extract_oopses
111 void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen);
112 #define koops_print_suspicious_strings abrt_koops_print_suspicious_strings
113 void koops_print_suspicious_strings(void);
120 #define koops_print_suspicious_strings_filtered abrt_koops_print_suspicious_strings_filtered
121 void koops_print_suspicious_strings_filtered(const regex_t **filterout);
122 
123 /* dbus client api */
124 
132 int chown_dir_over_dbus(const char *problem_dir_path);
133 
141 int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
142 
148 problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
149 
156 GList *get_problems_over_dbus(bool authorize);
157 
162 typedef struct ignored_problems ignored_problems_t;
163 
171 ignored_problems_t *ignored_problems_new(char *file_path);
172 
182 
191 void ignored_problems_add(ignored_problems_t *set, const char *problem_id);
192 
201 void ignored_problems_remove(ignored_problems_t *set, const char *problem_id);
202 
213 bool ignored_problems_contains(ignored_problems_t *set, const char *problem_id);
214 
223 void ignored_problems_add_problem_data(ignored_problems_t *set, problem_data_t *pd);
224 
233 void ignored_problems_remove_problem_data(ignored_problems_t *set, problem_data_t *pd);
234 
245 bool ignored_problems_contains_problem_data(ignored_problems_t *set, problem_data_t *pd);
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
251 #endif