Changeset View
Changeset View
Standalone View
Standalone View
tools/build/cross-build/include/common/sys/sysctl.h
Show All 31 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#pragma once | #pragma once | ||||
#ifdef BOOTSTRAPPING_WANT_NATIVE_SYSCTL | |||||
jrtc27: Hmm. You could make this a BOOTSTRAPPING_WANT_NATIVE_SYSCTL define? That way it's both clearer… | |||||
Done Inline ActionsYeah that's what I had initially (with a different spelling), will update to use yours. arichardson: Yeah that's what I had initially (with a different spelling), will update to use yours. | |||||
/* We need the real sysctl.h e.g. when bootstrapping the LLVM tools. */ | |||||
Not Done Inline ActionsAs mentioned above, I'd rather solve this on a different level, but maybe it's not that easy... dim: As mentioned above, I'd rather solve this on a different level, but maybe it's not that easy...
| |||||
Done Inline ActionsIn general we want to make sure that bootstrap tools don't use sysctl/sysctlbyname() since they generally expect FreeBSD sysctl and then might not work as expected. However, in the case of LLVM we do need the sysctls() on macOS so we need some way of opting into using the real sysctl definitions. arichardson: In general we want to make sure that bootstrap tools don't use sysctl/sysctlbyname() since they… | |||||
#include_next <sys/sysctl.h> | |||||
#else | |||||
/* Otherwise, avoid sysctls since they might not be supported on the host. */ | |||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#define sysctlbyname __freebsd_sysctlbyname | #define sysctlbyname __freebsd_sysctlbyname | ||||
#define sysctl __freebsd_sysctl | #define sysctl __freebsd_sysctl | ||||
int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); | int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); | ||||
int sysctlbyname(const char *, void *, size_t *, const void *, size_t); | int sysctlbyname(const char *, void *, size_t *, const void *, size_t); | ||||
#endif |
Hmm. You could make this a BOOTSTRAPPING_WANT_NATIVE_SYSCTL define? That way it's both clearer and cleaner IMO.