From: ian Date: Tue, 12 Oct 1999 22:55:15 +0000 (+0000) Subject: Return EAGAIN from _check instead of EWOULDBLOCK. X-Git-Tag: rel-adns-0-5~15 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=commitdiff_plain;h=226c5eef1caec08ee33276de158e263c0593c0d0 Return EAGAIN from _check instead of EWOULDBLOCK. --- diff --git a/changelog b/changelog index 521c366..cc9e058 100644 --- a/changelog +++ b/changelog @@ -11,6 +11,7 @@ adns (0.5) unstable; urgency=medium * RRs with mailboxes never rejected due to strange chars if _raw. * Lack of a mailbox produces `.' not `<>'. * Better usage messages (and no default query domain) for adnstest. + * Return EAGAIN from _check instead of EWOULDBLOCK. Bugfixes: * Do not invoke __autosys indirectly from __procdgram (result: coredump diff --git a/client/adnslogres.c b/client/adnslogres.c index c2ca2ef..b567bf9 100644 --- a/client/adnslogres.c +++ b/client/adnslogres.c @@ -154,7 +154,7 @@ static void proclog(int opts) { err= adns_wait(adns, &head->query, &answer, NULL); else err= adns_check(adns, &head->query, &answer, NULL); - if (err != EWOULDBLOCK) { + if (err != EAGAIN) { printline(head->start, head->addr, head->rest, answer->status == adns_s_ok ? *answer->rrs.str : NULL); line= head; head= head->next; diff --git a/src/adns.h b/src/adns.h index 7993c8f..fa9b6ca 100644 --- a/src/adns.h +++ b/src/adns.h @@ -231,7 +231,9 @@ typedef enum { /* permanent errors */ adns_s_nxdomain, - adns_s_nodata + adns_s_nodata, + + adns_s_max_permfail= 499 } adns_status; @@ -320,9 +322,9 @@ typedef struct { * values. * * For _wait and _check failures are reported in the answer - * structure, and only 0, ESRCH or (for _check) EWOULDBLOCK is + * structure, and only 0, ESRCH or (for _check) EAGAIN is * returned: if no (appropriate) requests are done adns_check returns - * EWOULDBLOCK; if no (appropriate) requests are outstanding both + * EAGAIN; if no (appropriate) requests are outstanding both * adns_query and adns_wait return ESRCH. * * Additionally, _wait can return EINTR if you set adns_if_eintr. @@ -533,7 +535,7 @@ void adns_checkconsistency(adns_state ads, adns_query qu); * adns_submit 2 * adns_submit 3 * adns_wait 1 - * adns_check 3 -> EWOULDBLOCK + * adns_check 3 -> EAGAIN * adns_wait 2 * adns_wait 3 * .... diff --git a/src/event.c b/src/event.c index 645e5b2..b2da291 100644 --- a/src/event.c +++ b/src/event.c @@ -565,10 +565,10 @@ int adns__internal_check(adns_state ads, qu= *query_io; if (!qu) { - if (!ads->output.head) return EWOULDBLOCK; + if (!ads->output.head) return EAGAIN; qu= ads->output.head; } else { - if (qu->id>=0) return EWOULDBLOCK; + if (qu->id>=0) return EAGAIN; } LIST_UNLINK(ads->output,qu); *answer= qu->answer; @@ -589,7 +589,7 @@ int adns_wait(adns_state ads, adns__consistency(ads,*query_io,cc_entex); for (;;) { r= adns__internal_check(ads,query_io,answer_r,context_r); - if (r != EWOULDBLOCK) break; + if (r != EAGAIN) break; maxfd= 0; tvp= 0; FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); adns_beforeselect(ads,&maxfd,&readfds,&writefds,&exceptfds,&tvp,&tvbuf,0); diff --git a/src/poll.c b/src/poll.c index fba6de5..45dc437 100644 --- a/src/poll.c +++ b/src/poll.c @@ -106,7 +106,7 @@ int adns_wait_poll(adns_state ads, for (;;) { r= adns__internal_check(ads,query_io,answer_r,context_r); - if (r != EWOULDBLOCK) goto xit; + if (r != EAGAIN) goto xit; nfds= MAX_POLLFDS; to= -1; adns_beforepoll(ads,fds,&nfds,&to,0); r= poll(fds,nfds,to);