/[monit]/monit/p.y
ViewVC logotype

Diff of /monit/p.y

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

revision 1.51 by hauk, Sat Dec 21 01:43:36 2002 UTC revision 1.52 by hauk, Sat Dec 21 13:56:04 2002 UTC
# Line 628  void yyerror(const char *msg) { Line 628  void yyerror(const char *msg) {
628    
629    ASSERT(msg);    ASSERT(msg);
630    
631    log("%s: %s '%s' at line %d\n", prog, msg, yytext, lineno );    log("%s: %s '%s' at line %d\n", prog, msg, yytext, lineno);
632    cfg_errflag++;    cfg_errflag++;
633    
634  }  }
# Line 677  int parse(char *controlfile) { Line 677  int parse(char *controlfile) {
677        check_depend();        check_depend();
678    END_LOCK;    END_LOCK;
679            
680    return ( cfg_errflag == 0 );    return(cfg_errflag == 0);
681        
682  }  }
683    
# Line 698  static void initialize() { Line 698  static void initialize() {
698    Run.Auth.defined= FALSE;    Run.Auth.defined= FALSE;
699    Run.servicessl= FALSE;    Run.servicessl= FALSE;
700    Run.clientssl= FALSE;    Run.clientssl= FALSE;
701      depend_list= NULL;
702    reset_runmail();    reset_runmail();
703    if(Run.bind_addr) {    if(Run.bind_addr) {
704      free(Run.bind_addr);      free(Run.bind_addr);
# Line 717  static void createprocess(char *name, ch Line 718  static void createprocess(char *name, ch
718    ASSERT(name);    ASSERT(name);
719    ASSERT(pidfile);    ASSERT(pidfile);
720    
721    if ( current ) {    if(current) {
722    
723      createprocinfo();      createprocinfo();
724      addprocess(current);      addprocess(current);
# Line 749  static void createprocess(char *name, ch Line 750  static void createprocess(char *name, ch
750   */   */
751  static void addprocess(Process_T p) {  static void addprocess(Process_T p) {
752        
753    Process_T n= NEW(n);    Process_T n;
754    
755      ASSERT(p);
756      
757      n= NEW(n);
758    memcpy(n, p, sizeof(*p));    memcpy(n, p, sizeof(*p));
759    
760    /* Add the process to the end of the process list */    /* Add the process to the end of the process list */
761    if ( tail != NULL ) {    if(tail != NULL) {
762            
763      tail->next= n;      tail->next= n;
764            
# Line 801  static void addchecksum(char *filename, Line 805  static void addchecksum(char *filename,
805    
806    c->file= filename;    c->file= filename;
807        
808    if ( sum ) {    if(sum) {
809            
810      c->md5= sum;      c->md5= sum;
811    
812            
813    } else if ( ! set_md5sum(&c->md5, filename) ) {    } else if(! set_md5sum(&c->md5, filename)) {
814            
815      log("%s: Cannot compute a checksum for %s at line %d\n",      log("%s: Cannot compute a checksum for %s at line %d\n",
816          prog, filename, lineno-1);          prog, filename, lineno-1);
# Line 838  static void addmail(char *mailto, struct Line 842  static void addmail(char *mailto, struct
842    
843    ASSERT(mailto);    ASSERT(mailto);
844    
845    if ( f->timeout  ||    if(f->timeout  ||
846         f->restart  ||         f->restart  ||
847         f->checksum ||         f->checksum ||
848         f->resource ||         f->resource ||
849         f->stop     ||         f->stop     ||
850         f->timestamp ) {         f->timestamp) {
851            
852      m->alert_on_timeout= f->timeout;      m->alert_on_timeout= f->timeout;
853      m->alert_on_restart= f->restart;      m->alert_on_restart= f->restart;
# Line 903  static void addport(struct PortSet *pp) Line 907  static void addport(struct PortSet *pp)
907    
908    }    }
909    
910    if ( pp->family == AF_INET ) {    if(pp->family == AF_INET) {
911      snprintf(address, STRLEN, "INET[%s:%d]", pp->hostname, pp->port);      snprintf(address, STRLEN, "INET[%s:%d]", pp->hostname, pp->port);
912    } else if ( pp->family == AF_UNIX ) {    } else if(pp->family == AF_UNIX) {
913      snprintf(address, STRLEN, "UNIX[%s]", pp->pathname);      snprintf(address, STRLEN, "UNIX[%s]", pp->pathname);
914    }    }
915    
916    if ( pp->ssl == TRUE ) {    if(pp->ssl == TRUE) {
917    
918      if ( !have_ssl() ) {      if(!have_ssl()) {
919    
920        log("%s: The ssl check cannot be activated at line %d, "        log("%s: The ssl check cannot be activated at line %d, "
921            "SSL is not support.\n",            "SSL is not support.\n",
# Line 949  static void addresource(struct ResourceS Line 953  static void addresource(struct ResourceS
953    
954    ASSERT(rr);    ASSERT(rr);
955    
956    if ( ! Run.doprocess ) {    if(! Run.doprocess) {
957    
958      log("%s: Cannot activate process check at line %d\n"      log("%s: Cannot activate process check at line %d\n"
959          "\t(The process status engine was disabled. On certain"          "\t(The process status engine was disabled. On certain"
# Line 967  static void addresource(struct ResourceS Line 971  static void addresource(struct ResourceS
971    r->operator= rr->operator;    r->operator= rr->operator;
972    r->next= current->resourcelist;    r->next= current->resourcelist;
973    
974    if ( r->max_cycle < 1 ) {    if(r->max_cycle < 1) {
975    
976      log("%s: The number of cycles must be greater then 0 in line %d\n",      log("%s: The number of cycles must be greater then 0 in line %d\n",
977          prog, lineno-1);          prog, lineno-1);
# Line 1086  static void addargument(char *argument) Line 1090  static void addargument(char *argument)
1090   */   */
1091  static void setlogfile(char *logfile) {  static void setlogfile(char *logfile) {
1092    
1093    if ( Run.logfile ) {    if(Run.logfile) {
1094            
1095      if ( is(Run.logfile, logfile) ) {      if(is(Run.logfile, logfile)) {
1096                
1097        return;        return;
1098                
# Line 1134  static void setmailserver(char *mailserv Line 1138  static void setmailserver(char *mailserv
1138    
1139    ASSERT(mailserver);    ASSERT(mailserver);
1140    
1141    if ( Run.mailserver ) {    if(Run.mailserver) {
1142            
1143      if ( is(Run.mailserver, mailserver) ) {      if(is(Run.mailserver, mailserver)) {
1144                
1145        return;        return;
1146                
# Line 1159  static void setuname(char *uname) { Line 1163  static void setuname(char *uname) {
1163    
1164    ASSERT(uname);    ASSERT(uname);
1165    
1166    if ( Run.Auth.uname ) {    if(Run.Auth.uname) {
1167            
1168      if ( is(Run.Auth.uname, uname) ) {      if(is(Run.Auth.uname, uname)) {
1169                
1170        return;        return;
1171                
# Line 1184  static void setpasswd(char *passwd) { Line 1188  static void setpasswd(char *passwd) {
1188    
1189    ASSERT(passwd);    ASSERT(passwd);
1190    
1191    if ( Run.Auth.passwd ) {    if(Run.Auth.passwd) {
1192            
1193      if ( is(Run.Auth.passwd, passwd) ) {      if(is(Run.Auth.passwd, passwd)) {
1194                
1195        return;        return;
1196                
# Line 1291  static void check_name(char *name) { Line 1295  static void check_name(char *name) {
1295    
1296    ASSERT(name);    ASSERT(name);
1297    
1298    if ( exist_process(name) ) {    if(exist_process(name)) {
1299            
1300      log("%s: Name conflict at line %d - check name '%s' already defined\n",      log("%s: Name conflict at line %d - check name '%s' already defined\n",
1301          prog, lineno, name);          prog, lineno, name);
# Line 1308  static void check_name(char *name) { Line 1312  static void check_name(char *name) {
1312   */   */
1313  static void check_timeout(int s, int c) {  static void check_timeout(int s, int c) {
1314    
1315    if ( s > c ) {    if(s > c) {
1316            
1317      yyerror("The number of restarts must be less than poll cycles");      yyerror("The number of restarts must be less than poll cycles");
1318            
1319    }    }
1320    
1321    if ( s <= 0 || c <= 0 ) {    if(s <= 0 || c <= 0) {
1322            
1323      yyerror("Zero or negative values not allowed in a timeout statement");      yyerror("Zero or negative values not allowed in a timeout statement");
1324            
# Line 1328  static void check_timeout(int s, int c) Line 1332  static void check_timeout(int s, int c)
1332   */   */
1333  static void check_every(int every) {  static void check_every(int every) {
1334    
1335    if ( every <= 1 ) {    if(every <= 1) {
1336            
1337      yyerror("An every statement must have a value greater than 1.");      yyerror("An every statement must have a value greater than 1.");
1338            
# Line 1344  static void check_hostname(char *hostnam Line 1348  static void check_hostname(char *hostnam
1348    
1349    ASSERT(hostname);    ASSERT(hostname);
1350    
1351    if ( !check_host(hostname) ) {    if(!check_host(hostname)) {
1352            
1353      yyerror("Hostname did not resolve");      yyerror("Hostname did not resolve");
1354            
# Line 1452  static void cleanup_md5_string(char *md5 Line 1456  static void cleanup_md5_string(char *md5
1456   */   */
1457  static void validate_depend(Process_T p, int *has_depend) {  static void validate_depend(Process_T p, int *has_depend) {
1458    
1459      ASSERT(p);
1460    
1461    if(p->visited)    if(p->visited)
1462        return;        return;
1463        
# Line 1459  static void validate_depend(Process_T p, Line 1465  static void validate_depend(Process_T p,
1465            
1466      Dependant_T d;      Dependant_T d;
1467            
1468      for(d= p->dependantlist; d; d= d->next ) {      for(d= p->dependantlist; d; d= d->next) {
1469                
1470        Process_T dp= get_process(d->dependant);        Process_T dp= get_process(d->dependant);
1471                
# Line 1493  static void validate_depend(Process_T p, Line 1499  static void validate_depend(Process_T p,
1499   */   */
1500  static void order_depend(Process_T p) {  static void order_depend(Process_T p) {
1501    
1502      ASSERT(p);
1503      
1504    if(p->visited)    if(p->visited)
1505        return;        return;
1506    
# Line 1502  static void order_depend(Process_T p) { Line 1510  static void order_depend(Process_T p) {
1510            
1511      Dependant_T d;      Dependant_T d;
1512            
1513      for(d= p->dependantlist; d; d= d->next ) {      for(d= p->dependantlist; d; d= d->next) {
1514                
1515        Process_T dp= get_process(d->dependant);        Process_T dp= get_process(d->dependant);
1516                

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

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