Skip to content

Commit a73297b

Browse files
authored
CDRIVER-4505 Fix build on MacOS due to undeclared getpagesize (#1136)
Fix build on MacOS due to undeclared getpagesize CDRIVER-4505 It appears that getpagesize has been deprecated on newer MacOS versions. We can see that POSIX version 7 (link below) has removed getpagesize altogether from the standard, so even including unistd.h does not solve this problem on newer MacOS versions. Please see here at section B.3.2 System Interfaces Removed in the Previous Version: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap03.html Relevant stackoverflow: https://stackoverflow.com/a/37193970 Jira: https://jira.mongodb.org/browse/CDRIVER-4505
1 parent 0af86d2 commit a73297b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libmongoc/src/mongoc/mongoc-counters.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#ifdef BSON_OS_UNIX
2525
#include <sys/mman.h>
2626
#include <sys/shm.h>
27+
#include <unistd.h>
2728
#endif
2829

2930
#ifdef _MSC_VER
@@ -111,7 +112,7 @@ mongoc_counters_calc_size (void)
111112
(n_cpu * n_groups * sizeof (mongoc_counter_slots_t)));
112113

113114
#ifdef BSON_OS_UNIX
114-
return BSON_MAX (getpagesize (), size);
115+
return BSON_MAX (sysconf (_SC_PAGESIZE), size);
115116
#else
116117
return size;
117118
#endif

0 commit comments

Comments
 (0)