fadvise64: alias it from fadvise

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: provide _exit and _Exit aliases

Right now doing the same as exit(), since we don't support the atexit handlers
anyway

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
stub posix_fallocate

MongoDB expects that call and would like to guarantee allocation of blocks
in the file. It does have a fallback, so for the time being I am just providing
the symbol. I have opened Issue #265 to track this.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
pthread: implement spinlocks

While we take pride in having no spinlocks in the system, if an application
wants to use them, who are we to deny them this god given right? Some
applications will implement spinlocks through a pthread interface, which is
what I implement here.

We did not have any standard trylock mechanism, so one is provided. Other than
that, the interface is pretty trivial except for the fact that it seems to
provide some protection against deadlocks. We will just ignore that for the
moment and assume a well behaved application.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: cheat about version number

Since most applications running under OSv will be compiled against glibc on
Linux, we need to provide symbols for gnu_get_libc_version and
gnu_get_libc_release. Unless we find a case where we have to, we shouldn't
lie, though. Answer OSv specific data here.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tcp: expose through getsockopt values of TCP_KEEPINTVL and TCP_KEEPIDLE

We are currently setting those values okay, but getting them takes us to the
default clause. They are all very simples cases of copying a variable, so it's
just a matter of doing that.

Both options mentioned are used by MongoDB. TCP_KEEPINIT is not, but well, it
can't hurt.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
bsd/linux: convert tcp sockopt from Linux to BSD numbers

The comment states that option names are the same for BSD and Linux, but that
is not true at all for a lot of them. Checking the constants, I have came up
with the following conversion list. Before this patch, MongoDB complains that
getsockopt to query the interval time returns an error.

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