From: Neil Brown Date: Wed, 7 Jun 2006 11:19:35 +0000 (+1000) Subject: Full prototype for class methods. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=a0b2af2cfb7d623ebb415998b7e32816896a21c1;p=metad.git Full prototype for class methods. Helps type checking. --- diff --git a/metad.h b/metad.h index 7c4f885..4900d1f 100644 --- a/metad.h +++ b/metad.h @@ -33,21 +33,6 @@ typedef struct service { time_t next_hold; /* hold time for next crashing processes */ } *service_t; -typedef struct class { - char *class; /* name of class */ - int (*c_process_opt)(); /* function to processes options */ - void (*register_service)(); /* register the service if necessary */ - void (*c_check_service)(); /* check if anything needs to be done for a service */ - void (*init_state)(); /* copy state from old service struct to new */ - void (*copy_state)(); /* copy state from old service struct to new */ - void (*free_state)(); /* free class dependant state */ - void (*send_class)(); /* send class info */ - void (*disable_service)(); /* unregister service */ - void (*new_parent)(); /* in parent of new child */ - void (*new_child)(); /* in a new child */ - int (*prefork)(); /* just before fork */ -} *class_t; - typedef struct proc { pid_t pid; /* pid of process */ service_t service; @@ -62,6 +47,21 @@ typedef struct proc { int status; /* wait status if exit_time > 0 */ } *proc_t; +typedef struct class { + char *class; /* name of class */ + int (*c_process_opt)(service_t sv, char *opt); /* function to processes options */ + void (*register_service)(service_t sv); /* register the service if necessary */ + void (*c_check_service)(service_t sv); /* check if anything needs to be done for a service */ + void (*init_state)(service_t to); /* copy state from old service struct to new */ + void (*copy_state)(service_t to, service_t from);/* copy state from old service struct to new */ + void (*free_state)(service_t sv); /* free class dependant state */ + void (*send_class)(service_t sv); /* send class info */ + void (*disable_service)(service_t sv); /* unregister service */ + void (*new_parent)(service_t sv, proc_t p);/* in parent of new child */ + void (*new_child)(service_t sv); /* in a new child */ + int (*prefork)(service_t sv); /* just before fork */ +} *class_t; + typedef struct daemon_info { /* class specific info for class "daemon" */ int min_proc; /* minimum number of processes to have running */