Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
Commits on Jun 11, 2012
@buytenh buytenh Remove -lrt -lpthread from pkgconfig Libs: line.
When linking in ivykis as a shared library, our dependent libraries
are automatically pulled in, and so we don't need to list them
explicitly in Libs:.  (From the Balabit ivykis tree.)

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Gergely Nagy <algernon@balabit.hu>
74e8690
@buytenh buytenh List dependent libraries on pkgconfig Libs.private: line.
For static linking, list our dependent libraries on the Libs.private:
line in our pkgconfig file.

Suggestion from Gergely Nagy <algernon@balabit.hu>.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Gergely Nagy <algernon@balabit.hu>
ccc8f40
@algernon iv_fd: Support platforms without platform-specific polling.
There are platforms out there, that do not have neither /dev/poll, nor
epoll, nor queue, nor ports (the Hurd is one such platform).  On these
platforms, the iv_fd_ structure has no list_notify member.

However, iv_fd_register_prologue wanted to init it anyway, this patch
teaches it to only do that in the same situation when list_notify is
part of the structure.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
068bd31
@buytenh buytenh Make sanitise_nofile_rlimit() assign directly to 'maxfd' global.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
da8803f
@buytenh buytenh iv_work: Save some space in struct work_pool_priv.
As we never dereference the ->public member (but only ever check it
against NULL), replace it by an int that signifies the same thing.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
98eb15d
@buytenh buytenh iv_work: Optimise struct work_pool_priv layout a little.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
571d381
@buytenh buytenh iv_work: Abort on worker thread shutdown with an event pending.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
bd98b76
@buytenh buytenh iv_work: Only stop and start idle timer once per thread worker loop.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
bfe928c
@buytenh buytenh iv_work: Don't re-kick callback event from worker thread if still pen…
…ding.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
ab537b6
@buytenh buytenh iv_work: Optimise out one local variable in iv_work_submit_local().
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
806bd98
Commits on Jun 18, 2012
@buytenh buytenh kqueue: Deal with EINTR returns from kevent() by retrying.
When calling kevent() on upload queue overflow, or when
unregistering a file descriptor, or when handling ->notify_fd_sync(),
an EINTR return means that we should retry the call until it returns
something other than EINTR.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
f9b420f
Commits on Jun 19, 2012
@buytenh buytenh poll: Deal with EINTR returns in ->notify_fd_sync().
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
dbd4e47
@buytenh buytenh select: Deal with EINTR returns in ->notify_fd_sync().
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
d0f05a4
@buytenh buytenh iv_fd_pump: Deal with EINTR returns on read(2)/write(2)/splice(2).
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
d82d553
@buytenh buytenh iv_event_raw: Include config.h.
So that HAVE_EVENTFD and HAVE_SYS_EVENTFD_H are passed through to us.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
999b6dc
@buytenh buytenh port: Fix iv_port_notify_fd_sync() return type.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
6ae1e9e
@buytenh buytenh iv_fd_pump: Solaris 11 build fix.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
82fd62c
Commits on Jun 22, 2012
@buytenh buytenh iv_signal: Split out spinlock handling into spinlock.h.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
24704ab
@buytenh buytenh iv_signal: Implement spinlocks by hand if pthread_spin_lock() unavail…
…able.

Some platforms (such as OpenBSD 5.1) don't provide an implementation
of pthread_spin_lock() and friends, in which case we implement spinlocks
by hand, using gcc's __sync_*() intrinsics.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
120194d
@buytenh buytenh iv_inotify: Only install man pages if inotify support was detected.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
54734e1
@buytenh buytenh iv_wait: Handle caller unregistration differently.
Perform detection of unregistration of the calling context via a
thread-local variable.  Aside from being cleaner, this also makes
the 'warning: dereferencing type-punned pointer will break
strict-aliasing rules' warning that we'd get on some platforms go
away.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
fad0833
@buytenh buytenh select: Save some space in struct iv_state.
As three of the four fd_set pointers stored in there can easily be
computed from the others.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
7388dbd
@buytenh buytenh Introduce iv_fatal(), and route all fatal error conditions through it.
When ivykis detects a fatal error, we shouldn't unconditionally log
the error message to syslog like we do right now.

This commit introduces iv_fatal(), which is a printf-style varargs
function that takes a message for a fatal error, formats it, logs it,
and then aborts the current process.

By default, the message will be logged to syslog as before, unless
iv_set_fatal_msg_handler() was used to set up an alternative error
message log function, in which case it will be logged to that function
instead.

(Original idea from the Balabit ivykis tree.  Suggestion for marking
iv_fatal() with __attribute__((format(printf, 1, 2))) from Gergely
Nagy <algernon@balabit.hu>.)

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
d93b0b9
@algernon iv_fatal: Add a manual page and an example.
This is a little manual page for iv_fatal(3), and a trivial example
for it in iv_examples(3).  While we're at it, remove direct use of
syslog(2) in iv_examples(3), as that is now deprecated.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
d819a5a
@buytenh buytenh Pass in iv_poll_method::poll() timeout argument as a struct timespec.
Instead of converting the struct timespec that we get from
iv_get_soonest_timeout() into a millisecond count that some poll
methods then convert back to a struct timespec again.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
9ce1b8f
@buytenh buytenh configure.ac: Don't test for stdint.h.
As we don't use it anywhere.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
5b1c525
@buytenh buytenh Introduce __iv_list_steal_elements().
For moving all elements on a list to another list, to be used for
enforcing fairness in various parts of ivykis.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
6682057
@buytenh buytenh iv_task: Implement fairness by list splicing.
When iv_run_tasks() is called, we want it to only process tasks that
were registered before the function was called.  This is currently
done by inserting a sentinel element, but it's easier to just move
all tasks to a local list on entry to the function and then work off
the local list.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
c82b287
@buytenh buytenh iv_event: Implement fairness by list splicing.
When iv_event_run_pending_events() is called, we want it to only
process events that were active before the function was called.  This
is currently done by inserting a sentinel element, but it's easier to
just move all events to a local list on entry to the function and
then work off the local list.  This simplifies the locking as well.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
bd45b39
@buytenh buytenh iv_wait: Implement fairness by list splicing.
When iv_wait_completion() is called, we want it to only process wait
events that were queued before the function was called.  We'll do
this in the same way as iv_task and iv_event do, by moving all wait
events to a local list on entry to the function and then working off
the local list.  This simplifies the locking as well.  If we exit
the function with wait events pending, iv_event guarantees that we'll
be called again at a later time.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
b6e1563
@buytenh buytenh iv_work: Implement fairness for thread work items using sequence numb…
…ers.

When iv_work_thread_got_event() is called, we want it to only process
work items that were registered before the function was called.

We can't do this by moving all work items to a local list like it
is done elsewhere in ivykis, since the list of pending work items
is shared between all threads in the thread pool, and so this would
starve other threads of work.

What we can do instead is to (virtually) assign each work item a
sequence number at enqueue time, and when it's time to process work
items, only process work items that have a sequence number less than
or equal to the sequence number of the last work item on the list
when we entered this thread's work processing function.

If we exit iv_work_thread_got_event() with work items pending,
iv_event guarantees that we'll be called again at a later time.

To make things slightly more efficient, we'll make a small change to
the handling of the idle thread list and the idle timer: if we exit
iv_work_thread_got_event() with work items pending, we won't re-add
ourselves to the list of idle threads, and we won't restart the idle
timer.  We'll detect this condition in the next call of the function
by checking whether thr->list is on a list, and if not, we'll skip
deleting ourselves from the list of idle threads and stopping the
idle timer on entry.

The need for thread work item fairness was pointed out by Balazs
Scheidler <bazsi@balabit.hu>.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
bcea2bf
@buytenh buytenh iv_work: Implement fairness for completion handlers by list splicing.
When iv_work_event() is called, we want it to only invoke work item
completion callbacks for work items that completed before the function
was called.  We'll do this in the (by now) usual way, by moving all
completed work items to a local list on entry to the function and then
working off the local list.  This simplifies the locking as well.  If
we exit the function with completed work items pending, iv_event
guarantees that we'll be called again at a later time.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
9d821eb
@buytenh buytenh iv_work: Implement fairness for local work items by list splicing.
When iv_work_handle_local() is called, we want it to only process
work items that were registered before the function was called.  We'll
do this in the (by now) usual way, by moving all work items to a local
list on entry to the function and then working off the local list.  If
we exit the function with work items pending, iv_task guarantees that
we'll be called again at a later time.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
653a04f
@buytenh buytenh iv_fd_pump: No need to relay EOF in echo server demo.
As we're going to close the socket on an incoming EOF anyway.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
b1a7d73
@buytenh buytenh lib/test/client: Silence gcc uninitialized variable warning.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
1c77126
@buytenh buytenh Bump version number to 0.30.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
2c54b6b
@algernon Merge tag 'v0.30-trunk' into patched 7a4d22a
@algernon Merge branch 'patched' into debian e271505
@algernon debian: Update for ivykis 0.30
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
0201b1f