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>
Merge pull request #51 from anttikantee/master

cosmetic: add missing linefeed

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
java.c: add support for -agentlib JVM option

This is needed to start the JVM with debugger interface.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
imgedit: introduce getargs command

The new command prints arguments set in the image.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
run.py: convert tab to spaces

In order to have consistent indentation.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
run.py: start QEMU in nographic mode

This is in order to make it send Ctrl+C to the guest instead
of killing the VM. Leads to less surprises when working with
interactive shell inside OSv.

To suppress the new behavior run with --g or --with-graphic.

Relates to issue #49.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
tst-mmap.so: Switch to C++ APIs

Use C++ APIs to remove dependency to OSv internals so that we can run
the same test on Linux. Make the concurrency tests depend on OSv because
C++ doesn't have a API for binding threads to specific CPUs and we don't
want to clutter the test with pthread'isms.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-mmap.so: Test for MAP_FAILED

The mmap() function returns MAP_FAILED on error. Test for that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-mmap.so: Fix mmap() flags

Fix tst-mmap test on Linux by passing MAP_PRIVATE as a mmap flag.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: Fix vma::sync() return value

Fix vma::sync() to return zero for msync'ing anonymous vmas like Linux
does.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tst-mmap.so: Fix mincore() stack and malloc tests

Linux requires mincore() addresses to be page aligned.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
runtime: Check that mincore() address is page aligned

Make mincore() error-path compatible with Linux by requiring 'addr' to
be page aligned.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: convert __dns.c to __dns.cc

Also convert it's header and change it's caller includes.

This patch is done so the libc resolver will be able to retrieve the dns from
OSv dns API.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: add setter and getter functions for nameservers and search domains

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
dhcp: wire dhcp dns servers with the libc DNS resolver code.

This Close issue #8 ""Make Java InetAddress.getHostName() works".

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