20 #ifndef LIBREPORT_INTERNAL_H_
21 #define LIBREPORT_INTERNAL_H_
39 #include <sys/socket.h>
42 #include <sys/types.h>
44 #include <arpa/inet.h>
50 #include <sys/param.h>
64 # define _(S) dgettext(PACKAGE, S)
74 extern char **environ;
75 #if defined(__GLIBC__) && __GLIBC__ < 2
76 int vdprintf(
int d,
const char *format, va_list ap);
80 #define NORETURN __attribute__ ((noreturn))
83 #define ERR_PTR ((void*)(uintptr_t)1)
86 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
89 #define CREATE_PRIVATE_TICKET "ABRT_CREATE_PRIVATE_TICKET"
92 #include "global_configuration.h"
94 #include "event_config.h"
97 #include "run_event.h"
100 #include "libreport_types.h"
101 #include "reporters.h"
107 #define prefixcmp libreport_prefixcmp
108 int prefixcmp(
const char *str,
const char *prefix);
109 #define suffixcmp libreport_suffixcmp
110 int suffixcmp(
const char *str,
const char *suffix);
111 #define trim_all_whitespace libreport_trim_all_whitespace
112 char *trim_all_whitespace(
const char *str);
113 #define shorten_string_to_length libreport_shorten_string_to_length
114 char *shorten_string_to_length(
const char *str,
unsigned length);
115 #define strtrim libreport_strtrim
116 char *strtrim(
char *str);
117 #define strtrimch libreport_strtrimch
118 char *strtrimch(
char *str,
int ch);
119 #define strremovech libreport_strremovech
120 char *strremovech(
char *str,
int ch);
121 #define append_to_malloced_string libreport_append_to_malloced_string
122 char *append_to_malloced_string(
char *mstr,
const char *append);
123 #define skip_blank libreport_skip_blank
124 char* skip_blank(
const char *s);
125 #define skip_whitespace libreport_skip_whitespace
126 char* skip_whitespace(
const char *s);
127 #define skip_non_whitespace libreport_skip_non_whitespace
128 char* skip_non_whitespace(
const char *s);
130 #define overlapping_strcpy libreport_overlapping_strcpy
131 void overlapping_strcpy(
char *dst,
const char *src);
133 #define concat_path_file libreport_concat_path_file
134 char *concat_path_file(
const char *path,
const char *filename);
139 #define concat_path_basename libreport_concat_path_basename
140 char *concat_path_basename(
const char *path,
const char *filename);
145 #define str_is_correct_filename libreport_str_is_correct_filename
146 bool str_is_correct_filename(
const char *str);
149 #define xmalloc_fgets libreport_xmalloc_fgets
150 char *xmalloc_fgets(FILE *file);
152 #define xmalloc_fgetline libreport_xmalloc_fgetline
153 char *xmalloc_fgetline(FILE *file);
155 #define xmalloc_fopen_fgetline_fclose libreport_xmalloc_fopen_fgetline_fclose
156 char *xmalloc_fopen_fgetline_fclose(
const char *filename);
160 COPYFD_SPARSE = 1 << 0,
161 } libreport_copyfd_flags;
179 #define copyfd_ext_at libreport_copyfd_ext_at
180 off_t copyfd_ext_at(
int src,
int dir_fd,
const char *name,
int mode,
181 uid_t uid, gid_t gid,
int open_flags,
int copy_flags, off_t size);
184 #define copyfd_eof libreport_copyfd_eof
185 off_t copyfd_eof(
int src_fd,
int dst_fd,
int flags);
186 #define copyfd_size libreport_copyfd_size
187 off_t copyfd_size(
int src_fd,
int dst_fd, off_t size,
int flags);
188 #define copyfd_exact_size libreport_copyfd_exact_size
189 void copyfd_exact_size(
int src_fd,
int dst_fd, off_t size);
190 #define copy_file_ext_at libreport_copy_file_ext_at
191 off_t copy_file_ext_at(
const char *src_name,
int dir_fd,
const char *name,
int mode, uid_t uid, gid_t gid,
int src_flags,
int dst_flags);
192 #define copy_file_ext(src_name, dst_name, mode, uid, gid, src_flags, dst_flags) \
193 copy_file_ext_at(src_name, AT_FDCWD, dst_name, mode, uid, gid, src_flags, dst_flags)
194 #define copy_file libreport_copy_file
195 off_t copy_file(
const char *src_name,
const char *dst_name,
int mode);
196 #define copy_file_at libreport_copy_file_at
197 off_t copy_file_at(
const char *src_name,
int dir_fd,
const char *name,
int mode);
198 #define copy_file_recursive libreport_copy_file_recursive
199 int copy_file_recursive(
const char *source,
const char *dest);
201 #define decompress_fd libreport_decompress_fd
202 int decompress_fd(
int fdi,
int fdo);
203 #define decompress_file libreport_decompress_file
204 int decompress_file(
const char *path_in,
const char *path_out, mode_t mode_out);
205 #define decompress_file_ext_at libreport_decompress_file_ext_at
206 int decompress_file_ext_at(
const char *path_in,
int dir_fd,
const char *path_out,
207 mode_t mode_out, uid_t uid, gid_t gid,
int src_flags,
int dst_flags);
211 #define xread libreport_xread
212 void xread(
int fd,
void *buf,
size_t count);
213 #define safe_read libreport_safe_read
214 ssize_t safe_read(
int fd,
void *buf,
size_t count);
215 #define safe_write libreport_safe_write
216 ssize_t safe_write(
int fd,
const void *buf,
size_t count);
217 #define full_read libreport_full_read
218 ssize_t full_read(
int fd,
void *buf,
size_t count);
219 #define full_write libreport_full_write
220 ssize_t full_write(
int fd,
const void *buf,
size_t count);
221 #define full_write_str libreport_full_write_str
222 ssize_t full_write_str(
int fd,
const char *buf);
223 #define xmalloc_read libreport_xmalloc_read
224 void* xmalloc_read(
int fd,
size_t *maxsz_p);
225 #define xmalloc_open_read_close libreport_xmalloc_open_read_close
226 void* xmalloc_open_read_close(
const char *filename,
size_t *maxsz_p);
227 #define xmalloc_xopen_read_close libreport_xmalloc_xopen_read_close
228 void* xmalloc_xopen_read_close(
const char *filename,
size_t *maxsz_p);
229 #define malloc_readlink libreport_malloc_readlink
230 char* malloc_readlink(
const char *linkname);
231 #define malloc_readlinkat libreport_malloc_readlinkat
232 char* malloc_readlinkat(
int dir_fd,
const char *linkname);
236 #define encode_base64 libreport_encode_base64
237 char *encode_base64(
const void *src,
int length);
243 #define sanitize_utf8 libreport_sanitize_utf8
244 char *sanitize_utf8(
const char *src, uint32_t control_chars_to_sanitize);
246 SANITIZE_ALL = 0xffffffff,
247 SANITIZE_TAB = (1 << 9),
248 SANITIZE_LF = (1 << 10),
249 SANITIZE_CR = (1 << 13),
252 #define SHA1_RESULT_LEN (5 * 4)
259 #define sha1_begin libreport_sha1_begin
261 #define sha1_hash libreport_sha1_hash
262 void sha1_hash(
sha1_ctx_t *ctx,
const void *buffer,
size_t len);
263 #define sha1_end libreport_sha1_end
267 #define str_to_sha1 libreport_str_to_sha1
268 const uint8_t *str_to_sha1(uint8_t result[SHA1_RESULT_LEN],
const char *str);
269 #define str_to_sha1str libreport_str_to_sha1str
270 const char *str_to_sha1str(
char result[SHA1_RESULT_LEN*2 + 1],
const char *str);
273 #define try_atou libreport_try_atou
274 int try_atou(
const char *numstr,
unsigned *value);
275 #define xatou libreport_xatou
276 unsigned xatou(
const char *numstr);
277 #define try_atoi libreport_try_atoi
278 int try_atoi(
const char *numstr,
int *value);
279 #define xatoi libreport_xatoi
280 int xatoi(
const char *numstr);
288 #define try_atoi_positive libreport_try_atoi_positive
289 int try_atoi_positive(
const char *numstr,
int *value);
290 #define xatoi_positive libreport_xatoi_positive
291 int xatoi_positive(
const char *numstr);
298 #define safe_waitpid libreport_safe_waitpid
299 pid_t safe_waitpid(pid_t pid,
int *wstat,
int options);
304 EXECFLG_INPUT = 1 << 0,
307 EXECFLG_OUTPUT = 1 << 1,
309 EXECFLG_INPUT_NUL = 1 << 2,
311 EXECFLG_OUTPUT_NUL = 1 << 3,
313 EXECFLG_ERR2OUT = 1 << 4,
315 EXECFLG_ERR_NUL = 1 << 5,
317 EXECFLG_QUIET = 1 << 6,
318 EXECFLG_SETGUID = 1 << 7,
319 EXECFLG_SETSID = 1 << 8,
320 EXECFLG_SETPGID = 1 << 9,
328 #define fork_execv_on_steroids libreport_fork_execv_on_steroids
329 pid_t fork_execv_on_steroids(
int flags,
337 #define run_in_shell_and_save_output libreport_run_in_shell_and_save_output
338 char *run_in_shell_and_save_output(
int flags,
345 #define is_in_string_list libreport_is_in_string_list
346 bool is_in_string_list(
const char *name,
const char *
const *v);
348 #define index_of_string_in_list libreport_index_of_string_in_list
349 int index_of_string_in_list(
const char *name,
const char *
const *v);
351 #define is_in_comma_separated_list libreport_is_in_comma_separated_list
352 bool is_in_comma_separated_list(
const char *value,
const char *list);
353 #define is_in_comma_separated_list_of_glob_patterns libreport_is_in_comma_separated_list_of_glob_patterns
354 bool is_in_comma_separated_list_of_glob_patterns(
const char *value,
const char *list);
358 #define glib_init libreport_glib_init
359 void glib_init(
void);
364 #define list_free_with_free libreport_list_free_with_free
365 void list_free_with_free(GList *list);
367 #define get_dirsize libreport_get_dirsize
368 double get_dirsize(
const char *pPath);
369 #define get_dirsize_find_largest_dir libreport_get_dirsize_find_largest_dir
370 double get_dirsize_find_largest_dir(
376 #define ndelay_on libreport_ndelay_on
377 int ndelay_on(
int fd);
378 #define ndelay_off libreport_ndelay_off
379 int ndelay_off(
int fd);
380 #define close_on_exec_on libreport_close_on_exec_on
381 int close_on_exec_on(
int fd);
383 #define xmalloc libreport_xmalloc
384 void* xmalloc(
size_t size);
385 #define xrealloc libreport_xrealloc
386 void* xrealloc(
void *ptr,
size_t size);
387 #define xzalloc libreport_xzalloc
388 void* xzalloc(
size_t size);
389 #define xstrdup libreport_xstrdup
390 char* xstrdup(
const char *s);
391 #define xstrndup libreport_xstrndup
392 char* xstrndup(
const char *s,
int n);
393 #define xstrdup_between libreport_xstrdup_between
394 char* xstrdup_between(
const char *s,
const char *open,
const char *close);
396 #define xpipe libreport_xpipe
397 void xpipe(
int filedes[2]);
398 #define xdup libreport_xdup
400 #define xdup2 libreport_xdup2
401 void xdup2(
int from,
int to);
402 #define xmove_fd libreport_xmove_fd
403 void xmove_fd(
int from,
int to);
405 #define xwrite libreport_xwrite
406 void xwrite(
int fd,
const void *buf,
size_t count);
407 #define xwrite_str libreport_xwrite_str
408 void xwrite_str(
int fd,
const char *str);
410 #define xlseek libreport_xlseek
411 off_t xlseek(
int fd, off_t offset,
int whence);
413 #define xchdir libreport_xchdir
414 void xchdir(
const char *path);
416 #define xvasprintf libreport_xvasprintf
417 char* xvasprintf(
const char *format, va_list p);
418 #define xasprintf libreport_xasprintf
419 char* xasprintf(
const char *format, ...);
421 #define xsetenv libreport_xsetenv
422 void xsetenv(
const char *key,
const char *value);
433 #define safe_unsetenv libreport_safe_unsetenv
434 void safe_unsetenv(
const char *var_val);
436 #define xsocket libreport_xsocket
437 int xsocket(
int domain,
int type,
int protocol);
438 #define xbind libreport_xbind
439 void xbind(
int sockfd,
struct sockaddr *my_addr, socklen_t addrlen);
440 #define xlisten libreport_xlisten
441 void xlisten(
int s,
int backlog);
442 #define xsendto libreport_xsendto
443 ssize_t xsendto(
int s,
const void *buf,
size_t len,
444 const struct sockaddr *to, socklen_t tolen);
446 #define xstat libreport_xstat
447 void xstat(
const char *name,
struct stat *stat_buf);
448 #define fstat_st_size_or_die libreport_fstat_st_size_or_die
449 off_t fstat_st_size_or_die(
int fd);
450 #define stat_st_size_or_die libreport_stat_st_size_or_die
451 off_t stat_st_size_or_die(
const char *filename);
453 #define xopen3 libreport_xopen3
454 int xopen3(
const char *pathname,
int flags,
int mode);
455 #define xopen libreport_xopen
456 int xopen(
const char *pathname,
int flags);
457 #define xunlink libreport_xunlink
458 void xunlink(
const char *pathname);
459 #define xunlinkat libreport_xunlinkat
460 void xunlinkat(
int dir_fd,
const char *pathname,
int flags);
468 #define is_regular_file libreport_is_regular_file
469 int is_regular_file(
struct dirent *dent,
const char *dirname);
470 #define is_regular_file_at libreport_is_regular_file_at
471 int is_regular_file_at(
struct dirent *dent,
int dir_fd);
473 #define dot_or_dotdot libreport_dot_or_dotdot
474 bool dot_or_dotdot(
const char *filename);
475 #define last_char_is libreport_last_char_is
476 char *last_char_is(
const char *s,
int c);
478 #define string_to_bool libreport_string_to_bool
479 bool string_to_bool(
const char *s);
481 #define xseteuid libreport_xseteuid
482 void xseteuid(uid_t euid);
483 #define xsetegid libreport_xsetegid
484 void xsetegid(gid_t egid);
485 #define xsetreuid libreport_xsetreuid
486 void xsetreuid(uid_t ruid, uid_t euid);
487 #define xsetregid libreport_xsetregid
488 void xsetregid(gid_t rgid, gid_t egid);
492 #define bin2hex libreport_bin2hex
493 char* bin2hex(
char *dst,
const char *str,
int count);
495 #define hex2bin libreport_hex2bin
496 char* hex2bin(
char *dst,
const char *str,
int count);
501 LOGMODE_STDIO = (1 << 0),
502 LOGMODE_SYSLOG = (1 << 1),
503 LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
504 LOGMODE_CUSTOM = (1 << 2),
505 LOGMODE_JOURNAL = (1 << 3),
508 #define g_custom_logger libreport_g_custom_logger
509 extern void (*g_custom_logger)(
const char*);
510 #define msg_prefix libreport_msg_prefix
511 extern const char *msg_prefix;
512 #define msg_eol libreport_msg_eol
513 extern const char *msg_eol;
514 #define logmode libreport_logmode
516 #define xfunc_error_retval libreport_xfunc_error_retval
517 extern int xfunc_error_retval;
520 #define EXIT_CANCEL_BY_USER 69
521 #define EXIT_STOP_EVENT_RUN 70
523 #define set_xfunc_error_retval libreport_set_xfunc_error_retval
524 void set_xfunc_error_retval(
int retval);
527 #define g_verbose libreport_g_verbose
528 extern int g_verbose;
530 #define VERB1 if (g_verbose >= 1)
532 #define VERB2 if (g_verbose >= 2)
534 #define VERB3 if (g_verbose >= 3)
538 #define xfunc_die libreport_xfunc_die
539 void xfunc_die(
void) NORETURN;
541 #define die_out_of_memory libreport_die_out_of_memory
542 void die_out_of_memory(
void) NORETURN;
546 #define log(...) log_standard(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
547 #define log_debug(...) log_standard(LOG_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__)
548 #define log_info(...) log_standard(LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__)
549 #define log_notice(...) log_standard(LOG_NOTICE, __FILE__, __LINE__, __func__, __VA_ARGS__)
550 #define log_warning(...) log_standard(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
551 #define log_error(...) log_standard(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__)
554 #define log_parser(...) if(0) log_debug(__VA_ARGS__)
556 #define log_standard(level, file, line, func, ...) log_wrapper(level, __FILE__, __LINE__, __func__, false, false, __VA_ARGS__)
559 #define log_error_and_die(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, false,__VA_ARGS__)
560 #define log_perror(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, false, __VA_ARGS__)
561 #define log_perror_and_die(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, false, __VA_ARGS__)
563 #define error_msg(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__)
564 #define perror_msg(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__)
565 #define warn_msg(...) log_wrapper(LOG_WARNING, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__)
566 #define pwarn_msg(...) log_wrapper(LOG_WARNING, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__)
567 #define error_msg_and_die(...) log_and_die_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__)
568 #define perror_msg_and_die(...) log_and_die_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__)
571 void log_wrapper(
int level,
576 bool use_custom_logger,
577 const char *format, ...) __attribute__ ((format (printf, 7,8)));
579 void log_and_die_wrapper(
int level,
584 bool use_custom_logger,
585 const
char *format, ...) __attribute__ ((noreturn, format (printf, 7,8)));
602 #define strbuf_new libreport_strbuf_new
603 struct strbuf *strbuf_new(
void);
610 #define strbuf_free libreport_strbuf_free
618 #define strbuf_free_nobuf libreport_strbuf_free_nobuf
625 #define strbuf_clear libreport_strbuf_clear
632 #define strbuf_append_char libreport_strbuf_append_char
639 #define strbuf_append_str libreport_strbuf_append_str
647 #define strbuf_prepend_str libreport_strbuf_prepend_str
655 #define strbuf_append_strf libreport_strbuf_append_strf
657 const char *format, ...);
663 #define strbuf_append_strfv libreport_strbuf_append_strfv
665 const char *format, va_list p);
672 #define strbuf_prepend_strf libreport_strbuf_prepend_strf
674 const char *format, ...);
680 #define strbuf_prepend_strfv libreport_strbuf_prepend_strfv
682 const char *format, va_list p);
689 #define get_cmdline libreport_get_cmdline
690 char* get_cmdline(pid_t pid);
691 #define get_environ libreport_get_environ
692 char* get_environ(pid_t pid);
693 #define get_executable libreport_get_executable
694 char *get_executable(pid_t pid);
695 #define get_cwd libreport_get_cwd
696 char* get_cwd(pid_t pid);
697 #define get_rootdir libreport_get_rootdir
698 char* get_rootdir(pid_t pid);
699 #define get_fsuid libreport_get_fsuid
700 int get_fsuid(
const char *proc_pid_status);
701 #define get_fsgid libreport_get_fsgid
702 int get_fsgid(
const char *proc_pid_status);
703 #define dump_fd_info_ext libreport_dump_fd_info_ext
704 int dump_fd_info_ext(
const char *dest_filename,
const char *proc_pid_fd_path, uid_t uid, gid_t gid);
705 #define dump_fd_info libreport_dump_fd_info
706 int dump_fd_info(
const char *dest_filename,
const char *proc_pid_fd_path);
707 #define get_env_variable libreport_get_env_variable
708 int get_env_variable(pid_t pid,
const char *name,
char **value);
710 #define PROC_NS_UNSUPPORTED ((ino_t)-1)
711 #define PROC_NS_ID_IPC 0
712 #define PROC_NS_ID_MNT 1
713 #define PROC_NS_ID_NET 2
714 #define PROC_NS_ID_PID 3
715 #define PROC_NS_ID_USER 4
716 #define PROC_NS_ID_UTS 5
717 static const char * libreport_proc_namespaces[] = {
"ipc",
"mnt",
"net",
"pid",
"uts",
"user" };
720 ino_t nsi_ids[ARRAY_SIZE(libreport_proc_namespaces)];
723 #define get_ns_ids libreport_get_ns_ids
724 int get_ns_ids(pid_t pid,
struct ns_ids *ids);
725 #define process_has_own_root libreport_process_has_own_root
726 int process_has_own_root(pid_t pid);
727 #define get_pid_of_container libreport_get_pid_of_container
728 int get_pid_of_container(pid_t pid, pid_t *init_pid);
729 #define dump_namespace_diff_ext libreport_dump_namespace_diff_ext
730 int dump_namespace_diff_ext(
const char *dest_filename, pid_t base_pid, pid_t tested_pid, uid_t uid, gid_t gid);
731 #define dump_namespace_diff libreport_dump_namespace_diff
732 int dump_namespace_diff(
const char *dest_filename, pid_t base_pid, pid_t tested_pid);
734 #define MOUNTINFO_ROOT(val) (val.mntnf_items[3])
735 #define MOUNTINFO_MOUNT_POINT(val) (val.mntnf_items[4])
736 #define MOUNTINFO_MOUNT_SOURCE(val) (val.mntnf_items[8])
745 char *mntnf_items[10];
747 #define mountinfo_destroy libreport_mountinfo_destroy
748 void mountinfo_destroy(
struct mountinfo *mntnf);
749 #define get_mountinfo_for_mount_point libreport_get_mountinfo_for_mount_point
750 int get_mountinfo_for_mount_point(FILE *fin,
struct mountinfo *mntnf,
const char *mnt_point);
755 #define iso_date_string libreport_iso_date_string
756 char *iso_date_string(
const time_t *pt);
757 #define LIBREPORT_ISO_DATE_STRING_SAMPLE "YYYY-MM-DD-hh:mm:ss"
758 #define LIBREPORT_ISO_DATE_STRING_FORMAT "%Y-%m-%d-%H:%M:%S"
767 #define iso_date_string_parse libreport_iso_date_string_parse
768 int iso_date_string_parse(
const char *date, time_t *pt);
771 MAKEDESC_SHOW_FILES = (1 << 0),
772 MAKEDESC_SHOW_MULTILINE = (1 << 1),
773 MAKEDESC_SHOW_ONLY_LIST = (1 << 2),
774 MAKEDESC_WHITELIST = (1 << 3),
776 MAKEDESC_SHOW_URLS = (1 << 4),
778 #define make_description libreport_make_description
779 char *make_description(problem_data_t *problem_data,
char **names_to_skip,
unsigned max_text_size,
unsigned desc_flags);
780 #define make_description_bz libreport_make_description_bz
781 char* make_description_bz(problem_data_t *problem_data,
unsigned max_text_size);
782 #define make_description_logger libreport_make_description_logger
783 char* make_description_logger(problem_data_t *problem_data,
unsigned max_text_size);
784 #define make_description_mailx libreport_make_description_mailx
785 char* make_description_mailx(problem_data_t *problem_data,
unsigned max_text_size);
788 #define OSINFO_ID "ID"
789 #define OSINFO_NAME "NAME"
790 #define OSINFO_VERSION_ID "VERSION_ID"
791 #define OSINFO_PRETTY_NAME "PRETTY_NAME"
802 #define parse_osinfo libreport_parse_osinfo
803 void parse_osinfo(
const char *osinfo_bytes, map_string_t *osinfo);
819 #define parse_osinfo_for_bz libreport_parse_osinfo_for_bz
820 void parse_osinfo_for_bz(map_string_t *osinfo,
char **product,
char **version);
836 #define parse_osinfo_for_rhts libreport_parse_osinfo_for_rhts
837 void parse_osinfo_for_rhts(map_string_t *osinfo,
char **product,
char **version);
839 #define parse_release_for_bz libreport_parse_release_for_bz
840 void parse_release_for_bz(
const char *pRelease,
char **product,
char **version);
841 #define parse_release_for_rhts libreport_parse_release_for_rhts
842 void parse_release_for_rhts(
const char *pRelease,
char **product,
char **version);
858 #define load_conf_file libreport_load_conf_file
859 bool load_conf_file(
const char *pPath, map_string_t *settings,
bool skipKeysWithoutValue);
860 #define load_plugin_conf_file libreport_load_plugin_conf_file
861 bool load_plugin_conf_file(
const char *name, map_string_t *settings,
bool skipKeysWithoutValue);
863 #define get_user_conf_base_dir libreport_get_user_conf_base_dir
864 const char *get_user_conf_base_dir(
void);
866 #define load_conf_file_from_dirs libreport_load_conf_file_from_dirs
867 bool load_conf_file_from_dirs(
const char *base_name,
const char *
const *directories, map_string_t *settings,
bool skipKeysWithoutValue);
870 CONF_DIR_FLAG_NONE = 0,
871 CONF_DIR_FLAG_OPTIONAL = 1,
874 #define load_conf_file_from_dirs_ext libreport_load_conf_file_from_dirs_ext
875 bool load_conf_file_from_dirs_ext(
const char *base_name,
const char *
const *directories,
876 const int * dir_flags, map_string_t *settings,
877 bool skipKeysWithoutValue);
879 #define save_conf_file libreport_save_conf_file
880 bool save_conf_file(
const char *path, map_string_t *settings);
881 #define save_plugin_conf_file libreport_save_plugin_conf_file
882 bool save_plugin_conf_file(
const char *name, map_string_t *settings);
884 #define save_app_conf_file libreport_save_app_conf_file
885 bool save_app_conf_file(
const char* application_name, map_string_t *settings);
886 #define load_app_conf_file libreport_load_app_conf_file
887 bool load_app_conf_file(
const char *application_name, map_string_t *settings);
888 #define set_app_user_setting libreport_set_app_user_setting
889 void set_app_user_setting(map_string_t *settings,
const char *name,
const char *value);
890 #define get_app_user_setting libreport_get_app_user_setting
891 const char *get_app_user_setting(map_string_t *settings,
const char *name);
893 #define save_user_settings libreport_save_user_settings
894 bool save_user_settings();
895 #define load_user_settings libreport_load_user_settings
896 bool load_user_settings(
const char *application_name);
897 #define set_user_setting libreport_set_user_setting
898 void set_user_setting(
const char *name,
const char *value);
899 #define get_user_setting libreport_get_user_setting
900 const char *get_user_setting(
const char *name);
905 #define load_forbidden_words libreport_load_forbidden_words
906 GList *load_words_from_file(
const char *filename);
907 #define get_file_list libreport_get_file_list
908 GList *get_file_list(
const char *path,
const char *ext);
909 #define free_file_list libreport_free_file_list
910 void free_file_list(GList *filelist);
911 #define new_file_obj libreport_new_file_obj
912 file_obj_t *new_file_obj(
const char* fullpath,
const char* filename);
913 #define free_file_obj libreport_free_file_obj
915 #define parse_delimited_list libreport_parse_delimited_list
916 GList *parse_delimited_list(
char* list,
const char *delim);
917 #define parse_list libreport_parse_list
918 GList *parse_list(
const char* list);
921 int delete_dump_dir_possibly_using_abrtd(
const char *dump_dir_name);
925 #define steal_directory libreport_steal_directory
926 struct dump_dir *steal_directory(
const char *base_dir,
const char *dump_dir_name);
934 #define uid_in_group libreport_uid_in_group
935 bool uid_in_group(uid_t uid, gid_t gid);
943 #define open_directory_for_writing libreport_open_directory_for_writing
944 struct dump_dir *open_directory_for_writing(
945 const char *dump_dir_name,
946 bool (*ask_continue)(
const char *,
const char *));
962 #define CD_MAX_TEXT_SIZE (8*1024*1024)
968 #define CD_TEXT_ATT_SIZE_BZ (4*1024)
970 #define CD_TEXT_ATT_SIZE_LOGGER (CD_MAX_TEXT_SIZE)
974 #define FILENAME_TIME "time"
975 #define FILENAME_LAST_OCCURRENCE "last_occurrence"
976 #define FILENAME_REASON "reason"
977 #define FILENAME_UID "uid"
991 #define FILENAME_ANALYZER "analyzer"
992 #define FILENAME_TYPE "type"
993 #define FILENAME_EXECUTABLE "executable"
994 #define FILENAME_PID "pid"
995 #define FILENAME_TID "tid"
996 #define FILENAME_GLOBAL_PID "global_pid"
997 #define FILENAME_PWD "pwd"
998 #define FILENAME_ROOTDIR "rootdir"
999 #define FILENAME_BINARY "binary"
1000 #define FILENAME_CMDLINE "cmdline"
1001 #define FILENAME_COREDUMP "coredump"
1002 #define FILENAME_CGROUP "cgroup"
1003 #define FILENAME_BACKTRACE "backtrace"
1004 #define FILENAME_MAPS "maps"
1005 #define FILENAME_SMAPS "smaps"
1006 #define FILENAME_PROC_PID_STATUS "proc_pid_status"
1007 #define FILENAME_ENVIRON "environ"
1008 #define FILENAME_LIMITS "limits"
1009 #define FILENAME_OPEN_FDS "open_fds"
1010 #define FILENAME_MOUNTINFO "mountinfo"
1011 #define FILENAME_NAMESPACES "namespaces"
1016 #define FILENAME_DUPHASH "duphash"
1020 #define FILENAME_CRASH_FUNCTION "crash_function"
1021 #define FILENAME_ARCHITECTURE "architecture"
1022 #define FILENAME_KERNEL "kernel"
1029 #define FILENAME_OS_INFO "os_info"
1030 #define FILENAME_OS_INFO_IN_ROOTDIR "os_info_in_rootdir"
1032 #define FILENAME_OS_RELEASE "os_release"
1033 #define FILENAME_OS_RELEASE_IN_ROOTDIR "os_release_in_rootdir"
1035 #define FILENAME_PACKAGE "package"
1036 #define FILENAME_COMPONENT "component"
1037 #define FILENAME_COMMENT "comment"
1038 #define FILENAME_RATING "backtrace_rating"
1039 #define FILENAME_HOSTNAME "hostname"
1041 #define FILENAME_REMOTE "remote"
1042 #define FILENAME_TAINTED "kernel_tainted"
1043 #define FILENAME_TAINTED_SHORT "kernel_tainted_short"
1044 #define FILENAME_TAINTED_LONG "kernel_tainted_long"
1045 #define FILENAME_VMCORE "vmcore"
1046 #define FILENAME_KERNEL_LOG "kernel_log"
1049 #define FILENAME_DESCRIPTION "description"
1055 #define FILENAME_UUID "uuid"
1057 #define FILENAME_COUNT "count"
1064 #define FILENAME_REPORTED_TO "reported_to"
1065 #define FILENAME_EVENT_LOG "event_log"
1071 #define FILENAME_NOT_REPORTABLE "not-reportable"
1072 #define FILENAME_CORE_BACKTRACE "core_backtrace"
1073 #define FILENAME_REMOTE_RESULT "remote_result"
1074 #define FILENAME_PKG_EPOCH "pkg_epoch"
1075 #define FILENAME_PKG_NAME "pkg_name"
1076 #define FILENAME_PKG_VERSION "pkg_version"
1077 #define FILENAME_PKG_RELEASE "pkg_release"
1078 #define FILENAME_PKG_ARCH "pkg_arch"
1079 #define FILENAME_USERNAME "username"
1080 #define FILENAME_ABRT_VERSION "abrt_version"
1081 #define FILENAME_EXPLOITABLE "exploitable"
1085 #define FILENAME_KICKSTART_CFG "ks.cfg"
1086 #define FILENAME_ANACONDA_TB "anaconda-tb"
1090 #define FILENAME_CONTAINER "container"
1091 #define FILENAME_CONTAINER_ID "container_id"
1092 #define FILENAME_CONTAINER_UUID "container_uuid"
1093 #define FILENAME_CONTAINER_IMAGE "container_image"
1094 #define FILENAME_CONTAINER_CMDLINE "container_cmdline"
1095 #define FILENAME_DOCKER_INSPECT "docker_inspect"
1098 #define CD_DUMPDIR "Directory"
1100 #define cmp_problem_data libreport_cmp_problem_data
1101 gint cmp_problem_data(gconstpointer a, gconstpointer b, gpointer filename);
1112 EVENT_LOG_HIGH_WATERMARK = 30 * 1024,
1113 EVENT_LOG_LOW_WATERMARK = 20 * 1024,
1116 #define log_problem_data libreport_log_problem_data
1117 void log_problem_data(problem_data_t *problem_data,
const char *pfx);
1119 extern int g_libreport_inited;
1120 void libreport_init(
void);
1122 #define INITIALIZE_LIBREPORT() \
1125 if (!g_libreport_inited) \
1127 g_libreport_inited = 1; \
1133 const char *abrt_init(
char **argv);
1134 #define export_abrt_envvars libreport_export_abrt_envvars
1135 void export_abrt_envvars(
int pfx);
1136 #define g_progname libreport_g_progname
1137 extern const char *g_progname;
1139 enum parse_opt_type {
1150 enum parse_opt_type type;
1152 const char *long_name;
1165 #define OPT_END() { OPTION_END }
1166 #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
1167 #define OPT_BOOL( s, l, v, h) { OPTION_BOOL , (s), (l), (v), NULL , (h) }
1168 #define OPT_INTEGER( s, l, v, h) { OPTION_INTEGER , (s), (l), (v), "NUM", (h) }
1169 #define OPT_STRING( s, l, v, a, h) { OPTION_STRING , (s), (l), (v), (a) , (h) }
1170 #define OPT_OPTSTRING(s, l, v, a, h) { OPTION_OPTSTRING, (s), (l), (v), (a) , (h) }
1171 #define OPT_LIST( s, l, v, a, h) { OPTION_LIST , (s), (l), (v), (a) , (h) }
1173 #define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), _("Be verbose"))
1174 #define OPT__DUMP_DIR(v) OPT_STRING('d', "problem-dir", (v), "DIR", _("Problem directory"))
1176 #define parse_opts libreport_parse_opts
1177 unsigned parse_opts(
int argc,
char **argv,
const struct options *opt,
1180 #define show_usage_and_die libreport_show_usage_and_die
1181 void show_usage_and_die(
const char *usage,
const struct options *opt) NORETURN;
1186 struct abrt_post_state;
1207 #define uri_userinfo_remove libreport_uri_userinfo_remove
1208 int uri_userinfo_remove(
const char *uri,
char **result,
char **scheme,
char **hostname,
char **username,
char **password,
char **location);