/[monit]/monit/event.c
ViewVC logotype

Diff of /monit/event.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by martinp, Tue Aug 12 13:11:01 2003 UTC revision 1.20 by martinp, Thu Aug 14 08:24:39 2003 UTC
# Line 78  struct Event_Table { Line 78  struct Event_Table {
78    
79  static void handle_event(Event_T E);  static void handle_event(Event_T E);
80    
 static void handle_uid(Event_T E);  
 static void handle_gid(Event_T E);  
81  static void handle_size(Event_T E);  static void handle_size(Event_T E);
82  static void handle_stop(Event_T E);  static void handle_stop(Event_T E);
83  static void handle_start(Event_T E);  static void handle_start(Event_T E);
84  static void handle_restart(Event_T E);  static void handle_restart(Event_T E);
85  static void handle_timeout(Event_T E);  static void handle_timeout(Event_T E);
 static void handle_checksum(Event_T E);  
86  static void handle_resource(Event_T E);  static void handle_resource(Event_T E);
87  static void handle_timestamp(Event_T E);  static void handle_timestamp(Event_T E);
88  static void handle_connection(Event_T E);  static void handle_connection(Event_T E);
89    static void handle_checksum(Event_T E);
90  static void handle_permission(Event_T E);  static void handle_permission(Event_T E);
91    static void handle_uid(Event_T E);
92    static void handle_gid(Event_T E);
93    
94    
95  /* ------------------------------------------------------------------ Public */  /* ------------------------------------------------------------------ Public */
# Line 231  static void handle_event(Event_T E) { Line 231  static void handle_event(Event_T E) {
231    }    }
232    
233    switch(E->id) {    switch(E->id) {
   case EVENT_UID:        handle_uid(E); break;  
   case EVENT_GID:        handle_gid(E); break;  
234    case EVENT_SIZE:       handle_size(E); break;    case EVENT_SIZE:       handle_size(E); break;
235    case EVENT_STOP:       handle_stop(E); break;    case EVENT_STOP:       handle_stop(E); break;
236    case EVENT_START:      handle_start(E); break;    case EVENT_START:      handle_start(E); break;
237    case EVENT_RESTART:    handle_restart(E); break;    case EVENT_RESTART:    handle_restart(E); break;
238    case EVENT_TIMEOUT:    handle_timeout(E); break;    case EVENT_TIMEOUT:    handle_timeout(E); break;
   case EVENT_CHECKSUM:   handle_checksum(E); break;  
239    case EVENT_RESOURCE:   handle_resource(E); break;    case EVENT_RESOURCE:   handle_resource(E); break;
240    case EVENT_TIMESTAMP:  handle_timestamp(E); break;    case EVENT_TIMESTAMP:  handle_timestamp(E); break;
241    case EVENT_CONNECTION: handle_connection(E); break;    case EVENT_CONNECTION: handle_connection(E); break;
242      case EVENT_CHECKSUM:   handle_checksum(E); break;
243    case EVENT_PERMISSION: handle_permission(E); break;    case EVENT_PERMISSION: handle_permission(E); break;
244      case EVENT_UID:        handle_uid(E); break;
245      case EVENT_GID:        handle_gid(E); break;
246    }    }
247        
248    if(E->id != EVENT_NULL) {    if(E->id != EVENT_NULL) {
# Line 300  static void handle_timeout(Event_T E) { Line 300  static void handle_timeout(Event_T E) {
300  }  }
301    
302    
 static void handle_checksum(Event_T E) {  
   
   LOCK(Run.mutex)  
       E->source->checksum->has_error= TRUE;  
   END_LOCK;  
   
 }  
   
   
303  static void handle_resource(Event_T E) {  static void handle_resource(Event_T E) {
304    
305    Resource_T r;    Resource_T r;
# Line 381  static void handle_connection(Event_T E) Line 372  static void handle_connection(Event_T E)
372  }  }
373    
374    
375    static void handle_checksum(Event_T E) {
376    
377      Service_T s= E->source;
378    
379      LOCK(Run.mutex)
380        s->checksum->has_error= TRUE;
381      END_LOCK;
382    
383      if(s->checksum->event_flag && s->checksum->exec != NULL) {
384        s->checksum->event_flag= FALSE;
385        spawn(s, s->checksum->exec);
386      }
387    
388    }
389    
390    
391  static void handle_permission(Event_T E) {  static void handle_permission(Event_T E) {
392    
393      Service_T s= E->source;
394    
395    LOCK(Run.mutex)    LOCK(Run.mutex)
396        E->source->perm->has_error= TRUE;      s->perm->has_error= TRUE;
397    END_LOCK;    END_LOCK;
398    
399      if(s->perm->event_flag && s->perm->exec != NULL) {
400        s->perm->event_flag= FALSE;
401        spawn(s, s->perm->exec);
402      }
403    
404  }  }
405    
406    
407  static void handle_uid(Event_T E) {  static void handle_uid(Event_T E) {
408    
409      Service_T s= E->source;
410    
411    LOCK(Run.mutex)    LOCK(Run.mutex)
412        E->source->uid->has_error= TRUE;      s->uid->has_error= TRUE;
413    END_LOCK;    END_LOCK;
414    
415      if(s->uid->event_flag && s->uid->exec != NULL) {
416        s->uid->event_flag= FALSE;
417        spawn(s, s->uid->exec);
418      }
419    
420  }  }
421    
422    
423  static void handle_gid(Event_T E) {  static void handle_gid(Event_T E) {
424    
425      Service_T s= E->source;
426    
427    LOCK(Run.mutex)    LOCK(Run.mutex)
428        E->source->gid->has_error= TRUE;      s->gid->has_error= TRUE;
429    END_LOCK;    END_LOCK;
430    
431      if(s->gid->event_flag && s->gid->exec != NULL) {
432        s->gid->event_flag= FALSE;
433        spawn(s, s->gid->exec);
434      }
435    
436  }  }
437    
438    

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26