summaryrefslogtreecommitdiffstats
path: root/src/include/report/run_event.h
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-02-18 15:11:32 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-02-18 15:11:32 +0100
commite09e019ca971e8ce4164e04a3b6007a679bef288 (patch)
tree553adb26730bd723995e7e65d61e8435c401106a /src/include/report/run_event.h
parent3d0baac256ff28e755b4f80d431d0eb7730d4dd9 (diff)
downloadabrt-e09e019ca971e8ce4164e04a3b6007a679bef288.tar.gz
abrt-e09e019ca971e8ce4164e04a3b6007a679bef288.tar.xz
abrt-e09e019ca971e8ce4164e04a3b6007a679bef288.zip
run_event: add async run event machinery
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/include/report/run_event.h')
-rw-r--r--src/include/report/run_event.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/report/run_event.h b/src/include/report/run_event.h
index 388a74e6..8730eea8 100644
--- a/src/include/report/run_event.h
+++ b/src/include/report/run_event.h
@@ -29,23 +29,46 @@ struct dump_dir;
struct run_event_state {
int children_count;
+
/* Used only for post-create dup detection. TODO: document its API */
int (*post_run_callback)(const char *dump_dir_name, void *param);
void *post_run_param;
+
/* Can take ownership of log_line, which is malloced. In this case, return NULL.
* Otherwise should return log_line (it will be freed by caller)
*/
char* (*logging_callback)(char *log_line, void *param);
void *logging_param;
+
+ /* Internal data for async command execution */
+ GList *commands;
+ pid_t command_pid;
+ int command_out_fd;
};
struct run_event_state *new_run_event_state(void);
void free_run_event_state(struct run_event_state *state);
+/* Asyncronous command execution */
+
+/* Returns 0 if no commands found for this dump_dir_name+event, else >0 */
+int prepare_commands(struct run_event_state *state, const char *dump_dir_name, const char *event);
+/* Returns -1 is no more commands needs to be executed,
+ * else sets state->command_pid and state->command_out_fd and returns >=0
+ */
+int spawn_next_command(struct run_event_state *state, const char *dump_dir_name, const char *event);
+/* Cleans up internal state created in prepare_commands */
+void free_commands(struct run_event_state *state);
+
+/* Syncronous command execution */
+
/* Returns exitcode of first failed action, or first nonzero return value
* of post_run_callback. If all actions are successful, returns 0.
*/
int run_event_on_dir_name(struct run_event_state *state, const char *dump_dir_name, const char *event);
int run_event_on_crash_data(struct run_event_state *state, crash_data_t *data, const char *event);
+
+/* Querying for possible events */
+
/* Returns a malloced string with '\n'-terminated event names */
char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx);