/etc/hosts: Remove non-relevant entry

Closes #324

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
shrinker: Fix osv_register_shrinker visibility for C apps

$ capstan run
Created instance: memory-hog
OSv v0.08
I'm a memory hog!
Failed looking up symbol osv_register_shrinker

Reported-by: Don Marti <dmarti@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
release-ec2: Choose availability zone dynamically

It turned out that set of availability zones in each region
may be different for different accounts so one should not
hard code availability zone name but choose it dynamically instead.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
release-ec2: add parameter for OSv modules list specification

--modules-list parameter introduced

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: Implement fallocate system call

This patch adds fallocate as a vnode operation, implements the
fallocate function and the system call.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: Fix corner-cases where stat variants report out-dated file size

It turns out that vnode->vn_size will not be always synchronized with the file
system underlying the vnode, and vn_stat will always provide its caller with
the file size known by the vfs layer. The latter is changed to get from the
fs instead.

Found the bug while using stat on a file (in zfs) after its was either truncated
or extended. We probably should change zfs later to update vnode->vn_size whenever
the respective znode->z_size is updated.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zfs: Implement zfs_fallocate

1) zfs_fallocate is ported from ZFS on Linux along with convoff.
zfs_fallocate being limited to FALLOC_FL_PUNCH_HOLE alone, though
not useful as fallocate require FALLOC_FL_PUNCH_HOLE to be ORed
with FALLOC_FL_KEEP_SIZE.

2) (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) semantics is implemented
in zfs_fallocate. Relevant changes were introduced into zfs_space.

3) From my conversation with ZFS folks, I realized that FALLOC_FL_KEEP_SIZE
alone could be implemented, but it will probably take a long time, and wouldn't
give us the proportional value.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: Add fallocate testcase

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio-vring: rename db_used() -> update_used_event()

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: implement some more terminal functions

Code comes from musl, but is moved to libc.cc to be together with the other functions
already present there.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: implement the whole mnt* family of functions

We had an implementation of getmntent, but its signature was wrong to begin
with. I doubt it was ever working, since it is not such a common function. But
even then, we lacked other functions in this family, like setmntent.

This patch implements them all. The main matching code comes from musl, but the
end result is significantly different. In particular, I didn't really want to
mess with creating new virtual proc files, symlinks and the such. Instead,
trying to opening a dynamic file (like /proc/mounts) or any of its famous
aliases will return a special value.

Functions like getmntent will be able to parse that value and act accordingly.
The code to show dynamic mounts comes from our old getmntent() implementation,
but it is here modified to not use statics for the strings so we can implement
getmntent_r() correctly.

Fixes #326

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
CC: Lyor Goldstein <lgoldstein@vmware.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mount: read initial entries from fstab

The main problem with supporting the setmntent function is not the code per se
- which is itself quite trivial. Rather, one expects that if this function (and
addmntent, for instance) is being used, somebody is about to make changes to the
system's initial mount points. We can make this all volatile, but I suspect users
would be frustrated to find out that the modifications made won't be reflected in
the system.

What this patch does, is that it creates an fstab file that is included in the
main build and contains our currently dynamic mounts for proc and dev.  When
OSv finds such a file, it will proceed mounting them.

The results here should be the same except for people booting using
bootfs.manifest, IOW, our initial build. Since we can build fine without those
pseudo filesystems, I didn't really bother doing anything about it.

I know this patch can be a bit polemic, since dynamically building a filesystem
list without depending on any file fits our model a bit better towards being
stateless as much as we can. But I believe it to be the right approach since
it will allow all the *mntent functions to write with the correct expectations.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
CC: Lyor Goldstein <lgoldstein@vmware.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
poll: fix poll_sync() on unconnected sockets

An unconnected socket needs to wait for a connection event; this does not
change sockbuf::sb_cc and so can't be waited on with sbwait().

Detect this and bail out early.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
poll: fix poll_sync() early termination

sbwait() can return with a false positive (say with an ACK only
packet) and so we return with incorrect results.

Fix by looping until we get either some events or a timeout.

Seen in netperf.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: implement madvise(MADV_NOHUGEPAGE)

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
gdb: fix "osv info thread" to show correct thread address

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: fix unsigned/signed comparison in misc-free-perf.cc

thread_allocator::next_core is compared against sched::cpus.size().
GCC 4.9 doesn't like the fact that the former is signed and the latter
is unsigned.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Fix download.osv.io S3 bucket name

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts: Fix capstan release upload

We can no longer use "--delete-removed" because the S3 bucket hosts
Capstan executables and access logs.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>