abrt 2.17.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
24extern "C" {
25#endif
26
27/* Some libc's forget to declare these, do it ourself */
28extern char **environ;
29#if defined(__GLIBC__) && __GLIBC__ < 2
30int vdprintf(int d, const char *format, va_list ap);
31#endif
32
33
40int abrt_low_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location);
41
42void abrt_trim_problem_dirs(const char *dirname, double cap_size, const char *exclude_path);
43void abrt_ensure_writable_dir_uid_gid(const char *dir, mode_t mode, uid_t uid, gid_t gid);
44void abrt_ensure_writable_dir(const char *dir, mode_t mode, const char *user);
45void abrt_ensure_writable_dir_group(const char *dir, mode_t mode, const char *user, const char *group);
46char *abrt_run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec);
47char *abrt_get_backtrace(struct dump_dir *dd, unsigned timeout_sec, const char *debuginfo_dirs);
48
49bool abrt_dir_is_in_dump_location(const char *dir_name);
50
51enum {
52 DD_PERM_EVENTS = 1 << 0,
53 DD_PERM_DAEMONS = 1 << 1,
54};
55bool abrt_dir_has_correct_permissions(const char *dir_name, int flags);
56bool abrt_new_user_problem_entry_allowed(uid_t uid, const char *name, const char *value);
57
58extern unsigned int abrt_g_settings_nMaxCrashReportsSize;
59extern char * abrt_g_settings_sWatchCrashdumpArchiveDir;
60extern char * abrt_g_settings_dump_location;
61extern bool abrt_g_settings_delete_uploaded;
62extern bool abrt_g_settings_autoreporting;
63extern char * abrt_g_settings_autoreporting_event;
64extern bool abrt_g_settings_shortenedreporting;
65extern bool abrt_g_settings_explorechroots;
66extern unsigned int abrt_g_settings_debug_level;
67
68
69int abrt_load_abrt_conf(void);
70void abrt_free_abrt_conf_data(void);
71
72int abrt_load_abrt_conf_file(const char *file, GHashTable *settings);
73
74int abrt_load_abrt_plugin_conf_file(const char *file, GHashTable *settings);
75
76int abrt_save_abrt_conf_file(const char *file, GHashTable *settings);
77
78int abrt_save_abrt_plugin_conf_file(const char *file, GHashTable *settings);
79
80
81void migrate_to_xdg_dirs(void);
82
83int check_recent_crash_file(const char *filename, const char *executable);
84
85/* Returns 1 if abrtd daemon is running, 0 otherwise. */
86int abrt_daemon_is_ok(void);
87
93void abrt_notify_new_path(const char *path);
94
103int abrt_notify_new_path_with_response(const char *path, char **message);
104
105/* Note: should be public since unit tests need to call it */
106char *abrt_koops_extract_version(const char *line);
107char *abrt_kernel_tainted_short(const char *kernel_bt);
108char *abrt_kernel_tainted_long(const char *tainted_short);
109char *abrt_koops_hash_str_ext(const char *oops_buf, int frame_count, int duphas_flags);
110char *abrt_koops_hash_str(const char *oops_buf);
111
112
113int abrt_koops_line_skip_level(const char **c);
114void abrt_koops_line_skip_jiffies(const char **c);
115
116/*
117 * extract_oops tries to find oops signatures in a log
118 */
120 char *ptr;
121 int level;
122};
123
124void abrt_koops_extract_oopses_from_lines(GList **oops_list, const struct abrt_koops_line_info *lines_info, int lines_info_size);
125void abrt_koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen);
126GList *abrt_koops_suspicious_strings_list(void);
127GList *abrt_koops_suspicious_strings_blacklist(void);
128void abrt_koops_print_suspicious_strings(void);
135void abrt_koops_print_suspicious_strings_filtered(const regex_t **filterout);
136
137/* dbus client api */
138
146int chown_dir_over_dbus(const char *problem_dir_path);
147
155int test_exist_over_dbus(const char *problem_id, const char *element_name);
156
164int dbus_problem_is_complete(const char *problem_id);
165
173char *load_text_over_dbus(const char *problem_id, const char *element_name);
174
183int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
184
190int fill_problem_data_over_dbus(const char *problem_dir_path, const char **elements, problem_data_t *problem_data);
191
197problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
198
204problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
205
213GList *get_problems_over_dbus(bool authorize);
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif
GList * get_problems_over_dbus(bool authorize)
Fetches all problems from problem database.
int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
Delets multiple problems specified by their id (as returned from problem_data_save)
problem_data_t * get_problem_data_dbus(const char *problem_dir_path)
Fetches problem information for specified problem id.
int test_exist_over_dbus(const char *problem_id, const char *element_name)
Checks whether the given element name exists.
void abrt_notify_new_path(const char *path)
Sends notification to abrtd that a new problem has been detected.
int chown_dir_over_dbus(const char *problem_dir_path)
Changes the access rights of the problem specified by problem id.
int abrt_low_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location)
Checks if there is enough free space to store the problem data.
int dbus_problem_is_complete(const char *problem_id)
Checks whether the problem corresponding to the given ID is complete.
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.
int abrt_notify_new_path_with_response(const char *path, char **message)
Sends notification to abrtd that a new problem has been detected and wait for the reply.
void abrt_koops_print_suspicious_strings_filtered(const regex_t **filterout)
char * load_text_over_dbus(const char *problem_id, const char *element_name)