Derivates of Sun JDK treat -Dfoo as -Dfoo=true
scripts: Add 'osv-crash' image

Add 'osv-crash' image for developers that includes the Java-based CRaSH
shell.

Requested-by: Roman Shaposhnik <roman@shaposhnik.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Support stringstream for multi-part body

Http request with multi-part body can be used to transfer form
parameters. In those cases, using a strningstream is more adequate than
a file.

This patch adds a default behavior to the multi part parser that would
store the information in a stringstream object. The original behavior
of using a temporary file remain, if the handler define such a file.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Move the json_exception wrapper to exception.hh

json_exception is a wrapper class that translate an exception to a json
format response. It is no required outside of routes.cc so it would move
to exception.hh

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Make set_headers static

set_headers does not need to be virtual, they are helper method that
does not require anything from the handler itself. Make them static
allow to use them without a handler, for example when no handler is
found and a 404 is returned.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: Return a json object when no handler is found

All the API request return json object.

This change return a json object with a 404 error code even if no
handler is found at all.
It also return a json object with 404 and page not found when a file is
not found.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Server: expose the url parsing method

This patch expose the url static parsing method outside of the class. It
would be used by the new batch API.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Swagger Definition: Add an API for batch processing

This adds a definition for a batch api. The batch request content is
passed in the request body.

The reply is a list of objects. Swagger does not support any-object to
be defined, so the return type is set to string.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Http Serve: Add a batch api implementation

This patch adds a batch API support.

It gets the definitions from the message body as a list of json objects
and uses a parser to create a request out of each of objects.

The handler uses the routes object to perform the request. The result
are combined in a list of objects.

If the parser is unable to parse the request, it would fail before any
of the request is attempted.

To test the changes do:

curl -F 'batch=[{"method":"GET",
"relative_url":"/os/version"},{"method":"GET",
"relative_url":"/os/name"}]' http://localhost:8000/api/batch

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
httpserver/osv-gui: update to latest

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #511 from rvs/master

Derivates of Sun JDK treat -Dfoo as -Dfoo=true
apps: update to latest

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
scripts/setup.py: Fix prerequisites for Ubuntu 14.04

OSv is currently failing to compile in a freshly installed Ubuntu 14.04.  The
reason is that we're missing the g++-multilib package, even after the setup
script is run.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: Implement pthread_attr_setstack()

Implement the pthread_attr_setstack() function, which was surprisingly
missing (the various other stack getting and setting variants were already
implemented).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add gnu_dev_* symbols

There are three Linux specific symbols gnu_dev_major(), gnu_dev_minor()
 and gnu_dev_makedev() that were not implemented in musl libc.
This patch adds these by reusing major(), minor() and makedev() code
from musl macros.
It also uses the macros from newer version of musl, that work around
some bugs, see musl changelog
https://github.com/rofl0r/musl/commit/9b732fe51b814468a08c84d13238b4c83a42451a

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Constantine Peresypkin <constantine.peresypk@rackspace.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: fix quitting qemu

Apparently, recent versions of qemu got more unfriendly toward automated
scripts. When a client conntects to an unix socket on which the monitor
is available qemu first sends a welcome message (any error causes qemu
to immediately close connection). Then the socket is added to poll().
If POLLHUP or POLLERR is reported then qemu also closes the connection
discarding any unread data (so sending command to qemu and immediately
closing connection won't work).

This patch deals with this qemu shyness by taking advantage of the fact
that send_command('quit') was the only use of that method and in this
particular case self.join() can be used so that connection isn't closed
too soon and qemu actually executes the command.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
net: Implement zerocopy TX

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
net: Implement zerocopy RX

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: Add zerocopy send test

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tests: Add zerocopy recv test

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