qemu/osdep: Add excluded fd parameter to qemu_close_all_open_fd()

In order for this function to be usable by tap.c code, add a list of
file descriptors that should not be closed.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Message-ID: <20240802145423.3232974-5-cleger@rivosinc.com>
[rth: Use max_fd in qemu_close_all_open_fd_close_range]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Clément Léger 2024-08-02 16:54:20 +02:00 committed by Richard Henderson
parent a9b5d6e536
commit 7532ca570a
3 changed files with 89 additions and 19 deletions

View file

@ -760,9 +760,13 @@ int qemu_fdatasync(int fd);
/**
* qemu_close_all_open_fd:
*
* Close all open file descriptors
* Close all open file descriptors except the ones supplied in the @skip array
*
* @skip: ordered array of distinct file descriptors that should not be closed
* if any, or NULL.
* @nskip: number of entries in the @skip array or 0 if @skip is NULL.
*/
void qemu_close_all_open_fd(void);
void qemu_close_all_open_fd(const int *skip, unsigned int nskip);
/**
* Sync changes made to the memory mapped file back to the backing