Implements #22 JSON output

Introduces a JSON root in every tostring call of
sinsp_evt_formatter regardless.  This may be better to break into
separate calls for the really paranoid.

Otherwise, it derives the key name from the field_info of the token
and then assigns the str value as returned by tostring.

When its done with one round it uses the JSON Fastwriter to return
the std::string back...

The third party JSON-CPP library had one line changed: The fastwriter
part of it would output a newline for us. This was already being handled
and would produce two new lines.  So I removed that from the library.

JSON is a finished standard and I don't expect many "upgrades" to the
library so I think this is a change we can live with.
Changing how newlines are handled

This commit perserves the newline system of the JSON CPP fast-writer
as requested in
https://github.com/draios/sysdig/pull/138#issuecomment-41636808
by instead truncating the last character which we know is going to
be a newline.
Outputs JSON capture objects in a large array

This code introduces an m_first bool to the eventformatter that
represents if its the first tostring call. This is used in order to
emit a '[' or a ',' for a start of an array, or the array delimeter,
respectively.

Also, sinsp_evt_formatter::on_capture_end is introduced, which, for
JSON will emit the trailing ']' representing the end of an array.

This means that an extra clause was put into the g_terminate conditional
inside of do_inspect which will do the on_capture_end of the inspector,
thus emitting the trailing ']'.

Additionally, the JSON::Value and JSON::FastWriter have been moved
to the class scope.
Implements #22 JSON output

Introduces a JSON root in every tostring call of
sinsp_evt_formatter regardless.  This may be better to break into
separate calls for the really paranoid.

Otherwise, it derives the key name from the field_info of the token
and then assigns the str value as returned by tostring.

When its done with one round it uses the JSON Fastwriter to return
the std::string back...

The third party JSON-CPP library had one line changed: The fastwriter
part of it would output a newline for us. This was already being handled
and would produce two new lines.  So I removed that from the library.

JSON is a finished standard and I don't expect many "upgrades" to the
library so I think this is a change we can live with.
Changing how newlines are handled

This commit perserves the newline system of the JSON CPP fast-writer
as requested in
https://github.com/draios/sysdig/pull/138#issuecomment-41636808
by instead truncating the last character which we know is going to
be a newline.
Outputs JSON capture objects in a large array

This code introduces an m_first bool to the eventformatter that
represents if its the first tostring call. This is used in order to
emit a '[' or a ',' for a start of an array, or the array delimeter,
respectively.

Also, sinsp_evt_formatter::on_capture_end is introduced, which, for
JSON will emit the trailing ']' representing the end of an array.

This means that an extra clause was put into the g_terminate conditional
inside of do_inspect which will do the on_capture_end of the inspector,
thus emitting the trailing ']'.

Additionally, the JSON::Value and JSON::FastWriter have been moved
to the class scope.
Merge branch '22-JSON-output' of github.com:kristopolous/sysdig into 22-JSON-output

Conflicts:
	userspace/libsinsp/eventformatter.cpp
Uses numeric long long values for numeric types in JSON output

When the m_print_format of a field is PF_DEC, in JSON output, the
value that is used is now the string representation passed through
atoll.
Better fd listener interface used in the agent
Better check to exclude directories from fd listener
Remove an include that fails on 2.6.32-ubuntu
Use right include for THIS_MODULE
Merge branch 'origin/master'
Remove use of 'goto' as an identifier in chisels to help with Lua 5.2 compatibility
Merge pull request #164 from mwild1/master

Remove use of 'goto' in chisels to improve Lua 5.2 compat (issue #148)
Uses Booleans and Nulls for their respective values

Adds support for JSON output of both booleans and null values.
Paralleling the tostring to have a symmetric tojson implementation
Better embedded JSON object support.
Better JSON support for time types + Some JSON bugfixes
Numerous JSON type fixes and expansion of file pointers