Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@
#include <vm/vm_param.h>
#endif // HAVE_XSWDEV

#if HAVE_XSW_USAGE
#include <sys/sysctl.h>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys/sysctl.h provides struct xsw_usage. I can either put that in #ifdef __APPLE__ or just under a check for HAVE_XSW_USAGE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HAVE_XSW_USAGE sounds good to me

#endif // HAVE_XSW_USAGE

#ifdef __APPLE__
#include <mach/vm_types.h>
#include <mach/vm_param.h>
#include <mach/mach_port.h>
#include <mach/mach_host.h>
#endif // __APPLE__

#if HAVE_SYSCTL
#if HAVE_SYSCONF
// <unistd.h> already included above
#elif HAVE_SYSCTL
#include <sys/sysctl.h>
#else
#error "Don't know how to get total physical memory on this platform"
#endif

#ifdef __linux__
Expand Down
11 changes: 9 additions & 2 deletions src/pal/src/misc/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ Revision History:
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <sys/types.h>
#if HAVE_SYSCTL

#if HAVE_SYSCONF
// <unistd.h> already included above
#elif HAVE_SYSCTL
#include <sys/sysctl.h>
#elif !HAVE_SYSCONF
#else
#error Either sysctl or sysconf is required for GetSystemInfo.
#endif

#if HAVE_SYSCTLBYNAME
#include <sys/sysctl.h>
#endif

#if HAVE_SYSINFO
#include <sys/sysinfo.h>
#endif
Expand Down