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" 90 #define STOP_ON_NOT_REPORTABLE "ABRT_STOP_ON_NOT_REPORTABLE" 93 #define USER_HOME_CONFIG_PATH "/.config/libreport" 96 #include "global_configuration.h" 98 #include "event_config.h" 101 #include "run_event.h" 102 #include "workflow.h" 103 #include "file_obj.h" 104 #include "libreport_types.h" 105 #include "reporters.h" 111 #define prefixcmp libreport_prefixcmp 112 int prefixcmp(
const char *str,
const char *prefix);
113 #define suffixcmp libreport_suffixcmp 114 int suffixcmp(
const char *str,
const char *suffix);
115 #define trim_all_whitespace libreport_trim_all_whitespace 116 char *trim_all_whitespace(
const char *str);
117 #define shorten_string_to_length libreport_shorten_string_to_length 118 char *shorten_string_to_length(
const char *str,
unsigned length);
119 #define strtrim libreport_strtrim 120 char *strtrim(
char *str);
121 #define strtrimch libreport_strtrimch 122 char *strtrimch(
char *str,
int ch);
123 #define strremovech libreport_strremovech 124 char *strremovech(
char *str,
int ch);
125 #define append_to_malloced_string libreport_append_to_malloced_string 126 char *append_to_malloced_string(
char *mstr,
const char *append);
127 #define skip_blank libreport_skip_blank 128 char* skip_blank(
const char *s);
129 #define skip_whitespace libreport_skip_whitespace 130 char* skip_whitespace(
const char *s);
131 #define skip_non_whitespace libreport_skip_non_whitespace 132 char* skip_non_whitespace(
const char *s);
134 #define overlapping_strcpy libreport_overlapping_strcpy 135 void overlapping_strcpy(
char *dst,
const char *src);
137 #define concat_path_file libreport_concat_path_file 138 char *concat_path_file(
const char *path,
const char *filename);
143 #define concat_path_basename libreport_concat_path_basename 144 char *concat_path_basename(
const char *path,
const char *filename);
149 #define str_is_correct_filename libreport_str_is_correct_filename 150 bool str_is_correct_filename(
const char *str);
153 #define xmalloc_fgets libreport_xmalloc_fgets 154 char *xmalloc_fgets(FILE *file);
156 #define xmalloc_fgetline libreport_xmalloc_fgetline 157 char *xmalloc_fgetline(FILE *file);
159 #define xmalloc_fopen_fgetline_fclose libreport_xmalloc_fopen_fgetline_fclose 160 char *xmalloc_fopen_fgetline_fclose(
const char *filename);
164 COPYFD_SPARSE = 1 << 0,
165 } libreport_copyfd_flags;
183 #define copyfd_ext_at libreport_copyfd_ext_at 184 off_t copyfd_ext_at(
int src,
int dir_fd,
const char *name,
int mode,
185 uid_t uid, gid_t gid,
int open_flags,
int copy_flags, off_t size);
188 #define copyfd_eof libreport_copyfd_eof 189 off_t copyfd_eof(
int src_fd,
int dst_fd,
int flags);
190 #define copyfd_size libreport_copyfd_size 191 off_t copyfd_size(
int src_fd,
int dst_fd, off_t size,
int flags);
192 #define copyfd_exact_size libreport_copyfd_exact_size 193 void copyfd_exact_size(
int src_fd,
int dst_fd, off_t size);
194 #define copy_file_ext_2at libreport_copy_file_ext_2at 195 off_t copy_file_ext_2at(
int src_dir_fd,
const char *src_name,
int dir_fd,
const char *name,
int mode, uid_t uid, gid_t gid,
int src_flags,
int dst_flags);
196 #define copy_file_ext_at libreport_copy_file_ext_at 197 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);
198 #define copy_file_ext(src_name, dst_name, mode, uid, gid, src_flags, dst_flags) \ 199 copy_file_ext_at(src_name, AT_FDCWD, dst_name, mode, uid, gid, src_flags, dst_flags) 200 #define copy_file libreport_copy_file 201 off_t copy_file(
const char *src_name,
const char *dst_name,
int mode);
202 #define copy_file_at libreport_copy_file_at 203 off_t copy_file_at(
const char *src_name,
int dir_fd,
const char *name,
int mode);
204 #define copy_file_recursive libreport_copy_file_recursive 205 int copy_file_recursive(
const char *source,
const char *dest);
207 #define decompress_fd libreport_decompress_fd 208 int decompress_fd(
int fdi,
int fdo);
209 #define decompress_file libreport_decompress_file 210 int decompress_file(
const char *path_in,
const char *path_out, mode_t mode_out);
211 #define decompress_file_ext_at libreport_decompress_file_ext_at 212 int decompress_file_ext_at(
const char *path_in,
int dir_fd,
const char *path_out,
213 mode_t mode_out, uid_t uid, gid_t gid,
int src_flags,
int dst_flags);
217 #define xread libreport_xread 218 void xread(
int fd,
void *buf,
size_t count);
219 #define safe_read libreport_safe_read 220 ssize_t safe_read(
int fd,
void *buf,
size_t count);
221 #define safe_write libreport_safe_write 222 ssize_t safe_write(
int fd,
const void *buf,
size_t count);
223 #define full_read libreport_full_read 224 ssize_t full_read(
int fd,
void *buf,
size_t count);
225 #define full_write libreport_full_write 226 ssize_t full_write(
int fd,
const void *buf,
size_t count);
227 #define full_write_str libreport_full_write_str 228 ssize_t full_write_str(
int fd,
const char *buf);
229 #define xmalloc_read libreport_xmalloc_read 230 void* xmalloc_read(
int fd,
size_t *maxsz_p);
231 #define xmalloc_open_read_close libreport_xmalloc_open_read_close 232 void* xmalloc_open_read_close(
const char *filename,
size_t *maxsz_p);
233 #define xmalloc_xopen_read_close libreport_xmalloc_xopen_read_close 234 void* xmalloc_xopen_read_close(
const char *filename,
size_t *maxsz_p);
235 #define malloc_readlink libreport_malloc_readlink 236 char* malloc_readlink(
const char *linkname);
237 #define malloc_readlinkat libreport_malloc_readlinkat 238 char* malloc_readlinkat(
int dir_fd,
const char *linkname);
242 #define encode_base64 libreport_encode_base64 243 char *encode_base64(
const void *src,
int length);
249 #define sanitize_utf8 libreport_sanitize_utf8 250 char *sanitize_utf8(
const char *src, uint32_t control_chars_to_sanitize);
252 SANITIZE_ALL = 0xffffffff,
253 SANITIZE_TAB = (1 << 9),
254 SANITIZE_LF = (1 << 10),
255 SANITIZE_CR = (1 << 13),
258 #define SHA1_RESULT_LEN (5 * 4) 265 #define sha1_begin libreport_sha1_begin 267 #define sha1_hash libreport_sha1_hash 268 void sha1_hash(
sha1_ctx_t *ctx,
const void *buffer,
size_t len);
269 #define sha1_end libreport_sha1_end 273 #define str_to_sha1 libreport_str_to_sha1 274 const uint8_t *str_to_sha1(uint8_t result[SHA1_RESULT_LEN],
const char *str);
275 #define str_to_sha1str libreport_str_to_sha1str 276 const char *str_to_sha1str(
char result[SHA1_RESULT_LEN*2 + 1],
const char *str);
279 #define try_atou libreport_try_atou 280 int try_atou(
const char *numstr,
unsigned *value);
281 #define xatou libreport_xatou 282 unsigned xatou(
const char *numstr);
283 #define try_atoi libreport_try_atoi 284 int try_atoi(
const char *numstr,
int *value);
285 #define xatoi libreport_xatoi 286 int xatoi(
const char *numstr);
294 #define try_atoi_positive libreport_try_atoi_positive 295 int try_atoi_positive(
const char *numstr,
int *value);
296 #define xatoi_positive libreport_xatoi_positive 297 int xatoi_positive(
const char *numstr);
304 #define safe_waitpid libreport_safe_waitpid 305 pid_t safe_waitpid(pid_t pid,
int *wstat,
int options);
310 EXECFLG_INPUT = 1 << 0,
313 EXECFLG_OUTPUT = 1 << 1,
315 EXECFLG_INPUT_NUL = 1 << 2,
317 EXECFLG_OUTPUT_NUL = 1 << 3,
319 EXECFLG_ERR2OUT = 1 << 4,
321 EXECFLG_ERR_NUL = 1 << 5,
323 EXECFLG_QUIET = 1 << 6,
324 EXECFLG_SETGUID = 1 << 7,
325 EXECFLG_SETSID = 1 << 8,
326 EXECFLG_SETPGID = 1 << 9,
334 #define fork_execv_on_steroids libreport_fork_execv_on_steroids 335 pid_t fork_execv_on_steroids(
int flags,
343 #define run_in_shell_and_save_output libreport_run_in_shell_and_save_output 344 char *run_in_shell_and_save_output(
int flags,
351 #define is_in_string_list libreport_is_in_string_list 352 bool is_in_string_list(
const char *name,
const char *
const *v);
354 #define index_of_string_in_list libreport_index_of_string_in_list 355 int index_of_string_in_list(
const char *name,
const char *
const *v);
357 #define is_in_comma_separated_list libreport_is_in_comma_separated_list 358 bool is_in_comma_separated_list(
const char *value,
const char *list);
359 #define is_in_comma_separated_list_of_glob_patterns libreport_is_in_comma_separated_list_of_glob_patterns 360 bool is_in_comma_separated_list_of_glob_patterns(
const char *value,
const char *list);
364 #define glib_init libreport_glib_init 365 void glib_init(
void);
370 #define list_free_with_free libreport_list_free_with_free 371 void list_free_with_free(GList *list);
373 #define get_dirsize libreport_get_dirsize 374 double get_dirsize(
const char *pPath);
375 #define get_dirsize_find_largest_dir libreport_get_dirsize_find_largest_dir 376 double get_dirsize_find_largest_dir(
382 #define ndelay_on libreport_ndelay_on 383 int ndelay_on(
int fd);
384 #define ndelay_off libreport_ndelay_off 385 int ndelay_off(
int fd);
386 #define close_on_exec_on libreport_close_on_exec_on 387 int close_on_exec_on(
int fd);
389 #define xmalloc libreport_xmalloc 390 void* xmalloc(
size_t size);
391 #define xrealloc libreport_xrealloc 392 void* xrealloc(
void *ptr,
size_t size);
393 #define xzalloc libreport_xzalloc 394 void* xzalloc(
size_t size);
395 #define xstrdup libreport_xstrdup 396 char* xstrdup(
const char *s);
397 #define xstrndup libreport_xstrndup 398 char* xstrndup(
const char *s,
int n);
399 #define xstrdup_between libreport_xstrdup_between 400 char* xstrdup_between(
const char *s,
const char *open,
const char *close);
402 #define xpipe libreport_xpipe 403 void xpipe(
int filedes[2]);
404 #define xdup libreport_xdup 406 #define xdup2 libreport_xdup2 407 void xdup2(
int from,
int to);
408 #define xmove_fd libreport_xmove_fd 409 void xmove_fd(
int from,
int to);
411 #define xwrite libreport_xwrite 412 void xwrite(
int fd,
const void *buf,
size_t count);
413 #define xwrite_str libreport_xwrite_str 414 void xwrite_str(
int fd,
const char *str);
416 #define xlseek libreport_xlseek 417 off_t xlseek(
int fd, off_t offset,
int whence);
419 #define xchdir libreport_xchdir 420 void xchdir(
const char *path);
422 #define xvasprintf libreport_xvasprintf 423 char* xvasprintf(
const char *format, va_list p);
424 #define xasprintf libreport_xasprintf 425 char* xasprintf(
const char *format, ...);
427 #define xsetenv libreport_xsetenv 428 void xsetenv(
const char *key,
const char *value);
439 #define safe_unsetenv libreport_safe_unsetenv 440 void safe_unsetenv(
const char *var_val);
442 #define xsocket libreport_xsocket 443 int xsocket(
int domain,
int type,
int protocol);
444 #define xbind libreport_xbind 445 void xbind(
int sockfd,
struct sockaddr *my_addr, socklen_t addrlen);
446 #define xlisten libreport_xlisten 447 void xlisten(
int s,
int backlog);
448 #define xsendto libreport_xsendto 449 ssize_t xsendto(
int s,
const void *buf,
size_t len,
450 const struct sockaddr *to, socklen_t tolen);
452 #define xstat libreport_xstat 453 void xstat(
const char *name,
struct stat *stat_buf);
454 #define fstat_st_size_or_die libreport_fstat_st_size_or_die 455 off_t fstat_st_size_or_die(
int fd);
456 #define stat_st_size_or_die libreport_stat_st_size_or_die 457 off_t stat_st_size_or_die(
const char *filename);
459 #define xopen3 libreport_xopen3 460 int xopen3(
const char *pathname,
int flags,
int mode);
461 #define xopen libreport_xopen 462 int xopen(
const char *pathname,
int flags);
463 #define xunlink libreport_xunlink 464 void xunlink(
const char *pathname);
465 #define xunlinkat libreport_xunlinkat 466 void xunlinkat(
int dir_fd,
const char *pathname,
int flags);
474 #define is_regular_file libreport_is_regular_file 475 int is_regular_file(
struct dirent *dent,
const char *dirname);
476 #define is_regular_file_at libreport_is_regular_file_at 477 int is_regular_file_at(
struct dirent *dent,
int dir_fd);
479 #define dot_or_dotdot libreport_dot_or_dotdot 480 bool dot_or_dotdot(
const char *filename);
481 #define last_char_is libreport_last_char_is 482 char *last_char_is(
const char *s,
int c);
484 #define string_to_bool libreport_string_to_bool 485 bool string_to_bool(
const char *s);
487 #define xseteuid libreport_xseteuid 488 void xseteuid(uid_t euid);
489 #define xsetegid libreport_xsetegid 490 void xsetegid(gid_t egid);
491 #define xsetreuid libreport_xsetreuid 492 void xsetreuid(uid_t ruid, uid_t euid);
493 #define xsetregid libreport_xsetregid 494 void xsetregid(gid_t rgid, gid_t egid);
496 #define xfdopen libreport_xfdopen 497 FILE *xfdopen(
int fd,
const char *mode);
500 #define bin2hex libreport_bin2hex 501 char* bin2hex(
char *dst,
const char *str,
int count);
503 #define hex2bin libreport_hex2bin 504 char* hex2bin(
char *dst,
const char *str,
int count);
509 LOGMODE_STDIO = (1 << 0),
510 LOGMODE_SYSLOG = (1 << 1),
511 LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
512 LOGMODE_CUSTOM = (1 << 2),
513 LOGMODE_JOURNAL = (1 << 3),
516 enum libreport_diemode {
521 #define g_custom_logger libreport_g_custom_logger 522 extern void (*g_custom_logger)(
const char*);
523 #define msg_prefix libreport_msg_prefix 524 extern const char *msg_prefix;
525 #define msg_eol libreport_msg_eol 526 extern const char *msg_eol;
527 #define logmode libreport_logmode 529 #define xfunc_error_retval libreport_xfunc_error_retval 530 extern int xfunc_error_retval;
533 #define EXIT_CANCEL_BY_USER 69 534 #define EXIT_STOP_EVENT_RUN 70 536 #define set_xfunc_error_retval libreport_set_xfunc_error_retval 537 void set_xfunc_error_retval(
int retval);
539 #define set_xfunc_diemode libreport_set_xfunc_diemode 540 void set_xfunc_diemode(
enum libreport_diemode mode);
543 #define g_verbose libreport_g_verbose 544 extern int g_verbose;
546 #define VERB1 if (g_verbose >= 1) 548 #define VERB2 if (g_verbose >= 2) 550 #define VERB3 if (g_verbose >= 3) 554 #define xfunc_die libreport_xfunc_die 555 void xfunc_die(
void) NORETURN;
557 #define die_out_of_memory libreport_die_out_of_memory 558 void die_out_of_memory(
void) NORETURN;
562 #define log_warning(...) log_standard(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__) 563 #define log_debug(...) log_standard(LOG_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__) 564 #define log_info(...) log_standard(LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__) 565 #define log_notice(...) log_standard(LOG_NOTICE, __FILE__, __LINE__, __func__, __VA_ARGS__) 566 #define log_warning(...) log_standard(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__) 567 #define log_error(...) log_standard(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__) 570 #define log_parser(...) if(0) log_debug(__VA_ARGS__) 572 #define log_standard(level, file, line, func, ...) log_wrapper(level, __FILE__, __LINE__, __func__, false, false, __VA_ARGS__) 575 #define log_error_and_die(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, false,__VA_ARGS__) 576 #define log_perror(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, false, __VA_ARGS__) 577 #define log_perror_and_die(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, false, __VA_ARGS__) 579 #define error_msg(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__) 580 #define perror_msg(...) log_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__) 581 #define warn_msg(...) log_wrapper(LOG_WARNING, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__) 582 #define pwarn_msg(...) log_wrapper(LOG_WARNING, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__) 583 #define notice_msg(...) log_wrapper(LOG_NOTICE, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__) 584 #define pnotice_msg(...) log_wrapper(LOG_NOTICE, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__) 585 #define error_msg_and_die(...) log_and_die_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, false, true, __VA_ARGS__) 586 #define perror_msg_and_die(...) log_and_die_wrapper(LOG_ERR, __FILE__, __LINE__, __func__, true, true, __VA_ARGS__) 589 void log_wrapper(
int level,
594 bool use_custom_logger,
595 const char *format, ...) __attribute__ ((format (printf, 7,8)));
597 void log_and_die_wrapper(
int level,
602 bool use_custom_logger,
603 const
char *format, ...) __attribute__ ((noreturn, format (printf, 7,8)));
620 #define strbuf_new libreport_strbuf_new 621 struct strbuf *strbuf_new(
void);
628 #define strbuf_free libreport_strbuf_free 636 #define strbuf_free_nobuf libreport_strbuf_free_nobuf 643 #define strbuf_clear libreport_strbuf_clear 650 #define strbuf_append_char libreport_strbuf_append_char 657 #define strbuf_append_str libreport_strbuf_append_str 665 #define strbuf_prepend_str libreport_strbuf_prepend_str 673 #define strbuf_append_strf libreport_strbuf_append_strf 675 const char *format, ...);
681 #define strbuf_append_strfv libreport_strbuf_append_strfv 683 const char *format, va_list p);
690 #define strbuf_prepend_strf libreport_strbuf_prepend_strf 692 const char *format, ...);
698 #define strbuf_prepend_strfv libreport_strbuf_prepend_strfv 700 const char *format, va_list p);
707 #define open_proc_pid_dir libreport_open_proc_pid_dir 708 int open_proc_pid_dir(pid_t pid);
709 #define get_cmdline_at libreport_get_cmdline_at 710 char* get_cmdline_at(pid_t pid);
711 #define get_cmdline libreport_get_cmdline 712 char* get_cmdline(pid_t pid);
713 #define get_environ_at libreport_get_environ_at 714 char* get_environ_at(pid_t pid);
715 #define get_environ libreport_get_environ 716 char* get_environ(pid_t pid);
717 #define get_executable_at libreport_get_executable_at 718 char *get_executable_at(pid_t pid);
719 #define get_executable libreport_get_executable 720 char *get_executable(pid_t pid);
721 #define get_cwd_at libreport_get_cwd_at 722 char* get_cwd_at(pid_t pid);
723 #define get_cwd libreport_get_cwd 724 char* get_cwd(pid_t pid);
725 #define get_rootdir_at libreport_get_rootdir_at 726 char* get_rootdir_at(pid_t pid);
727 #define get_rootdir libreport_get_rootdir 728 char* get_rootdir(pid_t pid);
730 #define get_fsuid libreport_get_fsuid 731 int get_fsuid(
const char *proc_pid_status);
732 #define get_fsgid libreport_get_fsgid 733 int get_fsgid(
const char *proc_pid_status);
734 #define dump_fd_info_at libreport_dump_fd_info_at 735 int dump_fd_info_at(
int pid_proc_fd, FILE *dest);
736 #define dump_fd_info_ext libreport_dump_fd_info_ext 737 int dump_fd_info_ext(
const char *dest_filename,
const char *proc_pid_fd_path, uid_t uid, gid_t gid);
738 #define dump_fd_info libreport_dump_fd_info 739 int dump_fd_info(
const char *dest_filename,
const char *proc_pid_fd_path);
740 #define get_env_variable_ext libreport_get_env_variable_ext 741 int get_env_variable_ext(
int fd,
char delim,
const char *name,
char **value);
742 #define get_env_variable libreport_get_env_variable 743 int get_env_variable(pid_t pid,
const char *name,
char **value);
745 #define PROC_NS_UNSUPPORTED ((ino_t)-1) 746 #define PROC_NS_ID_IPC 0 747 #define PROC_NS_ID_MNT 1 748 #define PROC_NS_ID_NET 2 749 #define PROC_NS_ID_PID 3 750 #define PROC_NS_ID_USER 4 751 #define PROC_NS_ID_UTS 5 752 #define PROC_NS_ID_CGROUP 6 753 static const char * libreport_proc_namespaces[] = {
"ipc",
"mnt",
"net",
"pid",
"uts",
"user",
"cgroup",
"pid_for_children" };
756 ino_t nsi_ids[ARRAY_SIZE(libreport_proc_namespaces)];
759 #define get_ns_ids_at libreport_get_ns_ids_at 760 int get_ns_ids_at(
int pid_proc_fd,
struct ns_ids *ids);
761 #define get_ns_ids libreport_get_ns_ids 762 int get_ns_ids(pid_t pid,
struct ns_ids *ids);
767 #define process_has_own_root_at libreport_process_has_own_root_at 768 int process_has_own_root_at(
int proc_pid_fd);
769 #define process_has_own_root libreport_process_has_own_root 770 int process_has_own_root(pid_t pid);
772 #define get_pid_of_container_at libreport_get_pid_of_container_at 773 int get_pid_of_container_at(
int pid_proc_fd, pid_t *init_pid);
774 #define get_pid_of_container libreport_get_pid_of_container 775 int get_pid_of_container(pid_t pid, pid_t *init_pid);
776 #define dump_namespace_diff_at libreport_dump_namespace_diff_at 777 int dump_namespace_diff_at(
int base_pid_proc_fd,
int tested_pid_proc_fd, FILE *dest);
778 #define dump_namespace_diff_ext libreport_dump_namespace_diff_ext 779 int dump_namespace_diff_ext(
const char *dest_filename, pid_t base_pid, pid_t tested_pid, uid_t uid, gid_t gid);
780 #define dump_namespace_diff libreport_dump_namespace_diff 781 int dump_namespace_diff(
const char *dest_filename, pid_t base_pid, pid_t tested_pid);
785 MOUNTINFO_INDEX_MOUNT_ID,
786 MOUNTINFO_INDEX_PARENT_ID,
787 MOUNTINFO_INDEX_MAJOR_MINOR,
788 MOUNTINFO_INDEX_ROOT,
789 MOUNTINFO_INDEX_MOUNT_POINT,
790 MOUNTINFO_INDEX_MOUNT_OPTIONS,
791 MOUNTINFO_INDEX_OPTIONAL_FIELDS,
792 MOUNTINFO_INDEX_FS_TYPE,
793 MOUNTINFO_INDEX_MOUNT_SOURCE,
794 MOUNTINFO_INDEX_SUPER_OPITONS,
795 _MOUNTINFO_INDEX_MAX,
798 #define MOUNTINFO_ROOT(val) (val.mntnf_items[MOUNTINFO_INDEX_ROOT]) 799 #define MOUNTINFO_MOUNT_POINT(val) (val.mntnf_items[MOUNTINFO_INDEX_MOUNT_POINT]) 800 #define MOUNTINFO_MOUNT_SOURCE(val) (val.mntnf_items[MOUNTINFO_INDEX_MOUNT_SOURCE]) 809 char *mntnf_items[_MOUNTINFO_INDEX_MAX];
811 #define mountinfo_destroy libreport_mountinfo_destroy 812 void mountinfo_destroy(
struct mountinfo *mntnf);
813 #define get_mountinfo_for_mount_point libreport_get_mountinfo_for_mount_point 814 int get_mountinfo_for_mount_point(FILE *fin,
struct mountinfo *mntnf,
const char *mnt_point);
819 #define iso_date_string libreport_iso_date_string 820 char *iso_date_string(
const time_t *pt);
821 #define LIBREPORT_ISO_DATE_STRING_SAMPLE "YYYY-MM-DD-hh:mm:ss" 822 #define LIBREPORT_ISO_DATE_STRING_FORMAT "%Y-%m-%d-%H:%M:%S" 831 #define iso_date_string_parse libreport_iso_date_string_parse 832 int iso_date_string_parse(
const char *date, time_t *pt);
835 MAKEDESC_SHOW_FILES = (1 << 0),
836 MAKEDESC_SHOW_MULTILINE = (1 << 1),
837 MAKEDESC_SHOW_ONLY_LIST = (1 << 2),
838 MAKEDESC_WHITELIST = (1 << 3),
840 MAKEDESC_SHOW_URLS = (1 << 4),
842 #define make_description libreport_make_description 843 char *make_description(problem_data_t *problem_data,
char **names_to_skip,
unsigned max_text_size,
unsigned desc_flags);
844 #define make_description_logger libreport_make_description_logger 845 char* make_description_logger(problem_data_t *problem_data,
unsigned max_text_size);
848 #define OSINFO_ID "ID" 849 #define OSINFO_NAME "NAME" 850 #define OSINFO_VERSION_ID "VERSION_ID" 851 #define OSINFO_PRETTY_NAME "PRETTY_NAME" 862 #define parse_osinfo libreport_parse_osinfo 863 void parse_osinfo(
const char *osinfo_bytes, map_string_t *osinfo);
879 #define parse_osinfo_for_bz libreport_parse_osinfo_for_bz 880 void parse_osinfo_for_bz(map_string_t *osinfo,
char **product,
char **version);
893 #define parse_osinfo_for_bug_url libreport_parse_osinfo_for_bug_url 894 void parse_osinfo_for_bug_url(map_string_t *osinfo,
char** url);
910 #define parse_osinfo_for_rhts libreport_parse_osinfo_for_rhts 911 void parse_osinfo_for_rhts(map_string_t *osinfo,
char **product,
char **version);
913 #define parse_release_for_bz libreport_parse_release_for_bz 914 void parse_release_for_bz(
const char *pRelease,
char **product,
char **version);
915 #define parse_release_for_rhts libreport_parse_release_for_rhts 916 void parse_release_for_rhts(
const char *pRelease,
char **product,
char **version);
932 #define load_conf_file libreport_load_conf_file 933 bool load_conf_file(
const char *pPath, map_string_t *settings,
bool skipKeysWithoutValue);
934 #define load_plugin_conf_file libreport_load_plugin_conf_file 935 bool load_plugin_conf_file(
const char *name, map_string_t *settings,
bool skipKeysWithoutValue);
937 #define get_user_conf_base_dir libreport_get_user_conf_base_dir 938 const char *get_user_conf_base_dir(
void);
940 #define load_conf_file_from_dirs libreport_load_conf_file_from_dirs 941 bool load_conf_file_from_dirs(
const char *base_name,
const char *
const *directories, map_string_t *settings,
bool skipKeysWithoutValue);
944 CONF_DIR_FLAG_NONE = 0,
945 CONF_DIR_FLAG_OPTIONAL = 1,
948 #define load_conf_file_from_dirs_ext libreport_load_conf_file_from_dirs_ext 949 bool load_conf_file_from_dirs_ext(
const char *base_name,
const char *
const *directories,
950 const int * dir_flags, map_string_t *settings,
951 bool skipKeysWithoutValue);
953 #define save_conf_file libreport_save_conf_file 954 bool save_conf_file(
const char *path, map_string_t *settings);
955 #define save_plugin_conf_file libreport_save_plugin_conf_file 956 bool save_plugin_conf_file(
const char *name, map_string_t *settings);
958 #define save_app_conf_file libreport_save_app_conf_file 959 bool save_app_conf_file(
const char* application_name, map_string_t *settings);
960 #define load_app_conf_file libreport_load_app_conf_file 961 bool load_app_conf_file(
const char *application_name, map_string_t *settings);
962 #define set_app_user_setting libreport_set_app_user_setting 963 void set_app_user_setting(map_string_t *settings,
const char *name,
const char *value);
964 #define get_app_user_setting libreport_get_app_user_setting 965 const char *get_app_user_setting(map_string_t *settings,
const char *name);
967 #define save_user_settings libreport_save_user_settings 968 bool save_user_settings(
void);
969 #define load_user_settings libreport_load_user_settings 970 bool load_user_settings(
const char *application_name);
971 #define set_user_setting libreport_set_user_setting 972 void set_user_setting(
const char *name,
const char *value);
973 #define get_user_setting libreport_get_user_setting 974 const char *get_user_setting(
const char *name);
979 #define load_forbidden_words libreport_load_forbidden_words 980 GList *load_words_from_file(
const char *filename);
981 #define get_file_list libreport_get_file_list 982 GList *get_file_list(
const char *path,
const char *ext);
983 #define free_file_list libreport_free_file_list 984 void free_file_list(GList *filelist);
985 #define new_file_obj libreport_new_file_obj 986 file_obj_t *new_file_obj(
const char* fullpath,
const char* filename);
987 #define free_file_obj libreport_free_file_obj 989 #define parse_delimited_list libreport_parse_delimited_list 990 GList *parse_delimited_list(
char* list,
const char *delim);
991 #define parse_list libreport_parse_list 992 GList *parse_list(
const char* list);
995 int delete_dump_dir_possibly_using_abrtd(
const char *dump_dir_name);
999 #define steal_directory libreport_steal_directory 1000 struct dump_dir *steal_directory(
const char *base_dir,
const char *dump_dir_name);
1008 #define uid_in_group libreport_uid_in_group 1009 bool uid_in_group(uid_t uid, gid_t gid);
1017 #define open_directory_for_writing libreport_open_directory_for_writing 1018 struct dump_dir *open_directory_for_writing(
1019 const char *dump_dir_name,
1020 bool (*ask_continue)(
const char *,
const char *));
1036 #define CD_MAX_TEXT_SIZE (8*1024*1024) 1042 #define CD_TEXT_ATT_SIZE_BZ (4*1024) 1044 #define CD_TEXT_ATT_SIZE_LOGGER (CD_MAX_TEXT_SIZE) 1048 #define FILENAME_TIME "time" 1049 #define FILENAME_LAST_OCCURRENCE "last_occurrence" 1050 #define FILENAME_REASON "reason" 1051 #define FILENAME_UID "uid" 1065 #define FILENAME_ANALYZER "analyzer" 1066 #define FILENAME_TYPE "type" 1067 #define FILENAME_EXECUTABLE "executable" 1068 #define FILENAME_PID "pid" 1069 #define FILENAME_TID "tid" 1070 #define FILENAME_GLOBAL_PID "global_pid" 1071 #define FILENAME_PWD "pwd" 1072 #define FILENAME_ROOTDIR "rootdir" 1073 #define FILENAME_BINARY "binary" 1074 #define FILENAME_CMDLINE "cmdline" 1075 #define FILENAME_COREDUMP "coredump" 1076 #define FILENAME_CGROUP "cgroup" 1077 #define FILENAME_BACKTRACE "backtrace" 1078 #define FILENAME_MAPS "maps" 1079 #define FILENAME_SMAPS "smaps" 1080 #define FILENAME_PROC_PID_STATUS "proc_pid_status" 1081 #define FILENAME_ENVIRON "environ" 1082 #define FILENAME_LIMITS "limits" 1083 #define FILENAME_OPEN_FDS "open_fds" 1084 #define FILENAME_MOUNTINFO "mountinfo" 1085 #define FILENAME_NAMESPACES "namespaces" 1086 #define FILENAME_CPUINFO "cpuinfo" 1091 #define FILENAME_DUPHASH "duphash" 1095 #define FILENAME_CRASH_FUNCTION "crash_function" 1096 #define FILENAME_ARCHITECTURE "architecture" 1097 #define FILENAME_KERNEL "kernel" 1104 #define FILENAME_OS_INFO "os_info" 1105 #define FILENAME_OS_INFO_IN_ROOTDIR "os_info_in_rootdir" 1107 #define FILENAME_OS_RELEASE "os_release" 1108 #define FILENAME_OS_RELEASE_IN_ROOTDIR "os_release_in_rootdir" 1110 #define FILENAME_PACKAGE "package" 1111 #define FILENAME_COMPONENT "component" 1112 #define FILENAME_COMMENT "comment" 1113 #define FILENAME_RATING "backtrace_rating" 1114 #define FILENAME_HOSTNAME "hostname" 1116 #define FILENAME_REMOTE "remote" 1117 #define FILENAME_TAINTED "kernel_tainted" 1118 #define FILENAME_TAINTED_SHORT "kernel_tainted_short" 1119 #define FILENAME_TAINTED_LONG "kernel_tainted_long" 1120 #define FILENAME_VMCORE "vmcore" 1121 #define FILENAME_KERNEL_LOG "kernel_log" 1124 #define FILENAME_DESCRIPTION "description" 1130 #define FILENAME_UUID "uuid" 1132 #define FILENAME_COUNT "count" 1139 #define FILENAME_REPORTED_TO "reported_to" 1140 #define FILENAME_EVENT_LOG "event_log" 1146 #define FILENAME_NOT_REPORTABLE "not-reportable" 1147 #define FILENAME_CORE_BACKTRACE "core_backtrace" 1148 #define FILENAME_REMOTE_RESULT "remote_result" 1149 #define FILENAME_PKG_EPOCH "pkg_epoch" 1150 #define FILENAME_PKG_NAME "pkg_name" 1151 #define FILENAME_PKG_VERSION "pkg_version" 1152 #define FILENAME_PKG_RELEASE "pkg_release" 1153 #define FILENAME_PKG_ARCH "pkg_arch" 1156 #define FILENAME_PKG_VENDOR "pkg_vendor" 1158 #define FILENAME_PKG_FINGERPRINT "pkg_fingerprint" 1160 #define FILENAME_USERNAME "username" 1161 #define FILENAME_ABRT_VERSION "abrt_version" 1162 #define FILENAME_EXPLOITABLE "exploitable" 1165 #define FILENAME_REPRODUCIBLE "reproducible" 1166 #define FILENAME_REPRODUCER "reproducer" 1170 #define FILENAME_KICKSTART_CFG "ks.cfg" 1171 #define FILENAME_ANACONDA_TB "anaconda-tb" 1175 #define FILENAME_CONTAINER "container" 1176 #define FILENAME_CONTAINER_ID "container_id" 1177 #define FILENAME_CONTAINER_UUID "container_uuid" 1178 #define FILENAME_CONTAINER_IMAGE "container_image" 1179 #define FILENAME_CONTAINER_CMDLINE "container_cmdline" 1181 #define FILENAME_CONTAINER_ROOTFS "container_rootfs" 1182 #define FILENAME_DOCKER_INSPECT "docker_inspect" 1187 #define FILENAME_EXCEPTION_TYPE "exception_type" 1190 #define CD_DUMPDIR "Directory" 1192 #define cmp_problem_data libreport_cmp_problem_data 1193 gint cmp_problem_data(gconstpointer a, gconstpointer b, gpointer filename);
1204 EVENT_LOG_HIGH_WATERMARK = 30 * 1024,
1205 EVENT_LOG_LOW_WATERMARK = 20 * 1024,
1208 #define log_problem_data libreport_log_problem_data 1209 void log_problem_data(problem_data_t *problem_data,
const char *pfx);
1211 extern int g_libreport_inited;
1212 void libreport_init(
void);
1214 #define INITIALIZE_LIBREPORT() \ 1217 if (!g_libreport_inited) \ 1219 g_libreport_inited = 1; \ 1225 const char *abrt_init(
char **argv);
1226 #define export_abrt_envvars libreport_export_abrt_envvars 1227 void export_abrt_envvars(
int pfx);
1228 #define g_progname libreport_g_progname 1229 extern const char *g_progname;
1231 enum parse_opt_type {
1242 enum parse_opt_type type;
1244 const char *long_name;
1257 #define OPT_END() { OPTION_END } 1258 #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) } 1259 #define OPT_BOOL( s, l, v, h) { OPTION_BOOL , (s), (l), (v), NULL , (h) } 1260 #define OPT_INTEGER( s, l, v, h) { OPTION_INTEGER , (s), (l), (v), "NUM", (h) } 1261 #define OPT_STRING( s, l, v, a, h) { OPTION_STRING , (s), (l), (v), (a) , (h) } 1262 #define OPT_OPTSTRING(s, l, v, a, h) { OPTION_OPTSTRING, (s), (l), (v), (a) , (h) } 1263 #define OPT_LIST( s, l, v, a, h) { OPTION_LIST , (s), (l), (v), (a) , (h) } 1265 #define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), _("Be verbose")) 1266 #define OPT__DUMP_DIR(v) OPT_STRING('d', "problem-dir", (v), "DIR", _("Problem directory")) 1268 #define parse_opts libreport_parse_opts 1269 unsigned parse_opts(
int argc,
char **argv,
const struct options *opt,
1272 #define show_usage_and_die libreport_show_usage_and_die 1273 void show_usage_and_die(
const char *usage,
const struct options *opt) NORETURN;
1278 struct abrt_post_state;
1299 #define uri_userinfo_remove libreport_uri_userinfo_remove 1300 int uri_userinfo_remove(
const char *uri,
char **result,
char **scheme,
char **hostname,
char **username,
char **password,
char **location);