pthread: Add pthread_attr_getstacksize()

Add pthread_attr_getstacksize() in preparation for fixing RLIMIT_STACK.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Use pthread stack info for RLIMIT_STACK

Currently, RLIMIT_STACK is 64 KB.  This is too small for the JVM which
limits stack size to RLIMIT_STACK if a VMA range that covers address
found in '__libc_stack_end' in /proc/self/maps.

In preparation for procfs support, switch to pthread_attr_getstacksize()
for RLIMIT_STACK.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: 'struct file' to VOP_READ

Add 'struct file' to VOP_READ API. This is needed for procfs which
generates file contents at open() time and read() must operate on it,
not the vnode.

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

Add procfs_maps() function to core/mmu.cc that returns all the VMAs
formatted for Linux compatible "/proc/<pid>/maps" file.

This will be called by the procfs filesystem.

Limitations:

  * Shared mappings are not identified as such.
  * File-backed mmap offset, device, inode, and pathname are not
    reported.
  * Special region names such as [heap] and [stack] are not reported.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
proc filesystem

This patch adds a simple Linux compatible procfs filesystem.  It
currently implements a "/proc/self/maps" file which is looked up by
OpenJDK during startup.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: mount procfs at boot

Add a '/proc' directory to OSv image and mount procfs on it.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: miscs-procfs.so

Add a simple manual test case for checking "/proc/self/maps" output.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "build: Support VMDK and other image formats"

This reverts commit 59563357b4b8dfe21bf4f6f570b51b3cab04046d which
causes significant slowdown on first time boot to a QCOW2 image:

  [penberg@localhost osv]$ time ./scripts/run.py
  OSv v0.05-rc1-108-g0639dd8
  OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack
  location - find_vma failed
  ^D^D^D
  [/]%

  real    0m9.954s
  user    0m4.958s
  sys     0m1.309s

  [penberg@localhost osv]$ git revert
  59563357b4b8dfe21bf4f6f570b51b3cab04046d
  [penberg@localhost osv]$ time ./scripts/run.py
  OSv v0.05-rc1-108-g0639dd8
  OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack
  location - find_vma failed
  ^D^D^D
  [/]% ^D

  real    0m4.441s
  user    0m3.785s
  sys     0m0.530s

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