On BSD-like systems "/dev/fd" serves the same purpose as
"/proc/self/fd". And since procfs is usually not mounted, on such
systems we can use "/dev/fd" instead.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/518
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
return 0;
}
-# ifdef __linux__
+# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
static int
virCommandMassCloseGetFDsDir(virBitmap *fds,
const char *dirName)
return 0;
}
-# endif /* __linux__ */
+# endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) */
static int
virCommandMassCloseGetFDs(virBitmap *fds)
* onto child process (well, the one we will exec soon since this
* is called from the child). */
return virCommandMassCloseGetFDsDir(fds, "/proc/self/fd");
+# elif defined(__APPLE__) || defined(__FreeBSD__)
+ return virCommandMassCloseGetFDsDir(fds, "/dev/fd");
# else
virBitmapSetAll(fds);
return 0;