From: ian Date: Fri, 15 Oct 1999 16:55:00 +0000 (+0000) Subject: + * New adns_if_logpid option (functionality suggested by Tony Finch). X-Git-Tag: privaterel-1999-10-16-fanf~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5f67bb7b7530dc1b916115613b6773ce04fd2d16;p=adns.git + * New adns_if_logpid option (functionality suggested by Tony Finch). @@ -10,6 +10,7 @@ General improvements + * New adns_if_logpid option (functionality suggested by Tony Finch). --- diff --git a/changelog b/changelog index 351a027..148bf01 100644 --- a/changelog +++ b/changelog @@ -10,6 +10,7 @@ adns (0.6) unstable; urgency=medium General improvements * New fanftest test program from Tony Finch. + * New adns_if_logpid option (functionality suggested by Tony Finch). -- diff --git a/src/adns.h b/src/adns.h index b8c5b02..726d94e 100644 --- a/src/adns.h +++ b/src/adns.h @@ -78,6 +78,7 @@ typedef enum { adns_if_noerrprint= 0x0002, /* never print output to stderr (_debug overrides) */ adns_if_noserverwarn= 0x0004, /* do not warn to stderr about duff nameservers etc */ adns_if_debug= 0x0008, /* enable all output to stderr plus debug msgs */ + adns_if_logpid= 0x0080, /* include pid in diagnostic output */ adns_if_noautosys= 0x0010, /* do not make syscalls at every opportunity */ adns_if_eintr= 0x0020, /* allow _wait and _synchronous to return EINTR */ adns_if_nosigpipe= 0x0040, /* applic has SIGPIPE set to SIG_IGN, do not protect */ diff --git a/src/general.c b/src/general.c index ae7cac0..0168a4a 100644 --- a/src/general.c +++ b/src/general.c @@ -27,6 +27,7 @@ */ #include +#include #include #include @@ -46,7 +47,11 @@ void adns__vdiag(adns_state ads, const char *pfx, adns_initflags prevent, (!(ads->iflags & adns_if_debug) && (!prevent || (ads->iflags & prevent)))) return; - fprintf(ads->diagfile,"adns%s: ",pfx); + if (ads->iflags & adns_if_logpid) { + fprintf(ads->diagfile,"adns%s [%ld]: ",pfx,(long)getpid()); + } else { + fprintf(ads->diagfile,"adns%s: ",pfx); + } vfprintf(ads->diagfile,fmt,al);