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>
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>
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>
Make sanitise_nofile_rlimit() assign directly to 'maxfd' global.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
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>
iv_work: Optimise struct work_pool_priv layout a little.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_work: Abort on worker thread shutdown with an event pending.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_work: Only stop and start idle timer once per thread worker loop.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_work: Don't re-kick callback event from worker thread if still pending.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_work: Optimise out one local variable in iv_work_submit_local().

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
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>
poll: Deal with EINTR returns in ->notify_fd_sync().

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
select: Deal with EINTR returns in ->notify_fd_sync().

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_fd_pump: Deal with EINTR returns on read(2)/write(2)/splice(2).

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
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>
port: Fix iv_port_notify_fd_sync() return type.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_fd_pump: Solaris 11 build fix.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_signal: Split out spinlock handling into spinlock.h.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_signal: Implement spinlocks by hand if pthread_spin_lock() unavailable.

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>
iv_inotify: Only install man pages if inotify support was detected.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>