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>
mmu: Fix msync() vma range walk

The tst-mmap.so test case noticed the following breakage in msync():

  Running mmap tests
  Assertion failed: msync(buf, 4096*9, MS_ASYNC) == 0
  (../../tests/tst-mmap.cc: main: 207)
  Aborted

The problem is that msync() uses the contains function which checks if
[start, end) is in a vma range but we really are interested in whether
the vma intersects with [start, end).

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mman: Check mmap() MAP_SHARED and MAP_PRIVATE flags

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
post-processing/memory: page allocator support

This patch adds page allocator support to memory analyzer post
processing script.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mempool: Fix early page allocator tracepoint

Fix memory_page_alloc tracepoint if untracked_alloc_page() uses the
early page allocator.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add interrupt and quit keys to console driver

This patch adds interrupt (by default ctrl-C) and quit (by default ctrl-\)
handling to the console driver, when the ISIG termios flag is enabled (and
this patch enables this flag by default). The application can change these
characters or disable ISIG with ioctls, exactly as in Unix.

The ^C character sends a SIGINT to the (only) process, and ^\ sends SIGQUIT.
By default both abort OSv, but when running Java we get a much more
interesting SIGQUIT handler - it shows a trace of all running threads
and other information.

Note that our line-discipline code currently sits in the console driver
(we do not have ptys yet), so it only applies to the console, not to
SSH connections or the likes.

Also note that by default (before the patch to issue #49), qemu will catch
the ^C and ^\ and won't even pass them to OSv, so apply the patch to #49
(or change the interrupt or quit characters) to see this feature working.

This patch relates to issue #53.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Start using doxygen for OSv's API documention

This patch begins to document OSv's native (non-Linux-compatible) C++ APIs
using Doxygen. With doxygen, functions, classes, and other APIs are
documented using comments inside the source code, similarly to the way
Javadoc is used in the Java world.

After this patch, running "doxygen" generates the documentation in HTML
form (and also ugly ones in LaTeX...) in the "doxyout" directory.
After running "doxygen" in the OSv top-level directory, open your browser to
file://.../doxyout/html/index.html to view this documentation.

This patch adds a doxygen configuration file, "Doxyfile", and documents
three functions in the osv namespace: osv::halt(), osv::poweroff(),
osv::halt().

The format of the resulting documentation is not perfect, but it's not
as bad as I feared, and also the documentation doesn't uglify the code
too much (it mainly impacts the header files), so I now believe it will
better for us than writing man pages (an avenue which I explored
previously).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Gdb: Add "osv runqueue" command

This patch adds a "osv runqueue" command to gdb, which shows the (sorted)
run queue of each CPU. Note that the run queue does not include the thread
currently running - just those which are ready to run.

This command is useful for debugging the scheduler and load balancer, but
is less generally useful than the "osv info threads" command, which lists
all threads, specially marking those which are runnable as well as those
which are running.

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