Skip to content

Commit 2badb12

Browse files
committed
Add util_get_page_size() to utils_common.h
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent dc10beb commit 2badb12

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/utils/utils_common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#include <stdlib.h>
1616
#include <string.h>
1717

18+
#ifndef _WIN32
19+
#include <sys/syscall.h>
20+
#include <unistd.h>
21+
#endif
22+
1823
#ifdef __cplusplus
1924
extern "C" {
2025
#endif
@@ -44,6 +49,9 @@ static inline char *util_getenv(const char *name) {
4449

4550
static inline void util_free_getenv(char *val) { free(val); }
4651

52+
// TODO: implement util_get_page_size() for Windows
53+
static inline size_t util_get_page_size(void) { return 4096; }
54+
4755
#else /* Linux */
4856

4957
#define __TLS __thread
@@ -53,6 +61,8 @@ static inline void util_free_getenv(const char *val) {
5361
(void)val; // unused
5462
}
5563

64+
static inline size_t util_get_page_size(void) { return sysconf(_SC_PAGE_SIZE); }
65+
5666
#endif /* _WIN32 */
5767

5868
// check if we are running in the proxy library

0 commit comments

Comments
 (0)