21 #ifndef LIBREPORT_DUMP_DIR_H_
22 #define LIBREPORT_DUMP_DIR_H_
25 #include <sys/types.h>
33 int create_symlink_lockfile(
const char *filename,
const char *pid_str);
36 DD_FAIL_QUIETLY_ENOENT = (1 << 0),
37 DD_FAIL_QUIETLY_EACCES = (1 << 1),
39 DD_OPEN_FOLLOW = (1 << 2),
40 DD_OPEN_READONLY = (1 << 3),
41 DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 4),
42 DD_DONT_WAIT_FOR_LOCK = (1 << 5),
59 struct dump_dir *dd_opendir(
const char *dir,
int flags);
63 struct dump_dir *dd_create(
const char *dir, uid_t uid, mode_t mode);
65 void dd_create_basic_files(
struct dump_dir *dd, uid_t uid,
const char *chroot_dir);
66 int dd_exist(
const struct dump_dir *dd,
const char *path);
67 void dd_sanitize_mode_and_owner(
struct dump_dir *dd);
69 DIR *dd_init_next_file(
struct dump_dir *dd);
70 int dd_get_next_file(
struct dump_dir *dd,
char **short_name,
char **full_name);
72 char* dd_load_text_ext(
const struct dump_dir *dd,
const char *name,
unsigned flags);
73 char* dd_load_text(
const struct dump_dir *dd,
const char *name);
74 void dd_save_text(
struct dump_dir *dd,
const char *name,
const char *data);
75 void dd_save_binary(
struct dump_dir *dd,
const char *name,
const char *data,
unsigned size);
80 long dd_get_item_size(
struct dump_dir *dd,
const char *name);
85 int dd_delete_item(
struct dump_dir *dd,
const char *name);
88 int dd_rename(
struct dump_dir *dd,
const char *new_path);
97 int dd_chown(
struct dump_dir *dd, uid_t new_uid);
101 #define add_reported_to libreport_add_reported_to
102 void add_reported_to(
struct dump_dir *dd,
const char *line);
112 #define free_report_result libreport_free_report_result
114 #define find_in_reported_to libreport_find_in_reported_to
119 void delete_dump_dir(
const char *dirname);
127 int dump_dir_accessible_by_uid(
const char *dirname, uid_t uid);
130 DD_STAT_ACCESSIBLE_BY_UID = 1,
131 DD_STAT_OWNED_BY_UID = DD_STAT_ACCESSIBLE_BY_UID << 1,
141 int dump_dir_stat_for_uid(
const char *dirname, uid_t uid);
149 int dd_mark_as_notreportable(
struct dump_dir *dd,
const char *reason);