shell: fix missing cleanup in "perf stat"

Our "perf stat ..." shell command installs a tracepoint counter
(implemented by the com.cloudius.trace.Counter) but neglects to
close() it when done.

So when the "perf stat" command is interrupted, the counter is left
behind, causing a waste of time at best (as we keep counting the tracepoint
even when perf stat is not running) - and a crash at worst (when
a GC frees the counter object, the kernel continues to count in it).

So this patch adds the missing close() calls in a "finally" section.
This "finally" is called when the perf stat command is interrupted
with a ^C.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Move exception to their own file

Exception handling in the httpserver is cover by http exception, and
general exception.

Http exception are mainly a result of bad input: a resource is not found
or arguments are wrong General exception results from some error in the
code.

The exception file holds a base class for the exception and the basic
derivation from it (not found, bad request and missing parameter).  All
the http server exception has a message and a status code that will be
used in the reply.

The exception handler will now use the message and status from the
exception in all httpserver exception.

Other exception will result a 500 (internal server error) reply.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix options for command: free

Right now, free -k is no different from free -m and free -g. free -b
gives the output for free -h. This patch fixes the above problem.

Signed-off-by: Nehal J Wani <nehaljw.kkd1@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>