Misc cleanup for FreeBSD and clang (#1560)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
mkdocs / deploy (push) Has been cancelled

This commit is contained in:
trapexit 2025-11-01 18:04:28 -05:00 • committed by Antonio SJ Musumeci
parent 2412ae7316
commit 41b65ae9e8
9 changed files with 25 additions and 64 deletions

View file

@ -20,17 +20,6 @@
static int g_PROCFS_DIR_FD = -1;
namespace procfs { int PROC_SELF_FD_FD = -1; }
static constexpr const char PROCFS_PATH[] = "/proc";
static constexpr const char PROC_SELF_FD[] = "/proc/self/fd";
// This is critical to the function of the app. abort if failed to
// open.
static
void
_open_proc_self_fd()
{
procfs::PROC_SELF_FD_FD = fs::open(PROC_SELF_FD,O_PATH|O_DIRECTORY);
assert(procfs::PROC_SELF_FD_FD >= 0);
}
int
procfs::init()
@ -47,7 +36,12 @@ procfs::init()
g_PROCFS_DIR_FD = rv;
#if defined(__linux__)
::_open_proc_self_fd();
// This is critical to the function of the app. abort if failed to
// open.
static constexpr const char PROC_SELF_FD[] = "/proc/self/fd";
procfs::PROC_SELF_FD_FD = fs::open(PROC_SELF_FD,O_PATH|O_DIRECTORY);
assert(procfs::PROC_SELF_FD_FD >= 0);
#endif
return 0;