linux: Add system calls required by Node.js

This wires various system calls that are required by Node.js to the
syscall() libc function.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: David Halls <dahalls@gmail.com>
[ penberg: fold multiple patches into one ]
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: open64_2

Needed by Node.js.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Add more _chk functions

Needed by Node.js.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Stdio-based syslog

Needed by Node.js.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
fs: add __open_2 function

Nadav says:
open() has an optional third argument, "mode", which is only needed in
some cases (when the O_CREAT mode is used). As a safety feature, recent
versions of Glibc add a feature where open() with two arguments is replaced
by a call to __open_2(), which verifies it isn't called with O_CREATE.

closes #483.

Cc: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Add missing syslog.c

I forgot to include syslog.c in commit 25286ac ("libc: Stdio-based
syslog")...

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: make number of lines a parameter

top.py currently hard-coded the number of top threads shown to 20.
This patch adds a parameter, "-l" (or "--lines") allowing to change
this default. This is useful for example if you intend to dump the
output of top.py to a file, in which case there is no reason to limit
it to 20 threads, and you can just as easily ask for 500.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: remove extra newline

Remove an extra blank line that was only printed when there are
several CPUs.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: add migration counts

Add to the per-thread statistics also a counter of CPU migrations of
this thread.

Also add to top.py -s display of each thread's overall count of
migrations, and the number of migrations per second during the
last refresh interval.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
top.py: add per-thread preemption statistics

This patch adds a per-thread counter of the number of times this thread
was preempted - i.e., the thread was still runable but nevertheless
was scheduled out.

It also adds this counter and its rate to top.py -s (--switches).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>