build: build core/run.cc

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: add helper for running with a vector<string> argv

Much easier than constructing a traditional argc/argv.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: save optind across invocations

optind is a global variable that is expected to be zero-initialized by
getopt().  Running one object after another violates this, if both use
getopt().

Fix by saving the value of optind across calls.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch 'run-fixes'

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: implement sync()

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: define mbstate_t as __mbstate_t

std::streambuf<char> is defined as an "extern template", which means it is
instantiated in the library, not at the point-of-use, in order to reduce
object size and compilation time.

One of its member functions, std::basic_streambuf::seekpos(...) has a
parameter whose type depends on mbstate_t; this embeds the type name into
the mangled function name.

On Linux, mbstate_t is a typedef for __mbstate_t, so the latter type name
is embedded into the mangled function name.  On osv, there is no such typedef,
so mbstate_t is embedded.  This causes lookup to fail when loading a shared
object that uses streambufs.

Fix by defining mbstate_t in the same way as glibc.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: stub eventfd()

Needed by boost.asio.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: implement epoll_create1()

It's a superset of epoll_create(), so implement the latter in terms of the
former.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: switch to cache=none

More realistic.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: allow forwarding tcp ports in run.py

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
imgedit: fix large partition chs

Large partitions set head=254, not 255.  Also be more accurate calculating
the exact point of overflow.
build: package zfs.so (the zfs utility) in bootfs

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mkfs: Add stub mkfs()

For the moment, it only creates a zpool, not a filesystem.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
paths.h: fix _PATH_MNTTAB

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: stub epoll EPOLLET treatment

Ignoring EPOLLET will generate more wakeups, but should work with most
applications.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
zfs: wire up some exporting functionality
mkfs: create /etc/mnttab

zfs utilities want /etc/mnttab, let them have it.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mkfs: create a filesystem

Create a file system on top of the pool.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
bsd: allow mnttab.h to be included from C++ code

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
bsd: reconcile MS_RDONLY definition with api/mount.h

Make the two definitions exactly equal so the compiler does not complain.

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