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

621 Commits

Author SHA1 Message Date
Jelmer Vernooij
bf06a5166e Set LD_LIBRARY_PATH during tests.
Without this, tests fail ir libtevent is not installed on the system.

Signed-Off-By: Jelmer Vernooij <jelmer@jelmer.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Nov 18 21:40:26 CET 2015 on sn-devel-104
2015-11-18 21:40:25 +01:00
Jeremy Allison
39d0a81ed8 lib: tevent: Whitespace cleanup.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Nov 18 15:54:03 CET 2015 on sn-devel-104
2015-11-18 15:54:03 +01:00
Jeremy Allison
2be3dd1407 lib: tevent: Fix bug in poll backend - poll_event_loop_poll()
If the (pfd->revents & POLLNVAL) case is triggered,
we do DLIST_REMOVE(ev->fd_events, fde); and then
use fde->next in the loop above.

Save off fde->next for loop interation before
this so we can't use a deleted ->next value.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-11-18 12:49:24 +01:00
Stefan Metzmacher
9884a8fa58 tevent: version 0.9.26
* New tevent_thread_proxy API
* Minor build fixes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-11-05 18:04:23 +01:00
Jeremy Allison
68077c617b lib: tevent: docs: Add tutorial on thread usage.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
2015-11-05 18:04:23 +01:00
Jeremy Allison
a132320b4c lib: tevent: tests: Add a second thread test that does request/reply.
Both tests run cleanly with valgrind --tool=drd and
valgrind --tool=helgrind

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
2015-11-05 18:04:23 +01:00
Jeremy Allison
187aebb25b lib: tevent: Initial test of tevent threaded context code.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
2015-11-05 18:04:23 +01:00
Jeremy Allison
49bddd8e47 lib: tevent: Initial checkin of threaded tevent context calling code.
Adds 2 new functions:

struct tevent_thread_proxy *tevent_thread_proxy_create(
                struct tevent_context *dest_ev_ctx);

void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp,
		struct tevent_immediate **pp_im,
		tevent_immediate_handler_t handler,
		void *pp_private_data);

Brief doc included. Tests, docs and tutorial to follow.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-11-05 18:04:23 +01:00
Stefan Metzmacher
d7bdb30cc1 tevent: version 0.9.25
* Fix compile error in Solaris ports backend.
* Fix access after free in tevent_common_check_signal(). bug #11308
* Improve pytevent bindings.
* Testsuite fixes.
* Improve the documentation of the tevent_add_fd()
  assumtions. It must be talloc_free'ed before closing the fd!
  See bug #11141 and bug #11316.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-12 17:08:19 +02:00
Stefan Metzmacher
93ee074f91 pytevent: add a TeventTimer_Object_ref helper structure to make the code clearer
This gives talloc_set_destructor to verify the type,
which removes a compiler warning.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-12 17:08:19 +02:00
Stefan Metzmacher
fb04f0f419 pytevent: remove const warnings using discard_const_p()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-12 17:08:19 +02:00
Stefan Metzmacher
1a8a5ba0d5 pytevent: remove dead code TEVENT_DEPRECATED is never defined
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-06-12 17:08:19 +02:00
Stefan Metzmacher
44584f8107 tevent.h: propose tstream_ versions of read_packet_send/recv and writev_send/recv
The functions operating on the raw file descriptor are for advanced callers,
which take extra care and avoid the problems of
https://bugzilla.samba.org/show_bug.cgi?id=11141.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-12 17:08:17 +02:00
Stefan Metzmacher
88971d4870 tevent/testsuite: make sure we cleanup tevent_fd structures in the correct order
First we need to remove the tevent_fd structures without
tevent_fd_set_auto_close(). Closing the fd needs to be the last
thing...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-12 17:08:17 +02:00
Petr Viktorin
d0f76510a9 pytevent: Build for two versions of Python at once
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 10 08:55:37 CEST 2015 on sn-devel-104
2015-06-10 08:55:37 +02:00
Petr Viktorin
8dbdd27526 pytevent: Port to Python 3
- Use PyStr (String on py2, Unicode on py3) for text strings
- Use PyLong instead of PyInt on Python 3
- Use new module initialization

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-06-10 06:06:19 +02:00
Petr Viktorin
560576217f pytalloc: Improve timer wrapper, and test it
Using Context.add_timer resulted in crashes due to missing type object
and bad reference handling.
Add a TeventTimer_Type struct, and introduce a clear ownership/lifetime model.

Add a "add_timer_offset" to allow adding timers from Python. (add_timer
requires passing struct timeval as a Python integer, which can't really
be done portably).

Add tests.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-06-10 06:06:19 +02:00
Petr Viktorin
4399dc582f pytevent: Define missing TeventFd_Type object
The type objects for Fd was declared but never defined,
resulting in segfaults when it was used.
Define it.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-06-10 06:06:18 +02:00
Petr Viktorin
f5838df58e pytevent: Better error and reference handling
py_backend_list:
- Handle cases of PyString_FromString or PyList_Append failing.
- Properly decrease the reference count of the returned strings.

py_register_backend:
- Decref "name" after use

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-06-10 06:06:18 +02:00
Stefan Metzmacher
9d797ffb27 tevent: fix access after free in tevent_common_check_signal()
This was reported by Pavel Březina <pbrezina@redhat.com>:

    We found a crash in SSSD when a tevent signal is freed in its handler, tevent
    than crashes when it access siginfo.

    sig_info is freed in signal destructor:

    > #ifdef SA_SIGINFO
    >         if (se->sa_flags & SA_SIGINFO) {
    >             if (sig_state->sig_info[se->signum]) {
    >                 talloc_free(sig_state->sig_info[se->signum]);
    >                 sig_state->sig_info[se->signum] = NULL;
    >             }
    >         }
    > #endif

    (gdb) bt
    #0  0x00007f5d4d86cc74 in tevent_signal_destructor (se=0x7f5d5370f920) at
    ../tevent_signal.c:213
    #1  0x00007f5d4d65f233 in _talloc_free_internal () from /lib64/libtalloc.so.2
    #2  0x00007f5d4d6593a3 in _talloc_free () from /lib64/libtalloc.so.2
    #3  0x00007f5d4342f3d4 in proxy_child_init_done (subreq=0x7f5d5370f600) at
    src/providers/proxy/proxy_auth.c:436
    #4  0x00007f5d4d86b0c2 in _tevent_req_error (req=req@entry=0x7f5d5370f600,
    error=error@entry=5, location=location@entry=0x7f5d43433010
    "src/providers/proxy/proxy_auth.c:356")
        at ../tevent_req.c:167
    #5  0x00007f5d4342ef5e in pc_init_sig_handler (ev=<optimized out>,
    sige=<optimized out>, signum=<optimized out>, count=<optimized out>,
    __siginfo=<optimized out>, pvt=<optimized out>)
        at src/providers/proxy/proxy_auth.c:356
    #6  0x00007f5d4d86d48c in tevent_common_check_signal (ev=0x7f5d536de670) at
    ../tevent_signal.c:428
    #7  0x00007f5d4d86f28c in epoll_event_loop (tvalp=0x7fff7b568490,
    epoll_ev=0x7f5d536de8b0) at ../tevent_epoll.c:647
    #8  epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at
    ../tevent_epoll.c:926
    #9  0x00007f5d4d86d7d7 in std_event_loop_once (ev=0x7f5d536de670,
    location=0x7f5d50faedc3 "src/util/server.c:668") at ../tevent_standard.c:114
    #10 0x00007f5d4d869fbd in _tevent_loop_once (ev=ev@entry=0x7f5d536de670,
    location=location@entry=0x7f5d50faedc3 "src/util/server.c:668") at
    ../tevent.c:530
    #11 0x00007f5d4d86a15b in tevent_common_loop_wait (ev=0x7f5d536de670,
    location=0x7f5d50faedc3 "src/util/server.c:668") at ../tevent.c:634
    #12 0x00007f5d4d86d777 in std_event_loop_wait (ev=0x7f5d536de670,
    location=0x7f5d50faedc3 "src/util/server.c:668") at ../tevent_standard.c:140
    #13 0x00007f5d50f96863 in server_loop (main_ctx=0x7f5d536dfac0) at
    src/util/server.c:668
    #14 0x00007f5d5180aa42 in main (argc=8, argv=<optimized out>) at
    src/providers/data_provider_be.c:2909

    But then it is accessed again in tevent_common_check_signal:

    > #ifdef SA_SIGINFO
    >         if (clear_processed_siginfo) {
    >             uint32_t j;
    >             for (j=0;j<count;j++) {
    >                 uint32_t ofs = (counter.seen + j)
    >                     % TEVENT_SA_INFO_QUEUE_COUNT;
    >                 memset((void*)&sig_state->sig_info[i][ofs],
    >                     '\0',
    >                     sizeof(siginfo_t));
    >             }
    >         }
    > #endif

    (gdb) bt
    #0  0x00007fd7ba400505 in memset (__len=<optimized out>, __ch=<optimized out>,
    __dest=<optimized out>) at /usr/include/bits/string3.h:84
    #1  tevent_common_check_signal (ev=0x7fd7bfddf670) at ../tevent_signal.c:459
    #2  0x00007fd7ba40228c in epoll_event_loop (tvalp=0x7fff85536430,
    epoll_ev=0x7fd7bfddf8b0) at ../tevent_epoll.c:647
    #3  epoll_event_loop_once (ev=<optimized out>, location=<optimized out>) at
    ../tevent_epoll.c:926
    #4  0x00007fd7ba4007d7 in std_event_loop_once (ev=0x7fd7bfddf670,
    location=0x7fd7bdb417c3 "src/util/server.c:668") at ../tevent_standard.c:114
    #5  0x00007fd7ba3fcfbd in _tevent_loop_once (ev=ev@entry=0x7fd7bfddf670,
    location=location@entry=0x7fd7bdb417c3 "src/util/server.c:668") at
    ../tevent.c:530
    #6  0x00007fd7ba3fd15b in tevent_common_loop_wait (ev=0x7fd7bfddf670,
    location=0x7fd7bdb417c3 "src/util/server.c:668") at ../tevent.c:634
    #7  0x00007fd7ba400777 in std_event_loop_wait (ev=0x7fd7bfddf670,
    location=0x7fd7bdb417c3 "src/util/server.c:668") at ../tevent_standard.c:140
    #8  0x00007fd7bdb29343 in server_loop (main_ctx=0x7fd7bfde0ac0) at
    src/util/server.c:668
    #9  0x00007fd7be39ca42 in main (argc=8, argv=<optimized out>) at
    src/providers/data_provider_be.c:2909

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11308

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): Tue Jun  2 21:02:11 CEST 2015 on sn-devel-104
2015-06-02 21:02:11 +02:00
Stefan Metzmacher
33ca0179ac tevent: add a note to tevent_add_fd()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11141

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-20 19:29:30 +02:00
Gordon Ross
a7d41e9460 lib: tevent: Fix compile error in Solaris ports backend.
Signed-off-by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-04-29 23:42:20 +02:00
Volker Lendecke
6bcc037b5b tevent: Fix CID 1035381 Unchecked return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-04-21 19:37:16 +02:00
Jelmer Vernooij
90ec37cf90 Move waf into third_party/.
Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-26 22:47:22 +01:00
David Disseldorp
89788dd319 tevent: version 0.9.24
* Ignore unsolicited signal wakeup in tevent_port event loop.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Mar  4 08:33:06 CET 2015 on sn-devel-104
2015-03-04 08:33:06 +01:00
Jeremy Allison
7be3a5f92d tevent: Ignore unexpected signal events in the same way the epoll backend does.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11118

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Mar  3 17:33:06 CET 2015 on sn-devel-104
2015-03-03 17:33:06 +01:00
Michael Adam
04b8e19e17 tevent: version 0.9.23
* Add Solaris ports as tevent backend.
* Improvements to the tevent_data tutorial.
* Remove use of the 'staticforward' macro.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Feb 27 03:48:57 CET 2015 on sn-devel-104
2015-02-27 03:48:57 +01:00
Jeremy Allison
88c1eb4ae1 Add Solaris ports as a tevent backend.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Sun Feb 15 23:25:07 CET 2015 on sn-devel-104
2015-02-15 23:25:07 +01:00
Richard Sharpe
6a56bdf986 Update the tevent_data.dox tutrial stuff to fix some errors, including white
space problems.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Ralph Boehme <rb@sernet.de>

Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Sat Jan 24 09:33:03 CET 2015 on sn-devel-104
2015-01-24 09:33:03 +01:00
Petr Viktorin
02980268e8 Remove use of the "staticforward" macro
This macro was used for compatibility with broken compilers.
Since Python 2.3, it is always defined as `static`, and only exists
"for source compatibility with old C extensions".

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2015-01-22 10:51:07 +01:00
Stefan Metzmacher
1dbd0bec04 tevent: version 0.9.22
* pkgconfig fixes
* Bug #10640 - smbd is not responding - tevent_common_signal_handler()
  increments non-atomic variables.
  https://bugzilla.samba.org/show_bug.cgi?id=10640
* Minor compile fixes

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-30 16:36:09 +02:00
Stefan Metzmacher
a65df7e8c0 tevent: remove unused exit_code in tevent_select.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-30 16:36:09 +02:00
Stefan Metzmacher
1ea3364721 tevent: remove unused exit_code in tevent_poll.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-09-30 16:36:09 +02:00
Volker Lendecke
221d9f7b8e lib: Polish echo_server
Samba has a lot of struct assignments now, in a lot of cases it simplifies the
code. Use it in the sample code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Sep 18 23:02:38 CEST 2014 on sn-devel-104
2014-09-18 23:02:38 +02:00
Michael Adam
befb39441f tevent:build: improve detection of srcdir
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Jeremy Allison
536c799f00 lib: tevent: make TEVENT_SIG_INCREMENT atomic.
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>
2014-06-07 03:15:14 +02:00
Lukas Slebodnik
a83c5240b1 tevent: Update flags in tevent pkgconfig file
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 735c1cd2da

Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-04-04 21:35:34 +02:00
Volker Lendecke
1dba07db0d dlinklist: Fix a typo
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
2014-04-02 17:11:37 +02:00
Stefan Metzmacher
4e5404967e lib/tevent/tests: add missing #include "torture/local/proto.h"
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-04-02 09:03:44 +02:00
Stefan Metzmacher
c4c88d1ee8 tevent: version 0.9.21
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>
2014-01-17 12:38:08 +01:00
Stefan Metzmacher
50b9f154d2 tevent: add tevent_req_set_cleanup_fn()
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>
2014-01-17 12:38:08 +01:00
Stefan Metzmacher
0ed93e099a tevent: add/use tevent_req_destructor
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>
2014-01-17 12:38:08 +01:00
Stefan Metzmacher
7502a309e8 tevent: add doxygen comments for tevent_num_signals() and tevent_sa_info_queue_count()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-17 12:38:08 +01:00
Volker Lendecke
fd80e54416 tevent: Add prototypes
... doxygen docs to be filled in :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-01-17 12:38:08 +01: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
7fe5584e2a tevent: fix crash bug in tevent_queue_immediate_trigger()
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>
2014-01-17 12:38:08 +01:00
Simo Sorce
ec499c3d66 Do not return a value from a void function.
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>
2013-12-26 08:49:00 -08:00
Volker Lendecke
91ef262c63 tevent: Fix CID 1138326 Unchecked return value
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>
2013-12-17 01:57:12 +01:00
Stefan Metzmacher
e26736dcc2 tevent: version 0.9.20
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
2013-12-12 00:39:35 +01:00
Stefan Metzmacher
4b330ba0a8 tevent: give the user the chance to ask for TEVENT_NUM_SIGNALS and 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>
2013-12-11 22:46:09 +01:00
Stefan Metzmacher
cbb93f5442 tevent: change TEVENT_SA_INFO_QUEUE_COUNT from 64 to 256
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>
2013-12-11 22:46:09 +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
4cc02d7c84 tevent: make use of talloc_get_type_abort() in tevent_epoll.c
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
7bf5e6b181 tevent: make use of talloc_get_type_abort() in tevent_signal.c
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
fbdaf7481b tevent: make use of talloc_get_type_abort() in tevent_select.c
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
99910b67d2 tevent: make use of talloc_get_type_abort() in tevent_req.c
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
982bf3c082 tevent: make use of talloc_get_type_abort() in tevent_queue.c
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
fb06f0e3d3 tevent: use talloc_get_type_abort() in the documentation examples
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-12-11 22:46:09 +01:00
Gregor Beck
8e44c2f963 tevent: add tevent_queue_wait_send/recv()
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>
2013-12-11 22:46:09 +01:00
Stefan Metzmacher
7a97d4c4c3 tevent: tevent_req_create() already uses ZERO_STRUCT(req)
There's no need to zero individual members.

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
39888fd4a3 tevent: let tevent_req_received() clear the private_cancel function
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>
2013-12-11 22:46:09 +01:00
Stefan Metzmacher
577afba8b3 tevent: cancel the timeout timer when the request is finished
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>
2013-12-11 22:46:09 +01:00
Volker Lendecke
8f4069c7cd tevent: Use talloc_pooled_object for tevent_req_create
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
2013-09-08 13:39:25 +02:00
Volker Lendecke
6c0758219a tevent: Remove a pointless goto
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-08-16 16:50:23 +02:00
Volker Lendecke
6a081e9919 tevent: Fix tutorial reference
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
2013-08-12 09:17:10 +02:00
Volker Lendecke
cae48e9a36 tevent: Add echo server sample code
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-05 04:07:57 +02:00
Stefan Metzmacher
8f98f5d85a tevent: change version to 0.9.19
* 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-01 17:05:02 +02:00
Volker Lendecke
066a642f10 tevent: Remove the signal pipe if no signal events are around
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-08-01 13:15:38 +02:00
David Disseldorp
e6f79b9489 tevent: document tevent_req_create state zeroing
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-08 20:43:49 +02:00
Volker Lendecke
af6d9cebaf tevent: Fix a typo
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-07-05 11:10:07 +02:00
Volker Lendecke
b96cea4aa5 Fix some blank line endings
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-21 19:57:06 +02:00
Volker Lendecke
dd0e38b5fe tevent: Fix Coverity ID 989236 Operands don't affect result
"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-14 09:31:39 -07:00
Andreas Schneider
d6ce1402a9 tevent: Link the tutorial on the mainpage.
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-12 19:54:30 +02:00
David Koňař
1bce2510ca tevent: Add tevent tutorial files.
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-06-12 18:05:16 +02:00
Andrew Bartlett
cd4b413cb0 build: Remove autoconf build system
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-05-28 12:17:10 +10:00
Volker Lendecke
7f366d745c tevent: Only set poll_ev->delete=false if it was true
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-04-04 18:32:39 +02:00
Jeremy Allison
566a2e6828 Fix tevent testsuite issue on Solaris.
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-22 18:16:45 +01:00
Jeremy Allison
c3ee49a099 Solaris/Illumos/Nexenta creates pipes that are bi-directional by default.
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-22 16:26:20 +01:00
Stefan Metzmacher
f9eb05509b 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@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-02 02:15:44 +01:00
Stefan Metzmacher
35385a3e28 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:54 -08:00
Stefan Metzmacher
afd4198bf1 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:50 -08:00
Stefan Metzmacher
e5ae80378a 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:46 -08:00
Stefan Metzmacher
3ed0f7d992 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:42 -08:00
Stefan Metzmacher
cf3ee4eb53 tevent: add test_event_fd1()
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-01 12:01:38 -08:00
Stefan Metzmacher
2c9d84b226 tevent: use better names for the subtests
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:35 -08:00
Jeremy Allison
04b1fa4112 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:31 -08:00
Stefan Metzmacher
23640472bc 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:26 -08:00
Jeremy Allison
4fcc94d852 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@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:24 -08:00
Stefan Metzmacher
16a072ec1c tevent: preferr the write handler if there're two possible handlers registered with epoll
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:21 -08:00
Stefan Metzmacher
fa4f1713f9 tevent: In epoll_event_loop() ensure we trigger the right handler for a 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-01 12:01:19 -08:00
Jeremy Allison
4057ef2e11 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:01:17 -08:00
Stefan Metzmacher
8b1a43ece8 tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:13 -08:00
Stefan Metzmacher
a347d55f50 tevent: handle multiplexed fde's in epoll_event_fd_destructor()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:09 -08:00
Stefan Metzmacher
6703c5b49f tevent: Fix epoll_mod_event() to cope with modifying a 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-01 12:01:07 -08:00
Jeremy Allison
15ca40fb7a tevent: Fix up epoll_del_event to cope with deleting a 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-01 12:01:05 -08:00
Stefan Metzmacher
809593e7f5 tevent: handle multiplexed fde's in epoll_add_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:01:02 -08:00
Jeremy Allison
e4b496cc09 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@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 12:00:59 -08:00
Stefan Metzmacher
7ef688c1dd tevent: ignore EBADF from epoll_ctl() and disable the event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:56 -08:00
Stefan Metzmacher
2721f0dc5b 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:52 -08:00
Stefan Metzmacher
ec9615c4fc tevent: always go through epoll_update_event()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:49 -08:00
Stefan Metzmacher
07e0427115 tevent: s/epoll_change_event/epoll_update_event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:45 -08:00
Stefan Metzmacher
056dcc7a8a tevent: the content of event is ignored by EPOLL_CTL_DEL
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:41 -08:00
Stefan Metzmacher
2b3b06b9b4 tevent: call epoll_panic() if EPOLL_CTL_DEL failed
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-01 12:00:37 -08:00
Stefan Metzmacher
31db8a08be tevent: use helper variables to hold the epoll_ctl() result
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:32 -08:00
Stefan Metzmacher
b2114eb3b0 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:29 -08: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
Stefan Metzmacher
73dabddbdc 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:15 -08:00
Stefan Metzmacher
2b05c96217 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:11 -08:00
Stefan Metzmacher
8764ec80bb 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:06 -08:00
Stefan Metzmacher
b31767bf27 tevent: debug a FATAL message on EBADF from the select backend
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 12:00:03 -08:00
Jeremy Allison
5ca6914884 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:59 -08:00
Stefan Metzmacher
b53c704a34 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:54 -08:00
Stefan Metzmacher
6952d761d2 tevent: ignore POLLNVAL from poll() and disable the event
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:51 -08:00
Stefan Metzmacher
de0204ccae 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:46 -08:00
Stefan Metzmacher
f45abeae40 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:42 -08:00
Stefan Metzmacher
ef8130fdbf tevent: merge poll_fresh_fde_destructor() into poll_event_fd_destructor()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:39 -08:00
Stefan Metzmacher
f75fd905f7 tevent: use tevent_poll_event_add_fd_internal() in poll_event_add_fd()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:33 -08:00
Stefan Metzmacher
8e3ef659f8 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:28 -08:00
Stefan Metzmacher
d5b341d873 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:24 -08:00
Stefan Metzmacher
f86df3e364 tevent: remember the errno from select(), poll() and epoll_wait()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:20 -08:00
Michael Adam
883d20a9bf 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@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:17 -08:00
Stefan Metzmacher
5f284bec47 tevent: fix compiler warning in tevent_context_init_byname()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:13 -08:00
Stefan Metzmacher
dea5115a3d tevent: fix some compiler warnings in testsuite.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:59:09 -08:00
Michael Adam
5c31b152d2 tevent: fix a comment typo in tevent_epoll.c
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:05 -08:00
Galen.Liu
4a7142ec04 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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:58:53 -08:00
Stefan Metzmacher
d5f9257108 tevent: define TEVENT_NUM_SIGNALS based on configure checks
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-01 11:58:49 -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
203f85c25e 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
5fe459f5d7 tevent: make use of tevent_find_ops_byname() in tevent_context_init_byname()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
b5556a79e3 tevent: make sure tevent_backend_init() only runs once
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
aceeb585cb 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@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
Jeremy Allison
06fb88b449 tevent: Add in some test code to allow the panic fallback path to be tested.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
6f9819229b tevent: Plumb in the panic fallback code into the epoll_panic() runtime call.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
04ba47e491 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
e4ef2ecf02 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@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
129da06d2d 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Jeremy Allison
c36f8c1400 tevent: Preparing to fix "standard" backend fallback. Initialize standard after epoll.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-14 10:19:38 -08:00
Stefan Metzmacher
570a4b3e22 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@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Feb  3 06:40:09 CET 2013 on sn-devel-104
2013-02-03 06:40:09 +01:00
Stefan Metzmacher
e79ad7cff1 tevent_poll: fix the usage of tevent_re_initialise()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:54:05 -08:00
Stefan Metzmacher
dd9f0c9b6d 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@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:47 -08:00
Volker Lendecke
1cfc76f72a 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:30 -08:00
Volker Lendecke
611fcca641 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:53:12 -08:00
Volker Lendecke
0cf62a92f2 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:57 -08:00
Volker Lendecke
3ce58cbcf3 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:40 -08:00
Volker Lendecke
e3309852f7 tevent_poll: Re-order routines
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:21 -08:00
Volker Lendecke
d944e2cae1 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@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-02 19:52:09 -08:00
Volker Lendecke
dc929ca57f tevent: Fix a comment typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>

Autobuild-User(master): Richard Sharpe <sharpe@samba.org>
Autobuild-Date(master): Thu Jan 31 17:52:39 CET 2013 on sn-devel-104
2013-01-31 17:52:39 +01:00
Volker Lendecke
7a21f605c1 tevent: Fix a comment
liboop.org is now in a language I don't understand. But it does definitely not
contain a library.

Reviewed by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 18 00:05:37 CET 2013 on sn-devel-104
2013-01-18 00:05:37 +01:00
Jeremy Allison
8f8ca589d2 tevent: Fix bug 9550 - sigprocmask does not work on FreeBSD to stop further signals in a signal handler
Mask off signals the correct way from the signal handler.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan 15 12:13:43 CET 2013 on sn-devel-104
2013-01-15 12:13:43 +01:00
Stefan Metzmacher
d7d8646e63 tevent: change version to 0.9.17 after adding the "poll_mt" backend
metze
2012-08-16 21:10:32 +02:00
Volker Lendecke
d7af2c842a tevent: Add threaded poll_mt testcase
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-08-16 20:52:17 +02:00
Volker Lendecke
fa71f32411 lib/tevent: Add a thread-safe tevent backend
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-08-16 20:49:11 +02:00
Volker Lendecke
d860aa2cac tevent_poll: Decouple poll_ev->fds handling from adding/removing fds
Step 1 in a python backend for multiple threads

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-08-16 20:48:32 +02:00
Andreas Schneider
41cffa3c8b doc: Remove build/ from doxygen config or it will not work in brew.
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Sat Aug  4 16:31:22 CEST 2012 on sn-devel-104
2012-08-04 16:31:22 +02:00
Volker Lendecke
c03e9769cd tevent: Refer to the correct header in testsuite.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-07-31 11:40:22 +02:00
Stefan Metzmacher
b725154fe7 tevent: change version to 0.9.16
This adds tevent_*_trace_*() and tevent_context_init_ops()

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun  8 20:47:41 CEST 2012 on sn-devel-104
2012-06-08 20:47:40 +02:00
Stefan Metzmacher
ba65400c6e tevent: expose tevent_context_init_ops
This can be used to implement wrapper backends,
while passing a private pointer to the backens init function
via ev->additional_data.

metze
2012-06-08 19:00:05 +02: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
Martin Schwenke
653cb76edf lib/tevent: In poll_event_context, add a pointer back to the tevent_context
This makes it consistent with the other backends.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-08 19:00:01 +02:00
Andrew Bartlett
8ddd2a869b build: Remove unused release scripts for tevent
These now use waf dist, and the script/librelease.sh script as a wrapper.

The mksyms.sh call in the source3/Makefile uses the copy in source3/script

Andrew Bartlett
2012-05-30 04:15:11 +02:00
Stefan Metzmacher
e05b54ea32 lib/tevent/testsuite: no longer use 'compat' symbols
metze
2012-05-14 15:12:33 +02:00
Michael Adam
3583922c82 tevent: fix indentation in the wscript
(accidentially commited in 5e8dee8d96)
2012-05-13 22:41:48 +02:00
Volker Lendecke
670e85fde6 tevent: Fix a typo 2012-04-09 18:05:02 +02:00
Jelmer Vernooij
4c292c8e62 tevent: Install tevent.py into PYTHONARCHDIR rather than PYTHONDIR for consistency with other Samba scripts. 2012-03-10 21:31:52 +01:00
Volker Lendecke
9e25361203 tevent_signal: Fix a valgrind error
This fixes an uninitialized read introduced by my fix for the tevent_signal
destructors. From looking at the code you might believe that this kicks in only
when talloc failed. But with -O3 I do see it in normal operations.

Sorry for that.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Wed Feb 15 17:58:37 CET 2012 on sn-devel-104
2012-02-15 17:58:36 +01:00
Stefan Metzmacher
de53fcd8de tevent: change the version to 0.9.15
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Feb  9 12:24:19 CET 2012 on sn-devel-104
2012-02-09 12:24:19 +01:00
Volker Lendecke
b5436fde5b tevent: Fix deleting signal events from within themselves
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-02-09 10:15:27 +01:00
Amitay Isaacs
2343703985 tevent: Fix python documentation strings
Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Tue Jan 31 16:59:29 CET 2012 on sn-devel-104
2012-01-31 16:59:29 +01:00
Volker Lendecke
092f1b9744 tevent: tevent_schedule_immediate never fails
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Dec  9 16:47:23 CET 2011 on sn-devel-104
2011-12-09 16:47:23 +01:00
Jelmer Vernooij
fbfd155a32 Add version attribute for pytevent.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Wed Dec  7 15:07:49 CET 2011 on sn-devel-104
2011-12-07 15:07:48 +01:00
Jelmer Vernooij
817f7529d3 tevent: Install python tevent modules.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Tue Dec  6 23:13:37 CET 2011 on sn-devel-104
2011-12-06 23:13:37 +01:00
Jelmer Vernooij
5d1922739e Add stub python module for tevent. 2011-12-06 21:03:21 +01:00
Jelmer Vernooij
0ebc501fa8 tevent: Fix typo in build script.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Dec  3 02:15:40 CET 2011 on sn-devel-104
2011-12-03 02:15:40 +01:00
Jelmer Vernooij
86afe83d86 waf: Factor checking for undefined symbol flags out into separate method.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sun Nov 13 19:38:38 CET 2011 on sn-devel-104
2011-11-13 19:38:38 +01:00
Jelmer Vernooij
b929cd2c09 tevent: Only check for pkg-config file when checking for system tevent. 2011-11-13 18:06:06 +01:00
Jelmer Vernooij
5e8dee8d96 tevent: Only build pytevent if the system doesn't provide it. 2011-11-13 18:06:06 +01:00
Jelmer Vernooij
011707dee8 tevent: remove unnecessary enablement. 2011-11-13 18:06:06 +01:00
Martin Schwenke
538748132f Fix -Wunused-but-set-variable compiler warnings in tevent_signal.c
The results of some read(2) and write(2) calls are assigned into a
variable that is never used.  Presumably this used to avoid compiler
warnings or similar.

However, from (approximately) GCC 4.6 this produces some warnings:

  [ 609/3910] Compiling lib/tevent/tevent_signal.c
  ../lib/tevent/tevent_signal.c: In function ‘tevent_common_signal_handler’:
  ../lib/tevent/tevent_signal.c:85:10: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]
  ../lib/tevent/tevent_signal.c: In function ‘signal_pipe_handler’:
  ../lib/tevent/tevent_signal.c:183:10: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

The simplest thing to do is remove the variables and cast the function
return to void.  There is already a comment above each call.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-11-10 10:28:44 +01:00
Jelmer Vernooij
31912781ca wafsamba: Only install .pc files if libraries are public. 2011-08-21 03:22:05 +02:00
Andrew Tridgell
4aba775219 tevent: don't force the nesting flag to false in the destructor
the tevent destructor is called in tevent_re_initialise(), to reset
the event context back to its original state for creating child
processes. We need the nesting flag to stay the same

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Aug 12 05:18:25 CEST 2011 on sn-devel-104
2011-08-12 05:18:25 +02:00
Sumit Bose
ce93b4f464 tevent: fix documentation for tevent_context_init_byname()
Signed-off-by: Simo Sorce <idra@samba.org>

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Aug 11 21:56:37 CEST 2011 on sn-devel-104
2011-08-11 21:56:37 +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
Simo Sorce
74f3e52f00 tevent: cleanup nesting counter when doing a full reinit.
We may be forking from within a loop, so we need to clean-up to avoid
aborts when nesting is not allowed and we are in a new children.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:02 +02:00
Stefan Metzmacher
fd3382906a tevent: change the version to 0.9.14 after the tevent_queue changes
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Aug  9 23:02:17 CEST 2011 on sn-devel-104
2011-08-09 23:02:17 +02:00
Stefan Metzmacher
c6363bb352 tevent: fix some comments in tevent.h
metze
2011-08-09 21:37:42 +02:00
Stefan Metzmacher
1533f1722d tevent: add tevent_queue_add_entry() and tevent_queue_add_optimize_empty()
This adds more flexible handling for the add operation:

- It allows the caller to remove a tevent_req from the queue
  by calling talloc_free() on the returned tevent_queue_entry.
- It allows the caller to optimize for the empty queue case,
  where it the caller wants to avoid the delay caused by
  the immediate event.

metze
2011-08-09 21:37:41 +02:00
Stefan Metzmacher
6b7d58cb4e tevent: splitout tevent_queue_add_internal() from tevent_queue_add()
metze
2011-08-09 21:37:41 +02:00
Stefan Metzmacher
aba9d48f55 tevent: allow tevent_queue_add() to take a NULL trigger function
This way the caller can add a blocker to the queue.

metze
2011-08-09 21:37:41 +02:00
Stefan Metzmacher
3c38ec72e7 tevent: add tevent_queue_running() function
metze
2011-08-09 21:37:40 +02:00
Jeremy Allison
0c67efdd68 Fix bug 7462 - Non-standard SA_RESETHAND is used in ...lib/tevent/tevent_signal.c
Make SA_RESETHAND conditional on its existance.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Aug  1 22:03:45 CEST 2011 on sn-devel-104
2011-08-01 22:03:45 +02:00
Volker Lendecke
83740555ea tevent: Slightly simplify poll_event_loop_poll
No real code change. Do an early return instead of an if-statement, avoiding
one level of indentation.
2011-07-28 17:42:23 +02:00
Stefan Metzmacher
4768fc6704 tevent: change version to 0.9.13 after adding tevent_req_defer_callback()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sat Jul  9 12:16:44 CEST 2011 on sn-devel-104
2011-07-09 12:16:44 +02:00
Stefan Metzmacher
e5827a4007 tevent: add tevent_req_defer_callback()
metze
2011-07-09 11:02:42 +02:00
Stefan Metzmacher
2a1ebeae19 tevent: fix comments for tevent_req_post()
metze
2011-07-09 11:02:41 +02:00
Volker Lendecke
8e1b9640e7 tevent: change version to 0.9.12 2011-06-20 12:33:24 +02:00
Volker Lendecke
c2a826b10c tevent: Add tevent_req_oom
This is a replacement for tevent_req_nomem(NULL, req)
2011-06-20 12:33:24 +02:00
Jeremy Allison
dbcdf3e39c Fix the poll() backend to correctly respond to POLLHUP|POLLERR returns on a fd selected for TEVENT_FD_WRITE only.
Don't trigger the write handler and remove the POLLOUT flag for this fd. Report errors on TEVENT_FD_READ requests only.
Metze please check !

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Jun  3 22:53:52 CEST 2011 on sn-devel-104
2011-06-03 22:53:52 +02:00