~ubuntu-branches/ubuntu/maverick/bind9/maverick

« back to all changes in this revision

Viewing changes to lib/bind/isc/eventlib.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
#if !defined(LINT) && !defined(CODECENTER)
23
 
static const char rcsid[] = "$Id: eventlib.c,v 1.2.2.1.4.5 2005/07/28 07:43:20 marka Exp $";
 
23
static const char rcsid[] = "$Id: eventlib.c,v 1.10 2006/03/09 23:57:56 marka Exp $";
24
24
#endif
25
25
 
26
26
#include "port_before.h"
29
29
#include <sys/types.h>
30
30
#include <sys/time.h>
31
31
#include <sys/stat.h>
32
 
#ifdef SOLARIS2
 
32
#ifdef  SOLARIS2
33
33
#include <limits.h>
34
 
#endif /* SOLARIS2 */
 
34
#endif  /* SOLARIS2 */
35
35
 
36
36
#include <errno.h>
37
37
#include <signal.h>
48
48
int      __evOptMonoTime;
49
49
 
50
50
#ifdef USE_POLL
51
 
#define pselect Pselect
 
51
#define pselect Pselect
52
52
#endif /* USE_POLL */
53
53
 
54
54
/* Forward. */
85
85
        INIT_LIST(ctx->accepts);
86
86
 
87
87
        /* Files. */
 
88
        ctx->files = NULL;
88
89
#ifdef USE_POLL
89
 
        ctx->pollfds = NULL;
 
90
        ctx->pollfds = NULL;
90
91
        ctx->maxnfds = 0;
91
92
        ctx->firstfd = 0;
92
93
        emulMaskInit(ctx, rdLast, EV_READ, 1);
97
98
        emulMaskInit(ctx, exNext, EV_EXCEPT, 0);
98
99
        emulMaskInit(ctx, nonblockBefore, EV_WASNONBLOCKING, 0);
99
100
#endif /* USE_POLL */
100
 
        ctx->files = NULL;
101
101
        FD_ZERO(&ctx->rdNext);
102
102
        FD_ZERO(&ctx->wrNext);
103
103
        FD_ZERO(&ctx->exNext);
104
104
        FD_ZERO(&ctx->nonblockBefore);
105
105
        ctx->fdMax = -1;
106
106
        ctx->fdNext = NULL;
107
 
        ctx->fdCount = 0;       /* Invalidate {rd,wr,ex}Last. */
 
107
        ctx->fdCount = 0;       /*%< Invalidate {rd,wr,ex}Last. */
108
108
#ifndef USE_POLL
109
109
        ctx->highestFD = FD_SETSIZE - 1;
110
110
        memset(ctx->fdTable, 0, sizeof ctx->fdTable);
111
 
#else
 
111
#else   
112
112
        ctx->highestFD = INT_MAX / sizeof(struct pollfd);
113
113
        ctx->fdTable = NULL;
114
 
#endif
 
114
#endif /* USE_POLL */
115
115
#ifdef EVENTLIB_TIME_CHECKS
116
116
        ctx->lastFdCount = 0;
117
117
#endif
150
150
int
151
151
evDestroy(evContext opaqueCtx) {
152
152
        evContext_p *ctx = opaqueCtx.opaque;
153
 
        int revs = 424242;      /* Doug Adams. */
 
153
        int revs = 424242;      /*%< Doug Adams. */
154
154
        evWaitList *this_wl, *next_wl;
155
155
        evWait *this_wait, *next_wait;
156
156
 
266
266
                nextTime = nextTimer->due;
267
267
                timerPast = (evCmpTime(nextTime, ctx->lastEventTime) <= 0);
268
268
        } else
269
 
                timerPast = 0;  /* Make gcc happy. */
270
 
 
 
269
                timerPast = 0;  /*%< Make gcc happy. */
271
270
        evPrintf(ctx, 9, "evGetNext: fdCount %d\n", ctx->fdCount);
272
271
        if (ctx->fdCount == 0) {
273
272
                static const struct timespec NoTime = {0, 0L};
309
308
#endif
310
309
                do {
311
310
#ifndef USE_POLL
312
 
                        /* XXX need to copy only the bits we are using. */
313
 
                        ctx->rdLast = ctx->rdNext;
314
 
                        ctx->wrLast = ctx->wrNext;
315
 
                        ctx->exLast = ctx->exNext;
 
311
                         /* XXX need to copy only the bits we are using. */
 
312
                         ctx->rdLast = ctx->rdNext;
 
313
                         ctx->wrLast = ctx->wrNext;
 
314
                         ctx->exLast = ctx->exNext;
316
315
#else
317
316
                        /*
318
317
                         * The pollfd structure uses separate fields for
742
741
        sigset_t sigs;
743
742
        int n;
744
743
#ifdef USE_POLL
745
 
        int polltimeout = INFTIM;
746
 
        evContext_p *ctx;
747
 
        struct pollfd *fds;
748
 
        nfds_t pnfds;
 
744
        int     polltimeout = INFTIM;
 
745
        evContext_p     *ctx;
 
746
        struct pollfd   *fds;
 
747
        nfds_t          pnfds;
749
748
 
750
749
        UNUSED(nfds);
751
750
#endif /* USE_POLL */
761
760
        if (sigmask)
762
761
                sigprocmask(SIG_SETMASK, sigmask, &sigs);
763
762
#ifndef USE_POLL
764
 
        n = select(nfds, rfds, wfds, efds, tvp);
 
763
         n = select(nfds, rfds, wfds, efds, tvp);
765
764
#else
766
 
        /*
 
765
        /*
767
766
         * rfds, wfds, and efds should all be from the same evContext_p,
768
767
         * so any of them will do. If they're all NULL, the caller is
769
768
         * presumably calling us to block.
784
783
                pnfds = 0;
785
784
        }
786
785
        n = poll(fds, pnfds, polltimeout);
787
 
        /*
788
 
         * pselect() should return the total number of events on the file
789
 
         * desriptors, not just the count of fd:s with activity. Hence,
790
 
         * traverse the pollfds array and count the events.
791
 
         */
792
786
        if (n > 0) {
793
787
                int     i, e;
 
788
 
 
789
                INSIST(ctx != NULL);
794
790
                for (e = 0, i = ctx->firstfd; i <= ctx->fdMax; i++) {
795
791
                        if (ctx->pollfds[i].fd < 0)
796
792
                                continue;
800
796
                                e++;
801
797
                        if (FD_ISSET(i, &ctx->exLast))
802
798
                                e++;
803
 
                        }
 
799
                }
804
800
                n = e;
805
801
        }
806
802
#endif /* USE_POLL */