tools/libxenevtchn: add possibility to not close file descriptor on exec
authorJuergen Gross <jgross@suse.com>
Fri, 15 Jan 2021 08:29:38 +0000 (09:29 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Jan 2021 11:44:47 +0000 (11:44 +0000)
commit29a6082f21f2109935fd13eff4c9ce0093c2a26e
treebddb789a00916ce386fb3dd1d1d40b8a50c83395
parent935e5fb0d5707d7356fb869bb83e27d11269558f
tools/libxenevtchn: add possibility to not close file descriptor on exec

Today the file descriptor for the access of the event channel driver
is being closed in case of exec(2). For the support of live update of
a daemon using libxenevtchn this can be problematic, so add a way to
keep that file descriptor open.

Add support of a flag XENEVTCHN_NO_CLOEXEC for xenevtchn_open() which
will result in _not_ setting O_CLOEXEC when opening the event channel
driver node.

The caller can then obtain the file descriptor via xenevtchn_fd().

Add an alternative open function xenevtchn_fdopen() which takes that
file descriptor as an additional parameter. This allows to allocate a
xenevtchn_handle and to associate it with that file descriptor.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
Reviewed-by: Julien Grall <jgrall@amazon.com>
tools/include/xenevtchn.h
tools/libs/evtchn/Makefile
tools/libs/evtchn/core.c
tools/libs/evtchn/freebsd.c
tools/libs/evtchn/libxenevtchn.map
tools/libs/evtchn/linux.c
tools/libs/evtchn/minios.c