summaryrefslogtreecommitdiff
path: root/lib/tevent
AgeCommit message (Collapse)AuthorFilesLines
2013-08-05tevent: Add echo server sample codeVolker Lendecke1-0/+664
This is under a deliberately permissive license. I would like people to start using libtevent and tevent_req (LGPL) without any worries about where to start from. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Aug 5 04:07:58 CEST 2013 on sn-devel-104
2013-08-01tevent: change version to 0.9.19Stefan Metzmacher2-1/+84
* Fix tevent testsuite issue on Solaris. * Add tevent tuturial and documentation updates * Fix Coverity ID 989236 Operands don't affect result * Bug: https://bugzilla.samba.org/show_bug.cgi?id=10012 Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Aug 1 17:05:02 CEST 2013 on sn-devel-104
2013-08-01tevent: Remove the signal pipe if no signal events are aroundVolker Lendecke1-1/+13
It makes adding/removing the first/last sigevents a bit more expensive, but it will fix tevent_loop_wait not finishing when one signal event was added and removed. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10012 Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2013-07-08tevent: document tevent_req_create state zeroingDavid Disseldorp1-3/+3
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jul 8 20:43:49 CEST 2013 on sn-devel-104
2013-07-05tevent: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Karolin Seeger <kseeger@samba.org> Autobuild-User(master): Karolin Seeger <kseeger@samba.org> Autobuild-Date(master): Fri Jul 5 11:10:07 CEST 2013 on sn-devel-104
2013-06-21Fix some blank line endingsVolker Lendecke1-4/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Jun 21 19:57:06 CEST 2013 on sn-devel-104
2013-06-14tevent: Fix Coverity ID 989236 Operands don't affect resultVolker Lendecke1-1/+1
"unsigned" could be less than uint64_t, so idx==UINT64_MAX is always false. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-12tevent: Link the tutorial on the mainpage.Andreas Schneider2-157/+535
Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Jun 12 19:54:30 CEST 2013 on sn-devel-104
2013-06-12tevent: Add tevent tutorial files.David Koňař8-0/+1034
Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2013-05-28build: Remove autoconf build systemAndrew Bartlett1-75/+0
We are now confident that that waf build system meets enough of our needs that we will work to improve it, rather than maintain two build systems. Andrew Bartlett Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-04-04tevent: Only set poll_ev->delete=false if it was trueVolker Lendecke1-1/+1
Might not be noticable, but I thought it would be an obvious tiny optimization. Possibly the compiler already does this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Apr 4 18:32:39 CEST 2013 on sn-devel-104
2013-03-22Fix tevent testsuite issue on Solaris.Jeremy Allison1-1/+6
On Solaris/Nexenta/Illumos once a pipe is full it will not be reported as writable until PIPE_BUF (actually on Solaris 4096, which is less than PIPE_BUF) bytes have been read from it. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Mar 22 18:16:45 CET 2013 on sn-devel-104
2013-03-22Solaris/Illumos/Nexenta creates pipes that are bi-directional by default.Jeremy Allison1-10/+16
Ensure the test code will pass against such a system (allow writes/reads going both ways). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-03-02tevent: change version to 0.9.18Stefan Metzmacher2-1/+84
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Mar 2 02:15:44 CET 2013 on sn-devel-104
2013-03-01tevent: optimize adding new zero timer eventsStefan Metzmacher6-31/+113
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: optimize adding new timer eventsStefan Metzmacher1-8/+24
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: add a debug message in tevent_common_loop_timer_delay()Stefan Metzmacher1-0/+4
We should debug a message before and after running the handler. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: add test_event_fd2()Stefan Metzmacher1-0/+242
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: add test_event_fd1()Stefan Metzmacher1-0/+221
This test verifies that TEVENT_FD_* flags are handled correctly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: use better names for the subtestsStefan Metzmacher1-2/+9
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: Regression test to ensure that a tevent backend can cope with ↵Jeremy Allison1-11/+50
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@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: use DEBUG_ERROR for the fallback message in epoll_panic()Stefan Metzmacher1-1/+1
A Samba autobuild passed without a fallback, so this is really an error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two ↵Jeremy Allison1-0/+7
fde's into one epoll event. Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: preferr the write handler if there're two possible handlers ↵Stefan Metzmacher1-0/+10
registered with epoll Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: In epoll_event_loop() ensure we trigger the right handler for a ↵Stefan Metzmacher1-7/+36
multiplexed fde event. Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: Add utility function epoll_handle_hup_or_err()Jeremy Allison1-0/+32
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@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()Stefan Metzmacher1-0/+17
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: handle multiplexed fde's in epoll_event_fd_destructor()Stefan Metzmacher1-0/+21
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: Fix epoll_mod_event() to cope with modifying a multiplexed fde event.Stefan Metzmacher1-2/+32
Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.Jeremy Allison1-2/+18
Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: handle multiplexed fde's in epoll_add_event()Stefan Metzmacher1-2/+32
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: Start to fix the epoll backend to support 2 fd events on the same fd ↵Jeremy Allison1-1/+96
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@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: ignore EBADF from epoll_ctl() and disable the eventStefan Metzmacher1-2/+26
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: unify handling of HAS_EVENT and REPORT_ERROR in ↵Stefan Metzmacher1-10/+6
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: always go through epoll_update_event()Stefan Metzmacher1-9/+14
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: s/epoll_change_event/epoll_update_eventStefan Metzmacher1-2/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: the content of event is ignored by EPOLL_CTL_DELStefan Metzmacher1-2/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: call epoll_panic() if EPOLL_CTL_DEL failedStefan Metzmacher1-4/+11
Only ENOENT is ignored as it is no error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: use helper variables to hold the epoll_ctl() resultStefan Metzmacher1-3/+9
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checksStefan Metzmacher1-9/+0
We'll never leave epoll_check_reopen() with epoll_fd == -1. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: add std_event_loop_wait()Stefan Metzmacher1-0/+17
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()Stefan Metzmacher1-1/+0
The epoll backend has done the cleanup already. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: avoid any operation on epoll_ev after a epoll_panic()Stefan Metzmacher1-11/+74
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: add epoll_{create,ctl}_panic_fallback() for testingStefan Metzmacher1-5/+49
This makes sure we only do random panics if a fallback handler is registered. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: use DLIST_DEMOTE() before calling on fde handler after select() and ↵Stefan Metzmacher2-0/+2
poll() This makes sure we don't preferr events which are at the beginning of the list. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: debug a FATAL message on EBADF from the select backendStefan Metzmacher1-0/+4
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: Fix multiple handler on the same fd bug in the tevent select backend.Jeremy Allison1-2/+6
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@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01tevent: revalidate fde->flags after poll()Stefan Metzmacher1-0/+6
This is important to avoid races between threads if the poll_mt backend is used. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: ignore POLLNVAL from poll() and disable the eventStefan Metzmacher1-1/+44
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01tevent: traverse the ev->fd_event list instead of the poll_ev->fds arrayStefan Metzmacher1-26/+5
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@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>