/[monit]/monit/monitor.h
ViewVC logotype

Diff of /monit/monitor.h

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

revision 1.58 by hauk, Mon Jun 16 22:06:15 2003 UTC revision 1.59 by hauk, Tue Jun 17 02:04:57 2003 UTC
# Line 104  Line 104 
104    
105  /** ------------------------------------------------- Special purpose macros */  /** ------------------------------------------------- Special purpose macros */
106    
107    
108  /* Mask compiler built-in namespace (C99) and reserved identifiers as  /* Mask compiler built-in namespace (C99) and reserved identifiers as
109   *  well as external identifiers (in libraries we link with). */   *  well as external identifiers (in libraries we link with). */
110  #define log  log_log  #define log  log_log
# Line 116  Sigfunc *signal(int signo, Sigfunc * fun Line 117  Sigfunc *signal(int signo, Sigfunc * fun
117  #define SIG_ERR ((Sigfunc *)-1)  #define SIG_ERR ((Sigfunc *)-1)
118  #endif  #endif
119    
120    
121  /** ------------------------------------------------- General purpose macros */  /** ------------------------------------------------- General purpose macros */
122    
123    
124  #ifdef MAX  #ifdef MAX
125  #undef MAX  #undef MAX
126  #endif  #endif
# Line 125  Sigfunc *signal(int signo, Sigfunc * fun Line 128  Sigfunc *signal(int signo, Sigfunc * fun
128  #define IS(a,b)  ((a&&b)?!strcasecmp(a, b):0)  #define IS(a,b)  ((a&&b)?!strcasecmp(a, b):0)
129  #define DEBUG if(Run.debug) log  #define DEBUG if(Run.debug) log
130    
131    
132  /** ------------------------------------------------- Synchronization macros */  /** ------------------------------------------------- Synchronization macros */
133    
134    
135  #define LOCK(mutex) do { pthread_mutex_t *_yymutex = &(mutex); \  #define LOCK(mutex) do { pthread_mutex_t *_yymutex = &(mutex); \
136          pthread_mutex_lock(_yymutex);          pthread_mutex_lock(_yymutex);
137  #define END_LOCK pthread_mutex_unlock(_yymutex); } while (0)  #define END_LOCK pthread_mutex_unlock(_yymutex); } while (0)
138    
139    
140  /** ----------------------------------------------- Object Constructor macro */  /** ----------------------------------------------- Object Constructor macro */
141    
142    
143  #define NEW(p) (xcalloc(1, (long)sizeof *(p)))  #define NEW(p) (xcalloc(1, (long)sizeof *(p)))
144    
145    
146  /** ------------------------------------------ Simple Assert Exception macro */  /** ------------------------------------------ Simple Assert Exception macro */
147    
148    
149  #define ASSERT(e) if(!(e)) { error("AssertException: at %s:%d\naborting..\n", \  #define ASSERT(e) if(!(e)) { error("AssertException: at %s:%d\naborting..\n", \
150      __FILE__, __LINE__); abort(); }      __FILE__, __LINE__); abort(); }
151    
152    
153  /* --------------------------------------------------------- Data structures */  /* --------------------------------------------------------- Data structures */
154    
155    
156  /** Defines data for application runtime */  /** Defines data for application runtime */
157  struct myrun {  struct myrun {
158    char *controlfile;                /**< The file to read configuration from */    char *controlfile;                /**< The file to read configuration from */
# Line 199  struct myrun { Line 210  struct myrun {
210    
211  };  };
212    
213    
214  /** Defines a port object */  /** Defines a port object */
215  typedef struct myport {  typedef struct myport {
216    volatile int socket;                       /**< Socket used for connection */    volatile int socket;                       /**< Socket used for connection */
# Line 222  typedef struct myport { Line 234  typedef struct myport {
234    struct myport *next;                               /**< next port in chain */    struct myport *next;                               /**< next port in chain */
235  } *Port_T;  } *Port_T;
236    
237    
238  /** Defines a protocol object with protocol functions */  /** Defines a protocol object with protocol functions */
239  typedef struct myprotocol *Protocol_T;  typedef struct myprotocol *Protocol_T;
240    
241    
242  typedef struct mydependant {  typedef struct mydependant {
243    char *dependant;                           /**< name of dependant service  */    char *dependant;                           /**< name of dependant service  */
244    /** For internal use */    /** For internal use */
245    struct mydependant *next;           /**< next dependant service in chain   */    struct mydependant *next;           /**< next dependant service in chain   */
246  } *Dependant_T;  } *Dependant_T;
247    
248    
249  /** Defines a checksum object */  /** Defines a checksum object */
250  typedef struct mychecksum {  typedef struct mychecksum {
251    char *file;                  /**< A filename to compute a md5 checksum for */    char *file;                  /**< A filename to compute a md5 checksum for */
# Line 240  typedef struct mychecksum { Line 255  typedef struct mychecksum {
255    struct mychecksum *next;                       /**< next checksum in chain */    struct mychecksum *next;                       /**< next checksum in chain */
256  } *Checksum_T;  } *Checksum_T;
257    
258    
259  /** Defines a mailinglist object */  /** Defines a mailinglist object */
260  typedef struct mymail {  typedef struct mymail {
261    char *to;                         /**< Mail address for alert notification */    char *to;                         /**< Mail address for alert notification */
# Line 258  typedef struct mymail { Line 274  typedef struct mymail {
274    struct mymail *next;                          /**< next recipient in chain */    struct mymail *next;                          /**< next recipient in chain */
275  } *Mail_T;  } *Mail_T;
276    
277    
278  /** Defines resource data */  /** Defines resource data */
279  typedef struct myresource {  typedef struct myresource {
280    int  resource_id;                              /**< Which value is checked */    int  resource_id;                              /**< Which value is checked */
# Line 270  typedef struct myresource { Line 287  typedef struct myresource {
287    struct myresource *next;    struct myresource *next;
288  } *Resource_T;  } *Resource_T;
289    
290    
291  /** Defines timestamp object */  /** Defines timestamp object */
292  typedef struct mytimestamp {  typedef struct mytimestamp {
293    char *pathname;                                    /**< Path to the object */    char *pathname;                                    /**< Path to the object */
# Line 280  typedef struct mytimestamp { Line 298  typedef struct mytimestamp {
298    struct mytimestamp *next;    struct mytimestamp *next;
299  } *Timestamp_T;  } *Timestamp_T;
300    
301    
302  /** Defines procfs (or other mechanism) data */  /** Defines procfs (or other mechanism) data */
303  typedef struct myprocinfo {  typedef struct myprocinfo {
304    int  pid;    int  pid;
# Line 299  typedef struct myprocinfo { Line 318  typedef struct myprocinfo {
318    long  cputime_prev;                                      /**< 1/10 seconds */    long  cputime_prev;                                      /**< 1/10 seconds */
319  } *ProcInfo_T;  } *ProcInfo_T;
320    
321    
322  /**  /**
323   * Defines a Command with ARGMAX optional arguments. The arguments   * Defines a Command with ARGMAX optional arguments. The arguments
324   * array must be NULL terminated and the first entry is the program   * array must be NULL terminated and the first entry is the program
# Line 317  typedef struct mycommand { Line 337  typedef struct mycommand {
337    char *env[ARGMAX];        /**< Environment variables to be set for Command */    char *env[ARGMAX];        /**< Environment variables to be set for Command */
338  } *Command_T;  } *Command_T;
339    
340    
341  /** Defines filesystem device data */  /** Defines filesystem device data */
342  typedef struct mydeviceinfo {  typedef struct mydeviceinfo {
343    long f_bsize;                                     /**< Transfer block size */    long f_bsize;                                     /**< Transfer block size */
# Line 327  typedef struct mydeviceinfo { Line 348  typedef struct mydeviceinfo {
348    long f_filesfree;                       /**< Free file nodes in filesystem */    long f_filesfree;                       /**< Free file nodes in filesystem */
349  } *DeviceInfo_T;  } *DeviceInfo_T;
350    
351    
352  /** Defines filesystem device configuration */  /** Defines filesystem device configuration */
353  typedef struct mydevice {  typedef struct mydevice {
354    int  resource;                        /**< Whether to check inode or space */    int  resource;                        /**< Whether to check inode or space */
# Line 338  typedef struct mydevice { Line 360  typedef struct mydevice {
360    struct mydevice *next;    struct mydevice *next;
361  } *Device_T;  } *Device_T;
362    
363    
364  /** Defines service data */  /** Defines service data */
365  typedef struct myservice {  typedef struct myservice {
366    
# Line 388  typedef struct myservice { Line 411  typedef struct myservice {
411    
412  } *Service_T;  } *Service_T;
413    
414    
415  /** Defines process tree */  /** Defines process tree */
416  typedef struct myprocesstree {  typedef struct myprocesstree {
   
417    int                       pid;    int                       pid;
418    int                       ppid;    int                       ppid;
419    long                      mem_kbyte;    long                      mem_kbyte;
   
420    int                       children_num;    int                       children_num;
   struct myprocesstree **   children;  
     
   struct myprocesstree *    parent;  
   
421    long                      mem_kbyte_sum;    long                      mem_kbyte_sum;
422    int                       children_sum;    int                       children_sum;
423    
424      struct myprocesstree **   children;
425      struct myprocesstree *    parent;
426  } ProcessTree_T;  } ProcessTree_T;
427    
428    
429  /* ------ Global variables ------------------------------------------------- */  /* -------------------------------------------------------- Global variables */
430  Service_T servicelist;                /**< The service list (created in p.y) */  
431    
432  char   *prog;                                  /**< The Name of this Program */  char   *prog;                                  /**< The Name of this Program */
433  struct myrun Run;                      /**< Struct holding runtime constants */  struct myrun Run;                      /**< Struct holding runtime constants */
434    Service_T servicelist;                /**< The service list (created in p.y) */
435    
436    
437    /* ------------------------------------------------------- Public prototypes */
438    
439    
 /* Public prototypes */  
440  void  error(const char *, ...);  void  error(const char *, ...);
441  char *trim(char *);  char *trim(char *);
442  char *ltrim(char *);  char *ltrim(char *);
# Line 489  void  state_update(); Line 513  void  state_update();
513  void  state_finalize();  void  state_finalize();
514  char *get_device(char *, unsigned, char *);  char *get_device(char *, unsigned, char *);
515  int   get_fsusage(char *, DeviceInfo_T);  int   get_fsusage(char *, DeviceInfo_T);
516    
517  #endif  #endif

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

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