1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

36 Commits

Author SHA1 Message Date
Nikolai Kondrashov
9d29593d92 tevent: Clarify apparently useless conditions
Comment on two similar conditions in tevent_standard.c, which,
otherwise, at a first glance, seem useless, i.e. always true.

The conditions checking glue->epoll_ops for being non-NULL, imply that
it *can* be NULL. A casual reader would not generally expect a "member"
function to modify its container's pointer in a container higher up, and
would assume that glue->epoll_ops could be NULL before the call,
resulting in a near-NULL pointer dereference.

However, in this case epoll_ops is indeed cleared in those "member"
functions, in the case of an epoll interface failure, to signify
fallback to poll interface.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Tue Jul 12 13:56:41 CEST 2016 on sn-devel-144
2016-07-12 13:56:41 +02:00
Volker Lendecke
e7d4b7deda tevent: Only build "std_fallback_to_poll" when epoll is around
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-01-17 12:38:08 +01:00
Stefan Metzmacher
36345d44c8 tevent: tevent_epoll_set_panic_fallback() can be a void function
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>
2013-12-11 22:46:09 +01:00
Stefan Metzmacher
5b9218a3c2 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:24 -08:00
Stefan Metzmacher
3fc93164fb 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:20 -08:00
Jeremy Allison
daada84920 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 14 22:40:30 CET 2013 on sn-devel-104
2013-02-14 22:40:30 +01:00
Jeremy Allison
16f57076b1 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@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
1ee428d5ca 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Martin Schwenke
796acbd9ff lib/tevent: Add trace point callback
Set/get a single callback function to be invoked at various trace
points.  Define "before wait" and "after wait" trace points - more
trace points can be added later if required.

CTDB wants this to log long waits and events.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-08 19:00:05 +02:00
Sumit Bose
158b208dfd tevent: Set FD_CLOEXEC on epoll handle
If an application using libtevent starts a new process the epoll file descriptor
is leaked to the new process if the event context is not freed explicitly. By
setting FD_CLOEXEC this is not needed anymore.

Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-11 14:38:53 -04:00
Jeremy Allison
6e66208f63 Finish the range checking on all FD_SET calls for select().
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Feb 28 21:10:08 CET 2011 on sn-devel-104
2011-02-28 21:10:08 +01:00
Volker Lendecke
1c9b856670 tevent: Only call handlers that ask for events
The s3 libsmbclient puts two different handlers on a single fd for readability
and writability. With select this works fine, however without this patch we
unconditionally call the write handler even if the socket is only readable. We
should have called the read handler instead.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Oct  6 23:40:24 UTC 2010 on sn-devel-104
2010-10-06 23:40:24 +00:00
Andrew Tridgell
2550bbc981 tevent: mark backend init fns as _PRIVATE_
these are not supposed to be exposed in the library
2010-04-18 15:00:38 +10:00
Stefan Metzmacher
66886f8966 tevent: add support for immediate events
They're like directly triggered timed events,
but you can preallocated them and scheduling them
will not fail.

metze
2009-03-17 19:59:00 +01:00
Stefan Metzmacher
940e61846e tevent: add tevent_common_loop_wait() helper function and use it
tevent_loop_wait should do the same for all backends.
It should loop as long as we have pending events.

metze
2009-03-17 19:58:57 +01:00
Stefan Metzmacher
0139befb91 tevent: check signal events first in event_loop_once
We also check for signal events directly before and after
the select/epoll calls.

metze
2009-03-17 19:58:56 +01:00
Stefan Metzmacher
3af7db3dce tevent: let tevent_loop_once() just run one fd event
This makes the logic much simpler for the callers,
and matches the samba3 behavior.

If needed we can add performance tunning for tevent_loop_wait()
later.

metze
2009-03-17 19:58:55 +01:00
Stefan Metzmacher
9932fd2d9a tevent: pass __location__ to tevent_loop_once/wait()
metze
2009-03-12 12:12:34 +01:00
Kai Blin
48b874e376 tevent: Rename ev_timeval* functions to tevent_timeval, export them.
Also add tevent_timeval_add() and tevent_timeval_current_ofs()
to help not depending on lub/util/time.c for things that just need tevent
2009-02-17 09:19:31 +01:00
Stefan Metzmacher
6211162d3e lib/tevent: change to LGPLv3+
metze
2009-02-16 08:53:25 +01:00
Stefan Metzmacher
ceac26008c tevent: keep a linked list of fd_events
metze
2009-01-05 22:44:53 +01:00
Stefan Metzmacher
b24924d6a6 tevent: keep a linked list of signal events
metze
2009-01-05 22:44:53 +01:00
Stefan Metzmacher
e058e51d63 tevent: completely initialize tevent_fd structs
This fixes crash bugs... I forgot to commit and squash
this to commit e45ed828d0

metze
2009-01-04 09:39:17 +01:00
Stefan Metzmacher
67810019a0 tevent: remove TEVENT_FD_AUTOCLOSE feature
TEVENT_FD_AUTOCLOSE adds a dependency to SOCKET_WRAPPER,
which is bad. Callers should use tevent_fd_set_close_fn() now.

metze
2009-01-03 19:58:54 +01:00
Stefan Metzmacher
2c8a10fe88 tevent: remove dependency to SOCKET_WRAPPER via "system/network.h"
metze
2009-01-03 19:58:54 +01:00
Stefan Metzmacher
e45ed828d0 tevent: add tevent_fd_set_close_fn()
Let callers specify a close function
as an alternative to TEVENT_FD_AUTOCLOSE.

metze
2009-01-03 19:58:51 +01:00
Stefan Metzmacher
e928d863e2 tevent: move some common tevent_fd related functions into tevent_fd.c
metze
2009-01-03 19:58:50 +01:00
Stefan Metzmacher
784b2dc8d0 tevent: use TEVENT_FD_* instead of EVENT_FD_*
metze
2009-01-02 18:16:53 +01:00
Stefan Metzmacher
4f04b06ac2 tevent: rename ev_debug_ops => tevent_debug_ops
And related changes, but we keep compat macros

metze
2009-01-02 18:16:53 +01:00
Stefan Metzmacher
227f799dee tevent: pass down handler_name and location to the backend layer
metze
2009-01-02 18:16:52 +01:00
Stefan Metzmacher
b12e78e645 tevent: use HAVE_EPOLL instead of HAVE_EVENTS_EPOLL
metze
2009-01-02 18:16:51 +01:00
Stefan Metzmacher
d9529a331a tevent: rename event_register_backend() => tevent_register_backend()
And fix the callers and there init functions.

metze
2009-01-02 18:16:51 +01:00
Stefan Metzmacher
183c379fe5 s4:lib/tevent: rename structs
list=""
list="$list event_context:tevent_context"
list="$list fd_event:tevent_fd"
list="$list timed_event:tevent_timer"

for s in $list; do
	o=`echo $s | cut -d ':' -f1`
	n=`echo $s | cut -d ':' -f2`
	r=`git grep "struct $o" |cut -d ':' -f1 |sort -u`
	files=`echo "$r" | grep -v source3 | grep -v nsswitch | grep -v packaging4`
	for f in $files; do
		cat $f | sed -e "s/struct $o/struct $n/g" > $f.tmp
		mv $f.tmp $f
	done
done

metze
2008-12-29 20:46:40 +01:00
Stefan Metzmacher
7bf5768a52 lib/tevent: rename event_* => tevent_* in the header file
We have compat macros to keep the callers happy.

metze
2008-12-29 08:42:00 +01:00
Stefan Metzmacher
46eda79090 s4:lib/tevent: add lib/events/ compat and let things compile
metze
2008-12-17 13:31:29 +01:00
Stefan Metzmacher
504f8816e3 s4:lib/events: move to toplevel directory as lib/tevent/
This commit will not compile on its own.

metze
2008-12-17 13:31:28 +01:00