80 Commits

Author SHA1 Message Date
Nick Mathewson
5e4bafbb89 fix a signed/unsigned warning in kqueue.c 2010-10-14 13:15:32 -04:00
Sebastian Hahn
b395392746 Fix compile in kqueue.c
Commit 38d09606 removed the evsigbase pointer, but forgot to remove
an assignment to it in kqueue.c.
2010-09-27 21:14:28 +02:00
Nick Mathewson
4858b7949c Remove the now-useless evsig_caught and evsig_process 2010-09-15 01:54:51 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
2c2618d858 more whitespace normalization 2010-03-05 13:00:15 -05:00
Nick Mathewson
17efc1cdfa Update all our copyright notices to say "2010" 2010-03-04 01:38:48 -05:00
Nick Mathewson
e5bbd40ad7 Clean up formatting: use tabs, not 8-spaces, to indent. 2010-02-18 17:44:09 -05:00
Nick Mathewson
3225dfb91d Remove kqueue->pend_changes.
Since we're no longer writing directly to it from add/del, we don't
need to worry about it changing as kq_dispatch releases the lock.  We
would make it a local variable, except that we wouldn't want to malloc
and free it all the time.
2010-01-14 17:04:08 -05:00
Nick Mathewson
45e5ae3717 Make kqueue use changelists.
This fixes a bug in kqueue identified by Charles Kerr and various
Transmission users, where adding and deleting an event in succession
would make the event get reported, even if we didn't actually want to
see it.

Of course, this also makes the array of changes passed to kevent
smaller, which could help performance.
2010-01-14 16:34:40 -05:00
William Ahern
56771a3eed Valgrind fix: Clear struct kevent before checking for OSX bug.
William's original commit message:

   Valgrind complains on startup because kq_init passes to kevent only
   a partially initialized structure. The code doesn't expect kevent
   to look at .fflags, .udata, or .data, I suppose, because it merely
   tickles the kernel looking for an error response. But perhaps
   that's unwarranted chuminess (notwithstanding that it's checking
   for an OS X bug), and needless noise nonetheless.
2009-11-29 10:20:46 -05:00
Nick Mathewson
76cd2b70bb Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Previously, our default lock model kind of assumed that every lock was
potentially a read-write lock.  This was a poor choice, since
read-write locks are far more expensive than regular locks, and so the
lock API should only use them when we can actually take advantage of
them.  Neither our pthreads or win32 lock implementation provided rw
locks.

Now that we have a way (not currently used!) to	indicate that we
really want a read-write lock, we shouldn't actually say "lock this
for reading" or "lock this for writing" unless we mean it.
2009-11-27 17:36:51 -05:00
Nick Mathewson
e1ffbb82e3 Fix memory-leak of signal handler array with kqueue.
It turns out that kqueue_dealloc wasn't calling evsig_dealloc()
(because it doesn't use the main signal handler logic) so the sh_old
array was leaking.

This patch also introduces a fix in evsig_dealloc() where we set
the sh_old array to NULL when we free it, so that main/fork can pass.
2009-11-21 23:57:44 -05:00
Nick Mathewson
18a8cfac39 Prefer calloc(a,b) to malloc(a*b). via openbsd.
svn:r1531
2009-11-15 19:00:12 +00:00
Nick Mathewson
784b8773a4 We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H
svn:r1516
2009-11-06 21:46:57 +00:00
Nick Mathewson
4d48cf61a2 Fix kqueue.c build on GNU/kFreeBSD systems.
Yes, some people like to have a BSD-family kernel (thus getting
kqueue) with a GNU-family libc (thus occasionally mandating
_GNU_SOURCE).

Thanks to Debian for noticing this.

svn:r1514
2009-11-06 21:13:25 +00:00
Nick Mathewson
0fd0255fa4 Remove compat/sys/_time.h
I've gone through everything that it declared to see where it was used,
and it seems that we probably don't need it anywhere.

Here's what it declared, and why I think we're okay dropping it.

o struct timeval {}
  (Used all over, and we can't really get away with declaring it ourselves;
  we need the same definition the system uses.  If we can't find struct
  timeval, we're pretty much sunk.)

o struct timespec {}
  (Used in event.c, evdns.c, kqueue.c, evport.c.  Of these,
   kqueue.c and event.c include sys/_time.h.  event.c conditions its use on
   _EVENT_HAVE_CLOCK_GETTIME, and kqueue() only works if timespec is defined.)

o TIMEVAL_TO_TIMESPEC
  (Used in kqueue.c, but every place with kqueue has sys/time.h)

o struct timezone {}
  (event2/util.h has a forward declaration; only evutil.c references it and
   doesn't look at its contents.)

o timerclear, timerisset, timercmp, timeradd, timersub
  (Everything now uses the evutil_timer* variants.)

o ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF, struct itemerval
  (These are only used in test/regress.c, which does not include _time.h)

o CLOCK_REALTIME
  (Only used in evdns.c, which does not include _time.h)

o TIMESPEC_TO_TIMEVAL
o DST_*
o timespecclear, timespecisset, timespeccmp, timespecadd, timespecsub
o struct clockinfo {}
o CLOCK_VIRTUAL, CLOCK_PROF
o TIMER_RELTIME, TIMER_ABSTIME
  (unused)

svn:r1494
2009-11-03 19:54:56 +00:00
Nick Mathewson
315fde1a70 Remove some duplicate code in kqueue.c and fix a small memory leak.
svn:r1483
2009-10-30 22:43:53 +00:00
Nick Mathewson
369aafc4d7 Refactor kq_init error handling.
svn:r1467
2009-10-27 04:03:58 +00:00
Nick Mathewson
2e36dbe1a6 Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
2009-10-26 20:00:43 +00:00
Nick Mathewson
b89b58b5f4 OSX compilation issues
svn:r1453
2009-10-21 06:03:00 +00:00
Nick Mathewson
6b22e74aa1 Add locking to event_base_loop.
This is harder than it sounds, since we need to make sure to
release the lock around the key call to the kernel (e.g.,
select, epoll_wait, kevent), AND we need to make sure that
none of the fields that are used in that call are touched by
anything that might be running concurrently in another
thread.  I managed to do this pretty well for everything but
poll().  With poll, I needed to introduce a copy of the
event_set structure.

This patch also fixes a bug in win32.c where we called
realloc() instead of mm_realloc().

svn:r1450
2009-10-21 03:54:00 +00:00
Nick Mathewson
e3fd294a6d Spelling fixes in comments and strings.
svn:r1445
2009-10-16 13:19:57 +00:00
Nick Mathewson
b85b710cf5 Update copyright statements to reflect the facts that:
a) this is 2009
b) niels and nick have been comaintainers for a while
c) saying "all rights reserved" when you then go on to explicitly
   disclaim some rights is sheer cargo-cultism.

svn:r1065
2009-01-27 22:34:36 +00:00
Nick Mathewson
8889a77039 Replace all use of config.h with event-config.h.
svn:r1064
2009-01-27 22:30:46 +00:00
Nick Mathewson
9993137cbb Remove all trailing whitespace in all the source files.
svn:r1063
2009-01-27 21:10:31 +00:00
Nick Mathewson
2b7febc80a Fix osx compile
svn:r1018
2009-01-18 01:33:18 +00:00
Nick Mathewson
554e14934e Move per-fd info from eventops into evmap. Not done for win32.c yet.
svn:r1008
2009-01-14 20:52:32 +00:00
Nick Mathewson
169321c9e6 Rename four internal headers to follow the -internal.h convention.
svn:r1000
2009-01-13 20:26:37 +00:00
Niels Provos
b225e756ae remove unused variable
svn:r974
2008-12-23 22:24:32 +00:00
Niels Provos
d776f8462b deprecate the usage of signal_{add,del,set} and name it evsignal_{add,del,set} instead; move the old definitions to compat
svn:r973
2008-12-23 22:23:37 +00:00
Niels Provos
02b2b4d1be Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
svn:r972
2008-12-23 16:37:01 +00:00
Niels Provos
f7e61870e9 support multiple events listening on the same signal; make signals regular events that go on the same event queue
svn:r901
2008-07-11 15:49:04 +00:00
Niels Provos
5512be0176 fix a bug where deleting signals with kqueue would delete subsequent adds
svn:r899
2008-07-11 15:15:04 +00:00
Nick Mathewson
05965921ab Add new functions to access backends by their features and to query the features of a backend.
svn:r842
2008-05-31 14:37:31 +00:00
Nick Mathewson
39400e68b6 Patch from Valery Kholodkov: support for edge-triggered events with epoll and kqueue. Changed from original patch: made test into a regression test, with explicit success/failure for edge-triggered and non-edge-triggered cases. Closes SF request 1968284.
svn:r840
2008-05-30 16:56:34 +00:00
Niels Provos
2deb3ce061 simplify handling of environment variables for disabling backends;
make event_get_supported_methods obey environment variables; this
fixes make verify; problem reported by Scott Lamb.


svn:r838
2008-05-29 01:39:43 +00:00
Nick Mathewson
49868b618a r15316@tombo: nickm | 2008-04-24 20:58:36 -0400
Rename internal memory management functions from event_malloc() etc to mm_malloc() etc.


svn:r725
2008-04-25 01:18:08 +00:00
Nick Mathewson
0ac73078ed r15193@tombo: nickm | 2008-04-16 16:00:35 -0400
Split event.h into several new headers in include/event2.  event.h is now just a wrapper that includes all the subheaders.


svn:r711
2008-04-16 20:01:51 +00:00
Niels Provos
ca42671a14 make event methods static so that they are not exported; from Andrei Nigmatulin
svn:r692
2008-03-29 01:45:45 +00:00
Niels Provos
19dad16699 Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
svn:r682
2008-03-02 01:46:00 +00:00
Niels Provos
2fde221759 address some compiler warnings in debug mode
svn:r630
2008-02-09 16:03:01 +00:00
Niels Provos
fbe24f43ab remove obsoleted recalc code
svn:r581
2007-12-09 05:07:20 +00:00
Niels Provos
5f3e31596b move EV_PERSIST handling out of the event backends
svn:r555
2007-11-27 01:39:10 +00:00
Nick Mathewson
2823cb0579 r14944@tombo: nickm | 2007-11-25 12:12:28 -0500
Make kqueue pass more unit tests.


svn:r544
2007-11-25 17:15:28 +00:00
Nick Mathewson
7eb250e9c5 r14939@tombo: nickm | 2007-11-25 11:59:26 -0500
New function event_set_mem_functions to replace internal calls to malloc, free, etc with a user-supplied functions.


svn:r541
2007-11-25 17:14:19 +00:00
Niels Provos
88897852fc provide event_reinit() to reinitialized an event_base after fork - necessary for epoll/kqueue
svn:r539
2007-11-25 06:57:59 +00:00
Nick Mathewson
7d821580e8 Fix compile warning on osx: the udata field in struct kevent is supposed to be void*, not intptr_t.
svn:r387
2007-08-10 16:31:02 +00:00
Niels Provos
3ad6b47e03 make clock_monotonic work; do not use default timeout;
from Scott Lamb, plus some fixes from me.


svn:r371
2007-07-30 22:41:00 +00:00
Niels Provos
41b7cbc381 more the signal base into the event base; this removes global state and makes signals
work better with threading; from Wouter Wijngaards
small fixes for kqueue and style by me


svn:r351
2007-03-10 06:37:53 +00:00
Niels Provos
b5d2f9a255 rolling back r339: evconfig.h does not work
svn:r341
2007-03-01 06:25:18 +00:00