#define ALLOW_ZIP true
#define CRASH_CHECK_DISK_PATH "/opt/usr"
+#define WAIT_FOR_OPT_TIMEOUT_SEC 60
#define MINICOREDUMPER_TIMEOUT 12*60
_E("Failed to delete temp directory");
}
+static int wait_for_opt(unsigned int timeout)
+{
+ unsigned int count = 0;
+
+ while (check_disk_available(CRASH_ROOT_PATH, 0) < 0 && count < timeout) {
+ log_kmsg("crash-manager: path %s is not available\n", CRASH_ROOT_PATH);
+ sleep(1);
+ count++;
+ }
+ if (count >= timeout) {
+ log_kmsg("crash-manager: timeout (%ds) while waiting for %s."
+ "Probably /opt is not mounted.\n", timeout, CRASH_ROOT_PATH);
+ return 0;
+ }
+
+ return 1;
+}
+
int main(int argc, char *argv[])
{
/* Execute dump_systemstate in parallel */
* value that prevents from running crash-manager recursively.
*/
- /* Get Configuration */
+ if (!wait_for_opt(WAIT_FOR_OPT_TIMEOUT_SEC))
+ exit(EXIT_FAILURE);
+ /* Get Configuration */
get_config();
/* Create crash directories */
/* Make build variables to string */
#define CRASH_PATH "@CRASH_PATH@"
+#define CRASH_ROOT_PATH "@CRASH_ROOT_PATH@"
#define CRASH_TEMP "@CRASH_TEMP@"
#define SYS_ASSERT "@SYS_ASSERT@"
#ifdef TIZEN_FEATURE_PTRACE_CALLSTACK
return 0;
}
+
+int log_kmsg(char *fmt, ...)
+{
+ int result = 1;
+ va_list ap;
+ FILE *file;
+
+ file = fopen("/dev/kmsg", "w");
+ if (file == NULL) {
+ _E("Open /dev/kmsg error: %m");
+ return 0;
+ }
+
+ va_start(ap, fmt);
+ if (vfprintf(file, fmt, ap) < 0) {
+ _E("Write to /dev/kmsg error: %m");
+ result = 0;
+ }
+ va_end(ap);
+ fclose(file);
+ return result;
+}
/**
* @}
*/
int validate_env_name(char *name, int len);
int validate_file_name(char *name, int len);
+
+int log_kmsg(char *fmt, ...);
/**
* @}
*/