summaryrefslogtreecommitdiff
path: root/source3/lib/events.c
AgeCommit message (Collapse)AuthorFilesLines
2013-03-01s3:lib/events: make use of tevent_common_loop_timer_delay()Stefan Metzmacher1-30/+6
This is critical as we also use tevent_common_add_timer(). And if the common code does internal changes, it may affects both tevent_common_add_timer() and tevent_common_loop_timer_delay() together! Without this we rely on a specific behavior and version of tevent. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-02-28s3:lib/events: make use of samba_tevent_set_debug()Stefan Metzmacher1-36/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-28s3:lib/events: add missing TEVENT_TRACE_BEFORE/AFTER_WAIT handlingStefan Metzmacher1-0/+6
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19s3:lib/events: s/EVENT_FD/TEVENT_FDStefan Metzmacher1-6/+6
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2012-08-09s3-events: Do not vasprintf() the tevent debug messages that will not be shownAndrew Bartlett1-4/+6
This malloc() and free() actually shows up quite high on a call profile of provision of the AD DC (and this is the matching patch for source3). Andrew Bartlett
2012-06-15s3-lib: Fix conversion of lib/events.c to modern tevent namesAndrew Bartlett1-2/+2
This corrects an error in 8e31d97c8b62d34aff5d52bfe46dbcc5805dae03. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jun 15 16:25:20 CEST 2012 on sn-devel-104
2012-06-15s3-lib: Convert lib/events.c to modern tevent namesAndrew Bartlett1-14/+14
2012-02-16lib/util: Remove sys_poll as it is no longer neededAndrew Bartlett1-8/+3
sys_poll() is only needed if the signal pipe is set up and used, but as no signal handler ever writes to the pipe, this can all be removed. signal based events are now handled via tevent. Andrew Bartlett Signed-off-by: Jeremy Allison <jra@samba.org>
2011-08-09s3:lib/events: Fix a bug in run_poll_events().Stefan Metzmacher1-0/+4
Ignore fd events without EVENT_FD_READ or EVENT_FD_WRITE also in run_events_poll(). They are ignore when building the array for the syscall in event_add_to_poll_args(), so we need to ignore them run_events_poll() too. metze Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Tue Aug 9 10:11:54 CEST 2011 on sn-devel-104
2011-07-04s3-lib Move event_add_idle() to source3/lib/events.cAndrew Bartlett1-1/+81
This allows libauth not to depend on smbd_base. Andrew Bartlett
2011-06-09s3-talloc Change TALLOC_ZERO_P() to talloc_zero()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc.
2011-06-09s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()Andrew Bartlett1-2/+2
Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett
2011-06-04Add the same fix to the S3 event backend as the previous commit added to the ↵Jeremy Allison1-1/+14
tevent poll backend. Metze please check ! Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Jun 4 00:27:37 CEST 2011 on sn-devel-104
2011-06-01Revert "s3: Mark sockets in error state writable"Volker Lendecke1-23/+0
This reverts commit 5f6f71956460d6840c1433b59e20555268b622ac. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Jun 1 14:56:25 CEST 2011 on sn-devel-104
2011-05-31s3: Mark sockets in error state writableVolker Lendecke1-0/+23
Without this patch, when a socket only has a write event pending, we will never detect an error condition. I've seen winbind doing 12:19:13.659964 gettimeofday({1306837153, 659984}, NULL) = 0 <0.000016> 12:19:13.660109 poll([{fd=35, events=POLLOUT}, {fd=32, events=POLLIN|POLLHUP}], 2, 9996) = 1 ([{fd=35, revents=POLLERR|POLLHUP}]) <0.000015> 12:19:13.660253 gettimeofday({1306837153, 660269}, NULL) = 0 <0.000013> 12:19:13.660298 poll([{fd=35, events=POLLOUT}, {fd=32, events=POLLIN|POLLHUP}], 2, 9996) = 1 ([{fd=35, revents=POLLERR|POLLHUP}]) <0.000015> for a while when trying to connect to a DC when the socket had died already. Volker Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Tue May 31 20:59:10 CEST 2011 on sn-devel-104
2011-05-10s3-events: tevent_internal.h is not a public headerAndrew Tridgell1-1/+1
We need to use the "foo.h" form instead of the <foo.h> form for headers that are not installed publicly. Otherwise when an external version of tevent is used we won't find the header and the build will fail. Note that this creates a structure dependency between the tevent structures in the external library and the headers in our source tree. That is not ideal, but is currently OK as the waf build will only use the external library if it is at least the same version as the internal tree, which means it will actually be the same version, as we release the external version from our tree. We should come up with a better solution, but for now this allows openchange to build again. Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Tue May 10 16:06:40 CEST 2011 on sn-devel-104
2011-04-11s3: Fix timeout calculation in event_add_to_poll_argsVolker Lendecke1-1/+1
In the initial phase nmbd does not yet have timed events. This led to nmbd not correctly registering its names in make test and certainly everywhere else. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Mon Apr 11 14:35:45 CEST 2011 on sn-devel-104
2011-02-28s3: Remove select-based s3 event backendVolker Lendecke1-114/+0
2011-02-28s3: Use poll for the event loopVolker Lendecke1-13/+267
2011-01-31s3:lib/events: use DLIST_DEMOTE() for fd eventsStefan Metzmacher1-0/+1
This makes sure that fd events doesn't dry out, because a fd with a lower number is busy. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Mon Jan 31 16:59:44 CET 2011 on sn-devel-104
2011-01-31s3:lib/events: don't loop over fd events is select gave -1Stefan Metzmacher1-1/+1
metze
2011-01-31Revert "s3:events: Call all ready fd event handlers on each iteration of the ↵Stefan Metzmacher1-15/+7
main loop" This reverts commit 455fccf86b6544cd17a2571c63a88f8aebff3f74. I'll add a more generic fix for this problem. metze
2011-01-24Revert "s3: Fix an infinite loop"Volker Lendecke1-4/+0
This reverts commit 61f7d7cdeccb1f733590e8bdb8229b32363a815e. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Mon Jan 24 10:10:43 CET 2011 on sn-devel-104
2011-01-23s3: Fix an infinite loopVolker Lendecke1-0/+4
If select returns EBADF (which should NEVER happen), then we loop infinitely because the select masks seem all active. I've been given an strace where smbd floods syslog with inotify-related error messages. The strace shows that select returns EBADF, and we're calling the inotify event callback. It then complains there's no data on the inotify fd. Metze, please check! We might need to fix this in 3.4 and 3.5 as well. And we need to find the deeper reason where we close a file descriptor and don't tell the events system about it. Volker Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Jan 23 10:05:39 CET 2011 on sn-devel-104
2010-12-23All calls to event_add_to_select_args() call GetTimeOfDay() andJeremy Allison1-6/+5
pass this in as the &now parameter. Push this call inside of event_add_to_select_args() to the correct point so it doesn't get called unless needed. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Dec 23 01:08:11 CET 2010 on sn-devel-104
2010-10-01s3:events: Call all ready fd event handlers on each iteration of the main loopSteven Danneman1-7/+15
Previously, only one fd handler was being called per main message loop in all smbd child processes. In the case where multiple fds are available for reading the fd corresponding to the event closest to the beginning of the event list would be run. Obviously this is arbitrary and could cause unfairness. Usually, the first event fd is the network socket, meaning heavy load of client requests can starve out other fd events such as oplock or notify upcalls from the kernel. In this patch, I have changed the behavior of run_events() to unset any fd that it has already called a handler function, as well as decrement the number of fds that were returned from select(). This allows the caller of run_events() to iterate it, until all available fds have been handled. I then changed the main loop in smbd child processes to iterate run_events(). This way, all available fds are handled on each wake of select, while still checking for timed or signalled events between each handler function call. I also added an explicit check for EINTR from select(), which previously was masked by the fact that run_events() would handle any signal event before the return code was checked. This required a signature change to run_events() but all other callers should have no change in their behavior. I also fixed a bug in run_events() where it could be called with a selrtn value of -1, doing unecessary looping through the fd_event list when no fds were available. Also, remove the temporary echo handler hack, as all fds should be treated fairly now.
2010-10-01samba: share select wrappers.Günther Deschner1-0/+1
Guenther
2010-03-26s3-event: switch s3 to using tevent_re_initialise()Andrew Tridgell1-6/+0
This correctly initialises the event backend, and checks for errors (thanks to Metze for suggesting this)
2010-03-14s3: Remove some unused codeVolker Lendecke1-20/+0
2010-02-05s3-events: make the old timed events compatible with teventAndrew Tridgell1-2/+19
tevent ensures that a timed event is only called once. The old events code relied on the called handler removing the event itself. If the handler removed the event after calling a function which invoked the event loop then the timed event could loop forever. This change makes the two timed event systems more compatible, by allowing the handler to free the te if it wants to, but ensuring it is off the linked list of events before the handler is called, and ensuring it is freed even if the handler doesn't free it.
2009-07-10Quieten events and tldap debug messagesVolker Lendecke1-1/+1
2009-05-17s3-events: Not only timed, also immediate events generate a timeout returnVolker Lendecke1-1/+1
2009-05-16s3-events: If immediate requests are pending, the timeout is 0Volker Lendecke1-0/+9
2009-03-17s3:events: add support for immediate eventsStefan Metzmacher1-9/+15
metze
2009-03-17s3:events: make use of tevent_common_loop_wait()Stefan Metzmacher1-12/+1
metze
2009-03-12s3:events: pass __location__ to event_loop_*()Stefan Metzmacher1-3/+3
metze
2009-03-03Fix "ignore return" warning.Jeremy Allison1-2/+3
Jeremy.
2009-02-25s3:events: map TEVENT_DEBUG_TRACE to debug level 10Stefan Metzmacher1-1/+1
metze
2009-01-28Avoid valgrind errorsVolker Lendecke1-35/+13
In event handlers, we might destroy other events that are pending in the lists. We can only run one event safely per select call. Yes, I've seen these valgrind errors :-) Jeremy, with ccdd921e61 you had checked in the change to run multiple events. Do you remember why it was necessary and could not be solved in a different way? Volker
2009-01-22s3:events: always run_events() before sys_select()Stefan Metzmacher1-5/+4
We might have pending signal events not only timed events. metze
2009-01-20s3:events: add support for signal eventsStefan Metzmacher1-0/+6
metze
2009-01-09s3:events: debug sys_select() errorsStefan Metzmacher1-0/+3
metze
2009-01-09s3:events: install a tevent debug handler that calls DEBUG()Stefan Metzmacher1-1/+42
metze
2009-01-05s3:events: use more tevent_common_* functionsStefan Metzmacher1-158/+6
metze
2009-01-05s3:events: register as tevent backendStefan Metzmacher1-137/+172
metze
2009-01-05s3:events: get rid of the stupid set_event_dispatch_time() functionStefan Metzmacher1-16/+0
metze
2009-01-05s3:events: get rid of the stupid cancel_named_event() functionStefan Metzmacher1-16/+0
metze
2009-01-05s3:events: change event_add_timed() prototype to match samba4Stefan Metzmacher1-4/+4
metze
2009-01-05s3:events: remove unused stuffStefan Metzmacher1-25/+0
metze
2009-01-05clean event context after child is forked.Bo Yang1-0/+6
Signed-off-by: Stefan Metzmacher <metze@samba.org>