mman: Fix mmap() tracepoint

Exit tracepoints are useful to record errors, and also for timing the
mmap operation.

Signed-off-by Pekka Enberg <penberg@cloudius-systems.com>
tests: Allow specify test names to testrunner

Allow specify test names to testrunner such as testrunner.so tst-foo1.so
tst-foo2.so to run tst-foo1 and tst-foo2 only in the order they are
specified. This does not change the default behavior that
cmdline=testrunner.so will run all tests under /tests dir.

This change can help developer to run the only test cases they need
quickly to verify new feature or find possible regressions.

Signed-off-by: Yang Bai <hamo.by@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add a few missing terminal-related functions

This patch adds a few simple terminal-related libc functions that ncurses
requires (needed to run curses-based applications on OSv).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Update instructions in README

The README contained out-of-date examples of how to run things in OSv.
Fixed those.

BTW, Much of the contents of the README don't really belong there. We already
have separate documents for debugging in OSv, and how to compile C/C++
code for OSv, and these should probably be in documentation/ in the
git repository, instead of in a Wiki or Google docs.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Yet another silly variant of sprintf

Used somewhere within libcurses, so provide an implementation.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
sys/socket.h: reconcile bsd and osv variants

Some structures are duplicated; deduplicate them.

A few are source-compatible but not binary-compatible; use the ones from
<bits/socket.h>.

Others are both source- and binary- compatible; put them in a new header
<sys/__socket.h> which is included from both.

Work around a problem with the byteorder functions/macros.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
netinet/in.h: reconcile osv and bsd headers

Some structures are duplicated; move the duplicates to a common header
<netinet/__in.h>.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
arpa/inet.h: reconcile osv and bsd headers

Workaround a bytorder function conflict, and reconcile a declaration.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
bsd: rename ifaddr

The bsd ifaddr struct conflicts with the osv ifaddr struct, which is a
public interface.  Rename the bsd struct to avoid conflict.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
bsd: rename ifconf

bsd's ifconf conflicts with osv's; rename it.

We use the bsd version in <osv/ioctl.h>, since we currently don't support
the Linux-ABI variants of these ioctls.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
bsd: rename osv ticks macro to bsd_ticks to avoid conflict with boost ticks usage

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net/if.h: reconcile osv and bsd headers

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
sys/socket.h: rename bsd_sockaddr using functions into bsd_*

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
dhcp: boost cleanup

This patch uses boost::asio::ip::address* to cleanup the core dhcp code.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
add missing linefeed
pthread: initialize earlier

boost's asio.hpp module init() function was calling pthread_key_create which
tried to manipulate some libc/pthread.cc unitialized objects.

pthread_key_create then returned -ENOMEM so an exception was thrown by boost
causing the loader's premain() function to fail and the boot to loop.

This patch lower the priority of the initialization of the libc/pthread.cc
objects so they are ready when premain is calling the boost module init()
function.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
prio: remove rendundant VMA_LIST_INIT_PRIO

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: add missing musl if_indextoname

Debug build was broken by it since boost::asio was used.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Put RunJava.class in a jar, runjava.jar

We use the RunJava Java class to run Java applications (both java.so
and the "java" CLI command use it). We used to have RunJava.class
uncompressed, in the /java directory, but this caused two problems:

1. Or noticed that having a directory (/java) on the classpath causes
   thousands of stat() calls when Java tries to look for all classes
   in this directory. With a jar, its contents are read only once.

2. The "java" CLI command (java.groovy) didn't work because apparently
   Groovy cannot deal with classes being in the top-level package.

   So this patch moves RunJava into the io.osv package, and put it into a jar
   /java/runjava.jar.

   Note that java.groovy is changed in a separate patch (because it's in
   a different sub-repository....)

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Add RunJava.jar instead of RunJava.class to boot image

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