107 |
static void check_checksum(Service_T); |
static void check_checksum(Service_T); |
108 |
static void check_timestamp(Service_T); |
static void check_timestamp(Service_T); |
109 |
static void check_process_state(Service_T); |
static void check_process_state(Service_T); |
110 |
|
static void check_process_pid(Service_T); |
111 |
|
static void check_process_ppid(Service_T); |
112 |
static void check_connection(Service_T, Port_T); |
static void check_connection(Service_T, Port_T); |
113 |
static void check_device_resources(Service_T, Device_T); |
static void check_device_resources(Service_T, Device_T); |
114 |
static void check_process_resources(Service_T, Resource_T); |
static void check_process_resources(Service_T, Resource_T); |
178 |
|
|
179 |
/* Test for running process */ |
/* Test for running process */ |
180 |
if(!(pid= Util_isProcessRunning(s))) { |
if(!(pid= Util_isProcessRunning(s))) { |
181 |
/* Reset the proc info object to prevent false data in the first run */ |
/* Reset the service info object to prevent false data in the first run */ |
182 |
Util_resetProcInfo(s); |
Util_resetInfo(s); |
183 |
Event_post(s, EVENT_NONEXIST, TRUE, s->action_NONEXIST, |
Event_post(s, EVENT_NONEXIST, TRUE, s->action_NONEXIST, |
184 |
"'%s' process is not running", s->name); |
"'%s' process is not running", s->name); |
185 |
return FALSE; |
return FALSE; |
193 |
if(Run.doprocess) { |
if(Run.doprocess) { |
194 |
if(update_process_data(s, ptree, ptreesize, pid)) { |
if(update_process_data(s, ptree, ptreesize, pid)) { |
195 |
check_process_state(s); |
check_process_state(s); |
196 |
|
check_process_pid(s); |
197 |
|
check_process_ppid(s); |
198 |
for(pr= s->resourcelist; pr; pr= pr->next) { |
for(pr= s->resourcelist; pr; pr= pr->next) { |
199 |
check_process_resources(s, pr); |
check_process_resources(s, pr); |
200 |
} |
} |
532 |
} |
} |
533 |
|
|
534 |
|
|
535 |
|
/** |
536 |
|
* Test process pid for possible change since last cycle |
537 |
|
*/ |
538 |
|
static void check_process_pid(Service_T s) { |
539 |
|
|
540 |
|
ASSERT(s && s->inf); |
541 |
|
|
542 |
|
/* process pid was not initialized yet */ |
543 |
|
if(s->inf->_pid == -1) |
544 |
|
return; |
545 |
|
|
546 |
|
if(s->inf->_pid != s->inf->pid) { |
547 |
|
Event_post(s, EVENT_CHANGED, TRUE, s->action_PID, |
548 |
|
"'%s' process PID changed to %d", s->name, s->inf->pid); |
549 |
|
} else { |
550 |
|
Event_post(s, EVENT_CHANGED, FALSE, s->action_PID, |
551 |
|
"'%s' PID has not changed", s->name); |
552 |
|
} |
553 |
|
} |
554 |
|
|
555 |
|
|
556 |
|
/** |
557 |
|
* Test process ppid for possible change since last cycle |
558 |
|
*/ |
559 |
|
static void check_process_ppid(Service_T s) { |
560 |
|
|
561 |
|
ASSERT(s && s->inf); |
562 |
|
|
563 |
|
/* process ppid was not initialized yet */ |
564 |
|
if(s->inf->_ppid == -1) |
565 |
|
return; |
566 |
|
|
567 |
|
if(s->inf->_ppid != s->inf->ppid) { |
568 |
|
Event_post(s, EVENT_CHANGED, TRUE, s->action_PPID, |
569 |
|
"'%s' process PPID changed to %d", s->name, s->inf->ppid); |
570 |
|
} else { |
571 |
|
Event_post(s, EVENT_CHANGED, FALSE, s->action_PPID, |
572 |
|
"'%s' PPID has not changed", s->name); |
573 |
|
} |
574 |
|
} |
575 |
|
|
576 |
|
|
577 |
/** |
/** |
578 |
* Check process resources |
* Check process resources |
579 |
*/ |
*/ |