summaryrefslogtreecommitdiffstats
path: root/lib/tevent
Commit message (Collapse)AuthorAgeFilesLines
* lib: tevent: make TEVENT_SIG_INCREMENT atomic.Jeremy Allison2014-06-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | On arm platforms incrementing a variable is not an atomic operation, so may be interrupted by signal processing (if a signal interrupts another signal handler). Use compiler built-ins to make this atomic. __sync_fetch_and_add() works on gcc, llvm, IBM xlC on AIX, and Intel icc (10.1 and above). atomic_add_32() works on Oracle Solaris. Based on an inital patch from kamei@osstech.co.jp. Bug #10640 - smbd is not responding - tevent_common_signal_handler() increments non-atomic variables https://bugzilla.samba.org/show_bug.cgi?id=10640 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
* tevent: Update flags in tevent pkgconfig fileLukas Slebodnik2014-04-041-2/+2
| | | | | | | | | | | After exapnding, @LIB_RPATH@ will be -Wl,-rpatch,/usr/local/lib if rpath is used on install. But "-Wl," will be passed to linker and should not be among CFLAGS. Other pkgconfig files have @LIB_RPATH@ in the right place. @see commit 735c1cd2da15167748e92ba6de48fdb5169db587 Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* dlinklist: Fix a typoVolker Lendecke2014-04-021-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Apr 2 17:11:37 CEST 2014 on sn-devel-104
* lib/tevent/tests: add missing #include "torture/local/proto.h"Stefan Metzmacher2014-04-021-0/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tevent: version 0.9.21Stefan Metzmacher2014-01-172-1/+89
| | | | | | | | | | | | | | | This fixes a the following bugs: - fix a crash bug in tevent_queue_immediate_trigger() - add missing tevent_num_signals() and tevent_sa_info_queue_count() prototypes including documentation. This adds the following new features: - tevent_req_set_cleanup_fn() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: add tevent_req_set_cleanup_fn()Stefan Metzmacher2014-01-173-0/+77
| | | | | | | | | | | | | | | | | | | | | | | Note that some callers used their own destructor for their tevent_req instance, they'll just overwrite this, which is not intended, but works without problems. The intended way is to specify a cleanup function and handle the TEVENT_REQ_RECEIVED state as destructor. Note that the TEVENT_REQ_RECEIVED cleanup event might be triggered by an explicit tevent_req_received() in the _recv() function. The TEVENT_REQ_RECEIVED event is only triggered once as tevent_req_received() will remove the destructor. So the difference compared to a custom destructor is that the struct tevent_req itself can continue to be there, while tevent_req_received() removed all internal state. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: add/use tevent_req_destructorStefan Metzmacher2014-01-171-1/+14
| | | | | | | | | | | | This makes sure we call tevent_req_received(req) on talloc_free() and cleanup things in a defined order. Note that some callers used their own destructor for their tevent_req instance, they'll just overwrite this, which is not intended, but works without problems. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: add doxygen comments for tevent_num_signals() and ↵Stefan Metzmacher2014-01-171-0/+23
| | | | | | | tevent_sa_info_queue_count() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: Add prototypesVolker Lendecke2014-01-171-0/+4
| | | | | | | ... doxygen docs to be filled in :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tevent: Only build "std_fallback_to_poll" when epoll is aroundVolker Lendecke2014-01-171-0/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tevent: fix crash bug in tevent_queue_immediate_trigger()Stefan Metzmacher2014-01-171-0/+4
| | | | | | | | | | | Assume we we have a queue with 2 entries (A and B with triggerA() and triggerB()). If triggerA() removes itself tevent_queue_entry_destructor() will be called for A, this schedules the immediate event to call triggerB(). If triggerA() then also removes B by an explicit of implizit talloc_free(), q->list is NULL, but the immediate event is still scheduled and can't be unscheduled. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* Do not return a value from a void function.Simo Sorce2013-12-261-1/+0
| | | | | | | | Reported by herwin <samba@herwinw.nl> Resolves: https://bugzilla.samba.org/show_bug.cgi?id=10346 Signed-off-by: Simo Sorce <idra@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: Fix CID 1138326 Unchecked return valueVolker Lendecke2013-12-171-1/+1
| | | | | | | For this case we explicitly have added tevent_req_oom Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tevent: version 0.9.20Stefan Metzmacher2013-12-122-1/+88
| | | | | | | | | | | | | | This adds the following new features: - tevent_queue_wait_send/recv() - tevent_num_signals() - tevent_sa_info_queue_count() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Dec 12 00:39:35 CET 2013 on sn-devel-104
* tevent: give the user the chance to ask for TEVENT_NUM_SIGNALS and ↵Stefan Metzmacher2013-12-111-0/+10
| | | | | | | | | | | TEVENT_SA_INFO_QUEUE_COUNT This way the caller can change use the supported limits without using hardcoded values. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10214 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: change TEVENT_SA_INFO_QUEUE_COUNT from 64 to 256Stefan Metzmacher2013-12-111-1/+1
| | | | | | | | | | | There are some existing callers which assume the old SA_INFO_QUEUE_COUNT 100 value. 256 should give room for the future. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10214 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: tevent_epoll_set_panic_fallback() can be a void functionStefan Metzmacher2013-12-113-6/+3
| | | | | | | There's no case where this could return an error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: make use of talloc_get_type_abort() in tevent_epoll.cStefan Metzmacher2013-12-111-15/+11
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: make use of talloc_get_type_abort() in tevent_signal.cStefan Metzmacher2013-12-111-6/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: make use of talloc_get_type_abort() in tevent_select.cStefan Metzmacher2013-12-111-6/+8
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: make use of talloc_get_type_abort() in tevent_req.cStefan Metzmacher2013-12-111-4/+6
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: make use of talloc_get_type_abort() in tevent_queue.cStefan Metzmacher2013-12-111-2/+3
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: use talloc_get_type_abort() in the documentation examplesStefan Metzmacher2013-12-111-2/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: add tevent_queue_wait_send/recv()Gregor Beck2013-12-112-0/+85
| | | | | | | | | Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Gregor Beck <gbeck@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: tevent_req_create() already uses ZERO_STRUCT(req)Stefan Metzmacher2013-12-111-2/+0
| | | | | | | There's no need to zero individual members. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: let tevent_req_received() clear the private_cancel functionStefan Metzmacher2013-12-111-0/+1
| | | | | | | This makes sure it's not called when the private state is already gone. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: cancel the timeout timer when the request is finishedStefan Metzmacher2013-12-111-0/+6
| | | | | | | | As we might defer the callback with tevent_req_defer_callback() when calling tevent_req_done(), we should cancel the timeout directly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* tevent: Use talloc_pooled_object for tevent_req_createVolker Lendecke2013-09-081-1/+4
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sun Sep 8 13:39:25 CEST 2013 on sn-devel-104
* tevent: Remove a pointless gotoVolker Lendecke2013-08-161-4/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tevent: Fix tutorial referenceVolker Lendecke2013-08-121-5/+3
| | | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Aug 12 09:17:10 CEST 2013 on sn-devel-104
* tevent: Add echo server sample codeVolker Lendecke2013-08-051-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
* tevent: change version to 0.9.19Stefan Metzmacher2013-08-012-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
* tevent: Remove the signal pipe if no signal events are aroundVolker Lendecke2013-08-011-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>
* tevent: document tevent_req_create state zeroingDavid Disseldorp2013-07-081-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
* tevent: Fix a typoVolker Lendecke2013-07-051-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
* Fix some blank line endingsVolker Lendecke2013-06-211-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
* tevent: Fix Coverity ID 989236 Operands don't affect resultVolker Lendecke2013-06-141-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>
* tevent: Link the tutorial on the mainpage.Andreas Schneider2013-06-122-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
* tevent: Add tevent tutorial files.David Koňař2013-06-128-0/+1034
| | | | | Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* build: Remove autoconf build systemAndrew Bartlett2013-05-281-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>
* tevent: Only set poll_ev->delete=false if it was trueVolker Lendecke2013-04-041-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
* Fix tevent testsuite issue on Solaris.Jeremy Allison2013-03-221-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
* Solaris/Illumos/Nexenta creates pipes that are bi-directional by default.Jeremy Allison2013-03-221-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>
* tevent: change version to 0.9.18Stefan Metzmacher2013-03-022-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
* tevent: optimize adding new zero timer eventsStefan Metzmacher2013-03-016-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>
* tevent: optimize adding new timer eventsStefan Metzmacher2013-03-011-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>
* tevent: add a debug message in tevent_common_loop_timer_delay()Stefan Metzmacher2013-03-011-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>
* tevent: add test_event_fd2()Stefan Metzmacher2013-03-011-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>
* tevent: add test_event_fd1()Stefan Metzmacher2013-03-011-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>
* tevent: use better names for the subtestsStefan Metzmacher2013-03-011-2/+9
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>