Package: libbsd0 Version: 0.11.5-1+b1 closefrom() is documented to be async-signal-safe on FreeBSD: https://www.freebsd.org/cgi/man.cgi?sigaction I'd like it to be async-signal-safe in libbsd too.
The current implementation uses opendir()/readdir()/closedir() and reallocarray()/close(), which are not async-signal-safe.
https://www.sourceware.org/ml/libc-alpha/2018-09/msg00270.html hints that you can use poll() to query for open fds. That should be efficient, portable and async-signal-safe.
-- Jakub Wilk