[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Wed Mar 6 03:58:04 MST 2013


The branch, v4-0-test has been updated
       via  9899861 tsocket_bsd: Attempt to increase the SO_SNDBUF if we get EMSGSIZE in sendto()
       via  755f6a3 s4-lib/socket: Return the original EMSGSIZE when sendto() and setsockopt() both fail
       via  e43fbb0 Handle EMSGSIZE on UNIX domain sockets.
       via  29170a6 s4-socket: Make sure unix socket addresses are null terminated.
       via  f6f939d Remove incomplete check for IPv6 link-local addresses.
       via  72d942d s3:lib/events: add missing TEVENT_TRACE_BEFORE/AFTER_WAIT handling
       via  4de31ea Fix typo to make master/lib/tevent identical to 4.0.x/lib/tevent
       via  4d8dfba tevent: change version to 0.9.18
       via  e92acf0 tevent: optimize adding new zero timer events
       via  8775458 tevent: optimize adding new timer events
       via  88a4927 tevent: add a debug message in tevent_common_loop_timer_delay()
       via  bd630a5 tevent: add test_event_fd2()
       via  4328399 tevent: add test_event_fd1()
       via  fa9eb95 tevent: use better names for the subtests
       via  9e6f66e tevent: Regression test to ensure that a tevent backend can cope with separate read/write events on a single fd.
       via  cddd09d tevent: use DEBUG_ERROR for the fallback message in epoll_panic()
       via  c203e02 tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's into one epoll event.
       via  d56d1e2 tevent: preferr the write handler if there're two possible handlers registered with epoll
       via  5d94df2 tevent: In epoll_event_loop() ensure we trigger the right handler for a multiplexed fde event.
       via  3fcc9f6 tevent: Add utility function epoll_handle_hup_or_err()
       via  babcaa0 tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()
       via  afa7c13 tevent: handle multiplexed fde's in epoll_event_fd_destructor()
       via  72016c2 tevent: Fix epoll_mod_event() to cope with modifying a multiplexed fde event.
       via  fdecc21 tevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.
       via  58a2d9f tevent: handle multiplexed fde's in epoll_add_event()
       via  3e39093 tevent: Start to fix the epoll backend to support 2 fd events on the same fd correctly.
       via  7723c10 tevent: ignore EBADF from epoll_ctl() and disable the event
       via  f268b1b tevent: unify handling of HAS_EVENT and REPORT_ERROR in epoll_{add,mod,del}_event()
       via  bc639f2 tevent: always go through epoll_update_event()
       via  3907b46 tevent: s/epoll_change_event/epoll_update_event
       via  d6fe13a tevent: the content of event is ignored by EPOLL_CTL_DEL
       via  0793fec tevent: call epoll_panic() if EPOLL_CTL_DEL failed
       via  255ef04 tevent: use helper variables to hold the epoll_ctl() result
       via  f34ef64 tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checks
       via  f751440 tevent: add std_event_loop_wait()
       via  bab5e50 tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()
       via  a70ea88 tevent: avoid any operation on epoll_ev after a epoll_panic()
       via  75b49eb tevent: add epoll_{create,ctl}_panic_fallback() for testing
       via  0f103a0 tevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()
       via  760827f tevent: debug a FATAL message on EBADF from the select backend
       via  330ff00 tevent: Fix multiple handler on the same fd bug in the tevent select backend.
       via  429a49b tevent: revalidate fde->flags after poll()
       via  d90aebf tevent: ignore POLLNVAL from poll() and disable the event
       via  aae4312 tevent: traverse the ev->fd_event list instead of the poll_ev->fds array
       via  7b1a12c tevent: maintain a list of disabled events in the poll backend
       via  9db5aba tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()
       via  8b9603b tevent: use tevent_poll_event_add_fd_internal() in poll_event_add_fd()
       via  ce2082f tevent: make sure we cleanup the array passed to poll() after deleting an event
       via  a733316 tevent: don't skip a fd event if the previous one was deleted during poll()
       via  7a28c62 tevent: remember the errno from select(), poll() and epoll_wait()
       via  3226323 tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
       via  facbaca tevent: fix compiler warning in tevent_context_init_byname()
       via  483737b tevent: fix some compiler warnings in testsuite.c
       via  fee7d86 tevent: fix a comment typo in tevent_epoll.c
       via  7bf5c70 tevent: fix --disable-python cause configure fails (bug #8718)
       via  a9b48b0 tevent: define TEVENT_NUM_SIGNALS based on configure checks
       via  a5f4ad4 lib/replace: add AC_CHECK_VALUEOF() macro
       via  2fb3750 wafsamba: add CHECK_VALUEOF() helper
       via  2a4addf s3:lib/events: make use of tevent_common_loop_timer_delay()
       via  bb7da2c tevent: Remove the previous "standard" tevent backend implementation.
       via  6d72f66 tevent: Add in the new implementation of "standard" tevent backend.
       via  99bb704 tevent: Add a private function tevent_poll_event_add_fd_internal().
       via  e2fa47f tevent: make use of tevent_find_ops_byname() in tevent_context_init_byname()
       via  7989267 tevent: make sure tevent_backend_init() only runs once
       via  f58a7e2 tevent: Add a utility function tevent_find_ops_byname().
       via  5bb5fc8 tevent: Add in the same tevent_re_initialise() fix Metze put in the tevent_poll backend.
       via  208d030 tevent: Add in some test code to allow the panic fallback path to be tested.
       via  7a3c16a tevent: Plumb in the panic fallback code into the epoll_panic() runtime call.
       via  b9683a6 tevent: Add an internal function tevent_epoll_set_panic_fallback().
       via  3fbe01d tevent: pass 'bool replay' to epoll_panic()
       via  d81d926 tevent: Ensure we return after every call to epoll_panic().
       via  685476c tevent: Preparing to fix "standard" backend fallback. Initialize standard after epoll.
       via  368f0e4 tevent_poll: add poll_event_loop_wait()
       via  fa1cf5e tevent_poll: fix the usage of tevent_re_initialise()
       via  59db4ce tevent_poll: call tevent_common_fd_destructor() from poll_fresh_fde_destructor()
       via  a414b9b tevent_poll: Avoid a crash in poll_event_set_fd_flags
       via  eb43f7f tevent_poll: Avoid a crash in poll_fresh_fde_destructor
       via  27cfae4 tevent_poll: NULL out fde->event_ctx for "fresh" poll fdes
       via  13383b1 tevent_poll: Use the poll_event_context_destructor always
       via  39bc9e6 tevent_poll: Re-order routines
       via  1959277 tevent_poll: Fix a crash in the poll backend
       via  06af8bb tevent: Fix a comment typo
      from  f77d5d6 Fix bug # 9666 - Broken filtering of link-local addresses.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 989986119221f4c79ab910d6e31e0bf05a7371cf
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Mar 4 14:06:14 2013 +1100

    tsocket_bsd: Attempt to increase the SO_SNDBUF if we get EMSGSIZE in sendto()
    
    This matches what was done for lib/socket/socket_unix.c in
    c692bb02b039ae8fef6ba968fd13b36ad7d62a72.
    
    (and is based on that patch by Landon Fuller <landonf at bikemonkey.org>)
    
    Andrew Bartlett
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Mon Mar  4 11:15:35 CET 2013 on sn-devel-104
    (cherry picked from commit 70e1b6185e3fb35fdc72eeb529ffb4b50122dc40)
    
    The last 3 patches address bug #9697 - DsReplicaGetInfo fails due to sendto()
    EMSGSIZE error on UNIX domain socket.
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Wed Mar  6 11:57:20 CET 2013 on sn-devel-104

commit 755f6a392f9c6f3ce6bfad9cf44bd98af7be327b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Mar 4 14:07:38 2013 +1100

    s4-lib/socket: Return the original EMSGSIZE when sendto() and setsockopt() both fail
    
    This ensures that should we be unable to increase the socket size, we return an
    error that the application layer above might expect and be able to make
    as reasonable response to (such as switching to a stream-based transport).
    
    This fixes up c692bb02b039ae8fef6ba968fd13b36ad7d62a72.
    
    As suggested by metze in https://bugzilla.samba.org/show_bug.cgi?id=9697#c4
    
    Andrew Bartlett
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 50b42d1c5bb19e3a5050d7d23ac96e273d3974ee)

commit e43fbb0cb7c67a0f7a29be02ed326f865993f117
Author: Landon Fuller <landonf at bikemonkey.org>
Date:   Sat Mar 2 14:08:47 2013 -0500

    Handle EMSGSIZE on UNIX domain sockets.
    
    On some systems (eg, FreeBSD) the default SO_SNDBUF for UNIX
    domain sockets is to small, and EMSGSIZE is returned. Other
    systems provide a larger default send buffer, but there is
    still no guarantee that the buffer will be sized appropriately.
    
    This patch modifies the sendto() path to attempt to resize
    the SO_SNDBUF dynamically upon an EMSGSIZE failure, and then
    retry the send.
    
    This fixes local DCE/RPC errors on FreeBSD, eg:
    
    https://lists.samba.org/archive/samba-technical/2013-January/089881.html
    
    Signed-Off-By: Landon Fuller <landonf at bikemonkey.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Mar  2 23:34:03 CET 2013 on sn-devel-104
    (cherry picked from commit c692bb02b039ae8fef6ba968fd13b36ad7d62a72)

commit 29170a651365f12152863118dc54e62fe1d7edde
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Dec 10 17:14:12 2012 +0100

    s4-socket: Make sure unix socket addresses are null terminated.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 7dd13503c0919766ecf3c8f5f48cda72aae8ac73)

commit f6f939daa9a37af8c1187fdcfba1b9716b284abb
Author: Landon Fuller <landonf at bikemonkey.org>
Date:   Sat Feb 23 22:32:25 2013 -0500

    Remove incomplete check for IPv6 link-local addresses.
    
    This has been superceded by a check for link-local
    addresses in get_interfaces()
    
    Signed-Off-By: Landon Fuller <landonf at bikemonkey.org>
    Reviewed-By: Richard Sharpe <realrichardsharpe at gmail.com>
    
    Fix bug #9696 - Remove incomplete samba_dnsupdate IPv6 link-local address
    check.

commit 72d942d24ae152bb4b4a05dbfbc1431060583d37
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 10:54:21 2013 +0100

    s3:lib/events: add missing TEVENT_TRACE_BEFORE/AFTER_WAIT handling
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    (cherry picked from commit 2fb69f51c47c8859485011879afb11650835ecbe)
    
    The last 77 patches address bug #9695 - Backport tevent changes to bring
    library to version 0.9.18.

commit 4de31ea07044df8fafdc4a24374412624a99353e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 1 16:10:47 2013 -0800

    Fix typo to make master/lib/tevent identical to 4.0.x/lib/tevent
    
    This was missed in the patch that was applied to fix bug 9550.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>

commit 4d8dfbaaa88a586dbfeead5efd5ff58cd14b61fa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 30 09:43:23 2012 +0100

    tevent: change version to 0.9.18
    
    This release contains a lot of fixes:
    
    - Adding new timer events is now faster, if there's
      a large number of timer events.
    
    - sigprocmask does not work on FreeBSD to stop further signals in a signal
      handler.
    
    - TEVENT_NUM_SIGNALS is calculated by configure in order
      to support realtime signals on freebsd.
    
    - ./configure --disable-python was fixed for the standalone build.
    
    - Several crash bugs in the poll backend are fixed.
    
    - The poll backend removes deleted events from the
      cached pollfd array now.
    
    - The poll doesn't pass pollfd.events == 0 to poll()
      and maintains a list of disabled events,
      instead of consuming 100% cpu and/or triggering
      the callers handler.
    
    - The poll backend detects POLLNVAL and reports EBADF
      instead of consuming 100% cpu.
    
    - The select backend supports separate handlers
      for TEVENT_FD_READ and TEVENT_FD_WRITE.
    
    - The poll and select backends are now doing fair
      queuing of fd events.
    
    - The epoll has better error checking
      and supports separate handlers
      for TEVENT_FD_READ and TEVENT_FD_WRITE.
    
    - The standard backend was rewritten to be a tiny
      wrapper on top of epoll with a fallback to poll,
      which means that it doesn't use select directly anymore.
    
    - TEVENT_TRACE_BEFORE_LOOP_ONCE and TEVENT_TRACE_AFTER_LOOP_ONCE
      are added in order to allow the application to hook in
      before and after the loop_once() backend function is called.
      The TEVENT_HAS_LOOP_ONCE_TRACE_POINTS define can be used to
      detect the new feature.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e92acf072edd8b9763f1681942a6d48c24f5ca6d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 12:45:39 2013 +0100

    tevent: optimize adding new zero timer events
    
    Such events were used before we had immediate events.
    It's likely that there're a lot of this events
    and we need to add new ones in fifo order.
    
    The tricky part is that tevent_common_add_timer()
    should not use the optimization as it's used
    by broken Samba versions, which don't use
    tevent_common_loop_timer_delay() in source3/lib/events.c.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 877545860cc97ba3cce9a9d59a15a1dba24aecac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 12:45:39 2013 +0100

    tevent: optimize adding new timer events
    
    As new timestamps typically get higher:-)
    it's better to traverse the existing list from
    the tail.
    
    This is not completely optimal, but it should be better
    than before.
    
    A second optimization could be done for zero timestamps,
    we would just remember the last_zero_timer,
    but that would change the internal ABI.
    Normally thatshould not be a poblem, but the Samba's
    source3/lib/events.c abuses tevent_internal.h
    from the current source tree, even if an external tevent.h
    is used. The other problem is that it makes use of
    tevent_common_add_timer() without using
    tevent_common_loop_timer_delay().
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 88a4927a6cb28ae792e30900ba6f6b5200763dd5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 09:25:32 2013 +0100

    tevent: add a debug message in tevent_common_loop_timer_delay()
    
    We should debug a message before and after running the handler.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bd630a54f728d6ad4f9759354b07d0a86c6aa009
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 27 16:43:44 2013 +0100

    tevent: add test_event_fd2()
    
    This test fills the socket kernel buffers
    and verifies that we don't report TEVENT_FD_WRITE
    if the buffer is full.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4328399ac6fc2ffd6c0c1c5443948cd17ed1975b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 21:48:44 2013 +0100

    tevent: add test_event_fd1()
    
    This test verifies that TEVENT_FD_* flags are handled correctly.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fa9eb951b0d897f8372678e4bed0f4ff5d366df8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 10:12:42 2013 +0100

    tevent: use better names for the subtests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9e6f66e9e4e4a3f38934ccb2aac4a4e0ab228e8b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 14 14:16:31 2013 -0800

    tevent: Regression test to ensure that a tevent backend can cope with separate read/write events on a single fd.
    
    This tests the multiplex fd changes to the epoll backend to
    ensure they work correctly.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit cddd09d4d757963717a4225161aa585bed268ac5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 14:30:54 2013 +0100

    tevent: use DEBUG_ERROR for the fallback message in epoll_panic()
    
    A Samba autobuild passed without a fallback, so this is
    really an error.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c203e0210e8bcf6820593ed03b16f384e777f0a5
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 14 13:52:41 2013 -0800

    tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's into one epoll event.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit d56d1e2706df8fe59040688cc88e050b52ef4166
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 11:50:56 2013 +0100

    tevent: preferr the write handler if there're two possible handlers registered with epoll
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5d94df2f181989e1bc4abb91bb46771248e1ce0c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 14:49:17 2013 +0100

    tevent: In epoll_event_loop() ensure we trigger the right handler for a multiplexed fde event.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 3fcc9f6287afb6e7cf7b4bfb6d8b3073eb389d1a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 14 15:53:38 2013 -0800

    tevent: Add utility function epoll_handle_hup_or_err()
    
    We'll use this to handle the EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR
    and EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR flags with multiplexed
    events in the event loop.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit babcaa06c63abca318567c5eea8d026ed440a813
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 17:17:31 2013 +0100

    tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit afa7c1312d1fad78b6da7759984f7b46d1576117
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 18:01:57 2013 +0100

    tevent: handle multiplexed fde's in epoll_event_fd_destructor()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 72016c2568eb4249fd7d8a616e9f69f91914b48c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 13:57:05 2013 +0100

    tevent: Fix epoll_mod_event() to cope with modifying a multiplexed fde event.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit fdecc210982c9edc1d9bead9aa442c1ca124c51c
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Feb 15 10:16:44 2013 -0800

    tevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 58a2d9fcc3c5ec88862664ca15d56d1371c292ee
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 17:14:52 2013 +0100

    tevent: handle multiplexed fde's in epoll_add_event()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3e3909395feee2cd8d2656f6234a43d39f6080ee
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 14 13:50:56 2013 -0800

    tevent: Start to fix the epoll backend to support 2 fd events on the same fd correctly.
    
    Add a utility function epoll_add_multiplex_fd() and
    a new flag EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX.
    
    This will be called by epoll_add_event() to merge two
    fde events with the same file descriptor.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7723c1002072ebaeeab008499553b09971607a5e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 13:33:19 2013 +0100

    tevent: ignore EBADF from epoll_ctl() and disable the event
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f268b1b5dc3fe80dc90d1832fe48387e6453da29
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 17:38:10 2013 +0100

    tevent: unify handling of HAS_EVENT and REPORT_ERROR in epoll_{add,mod,del}_event()
    
    epoll_{add,mod,del}_event() are only called via epoll_update_event()
    and epoll_update_event() should not remove REPORT_ERROR itself.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bc639f2a798772a1ec3a24525d98dc831a3b5e30
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 11:26:00 2013 +0100

    tevent: always go through epoll_update_event()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3907b46fe066de4373a8c67d6edd19919b56c7ac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 12:55:11 2013 +0100

    tevent: s/epoll_change_event/epoll_update_event
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d6fe13a5e13611d6150d35cb733ff3bc3ea78197
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 17:15:52 2013 +0100

    tevent: the content of event is ignored by EPOLL_CTL_DEL
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0793fec02a0eacf3c9ff79db729b118f6205d61c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 15 10:31:36 2013 +0100

    tevent: call epoll_panic() if EPOLL_CTL_DEL failed
    
    Only ENOENT is ignored as it is no error.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 255ef04dbb1398f158eaf50dabc17f70a7e74b4d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 13:12:27 2013 +0100

    tevent: use helper variables to hold the epoll_ctl() result
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f34ef647d9b57934d6254bb46b8b286e8e9c9223
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Feb 20 13:07:34 2013 +0100

    tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checks
    
    We'll never leave epoll_check_reopen() with epoll_fd == -1.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f7514403e889193ed884fabcbddbd29abd2eaaaa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Feb 17 16:41:41 2013 +0100

    tevent: add std_event_loop_wait()
    
    We also need to fallback in tevent_loop_wait()
    otherwise we might miss events in the poll->fresh list.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bab5e50cdee19c521ba809036b10d6177ca4eab3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Feb 17 16:40:20 2013 +0100

    tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()
    
    The epoll backend has done the cleanup already.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a70ea88a084f85d1daa485b78b2e5f2af12925bb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 15 16:33:56 2013 +0100

    tevent: avoid any operation on epoll_ev after a epoll_panic()
    
    This calls TALLOC_FREE(ev->additional_data), which is epoll_ev
    within epoll_panic() before calling the fallback handler.
    
    In order to notice that a epoll_panic() happened, a caller can
    register a pointer to a bool variable under epoll_ev->panic_state.
    
    As epoll_check_reopen() can fail due to a epoll_panic(),
    we need to force the replay flag if we have called any event handler.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 75b49eb1bb2c7ec983f778c4e46cb3e573303172
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 15 12:10:26 2013 +0100

    tevent: add epoll_{create,ctl}_panic_fallback() for testing
    
    This makes sure we only do random panics if a fallback handler
    is registered.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0f103a0bec15bcab23c3090c0a54d0e2d6154d19
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 21 15:44:30 2013 +0100

    tevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()
    
    This makes sure we don't preferr events which are at the beginning
    of the list.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 760827fc30544cdce111ed0640947fd63a81f137
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 14:43:55 2013 +0100

    tevent: debug a FATAL message on EBADF from the select backend
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 330ff00951c44b9b75a7ae880d59e7253a726d53
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 27 10:18:44 2013 -0800

    tevent: Fix multiple handler on the same fd bug in the tevent select backend.
    
    When we're deciding what handlers to call in the select backend,
    we didn't take into account the fact that the same fd may have
    been added into the read FD_SET and the write FD_SET but with
    different handlers.
    
    We must match on both the file descriptor and the flags requested
    before calling the handler.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 429a49b6b76410d40128131248d87326e1b4d84d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 16:43:35 2013 +0100

    tevent: revalidate fde->flags after poll()
    
    This is important to avoid races between threads if the poll_mt
    backend is used.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d90aebf294de897588a9275bdb538accf2958f58
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 21:45:11 2013 +0100

    tevent: ignore POLLNVAL from poll() and disable the event
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit aae4312b745cd2e40ca7a224831745e7a6e9bba1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 21 15:41:17 2013 +0100

    tevent: traverse the ev->fd_event list instead of the poll_ev->fds array
    
    That has the same complexity but simplifies the code.
    
    It also seems to fix a real problem, which was found
    by the following test failure in Samba's autobuild,
    while removing the epoll support from the "standard" backend.
    
        [402/1555 in 19m8s] samba3.raw.composite(plugin_s4_dc)
        smbtorture 4.1.0pre1-DEVELOPERBUILD
        Using seed 1361531675
        Testing savefile
        Testing parallel fetchfile with 10 ops
        waiting for completion
        maximum runtime exceeded for smbtorture - terminating
        UNEXPECTED(error): samba3.raw.composite.fetchfile (subunit.RemotedTestCase)(plugin_s4_dc)
        REASON: _StringException: _StringException: was started but never finished!
        UNEXPECTED(error): samba3.raw.composite.fetchfile(plugin_s4_dc) (subunit.RemotedTestCase)
        REASON: was started but never finished!
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7b1a12c213f66cff4a3e20bf95e88c34569b0041
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 17:07:28 2013 +0100

    tevent: maintain a list of disabled events in the poll backend
    
    We need to avoid passing pollfd.events == 0, to poll(),
    as it will report POLLERR and POLLHUP events, but our caller
    does not expect the event handler to be called.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9db5aba62b9839adc4f781427ccafc971c1b8bd4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 17:04:00 2013 +0100

    tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8b9603bc8d8df6e499e81b9cded2858b0ff88230
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 28 17:02:45 2013 +0100

    tevent: use tevent_poll_event_add_fd_internal() in poll_event_add_fd()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ce2082f42da43c97756b7d25f335e69a66e26b1e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 21 14:41:24 2013 +0100

    tevent: make sure we cleanup the array passed to poll() after deleting an event
    
    If we don't cleanup the array passed to poll after an
    event was deleted, we may pass a bad file descriptor to poll().
    
    This was found by the following test failure in Samba's
    autobuild, while removing the epoll support from
    the "standard" backend.
    
        [48/1555 in 4m37s] samba3.smbtorture_s3.plain(s3dc).LOCK4
        UNEXPECTED(failure): samba3.smbtorture_s3.plain(s3dc).LOCK4.smbtorture(s3dc)
        REASON: _StringException: _StringException: using seed 1361530718
        host=127.0.0.2 share=tmp user=metze myname=sn-devel-104
        Running LOCK4
        starting locktest4
        Failed to create file: NT_STATUS_INVALID_HANDLE
        finished locktest4
        TEST LOCK4 FAILED!
        LOCK4 took 190.492 secs
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a73331602625b5b5e8a3d6d86bd85658efb7c3ed
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Feb 17 23:21:28 2013 +0100

    tevent: don't skip a fd event if the previous one was deleted during poll()
    
    In a threaded environment it can happen that an tevent_fd is talloc_free'ed
    while the main thread sleeps in the poll() syscall.
    
    In such a case poll_event_fd_destructor() would set poll_ev->fdes[i] = NULL.
    
    We then skip the removed event, but before we also skipped the one
    that was located at the end of the array. We moved it to possition
    'i', but the next loop uses 'i=i+1'.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7a28c62b0797522e1f1f8cf04b9ffd006ded1aa2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 15 11:24:59 2013 +0100

    tevent: remember the errno from select(), poll() and epoll_wait()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3226323cd3eb1939df23fc630394c947599eb4e0
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 26 15:54:57 2013 +0100

    tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
    
    The define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS can be used to
    detect the new feature, without writing configure tests.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit facbaca7b9fd793a9026a070a5da5ee7590723c1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sun Feb 17 16:36:25 2013 +0100

    tevent: fix compiler warning in tevent_context_init_byname()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 483737b3515dd04bd6c35214d084e114e14c2bc6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 21:48:11 2013 +0100

    tevent: fix some compiler warnings in testsuite.c
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fee7d8608bcc2065633201ba0cb5bf3ade90564f
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 26 15:51:38 2013 +0100

    tevent: fix a comment typo in tevent_epoll.c
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7bf5c70ab0947efa9d38a3bc3e63bf77c784dc1b
Author: Galen.Liu <galen.gang.liu at gmail.com>
Date:   Mon Feb 4 07:43:01 2013 +0100

    tevent: fix --disable-python cause configure fails (bug #8718)
    
    When we disable python, it will cause build fail!
    so, the patch will fix it.
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a9b48b0924982eb5a377975499d8629e3924fe7b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 14:26:16 2013 +0100

    tevent: define TEVENT_NUM_SIGNALS based on configure checks
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a5f4ad4d67217e583fb39b86b87ec447c16a9afa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 14:53:07 2013 +0100

    lib/replace: add AC_CHECK_VALUEOF() macro
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2fb3750e2bf9b2c1c6a2624a2ebe0243627a1013
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 14:20:07 2013 +0100

    wafsamba: add CHECK_VALUEOF() helper
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2a4addf7335e32b5a81df260b89b6ef6315f297b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Mar 1 09:27:29 2013 +0100

    s3:lib/events: make use of tevent_common_loop_timer_delay()
    
    This is critical as we also use tevent_common_add_timer().
    And if the common code does internal changes, it may affects
    both tevent_common_add_timer() and tevent_common_loop_timer_delay()
    together!
    
    Without this we rely on a specific behavior and version of
    tevent.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bb7da2c8f05606b1d8e210f8e9f9b1f2ab863224
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 11:42:08 2013 -0800

    tevent: Remove the previous "standard" tevent backend implementation.
    
    This was a horrible hybrid of duplicated epoll and select()
    code.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Feb 14 22:40:30 CET 2013 on sn-devel-104

commit 6d72f66967278878ca84c0e1b4363558cf190131
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 11:40:49 2013 -0800

    tevent: Add in the new implementation of "standard" tevent backend.
    
    Falls back cleanly from epoll -> poll, or uses poll if
    epoll not available.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 99bb70474bbb8484dc7bf40f5d8f4447e28af158
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 11:20:28 2013 -0800

    tevent: Add a private function tevent_poll_event_add_fd_internal().
    
    Not yet used, but will be called by the "standard"
    fallback from epoll -> poll backends.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit e2fa47fb94cfed239382633c73175acdc43b7ec6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 14 09:30:31 2013 +0100

    tevent: make use of tevent_find_ops_byname() in tevent_context_init_byname()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 7989267d18e92d915fa9d9b83d49476ffe489854
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 14 09:29:57 2013 +0100

    tevent: make sure tevent_backend_init() only runs once
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit f58a7e20c461b3b507c7b574d1a1204ec0922190
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:56:58 2013 -0800

    tevent: Add a utility function tevent_find_ops_byname().
    
    Returns an event ops struct given a string name. Not
    yet used, but will be part of the new "standard" fallback
    code.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 5bb5fc854538d426cb489c88da0aa4e279ad7648
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:53:15 2013 -0800

    tevent: Add in the same tevent_re_initialise() fix Metze put in the tevent_poll backend.
    
    We might be called during tevent_re_initialise()
    which means we need to free our old additional_data.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 208d0300c94a5c9266072ee172d4f27dc2657aee
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:52:30 2013 -0800

    tevent: Add in some test code to allow the panic fallback path to be tested.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7a3c16af4e83c6e1d93dd59366b69654a7f7a489
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:48:02 2013 -0800

    tevent: Plumb in the panic fallback code into the epoll_panic() runtime call.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit b9683a601e4e7c4b330eb43cf24df661c5cc09bf
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:43:39 2013 -0800

    tevent: Add an internal function tevent_epoll_set_panic_fallback().
    
    Can be set externally, allows us to fallback if epoll
    fails at runtime.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 3fbe01dc1b3aebf6036355133b57c66d95e9a915
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 14 10:58:55 2013 +0100

    tevent: pass 'bool replay' to epoll_panic()
    
    A fallback panic handler will need to know if
    there was an error while waiting for events
    (replay=true) or if the error happened on modify
    (replay=false).
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit d81d9263803e640fb780b95d1e091b6fb5d6ede2
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:38:01 2013 -0800

    tevent: Ensure we return after every call to epoll_panic().
    
    Currently we can't return from this, but the new fallback
    code will change this.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 685476c40aaa1a0cd1958559d969d93803d7281b
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 11 10:36:52 2013 -0800

    tevent: Preparing to fix "standard" backend fallback. Initialize standard after epoll.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 368f0e4c6a41923b8f6eeb6f47ead68ffcd1bafc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 1 15:50:08 2013 +0100

    tevent_poll: add poll_event_loop_wait()
    
    We can't use tevent_common_loop_wait() because new fd events
    will be added to the poll_ev->fresh list instead of
    ev->fd_events.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sun Feb  3 06:40:09 CET 2013 on sn-devel-104

commit fa1cf5e1400471d85223395ff02fa260609fc0fd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 1 15:27:10 2013 +0100

    tevent_poll: fix the usage of tevent_re_initialise()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 59db4ce1c981845bb1a5384f2030a59fa36f796b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 1 15:56:34 2013 +0100

    tevent_poll: call tevent_common_fd_destructor() from poll_fresh_fde_destructor()
    
    We need to trigger the fde->close_fn().
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a414b9b0898162122ebafa220826a8e5eed2ad31
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 16:34:41 2013 +0100

    tevent_poll: Avoid a crash in poll_event_set_fd_flags
    
    The event context might have been freed before the fde
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eb43f7fa3d7f05ac4393cc156a319822120a1bb5
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 16:34:41 2013 +0100

    tevent_poll: Avoid a crash in poll_fresh_fde_destructor
    
    The event context might have been freed before the fde
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 27cfae4bb2406c8ee8fac85c949da933fe7f63ad
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 16:31:45 2013 +0100

    tevent_poll: NULL out fde->event_ctx for "fresh" poll fdes
    
    This is done in tevent_common_context_destructor for the non-fresh
    fdes already
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 13383b1f2e1fb02d8e5cc8ed2db7b63e8c24829f
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 16:28:08 2013 +0100

    tevent_poll: Use the poll_event_context_destructor always
    
    This is in preparation for the next patch to NULL out the event_ctx
    pointers in the poll_ev->fresh list
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 39bc9e6c20ac90072c28c1ded071f13803e219db
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 16:25:23 2013 +0100

    tevent_poll: Re-order routines
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 19592772cf96f1e6d7258fe0d4119e935f0e80a6
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 14:33:15 2013 +0100

    tevent_poll: Fix a crash in the poll backend
    
    If tevent_add_fd is immediately followed by tevent_fd_set_flags, the poll
    backend crashes. This was introduced when the poll backend was prepared
    for the multi-threaded python extension.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 06af8bb99b555428060278a27c0b252daa4c6dd8
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 15:46:43 2013 +0100

    tevent: Fix a comment typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ira Cooper <ira at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
    
    Autobuild-User(master): Richard Sharpe <sharpe at samba.org>
    Autobuild-Date(master): Thu Jan 31 17:52:39 CET 2013 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba_autoconf.py              |   20 +-
 lib/replace/libreplace_macros.m4                   |   15 +
 .../ABI/{tevent-0.9.16.sigs => tevent-0.9.18.sigs} |    1 +
 lib/tevent/libtevent.m4                            |   29 +
 lib/tevent/testsuite.c                             |  554 +++++++++++++++++-
 lib/tevent/tevent.c                                |   56 ++-
 lib/tevent/tevent.h                                |   11 +
 lib/tevent/tevent_epoll.c                          |  613 +++++++++++++++++--
 lib/tevent/tevent_internal.h                       |   21 +
 lib/tevent/tevent_poll.c                           |  307 ++++++++--
 lib/tevent/tevent_select.c                         |   27 +-
 lib/tevent/tevent_signal.c                         |    4 +-
 lib/tevent/tevent_standard.c                       |  633 +++++---------------
 lib/tevent/tevent_timed.c                          |  117 ++++-
 lib/tevent/wscript                                 |   21 +-
 lib/tsocket/tsocket_bsd.c                          |   26 +
 source3/lib/events.c                               |   42 +-
 source4/lib/socket/socket_unix.c                   |   43 +-
 source4/scripting/bin/samba_dnsupdate              |    4 +-
 19 files changed, 1827 insertions(+), 717 deletions(-)
 copy lib/tevent/ABI/{tevent-0.9.16.sigs => tevent-0.9.18.sigs} (97%)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 76316d2..65c66f3 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -323,7 +323,25 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None):
             ret = False
     return ret
 
-
+ at conf
+def CHECK_VALUEOF(conf, v, headers=None, define=None):
+    '''check the value of a variable/define'''
+    ret = True
+    v_define = define
+    if v_define is None:
+        v_define = 'VALUEOF_%s' % v.upper().replace(' ', '_')
+    if CHECK_CODE(conf,
+                  'printf("%%u", (unsigned)(%s))' % v,
+                  define=v_define,
+                  execute=True,
+                  define_ret=True,
+                  quote=False,
+                  headers=headers,
+                  local_include=False,
+                  msg="Checking value of %s" % v):
+        return int(conf.env[v_define])
+
+    return None
 
 @conf
 def CHECK_CODE(conf, code, define,
diff --git a/lib/replace/libreplace_macros.m4 b/lib/replace/libreplace_macros.m4
index 42b8847..f3753c4 100644
--- a/lib/replace/libreplace_macros.m4
+++ b/lib/replace/libreplace_macros.m4
@@ -330,3 +330,18 @@ fi
   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
 fi
 ])
+
+# AC_CHECK_VALUEOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])
+# ---------------------------------------------------------------
+AC_DEFUN([AC_CHECK_VALUEOF],
+[AS_LITERAL_IF(m4_translit([[$1]], [*], [p]), [],
+	       [m4_fatal([$0: requires literal arguments])])]dnl
+[
+_AC_CACHE_CHECK_INT([value of $1], [AS_TR_SH([ac_cv_valueof_$1])],
+  [(long int) ($1)],
+  [AC_INCLUDES_DEFAULT([$2])],
+  [])
+
+AC_DEFINE_UNQUOTED(AS_TR_CPP(valueof_$1), $AS_TR_SH([ac_cv_valueof_$1]),
+		   [The value of `$1'.])
+])# AC_CHECK_VALUEOF
diff --git a/lib/tevent/ABI/tevent-0.9.16.sigs b/lib/tevent/ABI/tevent-0.9.18.sigs
similarity index 97%
copy from lib/tevent/ABI/tevent-0.9.16.sigs
copy to lib/tevent/ABI/tevent-0.9.18.sigs
index ea7f944..70d20b6 100644
--- a/lib/tevent/ABI/tevent-0.9.16.sigs
+++ b/lib/tevent/ABI/tevent-0.9.18.sigs
@@ -21,6 +21,7 @@ tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *)
 tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *)
 tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *)
 tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *)
+tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *)
 tevent_common_check_signal: int (struct tevent_context *)
 tevent_common_context_destructor: int (struct tevent_context *)
 tevent_common_fd_destructor: int (struct tevent_fd *)
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 5c5969b..4d4fd2b 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -39,6 +39,35 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x
    AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
 fi
 
+tevent_num_signals_includes="$ac_includes_default
+#include <signal.h>
+"
+tevent_num_signals=64
+AC_CHECK_VALUEOF(NSIG, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_NSIG
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+	tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(_NSIG, [$tevent_num_signals_includes])
+v=$ac_cv_valueof__NSIG
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+	tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(SIGRTMAX, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_SIGRTMAX
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+	tevent_num_signals=$v
+}
+AC_CHECK_VALUEOF(SIGRTMIN, [$tevent_num_signals_includes])
+v=$ac_cv_valueof_SIGRTMIN
+test -n "$v" && {
+	v=`expr $v + $v`
+}
+test -n "$v" && test "$v" -gt "$tevent_num_signals" && {
+	tevent_num_signals=$v
+}
+AC_DEFINE_UNQUOTED(TEVENT_NUM_SIGNALS, $tevent_num_signals, [Max signal number value])
+
 if test x"$VERSIONSCRIPT" != "x"; then
     EXPORTSFILE=tevent.exports
     AC_SUBST(EXPORTSFILE)
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index 3d2a79a..8e3f4af 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -4,6 +4,7 @@
    testing of the events subsystem
 
    Copyright (C) Stefan Metzmacher 2006-2009
+   Copyright (C) Jeremy Allison    2013
 
      ** NOTE! The following LGPL license applies to the tevent
      ** library. This does NOT imply that all of Samba is released
@@ -27,6 +28,7 @@
 #include "lib/tevent/tevent.h"
 #include "system/filesys.h"
 #include "system/select.h"
+#include "system/network.h"
 #include "torture/torture.h"
 #ifdef HAVE_PTHREAD
 #include <pthread.h>
@@ -35,7 +37,7 @@
 
 static int fde_count;
 
-static void fde_handler(struct tevent_context *ev_ctx, struct tevent_fd *f, 
+static void fde_handler_read(struct tevent_context *ev_ctx, struct tevent_fd *f,
 			uint16_t flags, void *private_data)
 {
 	int *fd = (int *)private_data;
@@ -44,11 +46,38 @@ static void fde_handler(struct tevent_context *ev_ctx, struct tevent_fd *f,
 	kill(getpid(), SIGUSR1);
 #endif
 	kill(getpid(), SIGALRM);
+
 	read(fd[0], &c, 1);
-	write(fd[1], &c, 1);
 	fde_count++;
 }
 
+static void fde_handler_write(struct tevent_context *ev_ctx, struct tevent_fd *f,
+			uint16_t flags, void *private_data)
+{
+	int *fd = (int *)private_data;
+	char c = 0;
+	write(fd[1], &c, 1);
+}
+
+
+/* These should never fire... */
+static void fde_handler_read_1(struct tevent_context *ev_ctx, struct tevent_fd *f,
+			uint16_t flags, void *private_data)
+{
+	struct torture_context *test = (struct torture_context *)private_data;
+	torture_comment(test, "fde_handler_read_1 should never fire !\n");
+	abort();
+}
+
+/* These should never fire... */
+static void fde_handler_write_1(struct tevent_context *ev_ctx, struct tevent_fd *f,
+			uint16_t flags, void *private_data)
+{
+	struct torture_context *test = (struct torture_context *)private_data;
+	torture_comment(test, "fde_handler_write_1 should never fire !\n");
+	abort();
+}
+
 static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer *te,
 			     struct timeval tval, void *private_data)
 {
@@ -70,17 +99,21 @@ static bool test_event_context(struct torture_context *test,
 	int fd[2] = { -1, -1 };
 	const char *backend = (const char *)test_data;
 	int alarm_count=0, info_count=0;
-	struct tevent_fd *fde;
+	struct tevent_fd *fde_read;
+	struct tevent_fd *fde_read_1;
+	struct tevent_fd *fde_write;
+	struct tevent_fd *fde_write_1;
 #ifdef SA_RESTART
 	struct tevent_signal *se1 = NULL;
 #endif
+#ifdef SA_RESETHAND
 	struct tevent_signal *se2 = NULL;
+#endif
 #ifdef SA_SIGINFO
 	struct tevent_signal *se3 = NULL;
 #endif
 	int finished=0;
 	struct timeval t;
-	char c = 0;
 
 	ev_ctx = tevent_context_init_byname(test, backend);
 	if (ev_ctx == NULL) {
@@ -88,7 +121,8 @@ static bool test_event_context(struct torture_context *test,
 		return true;
 	}
 
-	torture_comment(test, "Testing event backend '%s'\n", backend);
+	torture_comment(test, "backend '%s' - %s\n",
+			backend, __FUNCTION__);
 
 	/* reset globals */
 	fde_count = 0;
@@ -96,25 +130,35 @@ static bool test_event_context(struct torture_context *test,
 	/* create a pipe */
 	pipe(fd);
 
-	fde = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_READ,
-			    fde_handler, fd);
-	tevent_fd_set_auto_close(fde);
+	fde_read = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_READ,
+			    fde_handler_read, fd);
+	fde_write_1 = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_WRITE,
+			    fde_handler_write_1, test);
+
+	fde_write = tevent_add_fd(ev_ctx, ev_ctx, fd[1], TEVENT_FD_WRITE,
+			    fde_handler_write, fd);
+	fde_read_1 = tevent_add_fd(ev_ctx, ev_ctx, fd[1], TEVENT_FD_READ,
+			    fde_handler_read_1, test);
+
+	tevent_fd_set_auto_close(fde_read);
+	tevent_fd_set_auto_close(fde_write);
 
 	tevent_add_timer(ev_ctx, ev_ctx, timeval_current_ofs(2,0),
 			 finished_handler, &finished);
 
 #ifdef SA_RESTART
 	se1 = tevent_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESTART, count_handler, &alarm_count);
+	torture_assert(test, se1 != NULL, "failed to setup se1");
 #endif
 #ifdef SA_RESETHAND
 	se2 = tevent_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESETHAND, count_handler, &alarm_count);
+	torture_assert(test, se2 != NULL, "failed to setup se2");
 #endif
 #ifdef SA_SIGINFO
 	se3 = tevent_add_signal(ev_ctx, ev_ctx, SIGUSR1, SA_SIGINFO, count_handler, &info_count);
+	torture_assert(test, se3 != NULL, "failed to setup se3");
 #endif
 
-	write(fd[1], &c, 1);
-
 	t = timeval_current();
 	while (!finished) {
 		errno = 0;
@@ -124,8 +168,10 @@ static bool test_event_context(struct torture_context *test,
 		}
 	}
 
-	talloc_free(fde);
-	close(fd[1]);
+	talloc_free(fde_read);
+	talloc_free(fde_write);
+	talloc_free(fde_read_1);
+	talloc_free(fde_write_1);
 
 	while (alarm_count < fde_count+1) {
 		if (tevent_loop_once(ev_ctx) == -1) {
@@ -141,6 +187,14 @@ static bool test_event_context(struct torture_context *test,
 
 	torture_assert_int_equal(test, alarm_count, 1+fde_count, "alarm count mismatch");
 
+#ifdef SA_RESETHAND
+	/*
+	 * we do not call talloc_free(se2)
+	 * because it is already gone,
+	 * after triggering the event handler.
+	 */
+#endif
+
 #ifdef SA_SIGINFO
 	talloc_free(se3);
 	torture_assert_int_equal(test, info_count, fde_count, "info count mismatch");
@@ -151,6 +205,460 @@ static bool test_event_context(struct torture_context *test,
 	return true;
 }
 
+struct test_event_fd1_state {
+	struct torture_context *tctx;
+	const char *backend;
+	struct tevent_context *ev;
+	int sock[2];
+	struct tevent_timer *te;
+	struct tevent_fd *fde0;
+	struct tevent_fd *fde1;
+	bool got_write;
+	bool got_read;
+	bool drain;
+	bool drain_done;
+	unsigned loop_count;
+	bool finished;
+	const char *error;
+};
+
+static void test_event_fd1_fde_handler(struct tevent_context *ev_ctx,
+				       struct tevent_fd *fde,
+				       uint16_t flags,
+				       void *private_data)
+{
+	struct test_event_fd1_state *state =
+		(struct test_event_fd1_state *)private_data;
+
+	if (state->drain_done) {
+		state->finished = true;
+		state->error = __location__;
+		return;
+	}
+
+	if (state->drain) {
+		ssize_t ret;
+		uint8_t c = 0;
+
+		if (!(flags & TEVENT_FD_READ)) {
+			state->finished = true;
+			state->error = __location__;
+			return;
+		}
+
+		ret = read(state->sock[0], &c, 1);
+		if (ret == 1) {
+			return;
+		}
+
+		/*
+		 * end of test...
+		 */
+		tevent_fd_set_flags(fde, 0);
+		state->drain_done = true;
+		return;
+	}
+
+	if (!state->got_write) {
+		uint8_t c = 0;
+
+		if (flags != TEVENT_FD_WRITE) {
+			state->finished = true;
+			state->error = __location__;
+			return;
+		}
+		state->got_write = true;
+
+		/*
+		 * we write to the other socket...
+		 */
+		write(state->sock[1], &c, 1);
+		TEVENT_FD_NOT_WRITEABLE(fde);
+		TEVENT_FD_READABLE(fde);
+		return;
+	}
+
+	if (!state->got_read) {
+		if (flags != TEVENT_FD_READ) {
+			state->finished = true;
+			state->error = __location__;
+			return;
+		}
+		state->got_read = true;
+
+		TEVENT_FD_NOT_READABLE(fde);
+		return;
+	}
+
+	state->finished = true;
+	state->error = __location__;
+	return;
+}
+
+static void test_event_fd1_finished(struct tevent_context *ev_ctx,
+				    struct tevent_timer *te,
+				    struct timeval tval,
+				    void *private_data)
+{
+	struct test_event_fd1_state *state =
+		(struct test_event_fd1_state *)private_data;
+
+	if (state->drain_done) {
+		state->finished = true;
+		return;
+	}
+
+	if (!state->got_write) {
+		state->finished = true;
+		state->error = __location__;
+		return;
+	}
+
+	if (!state->got_read) {
+		state->finished = true;
+		state->error = __location__;
+		return;
+	}
+
+	state->loop_count++;
+	if (state->loop_count > 3) {
+		state->finished = true;
+		state->error = __location__;
+		return;
+	}
+
+	state->got_write = false;
+	state->got_read = false;
+
+	tevent_fd_set_flags(state->fde0, TEVENT_FD_WRITE);
+
+	if (state->loop_count > 2) {
+		state->drain = true;
+		TALLOC_FREE(state->fde1);
+		TEVENT_FD_READABLE(state->fde0);
+	}
+
+	state->te = tevent_add_timer(state->ev, state->ev,
+				    timeval_current_ofs(0,2000),
+				    test_event_fd1_finished, state);
+}
+
+static bool test_event_fd1(struct torture_context *tctx,
+			   const void *test_data)
+{
+	struct test_event_fd1_state state;
+
+	ZERO_STRUCT(state);
+	state.tctx = tctx;
+	state.backend = (const char *)test_data;
+
+	state.ev = tevent_context_init_byname(tctx, state.backend);
+	if (state.ev == NULL) {
+		torture_skip(tctx, talloc_asprintf(tctx,
+			     "event backend '%s' not supported\n",
+			     state.backend));
+		return true;
+	}
+
+	tevent_set_debug_stderr(state.ev);
+	torture_comment(tctx, "backend '%s' - %s\n",
+			state.backend, __FUNCTION__);
+
+	/*
+	 * This tests the following:
+	 *
+	 * It monitors the state of state.sock[0]
+	 * with tevent_fd, but we never read/write on state.sock[0]
+	 * while state.sock[1] * is only used to write a few bytes.
+	 *
+	 * We have a loop:
+	 *   - we wait only for TEVENT_FD_WRITE on state.sock[0]
+	 *   - we write 1 byte to state.sock[1]
+	 *   - we wait only for TEVENT_FD_READ on state.sock[0]
+	 *   - we disable events on state.sock[0]
+	 *   - the timer event restarts the loop
+	 * Then we close state.sock[1]
+	 * We have a loop:
+	 *   - we wait for TEVENT_FD_READ/WRITE on state.sock[0]
+	 *   - we try to read 1 byte
+	 *   - if the read gets an error of returns 0
+	 *     we disable the event handler
+	 *   - the timer finishes the test
+	 */
+	state.sock[0] = -1;
+	state.sock[1] = -1;
+	socketpair(AF_UNIX, SOCK_STREAM, 0, state.sock);
+
+	state.te = tevent_add_timer(state.ev, state.ev,
+				    timeval_current_ofs(0,1000),
+				    test_event_fd1_finished, &state);
+	state.fde0 = tevent_add_fd(state.ev, state.ev,
+				   state.sock[0], TEVENT_FD_WRITE,
+				   test_event_fd1_fde_handler, &state);
+	/* state.fde1 is only used to auto close */
+	state.fde1 = tevent_add_fd(state.ev, state.ev,
+				   state.sock[1], 0,
+				   test_event_fd1_fde_handler, &state);
+
+	tevent_fd_set_auto_close(state.fde0);
+	tevent_fd_set_auto_close(state.fde1);
+
+	while (!state.finished) {
+		errno = 0;
+		if (tevent_loop_once(state.ev) == -1) {
+			talloc_free(state.ev);
+			torture_fail(tctx, talloc_asprintf(tctx,
+				     "Failed event loop %s\n",
+				     strerror(errno)));
+		}
+	}
+
+	talloc_free(state.ev);
+
+	torture_assert(tctx, state.error == NULL, talloc_asprintf(tctx,
+		       "%s", state.error));
+
+	return true;
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list