abrt  2.1.5.6.g638c.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 <gio/gio.h> /* dbus */
13 #include "abrt-dbus.h"
14 /* libreport's internal functions we use: */
15 #include <libreport/internal_libreport.h>
16 #include "hooklib.h"
17 
18 #ifdef HAVE_CONFIG_H
19 # include "config.h"
20 #endif
21 
22 /* Must be after #include "config.h" */
23 #if ENABLE_NLS
24 # include <libintl.h>
25 # define _(S) gettext(S)
26 #else
27 # define _(S) (S)
28 #endif
29 
30 #undef NORETURN
31 #define NORETURN __attribute__ ((noreturn))
32 
33 #undef ARRAY_SIZE
34 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Some libc's forget to declare these, do it ourself */
41 extern char **environ;
42 #if defined(__GLIBC__) && __GLIBC__ < 2
43 int vdprintf(int d, const char *format, va_list ap);
44 #endif
45 
46 
47 #define check_free_space abrt_check_free_space
48 
56 void check_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location);
57 #define trim_problem_dirs abrt_trim_problem_dirs
58 void trim_problem_dirs(const char *dirname, double cap_size, const char *exclude_path);
59 #define run_unstrip_n abrt_run_unstrip_n
60 char *run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec);
61 #define get_backtrace abrt_get_backtrace
62 char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char *debuginfo_dirs);
63 
64 
65 #define g_settings_nMaxCrashReportsSize abrt_g_settings_nMaxCrashReportsSize
66 extern unsigned int g_settings_nMaxCrashReportsSize;
67 #define g_settings_sWatchCrashdumpArchiveDir abrt_g_settings_sWatchCrashdumpArchiveDir
68 extern char * g_settings_sWatchCrashdumpArchiveDir;
69 #define g_settings_dump_location abrt_g_settings_dump_location
70 extern char * g_settings_dump_location;
71 #define g_settings_delete_uploaded abrt_g_settings_delete_uploaded
72 extern bool g_settings_delete_uploaded;
73 #define g_settings_autoreporting abrt_g_settings_autoreporting
74 extern bool g_settings_autoreporting;
75 #define g_settings_autoreporting_event abrt_g_settings_autoreporting_event
76 extern char * g_settings_autoreporting_event;
77 
78 
79 #define load_abrt_conf abrt_load_abrt_conf
80 int load_abrt_conf();
81 #define free_abrt_conf_data abrt_free_abrt_conf_data
82 void free_abrt_conf_data();
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();
92 
93 /* Note: should be public since unit tests need to call it */
94 #define koops_extract_version abrt_koops_extract_version
95 char *koops_extract_version(const char *line);
96 #define kernel_tainted_short abrt_kernel_tainted_short
97 char *kernel_tainted_short(const char *kernel_bt);
98 #define kernel_tainted_long abrt_kernel_tainted_long
99 char *kernel_tainted_long(const char *tainted_short);
100 #define koops_hash_str abrt_koops_hash_str
101 int koops_hash_str(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *oops_buf);
102 #define koops_extract_oopses abrt_koops_extract_oopses
103 void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen);
104 #define koops_print_suspicious_strings abrt_koops_print_suspicious_strings
105 void koops_print_suspicious_strings(void);
106 
107 /* dbus client api */
108 
116 int chown_dir_over_dbus(const char *problem_dir_path);
117 
125 int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
126 
132 problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
133 
140 GList *get_problems_over_dbus(bool authorize);
141 
146 typedef struct ignored_problems ignored_problems_t;
147 
155 ignored_problems_t *ignored_problems_new(char *file_path);
156 
166 
175 void ignored_problems_add(ignored_problems_t *set, const char *problem_id);
176 
185 void ignored_problems_remove(ignored_problems_t *set, const char *problem_id);
186 
197 bool ignored_problems_contains(ignored_problems_t *set, const char *problem_id);
198 
199 #ifdef __cplusplus
200 }
201 #endif
202 
203 #endif