36 |
|
#define versionNo 0.8 |
37 |
|
#define RECONFIGURE_RETURN_CODE 2 |
38 |
|
#define UDP_MAX_PACKET_SIZE 8192 |
39 |
+ |
#define PID_FILE "/var/tmp/.ihost.pid" |
40 |
|
|
41 |
|
#define logmessage(level, ...) do { cur_level = level; errf(__VA_ARGS__); } while (0) |
42 |
|
|
486 |
|
extern int syslog_logging; |
487 |
|
extern int log_level; |
488 |
|
extern int cur_level; |
489 |
+ |
FILE *f; |
490 |
|
|
491 |
|
log_level=1; |
492 |
|
cur_level=1; |
587 |
|
/* Print out everything its doing */ |
588 |
|
log_level=LOG_DEBUG; |
589 |
|
break; |
590 |
+ |
} |
591 |
+ |
|
592 |
+ |
logmessage(LOG_DEBUG,"Writing PID FILE"); |
593 |
+ |
pid=getpid(); |
594 |
+ |
if((f=fopen(PID_FILE,"w")) == NULL){ |
595 |
+ |
logmessage(LOG_WARNING, "Failed to write PID file"); |
596 |
+ |
}else{ |
597 |
+ |
if((fprintf(f,"%d",(int)pid)) != sizeof(pid)){ |
598 |
+ |
logmessage(LOG_WARNING, "Failed to write PID file"); |
599 |
+ |
} |
600 |
+ |
if((fclose(f))!=0){ |
601 |
+ |
logmessage(LOG_ERR, "failed to close PID file"); |
602 |
+ |
exit(1); |
603 |
+ |
} |
604 |
|
} |
605 |
|
|
606 |
|
if(ihost_configure(&ihost_state)!=0){ |