mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
An application which uses libxl_osevent_register_hooks, and doesn't use libxl_sigchld_owner_mainloop, would never properly experience the deaths of its (libxl) children. This is because the SIGCHLD self pipe would be handled using ad-hoc code in beforepoll_internal and afterpoll_internal. However, this is no good if application is using the fd registration system instead; in that case these functions would not be called and nothing would deal with readability of the self pipe. Fix this as follows: The SIGCHLD self pipe now is now dealt with by a standard libxl__ev_fd handler, which is registered and deregistered along with the SIGCHLD handler itself. The handler function subsumes the ad-hoc response code removed from beforepoll_internal, and the functionality of libxl__fork_selfpipe_woken. This is also tidier as the SIGCHLD self pipe is no longer touched outside libxl_fork.c other than in ctx initialisation and teardown. (The ad-hoc arrangements for poller->wakeup_pipe in beforepoll_internal and afterpoll_internal are OK because the libxl__poller mechanism exists to wake up threads which are sitting inside libxl's poll loop, so is not applicable to the application's event loop.) Reported-by: Bamvor Jian Zhang <bjzhang@suse.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Cc: Bamvor Jian Zhang <bjzhang@suse.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Jim Fehlig <jfehlig@suse.com>