~ubuntu-branches/ubuntu/oneiric/bind9/oneiric

« back to all changes in this revision

Viewing changes to lib/isc/unix/socket.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2011-02-23 10:20:51 UTC
  • mfrom: (1.6.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110223102051-up42ig1hxw3je0ba
Tags: 1:9.7.3.dfsg-1~build1
Natty version, no source changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: socket.c,v 1.326.20.4 2010/03/12 03:25:20 marka Exp $ */
 
18
/* $Id: socket.c,v 1.326.20.7 2010-12-22 03:27:22 marka Exp $ */
19
19
 
20
20
/*! \file */
21
21
 
67
67
#include <sys/epoll.h>
68
68
#endif
69
69
#ifdef ISC_PLATFORM_HAVEDEVPOLL
 
70
#if defined(HAVE_SYS_DEVPOLL_H)
70
71
#include <sys/devpoll.h>
 
72
#elif defined(HAVE_DEVPOLL_H)
 
73
#include <devpoll.h>
 
74
#endif
71
75
#endif
72
76
 
73
77
#include "errno2result.h"
4991
4995
        return (ISC_R_SUCCESS);
4992
4996
}
4993
4997
 
 
4998
/*
 
4999
 * Enable this only for specific OS versions, and only when they have repaired
 
5000
 * their problems with it.  Until then, this is is broken and needs to be
 
5001
 * diabled by default.  See RT22589 for details.
 
5002
 */
 
5003
#undef ENABLE_ACCEPTFILTER
 
5004
 
4994
5005
ISC_SOCKETFUNC_SCOPE isc_result_t
4995
5006
isc__socket_filter(isc_socket_t *sock0, const char *filter) {
4996
5007
        isc__socket_t *sock = (isc__socket_t *)sock0;
4997
 
#ifdef SO_ACCEPTFILTER
 
5008
#if defined(SO_ACCEPTFILTER) && defined(ENABLE_ACCEPTFILTER)
4998
5009
        char strbuf[ISC_STRERRORSIZE];
4999
5010
        struct accept_filter_arg afa;
5000
5011
#else
5004
5015
 
5005
5016
        REQUIRE(VALID_SOCKET(sock));
5006
5017
 
5007
 
#ifdef SO_ACCEPTFILTER
 
5018
#if defined(SO_ACCEPTFILTER) && defined(ENABLE_ACCEPTFILTER)
5008
5019
        bzero(&afa, sizeof(afa));
5009
5020
        strncpy(afa.af_name, filter, sizeof(afa.af_name));
5010
5021
        if (setsockopt(sock->fd, SOL_SOCKET, SO_ACCEPTFILTER,
5111
5122
         * Attach to socket and to task.
5112
5123
         */
5113
5124
        isc_task_attach(task, &ntask);
 
5125
        if (isc_task_exiting(ntask)) {
 
5126
                isc_task_detach(&ntask);
 
5127
                isc_event_free(ISC_EVENT_PTR(&dev));
 
5128
                UNLOCK(&sock->lock);
 
5129
                return (ISC_R_SHUTTINGDOWN);
 
5130
        }
5114
5131
        nsock->references++;
5115
5132
        nsock->statsindex = sock->statsindex;
5116
5133