vfs: bio: call bio_sync when closing the vfs layer

bio_sync is a function intended to be called when the bio layer is
done. It goes through all the cached buffers, and sync buffers that
were marked as B_DELWRI, meaning that I/O was delayed until the
underlying buffer is reused. Simply put, delayed writes.

If OSv is being powered off, it's unlikely that buffers marked as
B_DELWRI will be re-used in time. This patch is not fixing a bug as
ZFS currently doesn't make use of delayed writes nor does our vfs
layer. Anyway, bio_sync is the de-initialize function for the bio
layer, and should be called when closing the vfs layer.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: unload _used_by_resolve_plt_got on object removal

Like _needed, _used_by_resolve_plt_got should be cleared as well
when the underlying object is being removed.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
runtime: make abort and __assert_fail callable early

backtrace functionality uses ELF functions which acquire lockfree
mutex locks, and they require threads to be initialized as in
(s_current != nullptr), as well as the ELF program to be
contructed (s_program != NULL).

abort used to print with debug_ll, but in the meantime debug_ll
changed in semantics due to the console framework changes.

Therefore we need to use debug_early to ensure that the message
ends up in the console at any time of call, in any condition.

This patch makes abort() and assert() callable even before
the full construction of the init array in premain and before
TLS is available.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Cc: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: add test for presence of 'osv.version' property

This feature was introduced in commit 7bd655ab918eb5cd0bf9f690bfe32066acd6c5f9

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
java: isolated contexts should not inherit system properties

Context started from another context should not inherit system
properties because they may interfere with its state badly. For
example inheriting of logging properties may result in
ClassNotFoundException:s in the child because the classes present in
parent context are not found in the child context.

The initial system properties set by JRE should be available though.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
zfs: Implement zfs_ioctl

The function zfs_ioctl was ported from FreeBSD code.

OSv port details:
1) Copyright was properly updated.
2) Added missing header bsd/sys/sys/filio.h from FreeBSD.
3) Solved conflicts.

Later on, lseek should be modified to take advantage of
this change, and add support for finding holes and data.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
virtio::net: Don't use indirect buffers

This improve TCP Tx performance by about 10%.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
virtio-net:txq: Don't caclucate the sg length

Don't caclucate the sg length, use vqueue->_sg_vec.size() instead.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
core: implement ppoll()

A simple implementation for ppoll() using poll().
Minoru says ppoll() is needed in programs such as TCPServer.

Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: add eaccess() to run irb

eaccess() refer to access(2)

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch 'master' of https://github.com/cloudius-systems/osv