ack_tracker: keep AckTracker parent class 64 bit aligned

AckTracker is a parent "class" for LateAckTracker which contains a RingBuffer.
RingBuffer has a pointer member which points to the memory where the AckRecord
slots (containing Bookmark) are stored.
When the AckTracker is unaligned then the RingBuffer within LateAckTracker
will also be unaligned and that can lead to SIGBUS on Sparc and IA64 platforms.

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #169 from lbudai/f/merge-proto

ack_tracker: keep AckTracker parent class 64 bit aligned
bookmark: eliminate paddings (while keeping alignment well)

Using those paddings was a mistake: it makes code too breakable.
If we want to avoid bus error(or any other alignment issues)
on some stricter architectures(eg.:Sparc, IA64) what we have to do is
keep Bookmark aligned. For that reason we should choose carefully the
internal representation of the Bookmark.

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #170 from lbudai/f/merge-proto

bookmark: eliminate paddings (while keeping alignment well)
log_pipe_init: handling result of log_pipe_init

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logwriter: Implementing the late acknowledge mechanism on the writer's side

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
ack_tracker: use AckType

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logmsg: adding the abort flag to the ack_and_ref member of LogMsg

It may happen that a message is sent to multiple destinations and
some of these destination have ack-ed the message but the queue of
the other writers have been freed. In this case these writers ack
the messages with AckType AT_ABORT which means that the message is
not processed and never will be.
To be correct we have to transfer the AT_ABORT all way along the
ack-path to notify the source that the message is not processed
on some paths and never will be to decrement the references to
the message. When the message is processed on all paths then the ack
is not only to decrement the references to the message but to change
the actual window size and save the actual buffer position to the
persist file.
The order of processed acks (AT_PROCESS) and unprocessed acks (AT_ABORT)
is undetermined. We have to accumulate the aborts and if at least one
writer acks with AT_ABORT (even if it is not the last one), we have to
transfer the AT_ABORT state to the source from log_msg_ack and
log_msg_refcache_stop.
To achive the above mentioned functionality the TLS_BLOCK has been
extended with a logmsg_cached_abort flag holding 0 or 1 and the member
ack_and_ref is change the following way: the lowest 15 bits hold the ref
counter (instead of 16 bits), then the next 15 bits hold the ack counter
(instead of 16 bits) and then 1 bit is holding the abort-flag (the last
one bit is unused at the moment).

test_logqueue: after changing the refcounter's size of logmsg the MESSAGES_PER_FEEDER is too high

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logqueue: refactoring pop_head and adding log_queue_rewind_backlog to log_writer_flush

Signed-off-by: Daniel Gados <gdani@balabit.hu>
Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #171 from lbudai/f/merge-proto

F/merge proto
configure.ac: Improved the linux capability check

The Linux capabilities check was dependent only on the existence of
<sys/capability.h>. While there was a check performed for -lcap and its
usability, if that check failed, linux capability support was never
turned off.

This caused problems on recent FreeBSDs, where the header exists, but -
naturally - the library does not. This patch fixes #175, by modifying
the check to turn off the feature if the library is not available.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
logmsg: log_msg_ack() code refactored little bit

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logmsg: log_msg_cached abort type is a boolean value (and not an integer)

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logqueue: the way we determine whether a queue is empty or not is racy

at this time we just use this racy function but we have to know about it:
this is why we rename it to is_empty_racy()

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logwriter: pending_proto re-established (we need it)

A pending proto can be set to null while it is present.
[see: log_writer_reopen_deferred]

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logqueue: ack_backlog checking is moved to the superclass

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logqueue: is_empty() fixed

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
logwriter: flush modes refactored

only two modes left: one for normal flush (LW_FLUSH_NORMAL)
and one for force mode (LW_FLUSH_FORCE)

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Preparations for syslog-ng 3.6.0alpha1

Bumped VERSION to 3.6.0alpha1; renamed NEWS to NEWS.md, and added
noteworthy changes since 3.5.5.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
configure.ac: Fix --enable-linux-caps

While fixing the auto-detection of Linux capabilities,
--enable-linux-caps got broken. This patch corrects that, so that both
work now.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>