epoll: switch epoll_object to using file pointers

Holding filerefs causes close() to be delayed indefinitly in case
the user "forgets" to EPOLL_CTL_DEL the file before close().

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: give 'file' a proper destructor

use file::operator delete to ensure it is reclaimed via rcu,
and let the rest of the cleanup happen via the destructor.

This allows us to add other members to file, and let the standard
construction/destruction sequence take place.

Note the constructor is already used (falloc_noinstall()).

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
vfs: prevent double initialization of file::f_lock

Since it's initialized with the constructor, the mutex is already initialized.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tst-except: add test for _Unwind_Resume

Previously, _Unwind_Resume wasn't available, so functions that handled an
exception implicitly (by running a few destructors) crashed.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
bench: don't leak threads in TCPEcho

Make sure all threads are detached so they can be reclaimed when
they exit.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tst-tcp: clean up better after threads

Make sure to wait until the running thread count drops to zero
before destroying things.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
tst-tcp: close socket before retaking the lock

Avoid possible blocking.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
epoll: remove epoll registrations after close()

To prevent leaks when a file is close()d without an EPOLL_CTL_DEL,
record epoll registrations in the file structure and remove them
when the file is destroyed.

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