libc: add poll_[un]install() functions to event_fd

This is needed to make eventfd work correctly with poll(). A list of
interested threads is maintained and notified when a successful write
or read happens.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zcopy: create eventfd before calling zsend()

If the transmitted data is acked in a period between zsend() completion
and eventfd creation the client will never receive the notification
that transmission was successful.

Cc: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zcopy: make sure that non-zero value is written to eventfd

Originally, the first 8 bytes of zmsghdr were written to eventfd in
order to notify the client that the transmitted data was acked. That
was unfortunate because that bytes might have been zeroed.

Cc: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: zcopy: wait for POLLIN instead of POLLOUT

When the sent data is acked ztx_release() writes to the eventfd. To
receive that notification user code should wait for the fd to become
available for reading - the correct event is POLLIN.

Cc: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: update file system's vnode operation list

update the vnode operation list of ramfs, devfs and procfs.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: use va_size instead when calculating st_blocks

st_size field is assigned to va_size, then let's use va_size again
when calculating st_blocks. Better to use the values from the
structure returned by VOP_GETATTR, which is supposed to fill all
the needed fields by vn_stat. Also avoid a needless read into
the underlying vnode.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zcopy_rx: Don't assert when bytes = 0

If connection suddenly closed, the function may return with error=0 *bytes=0.
In this condition, zm->zm_rxhandle will not set, because no data has been received.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zcopy_tx: add socket type check to drop unsupported protocol

zcopy_tx currently does not supported UDP.
Therefore we need to reject UDP socket.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
zcopy_rx: add socket type check to drop unsupported protocol

zcopy_rx currently does not supported UDP.
Therefore we need to reject UDP socket.

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