run.py: Fix API user networking port forwarding

The API is listening to port 8000, not 8080.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio-net: fix handling of bad buffers

When we discard a bad buffer, we don't advance to the next one, so we'll free
it again on the next pass, resulting in a double-free.

Tested-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Add alphasort() function

Don Martin writes:

  I'm experimenting with Capstan, trying to rule out some things for
  getting a bigger application working. I have a simple program to
  recursively list directory contents, here...

    https://github.com/dmarti/mini-ls

  It works on the host, but when I build the .so, the "capstan build" step
  works, and then when I do "capstan run"...

  $ capstan run
  OSv v0.05-501-gdbdf4f7
  Failed looking up symbol alphasort

This is missing libc functionality in OSv. To fix that, add the
alphasort function from musl.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Doxygen: exclude drivers/libtsm

drivers/libtsm includes a bunch of Doxygen comments, and worst of all, a
"@mainpage" tag controlling Doxygen's main page. Since libtsm isn't really
part of the API we intend to advertise, let's exclude this directory from
being scanned by doxygen.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
kbd: don't reset modifier key state on every readkey()

Fixes #219.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
kbd: fix type definition of shift

This variable is for keeping value of uint32_t shiftcode[n], so it
should be uint32_t as well.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix type and documentation of sched::thread::id()

After commit 5c652796fe8d08b7ecc87739025492505c9c1b5a, our thread id
is 32 bit, not 64 bit. This patch fixes the return type of the id()
function, and replaces an incorrect comment (which claimed that the
ids are unique during the lifetime of the system) with a more accurate
description on this function, using a doxygen comment (so it can be
seen in our doxygen API documentation).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: Use thread_handle instead of thread pointer in tlb

Thread pointed to by tlb_flush_waiter may exit before tlb_flush_ipi()
calls wake() on it which will cause access to freed memory. Fix that by
using thread_handle which was introduces to handle exactly those kind of
races.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Use git submodule update --init --recursive

In a case of nested submodules, like swagger-ui inside mgmt inside osv,
only the --recursive update all the submodules, all the way down.

Signed-off-by: Tzach Livyatan <tzach@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc function availability checker for a shared library

This script list up missing libc function called from a shared library.
Usage:
./scripts/check-libcfunc-avail.sh release apps/memcached/memcached.so

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
signal handling: support SA_RESETHAND

Add support for SA_RESETHAND signal handler flag, which means that the signal
handler is reset to the default one after handling the signal once.

I admit it's not a very useful feature (our default handler is powering off
the system...) but no reason not to support it.

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

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: introduce mmap_small flag

If the flags is set on vma it is backed by small pages only.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
arc: mark arc buffers as shared

A new (private) flag is added that marks a buffer as shared between
ZFS and the page cache. It indicates that before evicting this buffer,
ZFS will have to take some action. Right now no action is taken besides
clearing the flag.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
arc: unmap shared buffer when they are evicted.

This comes together with the placeholder in the mmu-side to get this
warning. The actual functionality is not yet implemented

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
mmu: page out class

To avoid overloading "change_perm"'s meaning, and taking advantage of our nice
template based page walker, this patch creates another walker that will unmap
a range of pages, marking them all as non present.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
mmu: force shared mappings to use small pages

The underlying filesystem won't be able to back it with huge pages, so force
small.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
uio: super structure around uio

I am using the same name as solaris code expect. The first field is an uio,
and the rest is something that we will use in specialized functions.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
zfs: provide a dmu mapping function

That will allow us to read a dmu arc-backed buffer and acquire a pointer to it,
instead of copying it somewhere else. This function will both do mapping and
unmapping, depending on its last parameter.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
vfs: allow a mapping operation

We won't require all filesystems to implement it, those who don't should return
ENOSYS.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>