libc: add getgrnam_r for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: move getgrnam from runtime.cc

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge branch 'java' of https://github.com/tgrabiec/osv

Fixes issues with running apache-derby on OSv reported by Takuya.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
httpserver: build with optimizations

I'm seeing a wierd miscompile without this, but it's a good idea anyway.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
procfs: fix use-after-free

release_mp_dentries() releases those dentries, so they cannot be used
afterwards.  The vnode ought to be free at that point.

Reviewed-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vga: initialize _offset

The debug allocator purposely copies junk into memory to catch uninitialized
fields, like this.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
httpserver: add build dependencies

Or chase mysterious bugs forever.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: Clean up in the lambda expression handlers

To simplify the use of lambda expression as handlers, the function type
was define, and additional function was added, a one that gets not only
the request but also the reply, this will allow using
lambda expression in more complicated scenarios then before.

The function handler was modified to use the more general function and a
temporary function is used to do the translation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: handler to support mandatory parameters

Mandatory parameters are query parameters that the handler expect to
exists before starting the handler logic.

The handler now holds a list of mandatory parameter, that will be verify
before the handler is called.

The handler logic can safely assume all the mandatory parameters are
there and doesn't need to verify it.
If the parameters are missing a 400 will be return with the appropriate
error message.

The code generator will automatically adds any mandatory parameter from
the Swagger definition file. But it is also possible to add additional
parameters.

if h is the handler calling:
h.mandatory("op");

will add the query parameter "op" as a mandatory parameter

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: add mandatory parameters to the path

The path object that holds the information form the Swagger definition
file now holds a list of mandatory parameters.

Those parameters will be used to validate that mandatory parameters are
included before calling the handler logic.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http server: Add a parameter not found exception

When a mandatory parameter is missing a missing mandatory exception will
be thrown.

The exception constructor gets the parameter name is a parameter.
It will return a 400 bad request.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: Add mandatory parameters support to the routes

The routes object now copy mandatory parameters from the path object to
the handler and uses the mandatory parameters in the handler to verify
that the mandatory parameters are in the request before calling the
handler logic.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http server: Adding path holder

Path holder is an object that simplifies setting a handler to an api
define in the Swagger definition file.

The code generation will set a path holder object for each of the api
calls. For example to the api action "getFile" the following will be
define:

static const path_holder getFile("getFile");

getFile can now be used to set a handler to the operation. So if h is a
handler you can do:

getFile.set_handler(h);

It also support lamda expression, so if f is a request_function (as
define in the handlers.hh file) you can do:

getFile.set_handler(f,"json");

With the new API there is no need to access the routes object in most
cases.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http server: code generation to support mandatory parameters

Mandatory query parameters are now set with the path description

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: Code generation declare path holder

Path holder replaces the constant name of the operation, the code
generation uses them instead of string.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: Initilialize the path_holder

The path_holder holds a pointer to the routes object. The main should
initialize it after creating the routes object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Http Server: file.cc to use new API

The changed API, changed how a handler is set for an action, the file.cc
was modified to use the new API.

So setting a handler becomes:
getFile.set_handler(new get_file_handler());

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Update mgmt

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
drivers: null: read must return zero upon success

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zfs: Port relatime property from ZFSonLinux

OSv port details:
* Adapted zfs_register_callbacks changes
* Discarded man page changes
* Solved conflict in zfs/zfs_znode.c
* Solved conflict in .../opensolaris/lib/libzfs/common/libzfs_dataset.c
* Added lacking MTNENT definitions into .../opensolaris/sys/mntent.h
* Adapted zfs_tstamp_update_setup and zfs_atime_need_update

Description:
"Add the "relatime" property.  When set to "on", a file's atime will only
be updated if the existing atime at least a day old or if the existing
ctime or mtime has been updated since the last access.  This behavior
is compatible with the Linux "relatime" mount option."

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>