Re: [PATCH v2 4/6] utils/osdep: Introduce qemu_close_range()

2023-06-19 Thread Richard Henderson
On 6/16/23 17:27, Bin Meng wrote: +int qemu_close_range(unsigned int first, unsigned int last) +{ +DIR *dir = NULL; + +#ifdef CONFIG_CLOSE_RANGE +int r = close_range(first, last, 0); +if (!r) { +/* Success, no need to try other ways. */ +return 0; +} +#endif What

Re: [PATCH v2 4/6] utils/osdep: Introduce qemu_close_range()

2023-06-19 Thread Richard Henderson
On 6/16/23 17:27, Bin Meng wrote: This introduces a new QEMU API qemu_close_range() that closes all open file descriptors from first to last (included). This API will try a more efficient call to close_range(), or walk through of /proc/self/fd whenever these are possible, otherwise it falls back

[PATCH v2 4/6] utils/osdep: Introduce qemu_close_range()

2023-06-16 Thread Bin Meng
This introduces a new QEMU API qemu_close_range() that closes all open file descriptors from first to last (included). This API will try a more efficient call to close_range(), or walk through of /proc/self/fd whenever these are possible, otherwise it falls back to a plain close loop. Co-develope