1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

170 Commits

Author SHA1 Message Date
Andrew Tridgell
87379e0d58 r22959: cope with a rather interesting interaction between epoll() and
fork(). See
http://junkcode.samba.org/ftp/unpacked/junkcode/epoll_fork.c for why
this is needed
(This used to be commit 6d06132ea9c5a1c7d098ba13f4146dc60e811e44)
2007-10-10 14:52:31 -05:00
Andrew Tridgell
ecc54f900f r22830: merged the latest lib/events updates from ctdb to Samba4. This
includes a new EVENT_FD_AUTOCLOSE flag that prevents race conditions
where code using fd events might close a fd before releasing the
struct fd_event. That causes headaches for epoll.
(This used to be commit f1ad216de13b154a1f8747a44b0970dcc47a784a)
2007-10-10 14:52:21 -05:00
Stefan Metzmacher
6c6c5927a1 r22661: optimize the handling of directly triggered timed events:
- if someone adds a timed_event with a zero timeval
  we now avoid serval gettimeofday() calls and the
  event handler doesn't get the current time when it's
  called, instead we also pass a zero timeval

- this also makes sure multiple timed events with a zero timeval
  are processed in the order there're added.

the little benchmark shows that processing 2000000 directly timed events
is now much faster, while avoiding syscalls at all!

> time ./evtest (with the old code)

real    0m6.388s
user    0m1.740s
sys     0m4.632s
> time ./evtest (with the new code)

real    0m1.498s
user    0m1.496s
sys     0m0.004s
metze@SERNOX:~/devel/samba/4.0/samba4-ci/source> cat evtest.c
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#include <talloc.h>
#include <events.h>

static void dummy_fde_handler(struct event_context *ev_ctx, struct fd_event *fde,
                              uint16_t flags, void *private_data)
{
}

static void timeout_handler(struct event_context *ev, struct timed_event *te,
                            struct timeval tval, void *private_data)
{
        uint32_t *countp = (uint32_t *)private_data;
        (*countp)++;
        if (*countp > 2000000) exit(0);
        event_add_timed(ev, ev, tval, timeout_handler, countp);
}

int main(void)
{
        struct event_context *ev;
        struct timeval tval =  { 0, 0 };
        uint32_t count = 0;
        ev = event_context_init(NULL);
        event_add_fd(ev, ev, 0, 0, dummy_fde_handler, NULL);
        event_add_timed(ev, ev, tval, timeout_handler, &count);
        return event_loop_wait(ev);
}
(This used to be commit 4db64b4ce2320b88d648078cbf86385f6fb44f1f)
2007-10-10 14:51:58 -05:00
Andrew Tridgell
19a6878380 r22634: make the events system much less dependent on the samba4 build system
(This used to be commit b0c8c1cd21e3f91431504d70a4bc0d3c6dee6071)
2007-10-10 14:51:56 -05:00
Andrew Tridgell
20a0206a10 r22632: merged volkers select events fix
(This used to be commit 216aa06fe634f98dce3f157e67303e90ddb70e2d)
2007-10-10 14:51:56 -05:00
Jelmer Vernooij
f851eb8dc6 r21299: Fix the build for those that don't have talloc.h installed.
(This used to be commit e782035251fd3d51a7a4221d107519fb1ba70ba7)
2007-10-10 14:48:05 -05:00
Jelmer Vernooij
97416e6b01 r21297: Remove the GTK+ tools and library from the main repository. They are now maintained separately in bzr at http://people.samba.org/bzr/jelmer/samba-gtk
This also adds some more headers to the list that is installed and a couple of extra #include lines so these
headers can be used externally without problems.
(This used to be commit 07652f65ce7a5b19130f1a27cbf0e1e5fae13454)
2007-10-10 14:48:04 -05:00
Andrew Tridgell
f0fcc332f5 r21212: detect if the kernel does not support integrated epoll/aio when the
event context is created. This allows the LOCAL-EVENT test to pass on
systems with have libaio but not the necessary kernel patches
(This used to be commit 2ff8abf0022824e6ae93019ee1b3391e651a8ee7)
2007-10-10 14:44:46 -05:00
Andrew Tridgell
b9f10ebb99 r21171: fixed a bug related to recursive event handling.
If this happens:

  - two sockets are readable, and select/epoll/aio returns both of
    them
  - read event on socket1 is called
  - inside that read event an event_loop_once is called, this returns that
    socket2 is readable
  - read event on socket2 is called
  - event_loop_once returns
  - top level event handler then calls read event on socket2 (as it
    still has that listed as readable)
  - read handler for socket2 returns zero byte read, which is
    interpreted as end of file
  - socket is incorrectly closed

this happened with ctdb, but it could happen anywhere (just
rarely). The fix is trivial - ensure we break out of the event loop
when we have been called recursively.
(This used to be commit e042002bb5ee8974220e1ade56b64389571f75a6)
2007-10-10 14:44:41 -05:00
Andrew Tridgell
7d184f1f72 r20989: don't mark epoll as set until after the io_submit() succeeds
this is part of the solution to LOCAL-EVENT on fort
(This used to be commit 35f62bc12559e355d4ac73018afe255ea7c5866b)
2007-10-10 14:44:18 -05:00
Andrew Bartlett
14503a65ec r20984: Try to ensure we can't have sig_state dissapear before se.
I think this happens when both are eventual children of the autofree context.

(Trying to track down a valgrind error on fort).

Andrew Bartlett
(This used to be commit aee751497ca738fa0de72dd0748590a74d5af2fd)
2007-10-10 14:44:17 -05:00
Andrew Tridgell
45c2b83ec7 r20960: attempt to fix a valgrind error in the signals backend.
This also reduces the static data in the signal backend when not using
signals to 4 bytes.
(This used to be commit 071a6e8eb1861b10b8a7aa61470f21a546ffa0ca)
2007-10-10 14:44:03 -05:00
Andrew Tridgell
fa5e920a7b r20941: avoid races in the block/unblock code
(This used to be commit 83353ec0cd05464abb581f51d8c26ade7f0876fe)
2007-10-10 14:43:56 -05:00
Andrew Tridgell
0c846b1b2d r20940: allow SA_SIGINFO signals to be oneshot. Why you would ever want this
is beyond me :-)
(This used to be commit e892cbdb4bb0779f8abb0902bee4a2e79456808d)
2007-10-10 14:43:56 -05:00
Andrew Tridgell
00e553a272 r20939: reduce the amount of static state for signal handlers from 96k to 1.2k
(This used to be commit bf060ce4fe3b58fc3e58214490c4da9c6644c365)
2007-10-10 14:43:56 -05:00
Andrew Tridgell
2e009caa1b r20938: use a double counter trick to avoid the need for atomic increment
(This used to be commit 7c7b79ed042abebc48d8eaa71c252df3200a84d9)
2007-10-10 14:43:56 -05:00
Volker Lendecke
a8a702a6c9 r20934: I *hate* deep indents :-)
(This used to be commit c98dd55e32a1d2df016e7a4deba218cd54efcdd2)
2007-10-10 14:43:55 -05:00
Andrew Tridgell
cf8eef4ad8 r20930: use sigaction() instead of signal()
add support for sa_flags argument to event_add_signal(). These are
passed to sigaction(). Special handling is provided for SA_RESETHAND
(which tells the event system to remove the handler after the signal)
and SA_SIGINFO which allows the siginfo structure to be received per
signal
(This used to be commit 1bb10b6cf7d717ad21834e73a4ca4b22b5fb6f0a)
2007-10-10 14:43:55 -05:00
Andrew Tridgell
c6174d5d6f r20929: fixed typo
(This used to be commit bad87e2c82208646c331507d3999a3311ed153d9)
2007-10-10 14:43:54 -05:00
Andrew Tridgell
336ae458e9 r20928: added signal events to lib/events
Jeremy asked for this to allow Samba3 to use the Samba4 events library

see torture/local/event.c for an example
(This used to be commit 7e105482ff9a3da6b4708ff99a64f1881614fc5f)
2007-10-10 14:43:54 -05:00
Stefan Metzmacher
9ba0c91e9f r20794: hopefully fix the build on systems without native linux aio
metze
(This used to be commit 4787b8e1f7a7bb6b1e0f8ca64a27e4c5e6f53c2c)
2007-10-10 14:43:30 -05:00
Stefan Metzmacher
274df78541 r20788: - remove epoll configure checks from libreplace
- fix epoll configure checks for the epoll and aio
  events backends
- we should only activate the epoll backend if sys/epoll.h
  and epoll_create() are found
- we should only activate the aio backend if sys/epoll.h, epoll_create(),
  libaio.h and io_getevents() are found

hopefully fix the build on 'bnhtest' in the build farm...

metze
(This used to be commit d46a5efb03ea1df50567cad00e1589870cdb31fe)
2007-10-10 14:40:55 -05:00
Stefan Metzmacher
f5473306c5 r20787: a subsystem doesn't need explicit dependencies to its modules
metze
(This used to be commit 017cf3f13799b03e0aef995bc4fa9ae74bc1acb7)
2007-10-10 14:40:55 -05:00
Andrew Tridgell
2ed1196129 r20623: change where the smb.conf parm event:backend is checked to ensure it
affects all event_context_init() calls
(This used to be commit 803e6cf6ef5caaf7c9faefcc111c97e1a97e9b82)
2007-10-10 14:37:16 -05:00
Andrew Tridgell
131cfe0399 r20621: - enable the aio events backend on systems that support it
- allow the events backend to be chosen in smb.conf
(This used to be commit 4a8e07286f827a6f57b2c54d97d31172553ceb0d)
2007-10-10 14:37:15 -05:00
Andrew Tridgell
34040b420a r20540: darn, also need to fix this event_context reference
(This used to be commit c8bd3ec09d3c370475df3a3cd77de6743b316c9e)
2007-10-10 14:36:50 -05:00
Andrew Tridgell
b213b70c08 r20539: - split the common timer related events code into events_timed.c
- make it easier to plug in a new events backend

- add simpler 'select' and 'epoll' backends

This is part of the effort to add good AIO support. The events_aio.c
backend is done, but sometimes dies with a SEGV, which is why it isn't
enabled yet.
(This used to be commit 934f18283dbc7958944931a93a854526bcd54884)
2007-10-10 14:36:50 -05:00
Andrew Tridgell
9ca93ced8b r20104: this is a alternative events backend, which uses a hybrid of aio and
epoll. It is not linked in anywhere yet - I'm committing it in case
anyone else wants to have a look at it.

The concept is quite strange really, but it seems to be the only way
that Linux 2.6.x can currently use a unified event model allowing for
AIO events and socket events to be waited for by a single unified
event wait function. You setup a epoll system, then setup a weird aio
event that points at the epoll system, then use io_getevents() to
actually do the waiting.

I'm hoping that kevents or a proper integration of epoll will allow us
to avoid ths rather hackish scheme, but meanwhile this is the only
path to proper AIO in Samba on Linux (without a horrible signals mess)

(NOTE: this code requires some kernel patches to work at the moment)
(This used to be commit 195051fdee341e8d8cb76e5c91dcc0f6c246a870)
2007-10-10 14:29:06 -05:00
Jelmer Vernooij
0329d755a7 r17930: Merge noinclude branch:
* Move dlinklist.h, smb.h to subsystem-specific directories
 * Clean up ads.h and move what is left of it to dsdb/
   (only place where it's used)
(This used to be commit f7afa1cb77f3cfa7020b57de12e6003db7cfcc42)
2007-10-10 14:16:54 -05:00
Andrew Tridgell
971d30bb20 r15854: more talloc_set_destructor() typesafe fixes
(This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3)
2007-10-10 14:08:32 -05:00
Jelmer Vernooij
69b51f702a r15207: Introduce PRIVATE_DEPENDENCIES and PUBLIC_DEPENDENCIES as replacement
for REQUIRED_SUBSYSTEMS.
(This used to be commit adc8a019b6da256f104abed1b82bfde6998a2ac9)
2007-10-10 14:04:18 -05:00
Jelmer Vernooij
35349a58df r14542: Remove librpc, libndr and libnbt from includes.h
(This used to be commit 51b4270513752d2eafbe77f9de598de16ef84a1f)
2007-10-10 13:58:42 -05:00
Jelmer Vernooij
71b4fd9792 r14477: Remove the NOPROTO property - it's no longer used as proto.h is gone.
(This used to be commit 9c37f847d32d2f327a88c53a90af0c73126b76be)
2007-10-10 13:57:30 -05:00
Jelmer Vernooij
c71c86c524 r13842: Make some more functions public.
(This used to be commit aac1b99b362993352d80692afa55c38fc851c016)
2007-10-10 13:52:15 -05:00
Andrew Tridgell
e964109e6a r13699: restore the system/select.h include, as otherwise we don't detect
epoll support
(This used to be commit 71eb159f9cc00e8de23a8700cea0e7a3be8c64d4)
2007-10-10 13:52:06 -05:00
Stefan Metzmacher
b3f2db5e01 r12844: don't include system headers directly
metze
(This used to be commit 75a98047d6829cadf4b9082bec2733055dad3465)
2007-10-10 13:50:05 -05:00
Jelmer Vernooij
d8e35f8828 r12498: Eliminate INIT_OBJ_FILES and ADD_OBJ_FILES. We were not using
the difference between these at all, and in the future the
fact that INIT_OBJ_FILES include smb_build.h will be sufficient to
have recompiles at the right time.
(This used to be commit b24f2583edee38abafa58578d8b5c4b43e517def)
2007-10-10 13:47:45 -05:00
Stefan Metzmacher
126f8b8b6a r12153: work arround the fact that epoll reports EPOLLERR and EPOLLHUP, even if
you don't ask for.

with this patch the epoll mode behaves like the select mode

metze
(This used to be commit f26c28a3ae7951657cc304659f3d19c16f462dd8)
2007-10-10 13:47:15 -05:00
Stefan Metzmacher
2b589a7691 r12146: as epoll notifies EPOLLERR and EPOLLHUP implicit,
let our code make it explicit, to make it clear

metze
(This used to be commit cf733e2684ab0d43d83b1ab5c9d178d895f768a1)
2007-10-10 13:47:14 -05:00
Stefan Metzmacher
040fc5aef5 r12141: - move epoll related code into one big #ifdef, and use dummy #define's
for the case where, epoll isn't available at compile time
- only pass the private std_event_context, to the local function,
  to get rid of the talloc_get_type() calls
- use the private pointer to std_event_context_init() to decide if we want to
  disable epoll at runtime

metze
(This used to be commit de322ea8b761df5434e60879b7eae3796ea68007)
2007-10-10 13:47:14 -05:00
Stefan Metzmacher
96180f2cac r12140: - add an additional_flags field to the fd_event struct, so that
the events backend can store private flags
- add function to access the gtk event loop ops struct

metze
(This used to be commit a5cc0758a393f36a770cdd57e317214d03934c13)
2007-10-10 13:47:13 -05:00
Stefan Metzmacher
91cf3943d3 r12124: we don't need this comment twice
metze
(This used to be commit 62c4ae8dde918d8393a3b181a5cac1be1e57e158)
2007-10-10 13:47:11 -05:00
Stefan Metzmacher
91abd131e6 r12123: handle fde == NULL at the correct level
metze
(This used to be commit 1dd5bb60a5047b94034eb084473bb8f4a9926e7c)
2007-10-10 13:47:11 -05:00
Jelmer Vernooij
4c5a4a7e02 r11244: Relative path names in .mk files
(This used to be commit 24e10300906c380919d2d631bfb3b8fd6b3f54ba)
2007-10-10 13:45:06 -05:00
Jelmer Vernooij
f4d590662e r11214: Remove scons files (see http://lists.samba.org/archive/samba-technical/2005-October/043443.html)
(This used to be commit 7fffc5c9178158249be632ac0ca179c13bd1f98f)
2007-10-10 13:45:03 -05:00
Volker Lendecke
4a34e81ccc r10690: Fix a bug that metze pointed out: Leaving the "rejecting" destructor around
prevents the memory from being freed.

Thanks,

Volker
(This used to be commit df8eeb01f498568207a4a8d5d12348c473f41799)
2007-10-10 13:39:19 -05:00
Volker Lendecke
faf2ad667a r10684: Add a nasty hack for the failure case of wbinfo -t. Tridge has a proper fix
for it pending.

Also fix a bug with timed events: Don't call the same event recursively in the
handler's inner semi-async event loop.

Volker
(This used to be commit e38e50127a3414461578421e676a9c58c106c272)
2007-10-10 13:39:18 -05:00
Jelmer Vernooij
5058f4b9e8 r10586: Add MergedObject() builder. Default to Library() rather
then StaticLibrary()
(This used to be commit b53313dc517986c69a4e4cb8fe3885b696f8faa1)
2007-10-10 13:39:08 -05:00
Stefan Metzmacher
38e43be7b8 r10537: - we now use a much nicer way to handle talloc_free(timed_event)
the events code replaces a destructor to one that returns allways -1
  while it's calling the event handler
- we don't need the composite and winsrepl specific fixes any more
- this also fixes the problem with smbcli, dcerpc, cldap, ldap and nbt
  request timeouts

metze
(This used to be commit 495996cfc49a1c6eefde6ff04fc75e0739be3aab)
2007-10-10 13:39:03 -05:00
Jelmer Vernooij
6812c73534 r10348: Add scons scripts for remaining subsystems. Most subsystems build now,
but final linking still fails (as does generating files asn1, et, idl and proto
files)
(This used to be commit 4f0d7f75b99c7f4388d8acb0838577d86baf68b5)
2007-10-10 13:38:30 -05:00