Introduce stats log API, convert existing output

Convert regular 'stats.log' output to this new API.

In addition to the current stats value, also give the last value. This
makes it easy to display the difference.
stats: introduce global config

As the stats api calls the loggers at a global interval, the global
interval should be configured globally.

 # global stats configuration
 stats:
   enabled: yes
   # The interval field (in seconds) controls at what interval
   # the loggers are invoked.
   interval: 8

If this config isn't found, the old config will be supported.
stats: initialize after outputs

Initialize stats after outputs so that we can check if we need to
initialize the stats api at all.
stats: disable stats if no loggers are enabled
output streaming: cleanup at runmode destruction
stats: expose stats to Lua output

Register with type 'stats':

    function init (args)
        local needs = {}
        needs["type"] = "stats"
        return needs
    end

The stats are passed as an array of tables:

    { 1, { name=<name>, tmname=<tm_name>, value=<value>, pvalue=<pvalue>}}
    { 2, { name=<name>, tmname=<tm_name>, value=<value>, pvalue=<pvalue>}}
    etc

Name is the counter name (e.g. decoder.invalid), tm_name is the thread name
(e.g. AFPacketeth05), value is current value, and pvalue is the value of the
last time the script was invoked.
MemBuffer: add expansion call

For some of the buffer users it's hard to predict how big the data
will be. In the stats.log case this depends on chosen runmode and
number of threads.

To deal with this case a 'MemBufferExpand' call is added. This realloc's
the buffer.
log-stats: expand membuffer if necessary

Many threads could lead to a membuffer size requirement bigger than
64k. So use the expansion call to grow the buffer as needed.
Runmodes: remove 'auto' runmodes

Remove 'auto' runmodes from all capture methods. It wasn't reliable
enough, as it didn't enforce inspection order of packets.
threading: remove '1slot' functions

No longer in use after the 'auto' runmode removal.

All runmodes now use either varslot or pktacqloop support.
Runmode: handle value 'auto'

Auto now selects the default runmode for the capture method.
af-packet: threads: auto, default to workers

Add a new default value for the 'threads:' setting in af-packet: "auto".
This will create as many capture threads as there are cores.

Default runmode of af-packet to workers.
util-ioctl: Add function to get number of RSS queues on iface

The number of RSS queues can be fetched via a standard ioctl which
is independant of hardware.
util-ioctl: add message in case of failure
af-packet: no more threads than RSS queues

If we manage to read the number of RSS queues from an interface,
this means that the optimal number of capture threads is equal
to the minimum of this number and of the number of cores on the
system.

This patch implements this logic thanks to the newly introduced
function GetIfaceRSSQueuesNum.
defrag: don't crash when out of memory

Handle memory allocation errors in defrag better. Could lead to
crashes if malloc errors happened.
http: don't crash when normalizing uri on low memory
ioctl: make all string args const pointers
afpacket: only check offloading once per iface

Instead of once per thread per iface.
Bug 977: -T / --init-errors-fatal to process all rules

Have -T / --init-errors-fatal process all rules so that it's easier
to debug problems in ruleset. Otherwise it can be a lengthy fix, test
error cycle if multiple rules have issues.

Convert empty rulefile error into a warning.

Bug #977