1
1
/*
2
- * Copyright (C) 2024 Intel Corporation
2
+ * Copyright (C) 2024-2025 Intel Corporation
3
3
*
4
4
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
5
5
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
*/
7
7
8
8
#include <assert.h>
9
- #include <stdio.h>
10
9
#include <sys/mman.h>
11
- #include <sys/syscall.h>
12
10
#include <unistd.h>
13
11
14
- #include "base_alloc.h"
15
- #include "base_alloc_global.h"
16
12
#include "utils_concurrency.h"
17
13
18
14
static UTIL_ONCE_FLAG Page_size_is_initialized = UTIL_ONCE_FLAG_INIT ;
19
15
static size_t Page_size ;
20
16
21
17
void * ba_os_alloc (size_t size ) {
22
- void * ptr = mmap (NULL , size , PROT_READ | PROT_WRITE ,
23
- MAP_PRIVATE | MAP_ANONYMOUS , -1 , 0 );
18
+ void * ptr = utils_mmap (NULL , size , PROT_READ | PROT_WRITE ,
19
+ MAP_PRIVATE | MAP_ANONYMOUS , -1 , 0 );
24
20
// this should be unnecessary but pairs of mmap/munmap do not reset
25
21
// asan's user-poisoning flags, leading to invalid error reports
26
22
// Bug 81619: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81619
@@ -29,7 +25,7 @@ void *ba_os_alloc(size_t size) {
29
25
}
30
26
31
27
void ba_os_free (void * ptr , size_t size ) {
32
- int ret = munmap (ptr , size );
28
+ int ret = utils_munmap (ptr , size );
33
29
assert (ret == 0 );
34
30
(void )ret ; // unused
35
31
}
0 commit comments