1
0
mirror of https://github.com/samba-team/samba.git synced 2025-10-30 08:23:49 +03:00
Commit Graph

87 Commits

Author SHA1 Message Date
Jelmer Vernooij
f9270073a2 r25537: Use new path for events modules. 2007-10-10 15:07:49 -05:00
Jelmer Vernooij
5e814287ba r25522: Convert to standard bool types. 2007-10-10 15:07:47 -05:00
Jelmer Vernooij
3468952e77 r25446: Merge some changes I made on the way home from SFO:
2007-09-29 More higher-level passing around of lp_ctx.
2007-09-29 Fix warning.
2007-09-29 Pass loadparm contexts on a higher level.
2007-09-29 Avoid using global loadparm context.
2007-10-10 15:07:34 -05:00
Jelmer Vernooij
fd697d77c9 r25430: Add the loadparm context to all parametric options. 2007-10-10 15:07:31 -05:00
Jelmer Vernooij
df9cebcb97 r25035: Fix some more warnings, use service pointer rather than service number in more places. 2007-10-10 15:05:43 -05:00
Jelmer Vernooij
5085c53fcf r25027: Fix more warnings. 2007-10-10 15:05:41 -05:00
Jelmer Vernooij
abe8349f9b r25026: Move param/param.h out of includes.h 2007-10-10 15:05:38 -05:00
Jelmer Vernooij
9647f860bd r24814: Fix headers, trim core.h even more. 2007-10-10 15:03:14 -05:00
Andrew Bartlett
fb1e1eebda r24502: More work to get LOCAL-EVENT passing on all platforms:
- Make the epoll_event_context_init() call fail if epoll_create() fails.

  This should cause this backend to be skipped on host with epoll() in
  libc but not in the kernel.

- At the moment, there is no sensible way to handle failures to add an
  epoll() event, and 'fallback to select' is misnamed (so we now
  abort()).

Andrew Bartlett
2007-10-10 15:02:02 -05:00
Andrew Tridgell
fcf38a38ac r23792: convert Samba4 to GPLv3
There are still a few tidyups of old FSF addresses to come (in both s3
and s4). More commits soon.
2007-10-10 14:59:12 -05:00
Andrew Tridgell
76b981fcef r23301: merged from ctdb 2007-10-10 14:53:10 -05:00
Andrew Tridgell
d28fc5f87f r22985: don't do checkins late at night ....
thanks to Volker for spotting this!
2007-10-10 14:52:35 -05:00
Andrew Tridgell
146303d91b r22971: fix build on systems without epoll 2007-10-10 14:52:34 -05:00
Andrew Tridgell
603d8b6f17 r22970: the events code calls close(), which needs to use socket_wrapper.h in
the build farm
2007-10-10 14:52:34 -05:00
Andrew Tridgell
4f84e6d569 r22968: andrew bartlett pointed out that the parent process could add a fd to
the epoll context which would then appear in the children. To fix this
we need to check for pid changes in more places. Luckily on platforms
where we have epoll(), getpid() is very very cheap.
2007-10-10 14:52:33 -05:00
Andrew Tridgell
a69f285998 r22964: log an error on epoll_create failing on reopen 2007-10-10 14:52:32 -05:00
Andrew Tridgell
aeca07659a r22963: fixed the epoll/fork interaction in the epoll and aio backends 2007-10-10 14:52:32 -05:00
Andrew Tridgell
6d06132ea9 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
2007-10-10 14:52:31 -05:00
Andrew Tridgell
f1ad216de1 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.
2007-10-10 14:52:21 -05:00
Stefan Metzmacher
4db64b4ce2 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);
}
2007-10-10 14:51:58 -05:00
Andrew Tridgell
b0c8c1cd21 r22634: make the events system much less dependent on the samba4 build system 2007-10-10 14:51:56 -05:00
Andrew Tridgell
216aa06fe6 r22632: merged volkers select events fix 2007-10-10 14:51:56 -05:00
Jelmer Vernooij
e782035251 r21299: Fix the build for those that don't have talloc.h installed. 2007-10-10 14:48:05 -05:00
Jelmer Vernooij
07652f65ce 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.
2007-10-10 14:48:04 -05:00
Andrew Tridgell
2ff8abf002 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
2007-10-10 14:44:46 -05:00
Andrew Tridgell
e042002bb5 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.
2007-10-10 14:44:41 -05:00
Andrew Tridgell
35f62bc125 r20989: don't mark epoll as set until after the io_submit() succeeds
this is part of the solution to LOCAL-EVENT on fort
2007-10-10 14:44:18 -05:00
Andrew Bartlett
aee751497c 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
2007-10-10 14:44:17 -05:00
Andrew Tridgell
071a6e8eb1 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.
2007-10-10 14:44:03 -05:00
Andrew Tridgell
83353ec0cd r20941: avoid races in the block/unblock code 2007-10-10 14:43:56 -05:00
Andrew Tridgell
e892cbdb4b r20940: allow SA_SIGINFO signals to be oneshot. Why you would ever want this
is beyond me :-)
2007-10-10 14:43:56 -05:00
Andrew Tridgell
bf060ce4fe r20939: reduce the amount of static state for signal handlers from 96k to 1.2k 2007-10-10 14:43:56 -05:00
Andrew Tridgell
7c7b79ed04 r20938: use a double counter trick to avoid the need for atomic increment 2007-10-10 14:43:56 -05:00
Volker Lendecke
c98dd55e32 r20934: I *hate* deep indents :-) 2007-10-10 14:43:55 -05:00
Andrew Tridgell
1bb10b6cf7 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
2007-10-10 14:43:55 -05:00
Andrew Tridgell
bad87e2c82 r20929: fixed typo 2007-10-10 14:43:54 -05:00
Andrew Tridgell
7e105482ff 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
2007-10-10 14:43:54 -05:00
Stefan Metzmacher
4787b8e1f7 r20794: hopefully fix the build on systems without native linux aio
metze
2007-10-10 14:43:30 -05:00
Stefan Metzmacher
d46a5efb03 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
2007-10-10 14:40:55 -05:00
Stefan Metzmacher
017cf3f137 r20787: a subsystem doesn't need explicit dependencies to its modules
metze
2007-10-10 14:40:55 -05:00
Andrew Tridgell
803e6cf6ef r20623: change where the smb.conf parm event:backend is checked to ensure it
affects all event_context_init() calls
2007-10-10 14:37:16 -05:00
Andrew Tridgell
4a8e07286f r20621: - enable the aio events backend on systems that support it
- allow the events backend to be chosen in smb.conf
2007-10-10 14:37:15 -05:00
Andrew Tridgell
c8bd3ec09d r20540: darn, also need to fix this event_context reference 2007-10-10 14:36:50 -05:00
Andrew Tridgell
934f18283d 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.
2007-10-10 14:36:50 -05:00
Andrew Tridgell
195051fdee 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)
2007-10-10 14:29:06 -05:00
Jelmer Vernooij
f7afa1cb77 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)
2007-10-10 14:16:54 -05:00
Andrew Tridgell
61c6100617 r15854: more talloc_set_destructor() typesafe fixes 2007-10-10 14:08:32 -05:00
Jelmer Vernooij
adc8a019b6 r15207: Introduce PRIVATE_DEPENDENCIES and PUBLIC_DEPENDENCIES as replacement
for REQUIRED_SUBSYSTEMS.
2007-10-10 14:04:18 -05:00
Jelmer Vernooij
51b4270513 r14542: Remove librpc, libndr and libnbt from includes.h 2007-10-10 13:58:42 -05:00
Jelmer Vernooij
9c37f847d3 r14477: Remove the NOPROTO property - it's no longer used as proto.h is gone. 2007-10-10 13:57:30 -05:00