[libcxx] Why is <sys/sysctl.h> included by default?

I want to switch some code from black-listing platforms to white-listing platforms instead.
Does anyone know what OSes / platforms want to use sys/sysctl.h in thread.cpp?

Longer post:
I suspect that this is rapidly going to turn into a discussion on how libcxx does preprocessor platform detection, but that's kind of what I want to talk about anyway.

Libcxx's thread.cpp has this chunk of code:
   #if !defined(_WIN32)
   # if !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__) && !defined(__CloudABI__)
   # include <sys/sysctl.h>
   # endif // !defined(__sun__) && !defined(__linux__) && !defined(_AIX) && !defined(__native_client__) && !defined(__CloudABI__)
   # include <unistd.h>
   #endif // !_WIN32

So if your OS is not one of the six listed (_WIN21, __sun__, __linux__, AIX, __native_client__, __CloudABI__), then you get to include sys/sysctl.h. sysctl.h isn't defined by the standard C library, and isn't part of POSIX.

I'm trying to add some new embedded OS and C library support to libcxx, and I don't have a sys/sysctl.h. I think the correct and maintainable thing to do here is to switch away from black-listing certain OSes, and instead white-list the OSes that want to use sys/sysctl.h here. I don't know what that list is though.

I'm a little more forgiving of unistd.h, as POSIX at least partially defines that header.

That list is anything BSD-derived (FreeBSD, NetBSD, OpenBSD, DragonFlyBSD, iOS, OS X, at least, so a similar length list to the blacklist currently).

That said, it looks as if sysctl is only used in thread::hardware_concurrency() though, and there’s a fallback path using sysconf, which should be portable to all vaguely *NIX-like platforms. The fallback path works at least on OS X, FreeBSD, and Linux (and presumably Dragonfly, as I believe this code predates their fork), so probably makes more sense. I don’t know if any other BSDs fail to implement sysconf(_SC_NPROCESSORS_ONLN), but that code path may actually be dead.