g_variant_unref(parameters);
}
-static void dump_system_state(void)
+static int dump_system_state(void)
{
int ret;
char command[PATH_MAX];
crash_info.log_path);
if (ret < 0) {
_E("Failed to snprintf for dump_systemstate command");
- return;
+ return -1;
}
- system_command(command);
+
+ return system_command_parallel(command);
}
static void execute_crash_modules(int argc, char *argv[], int debug)
int main(int argc, char *argv[])
{
+ /* Execute dump_systemstate in parallel */
+ static int dump_state_pid;
+
prctl(PR_SET_DUMPABLE, 0);
/* Get Configuration */
get_sysassert_cs();
#endif
- /* .dbugmode: launch crash-popup */
- if (access(DEBUGMODE_FILE, F_OK) == 0)
- launch_crash_popup();
-
/* Exec dump_systemstate */
- dump_system_state();
+ dump_state_pid = dump_system_state();
/* Exec crash modules */
execute_crash_modules(argc, argv, DEBUG);
+ /* Wait dump_system_state */
+ wait_system_command(dump_state_pid);
+
/* Tar compression */
if (allow_zip)
compress();
else
move_dump_dir();
+ /* .dbugmode: launch crash-popup */
+ if (access(DEBUGMODE_FILE, F_OK) == 0)
+ launch_crash_popup();
+
return 0;
}
#include "util.h"
#include "log.h"
-int system_command(char *command)
+int system_command_parallel(char *command)
{
- int pid = 0,
- status = 0;
+ int pid = 0;
const char *environ[] = { NULL };
if (command == NULL)
execve("/bin/sh", argv, (char **)environ);
exit(127);
}
+
+ return pid;
+}
+
+int wait_system_command(int pid)
+{
+ int status = 0;
+
+ if (pid < 0)
+ return -1;
+
do {
if (waitpid(pid, &status, 0) == -1) {
if (errno != EINTR)
return 0;
}
+int system_command(char *command)
+{
+ int pid = 0;
+
+ pid = system_command_parallel(command);
+
+ return wait_system_command(pid);
+}
+
int system_command_with_timeout(int timeout_seconds, char *command)
{
const char *environ[] = { NULL };
int system_command_with_timeout(int timeout_seconds, char *command);
+int system_command_parallel(char *command);
+
+int wait_system_command(int pid);
+
int fprintf_fd(int fd, const char *fmt, ...);
int write_fd(int fd, const void *buf, int len);