From 47b2e1194892f662995d5886649e983f7509b707 Mon Sep 17 00:00:00 2001 From: juho Date: Wed, 22 May 2013 14:22:11 +0900 Subject: [PATCH] add limit number of launching crash-worker at the same time. crash notify files can have many notify to launch crash-worker when crash is occured many times at the sametime. It can make problem of target stuck. so add limit number of launching crash-worker at the same time. Change-Id: Ia3a2e107b0d9b18c0eb33280061d8a8d27c35ec8 Signed-off-by: juho --- src/bs/bs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bs/bs.c b/src/bs/bs.c index 1043d2f..7453375 100644 --- a/src/bs/bs.c +++ b/src/bs/bs.c @@ -34,6 +34,7 @@ #include "core/launch.h" #include "core/devices.h" +#define CRASH_WORKER_MAX 3 #define CRASH_PID_MAX 7 #define CRASH_MODE_MAX 2 #define CRASH_TIME_MAX 65 @@ -297,7 +298,7 @@ static void launch_crash_worker(const char *filename, int popup_on) static int popup_pid = 0; FILE *fp; int ret = -1; - int len = 0; + int len, count; char linebuffer[CRASH_ARG_MAX] = {0,}; char crash_worker_args[CRASH_ARG_MAX] = {0,}; struct crash_arg parsing_arg; @@ -305,6 +306,7 @@ static void launch_crash_worker(const char *filename, int popup_on) if (fp == NULL) { return; } + count = 0; /* launch crash process */ while (fgets(linebuffer, CRASH_ARG_MAX, fp) != NULL) { len = strlen(linebuffer); @@ -332,6 +334,9 @@ static void launch_crash_worker(const char *filename, int popup_on) fprintf(fpAdj, "%d", (-17)); fclose(fpAdj); } + count++; + if (CRASH_WORKER_MAX <= count) + break; } if (popup_on) { if (!is_running_process(popup_pid)) -- 2.7.4