vfs: change vfs_lookup to CPP code

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: delete dentry of removed directory in sys_rmdir

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: add support to follow symlink in namei

namei functions resolves path and returns it's directory entry. namei
processes each component of the path separately. To ensure correct
processing of the path, namei should follow any symbolic link it may
encounter. Symbolic link is a pointer to another directory entry. It
contains path to which it points. To follow a symbolic link, the path
to which it points must be read first. A standard system call to read
path to which symbolic link points is readlink.

A readlink reads value of symbolic link and copies it in return buffer.
However, for readlink to work, last component of given path must not
be followed.

In summary, this patch
1. Modifies namei to follow symbolic link
2. Adds a new API namei_last_nofollow() which works like namei, except
if last component of the path is symbolic link it won't follow it.
3. Adds readlink functionality

V1:
- changed return prototype of sys_readlink
- added lock in read_link before reading link value
- changed plan char * to std::unique_ptr
- refactored namei() code and removed a goto

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: open with O_NOFOLLOW must fail when path is symlink

open fucntion must return ELOOP when given path is symbolic link. The
patch adds corresponding check for open flag.

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: modify rename to work with symlink

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: unlink change to work with symlink

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: add lstat support

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: add symlink support

V1:
- refactored code to remove gotos
- replaced char * with std::unique_ptr
- removed a directory entry is check race

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: add symlink test

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: remove checks on symlink target

It is perfectly legal to create a dangling symlink; from symlink(2):

  "NOTES
       No checking of oldpath is done."

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
cpiod: don't ignore symlinks

Java wants symlinks, allow them.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
modules: allow symbolic links

Don't complain about broken links (they can be unbroken after the entire fs
image is assembled).

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build: teach upload_manifest about symlinks

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
java: fix RPATH trouble

Newer openjdk has RPATH in some shared objects containing the full package
path (/usr/lib/jvm/java-1.7.0-openjdk-$release.x864_64), and tries to load
packages from that path.

While we should evnetually place the files there, that's too large a change.
Instead, keep the jdk in /usr/lib/jvm/java and create a symbolic link
/usr/lib/jvm/java-1.7.0-openjdk-$release.x864_64 to point to that, so RPATH
can be satisified.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
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>
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...@gmail.com>
core: add ppoll(2) C linkage
libc: add pthread_attr_setinheritsched to run WEBrick its ruby HTTP server
libc: add eaccess() to run irb

eaccess() refer to access(2)