metze/samba/wip.git
11 years agoTODO fix commit messages: tevent: add fd2 test which fill the socket kernel buffer
Stefan Metzmacher [Wed, 27 Feb 2013 15:43:44 +0000 (16:43 +0100)]
TODO fix commit messages: tevent: add fd2 test which fill the socket kernel buffer

11 years agosq test_event_fd1
Stefan Metzmacher [Wed, 27 Feb 2013 15:37:09 +0000 (16:37 +0100)]
sq test_event_fd1

11 years agoTEVENT_TRACE_BEFORE_LOOP_ONCE... testsuite
Stefan Metzmacher [Wed, 27 Feb 2013 13:04:07 +0000 (14:04 +0100)]
TEVENT_TRACE_BEFORE_LOOP_ONCE... testsuite

11 years agosq testsuite warnings...
Stefan Metzmacher [Wed, 27 Feb 2013 12:58:39 +0000 (13:58 +0100)]
sq testsuite warnings...

11 years agosq nmbd tevent_fd
Stefan Metzmacher [Wed, 27 Feb 2013 12:49:22 +0000 (13:49 +0100)]
sq nmbd tevent_fd

11 years agoRevert "nmbd..."
Stefan Metzmacher [Wed, 27 Feb 2013 11:26:24 +0000 (12:26 +0100)]
Revert "nmbd..."

This reverts commit b9567fbd605be8f938af5980211196d94a45496a.

11 years agonmbd...
Stefan Metzmacher [Wed, 27 Feb 2013 09:46:23 +0000 (10:46 +0100)]
nmbd...

11 years agoTODO s3:nmbd: use tevent_fd handlers to process incoming packets
Stefan Metzmacher [Wed, 27 Feb 2013 08:32:36 +0000 (09:32 +0100)]
TODO s3:nmbd: use tevent_fd handlers to process incoming packets

11 years agos3:nmbd: fix talloc_zero_array() check in nmbd_packets.c
Stefan Metzmacher [Wed, 27 Feb 2013 08:29:47 +0000 (09:29 +0100)]
s3:nmbd: fix talloc_zero_array() check in nmbd_packets.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:nmbd: keep the last_packet in the socket_attributes of the listening socket
Stefan Metzmacher [Wed, 27 Feb 2013 07:54:39 +0000 (08:54 +0100)]
s3:nmbd: keep the last_packet in the socket_attributes of the listening socket

This way we avoid malloc/free and extent the lifetime of the cache,
which allows us to remove the dependency that we have to process
all pollfd entries in one run.

This is done in preparation to use tevent_fd for the listening sockets.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoTODO tevent: add test_event_fd1()
Stefan Metzmacher [Fri, 22 Feb 2013 20:48:44 +0000 (21:48 +0100)]
TODO tevent: add test_event_fd1()

This test verifies that TEVENT_FD_* flags are handled correctly.

TODO: test errors

11 years agos4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:45:32 +0000 (22:45 +0100)]
s4:torture/smb2: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior whe n running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s
Stefan Metzmacher [Sun, 17 Feb 2013 21:43:49 +0000 (22:43 +0100)]
s4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s

This is 1000 times longer than before and is less likely to
change the timing behavior whe n running under valgrind.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:libcli/smb2: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:41:00 +0000 (22:41 +0100)]
s4:libcli/smb2: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:libcli/raw: don't schedule idle handlers on a dead connection
Stefan Metzmacher [Sun, 17 Feb 2013 21:39:40 +0000 (22:39 +0100)]
s4:libcli/raw: don't schedule idle handlers on a dead connection

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoRevert "tevent: change version to 0.9.18 after the SIGRTMAX fix"
Stefan Metzmacher [Fri, 30 Nov 2012 10:34:35 +0000 (11:34 +0100)]
Revert "tevent: change version to 0.9.18 after the SIGRTMAX fix"

This reverts commit 27a4b1b94877404099e72591760a48eb3c730647.

11 years agotevent: change version to 0.9.18 after the SIGRTMAX fix
Stefan Metzmacher [Fri, 30 Nov 2012 08:43:23 +0000 (09:43 +0100)]
tevent: change version to 0.9.18 after the SIGRTMAX fix

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoRevert "HACK blackbox subunit print ok"
Stefan Metzmacher [Fri, 15 Feb 2013 11:14:37 +0000 (12:14 +0100)]
Revert "HACK blackbox subunit print ok"

This reverts commit 3c8f2cda9ff4db117b9fba5006052d52f235dcaa.

11 years agoHACK blackbox subunit print ok
Stefan Metzmacher [Thu, 14 Feb 2013 14:52:46 +0000 (15:52 +0100)]
HACK blackbox subunit print ok

TDB_NO_FSYNC=1 buildnice make -j test TESTS=LOCAL-WBCLIENT
...
less st/subunit

11 years agoRevert "talloc-2.0.8"
Stefan Metzmacher [Fri, 15 Feb 2013 11:13:48 +0000 (12:13 +0100)]
Revert "talloc-2.0.8"

This reverts commit 56faddd67a6c8c28d77374d0a89314cac2527395.

11 years agoRevert "tevent zero..."
Stefan Metzmacher [Fri, 15 Feb 2013 11:13:45 +0000 (12:13 +0100)]
Revert "tevent zero..."

This reverts commit 0425ebb8848964f9c334d0b720ab470c75ba790f.

11 years agotevent zero...
Stefan Metzmacher [Fri, 15 Feb 2013 08:18:50 +0000 (09:18 +0100)]
tevent zero...

11 years agotalloc-2.0.8
Stefan Metzmacher [Fri, 15 Feb 2013 08:18:35 +0000 (09:18 +0100)]
talloc-2.0.8

11 years agoRevert "reproduce..."
Stefan Metzmacher [Sun, 17 Feb 2013 15:44:55 +0000 (16:44 +0100)]
Revert "reproduce..."

This reverts commit c1b0d4d7f7ae1e80390ca8084ec756e4bc524f82.

11 years agoreproduce...
Stefan Metzmacher [Fri, 15 Feb 2013 15:46:21 +0000 (16:46 +0100)]
reproduce...

11 years agoRevert "HACK compile kqueue backend"
Stefan Metzmacher [Sun, 17 Feb 2013 15:44:39 +0000 (16:44 +0100)]
Revert "HACK compile kqueue backend"

This reverts commit 35be41edea23c792a0f7cdd0b4acdd5ff65c6c84.

11 years agoHACK compile kqueue backend
Stefan Metzmacher [Sun, 17 Feb 2013 14:35:34 +0000 (15:35 +0100)]
HACK compile kqueue backend

11 years agoTODO/UNTESTED: tevent: add kqueue backend
Stefan Metzmacher [Sun, 17 Feb 2013 14:03:03 +0000 (15:03 +0100)]
TODO/UNTESTED: tevent: add kqueue backend

TODO add EBADF handling...

11 years agoTODO/SQ: improve use of tevent_loop_wait() in parent smbd process (spare a free/talloc)
Michael Adam [Tue, 26 Feb 2013 16:47:38 +0000 (17:47 +0100)]
TODO/SQ: improve use of tevent_loop_wait() in parent smbd process (spare a free/talloc)

11 years agoTODO/SQ: s3:smbd: improve use of tevent_loop_wait() in child smbd
Michael Adam [Tue, 26 Feb 2013 16:45:25 +0000 (17:45 +0100)]
TODO/SQ: s3:smbd: improve use of tevent_loop_wait() in child smbd

11 years agoTODO - s3:winbindd: use tevent_loop_wait() in the main loop
Michael Adam [Tue, 26 Feb 2013 16:38:14 +0000 (17:38 +0100)]
TODO - s3:winbindd: use tevent_loop_wait() in the main loop

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:smbd: use tevent_loop_wait() in the parent smbd process.
Michael Adam [Tue, 26 Feb 2013 15:39:46 +0000 (16:39 +0100)]
s3:smbd: use tevent_loop_wait() in the parent smbd process.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:smbd: use tevent_loop_wait() in the child process event loop
Michael Adam [Tue, 26 Feb 2013 15:18:09 +0000 (16:18 +0100)]
s3:smbd: use tevent_loop_wait() in the child process event loop

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
Michael Adam [Tue, 26 Feb 2013 14:54:57 +0000 (15:54 +0100)]
tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent:epoll: fix a comment typo.
Michael Adam [Tue, 26 Feb 2013 14:51:38 +0000 (15:51 +0100)]
tevent:epoll: fix a comment typo.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:nmbd: convert the asyncdns child handling to use tevent
Stefan Metzmacher [Thu, 21 Feb 2013 15:46:32 +0000 (16:46 +0100)]
s3:nmbd: convert the asyncdns child handling to use tevent

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoRevert "TESTING ONLY: tevent: Force the poll backend"
Stefan Metzmacher [Thu, 14 Feb 2013 11:28:28 +0000 (12:28 +0100)]
Revert "TESTING ONLY: tevent: Force the poll backend"

This reverts commit 81485d356d19a97adb84d8db981c679a8afa3c54.

11 years agoTESTING ONLY: tevent: Force the poll backend
Volker Lendecke [Thu, 31 Jan 2013 13:35:57 +0000 (14:35 +0100)]
TESTING ONLY: tevent: Force the poll backend

11 years agoRevert "HACK epoll TEST_PANIC_FALLBACK"
Stefan Metzmacher [Wed, 20 Feb 2013 14:12:08 +0000 (15:12 +0100)]
Revert "HACK epoll TEST_PANIC_FALLBACK"

This reverts commit 0b9c1ee06465ba0edd0753a3b6b526fa045288a3.

11 years agoHACK epoll TEST_PANIC_FALLBACK
Stefan Metzmacher [Sun, 17 Feb 2013 15:43:49 +0000 (16:43 +0100)]
HACK epoll TEST_PANIC_FALLBACK

11 years agoRevert "HACK tevent_standard no fallback"
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:47 +0000 (16:45 +0100)]
Revert "HACK tevent_standard no fallback"

This reverts commit 6597a8f6fc9870cd02aa0650f4a0e3453d49f4cd.

11 years agoHACK tevent_standard no fallback
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:29 +0000 (16:45 +0100)]
HACK tevent_standard no fallback

11 years agoRevert "HACK tevent_standard no epoll"
Stefan Metzmacher [Thu, 21 Feb 2013 07:41:29 +0000 (08:41 +0100)]
Revert "HACK tevent_standard no epoll"

This reverts commit db830ce72e82372fcd5b40a126eaade9d31cdbf8.

11 years agoHACK tevent_standard no epoll
Stefan Metzmacher [Thu, 21 Feb 2013 07:41:13 +0000 (08:41 +0100)]
HACK tevent_standard no epoll

11 years agoTODO: Regression test to ensure that a tevent backend can cope with separate read...
Jeremy Allison [Thu, 14 Feb 2013 22:16:31 +0000 (14:16 -0800)]
TODO: 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>
TODO: why (fde_wcount - fde_count < 256) ???
      if we get TEVENT_FD_WRITE we should not block
      we should also not read if we don't get TEVENT_FD_READ,
      because this will block

11 years agotevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's...
Jeremy Allison [Thu, 14 Feb 2013 21:52:41 +0000 (13:52 -0800)]
tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's into one epoll event.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: preferr the write handler in there're two possible handlers registered with...
Stefan Metzmacher [Wed, 20 Feb 2013 10:50:56 +0000 (11:50 +0100)]
tevent: preferr the write handler in there're two possible handlers registered with epoll

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: In epoll_event_loop() ensure we trigger the right handler for a multiplexed...
Stefan Metzmacher [Wed, 20 Feb 2013 13:49:17 +0000 (14:49 +0100)]
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>
11 years agotevent: Add utility function epoll_handle_hup_or_err()
Jeremy Allison [Thu, 14 Feb 2013 23:53:38 +0000 (15:53 -0800)]
tevent: Add utility function epoll_handle_hup_or_err()

We'll use this to handle the EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR
and EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR flags with multiplexed
events in the event loop.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()
Stefan Metzmacher [Wed, 20 Feb 2013 16:17:31 +0000 (17:17 +0100)]
tevent: handle EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX in epoll_update_event()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: handle multiplexed fde's in epoll_event_fd_destructor()
Stefan Metzmacher [Wed, 20 Feb 2013 17:01:57 +0000 (18:01 +0100)]
tevent: handle multiplexed fde's in epoll_event_fd_destructor()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: Fix epoll_mod_event() to cope with modifying a multiplexed fde event.
Jeremy Allison [Thu, 14 Feb 2013 22:14:50 +0000 (14:14 -0800)]
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>
11 years agotevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.
Jeremy Allison [Fri, 15 Feb 2013 18:16:44 +0000 (10:16 -0800)]
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>
11 years agotevent: handle multiplexed fde's in epoll_add_event()
Stefan Metzmacher [Wed, 20 Feb 2013 16:14:52 +0000 (17:14 +0100)]
tevent: handle multiplexed fde's in epoll_add_event()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: Start to fix the epoll backend to support 2 fd events on the same fd correctly.
Jeremy Allison [Thu, 14 Feb 2013 21:50:56 +0000 (13:50 -0800)]
tevent: Start to fix the epoll backend to support 2 fd events on the same fd correctly.

Add a utility function epoll_add_multiplex_fd() and
a new flag EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX.

This will be called by epoll_add_event() to merge two
fde events with the same file descriptor.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agoRevert "HACK tevent_standard no fallback"
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:47 +0000 (16:45 +0100)]
Revert "HACK tevent_standard no fallback"

This reverts commit 6597a8f6fc9870cd02aa0650f4a0e3453d49f4cd.

11 years agoHACK tevent_standard no fallback
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:29 +0000 (16:45 +0100)]
HACK tevent_standard no fallback

11 years agoTODO-TESTING tevent: ignore EBADF from EPOLL_CTL_ADD/MOD
Stefan Metzmacher [Wed, 20 Feb 2013 12:34:07 +0000 (13:34 +0100)]
TODO-TESTING tevent: ignore EBADF from EPOLL_CTL_ADD/MOD

11 years agoRevert "HACK tevent_standard no fallback"
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:47 +0000 (16:45 +0100)]
Revert "HACK tevent_standard no fallback"

This reverts commit 6597a8f6fc9870cd02aa0650f4a0e3453d49f4cd.

11 years agoHACK tevent_standard no fallback
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:29 +0000 (16:45 +0100)]
HACK tevent_standard no fallback

11 years agoTODO-TESTING tevent: ignore EBADF from EPOLL_CTL_DEL
Stefan Metzmacher [Wed, 20 Feb 2013 12:33:19 +0000 (13:33 +0100)]
TODO-TESTING tevent: ignore EBADF from EPOLL_CTL_DEL

11 years agoRevert "HACK tevent_standard no fallback"
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:47 +0000 (16:45 +0100)]
Revert "HACK tevent_standard no fallback"

This reverts commit 6597a8f6fc9870cd02aa0650f4a0e3453d49f4cd.

11 years agoHACK tevent_standard no fallback
Stefan Metzmacher [Wed, 20 Feb 2013 15:45:29 +0000 (16:45 +0100)]
HACK tevent_standard no fallback

11 years agotevent: unify handling of HAS_EVENT and REPORT_ERROR in epoll_{add,mod,del}_event()
Stefan Metzmacher [Wed, 20 Feb 2013 16:38:10 +0000 (17:38 +0100)]
tevent: unify handling of HAS_EVENT and REPORT_ERROR in epoll_{add,mod,del}_event()

epoll_{add,mod,del}_event() are only called via epoll_update_event()
and epoll_update_event() should not remove REPORT_ERROR itself.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: always go through epoll_change_event()
Stefan Metzmacher [Wed, 20 Feb 2013 10:26:00 +0000 (11:26 +0100)]
tevent: always go through epoll_change_event()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: s/epoll_change_event/epoll_update_event
Stefan Metzmacher [Wed, 20 Feb 2013 11:55:11 +0000 (12:55 +0100)]
tevent: s/epoll_change_event/epoll_update_event

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: the content of event is ignored by EPOLL_CTL_DEL
Stefan Metzmacher [Wed, 20 Feb 2013 16:15:52 +0000 (17:15 +0100)]
tevent: the content of event is ignored by EPOLL_CTL_DEL

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: use helper variables to hold the epoll_ctl() result
Stefan Metzmacher [Wed, 20 Feb 2013 12:12:27 +0000 (13:12 +0100)]
tevent: use helper variables to hold the epoll_ctl() result

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: remove unused if (epoll_ev->epoll_fd == -1) return; checks
Stefan Metzmacher [Wed, 20 Feb 2013 12:07:34 +0000 (13:07 +0100)]
tevent: remove unused if (epoll_ev->epoll_fd == -1) return; checks

We'll never leave epoll_check_reopen() with epoll_fd == -1.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: add std_event_loop_wait()
Stefan Metzmacher [Sun, 17 Feb 2013 15:41:41 +0000 (16:41 +0100)]
tevent: add std_event_loop_wait()

We also need to fallback in tevent_loop_wait()
otherwise we might miss events in the poll->fresh list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()
Stefan Metzmacher [Sun, 17 Feb 2013 15:40:20 +0000 (16:40 +0100)]
tevent: don't call TALLOC_FREE(ev->additional_data) in std_fallback_to_poll()

The epoll backend has done the cleanup already.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: avoid any operation on epoll_ev after a epoll_panic()
Stefan Metzmacher [Fri, 15 Feb 2013 15:33:56 +0000 (16:33 +0100)]
tevent: avoid any operation on epoll_ev after a epoll_panic()

This calls TALLOC_FREE(ev->additional_data), which is epoll_ev
within epoll_panic() before calling the fallback handler.

In order to notice that a epoll_panic() happened, a caller can
register a pointer to a bool variable under epoll_ev->panic_state.

As epoll_check_reopen() can fail due to a epoll_panic(),
we need to force the replay flag if we have called any event handler.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: add epoll_{create,ctl}_panic_fallback() for testing
Stefan Metzmacher [Fri, 15 Feb 2013 11:10:26 +0000 (12:10 +0100)]
tevent: add epoll_{create,ctl}_panic_fallback() for testing

This makes sure we only do random panics if a fallback handler
is registered.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: call epoll_panic() if EPOLL_CTL_DEL failed
Stefan Metzmacher [Fri, 15 Feb 2013 09:31:36 +0000 (10:31 +0100)]
tevent: call epoll_panic() if EPOLL_CTL_DEL failed

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: optimize adding new timer events
Stefan Metzmacher [Fri, 22 Feb 2013 11:45:39 +0000 (12:45 +0100)]
tevent: optimize adding new timer events

There're two cases:

1. Adding a timer with a zero timestamp.
   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.

2. Adding a timer with a real timestamp.
   As this 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.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()
Stefan Metzmacher [Thu, 21 Feb 2013 14:44:30 +0000 (15:44 +0100)]
tevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()

This makes sure we don't preferr events which are at the beginning
of the list.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: detect bad file descriptors reported via POLLNVAL
Stefan Metzmacher [Fri, 22 Feb 2013 20:45:11 +0000 (21:45 +0100)]
tevent: detect bad file descriptors reported via POLLNVAL

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: traverse the ev->fd_event list instead of the poll_ev->fds array
Stefan Metzmacher [Thu, 21 Feb 2013 14:41:17 +0000 (15:41 +0100)]
tevent: traverse the ev->fd_event list instead of the poll_ev->fds array

That has the same complexity but simplifies the code.

It also seems to fix a real problem, which was found
by the following test failure in Samba's autobuild,
while removing the epoll support from the "standard" backend.

    [402/1555 in 19m8s] samba3.raw.composite(plugin_s4_dc)
    smbtorture 4.1.0pre1-DEVELOPERBUILD
    Using seed 1361531675
    Testing savefile
    Testing parallel fetchfile with 10 ops
    waiting for completion
    maximum runtime exceeded for smbtorture - terminating
    UNEXPECTED(error): samba3.raw.composite.fetchfile (subunit.RemotedTestCase)(plugin_s4_dc)
    REASON: _StringException: _StringException: was started but never finished!
    UNEXPECTED(error): samba3.raw.composite.fetchfile(plugin_s4_dc) (subunit.RemotedTestCase)
    REASON: was started but never finished!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: make sure we cleanup the array passed to poll() after deleting an event
Stefan Metzmacher [Thu, 21 Feb 2013 13:41:24 +0000 (14:41 +0100)]
tevent: make sure we cleanup the array passed to poll() after deleting an event

If we don't cleanup the array passed to poll after an
event was deleted, we may pass a bad file descriptor to poll().

This was found by the following test failure in Samba's
autobuild, while removing the epoll support from
the "standard" backend.

    [48/1555 in 4m37s] samba3.smbtorture_s3.plain(s3dc).LOCK4
    UNEXPECTED(failure): samba3.smbtorture_s3.plain(s3dc).LOCK4.smbtorture(s3dc)
    REASON: _StringException: _StringException: using seed 1361530718
    host=127.0.0.2 share=tmp user=metze myname=sn-devel-104
    Running LOCK4
    starting locktest4
    Failed to create file: NT_STATUS_INVALID_HANDLE
    finished locktest4
    TEST LOCK4 FAILED!
    LOCK4 took 190.492 secs

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: don't skip a fd event if the previous one was deleted during poll()
Stefan Metzmacher [Sun, 17 Feb 2013 22:21:28 +0000 (23:21 +0100)]
tevent: don't skip a fd event if the previous one was deleted during poll()

In a threaded environment it can happen that an tevent_fd is talloc_free'ed
while the main thread sleeps in the poll() syscall.

In such a case poll_event_fd_destructor() would set poll_ev->fdes[i] = NULL.

We then skip the removed event, but before we also skipped the one
that was located at the end of the array. We moved it to possition
'i', but the next loop uses 'i=i+1'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: remember the errno from select(), poll() and epoll_wait()
Stefan Metzmacher [Fri, 15 Feb 2013 10:24:59 +0000 (11:24 +0100)]
tevent: remember the errno from select(), poll() and epoll_wait()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: fix compiler warning in tevent_context_init_byname()
Stefan Metzmacher [Sun, 17 Feb 2013 15:36:25 +0000 (16:36 +0100)]
tevent: fix compiler warning in tevent_context_init_byname()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: fix some compiler warnings in testsuite.c
Stefan Metzmacher [Fri, 22 Feb 2013 20:48:11 +0000 (21:48 +0100)]
tevent: fix some compiler warnings in testsuite.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: fix --disable-python cause configure fails (bug #8718)
Galen.Liu [Mon, 4 Feb 2013 06:43:01 +0000 (07:43 +0100)]
tevent: fix --disable-python cause configure fails (bug #8718)

When we disable python, it will cause build fail!
so, the patch will fix it.

Reviewed-by: Stefan Metzmacher <metze@samba.org>
11 years agotevent: define TEVENT_NUM_SIGNALS based on configure checks
Stefan Metzmacher [Fri, 22 Feb 2013 13:26:16 +0000 (14:26 +0100)]
tevent: define TEVENT_NUM_SIGNALS based on configure checks

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agolib/replace: add AC_CHECK_VALUEOF() macro
Stefan Metzmacher [Fri, 22 Feb 2013 13:53:07 +0000 (14:53 +0100)]
lib/replace: add AC_CHECK_VALUEOF() macro

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agowafsamba: add CHECK_VALUEOF() helper
Stefan Metzmacher [Fri, 22 Feb 2013 13:20:07 +0000 (14:20 +0100)]
wafsamba: add CHECK_VALUEOF() helper

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:pylibsmb: make sure we get tevent debug messages
Stefan Metzmacher [Thu, 21 Feb 2013 07:29:18 +0000 (08:29 +0100)]
s3:pylibsmb: make sure we get tevent debug messages

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos3:lib/events: make use of samba_tevent_set_debug()
Stefan Metzmacher [Thu, 21 Feb 2013 07:39:05 +0000 (08:39 +0100)]
s3:lib/events: make use of samba_tevent_set_debug()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:lib/events: make use of samba_tevent_set_debug()
Stefan Metzmacher [Thu, 21 Feb 2013 07:35:50 +0000 (08:35 +0100)]
s4:lib/events: make use of samba_tevent_set_debug()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agolib/util: add samba_tevent_set_debug()
Stefan Metzmacher [Thu, 21 Feb 2013 08:00:56 +0000 (09:00 +0100)]
lib/util: add samba_tevent_set_debug()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agolib/util: allow samba_tevent_debug() to take a name as context
Stefan Metzmacher [Thu, 21 Feb 2013 07:23:42 +0000 (08:23 +0100)]
lib/util: allow samba_tevent_debug() to take a name as context

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoauth/pycredentials: make use of samba_tevent_context_init()
Stefan Metzmacher [Thu, 21 Feb 2013 07:32:35 +0000 (08:32 +0100)]
auth/pycredentials: make use of samba_tevent_context_init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:pyregistry: make use of samba_tevent_context_init()
Stefan Metzmacher [Thu, 21 Feb 2013 07:31:41 +0000 (08:31 +0100)]
s4:pyregistry: make use of samba_tevent_context_init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:pygensec: make use of samba_tevent_context_init()
Stefan Metzmacher [Thu, 21 Feb 2013 07:30:51 +0000 (08:30 +0100)]
s4:pygensec: make use of samba_tevent_context_init()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agos4:winbindd: do not drop the workgroup name in the getgrgid call
Michael Adam [Wed, 27 Feb 2013 00:04:46 +0000 (01:04 +0100)]
s4:winbindd: do not drop the workgroup name in the getgrgid call

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Feb 27 05:44:39 CET 2013 on sn-devel-104

11 years agos4:winbindd: do not drop the workgroup name in the getgrnam and getgrent calls.
Michael Adam [Tue, 26 Feb 2013 23:45:55 +0000 (00:45 +0100)]
s4:winbindd: do not drop the workgroup name in the getgrnam and getgrent calls.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 years agoFix bug #9674 - Samba denies owner Read Control when there is a DENY entry while...
Richard Sharpe [Sat, 23 Feb 2013 16:41:27 +0000 (08:41 -0800)]
Fix bug #9674 - Samba denies owner Read Control when there is a DENY entry while W2K08 does not.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb 23 19:28:15 CET 2013 on sn-devel-104

11 years agoMake systemctl reference indirect in packaging/NetworkManager/30-winbind-systemd
Alexander Bokovoy [Fri, 22 Feb 2013 10:07:19 +0000 (12:07 +0200)]
Make systemctl reference indirect in packaging/NetworkManager/30-winbind-systemd

Some distributions have clever dependency generators when building packages
and generate dependencies for each executable called out in shell scripts.
The end result is that a package built out of samba would contain explicit dependency
to systemd even though it is usable without systemd.

Making systemctl reference indirect avoids explicit dependency.

Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Autobuild-Date(master): Fri Feb 22 18:18:20 CET 2013 on sn-devel-104

11 years agos3-rpc_server: Make sure that fd is really closed on error.
Andreas Schneider [Wed, 20 Feb 2013 09:52:37 +0000 (10:52 +0100)]
s3-rpc_server: Make sure that fd is really closed on error.
Reviewed-by: Alexander Bokovoy <ab@samba.org>