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
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>