percpu alloc: add missing extern C
[librseq.git] / include / rseq / percpu-alloc.h
1 /* SPDX-License-Identifier: MIT */
2 /* SPDX-FileCopyrightText: 2024 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */
3
4 #ifndef _RSEQ_PERCPU_ALLOC_H
5 #define _RSEQ_PERCPU_ALLOC_H
6
7 #include <stddef.h>
8 #include <sys/types.h>
9 #include <sys/mman.h>
10
11 /*
12 * rseq/percpu-alloc.h
13 */
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 struct rseq_percpu_pool;
20
21 struct rseq_percpu_pool *rseq_percpu_pool_create(size_t item_len,
22 size_t percpu_len, int max_nr_cpus,
23 int mmap_prot, int mmap_flags, int mmap_fd, off_t mmap_offset,
24 int numa_flags);
25 int rseq_percpu_pool_destroy(struct rseq_percpu_pool *pool);
26
27 void *rseq_percpu_malloc(struct rseq_percpu_pool *pool);
28 void *rseq_percpu_zmalloc(struct rseq_percpu_pool *pool);
29 void rseq_percpu_free(void *ptr);
30
31 void *__rseq_percpu_ptr(void *ptr, int cpu);
32
33 #define rseq_percpu_ptr(ptr, cpu) ((__typeof__(ptr)) __rseq_percpu_ptr(ptr, cpu))
34
35 struct rseq_percpu_pool_set *rseq_percpu_pool_set_create(void);
36 int rseq_percpu_pool_set_destroy(struct rseq_percpu_pool_set *pool_set);
37 int rseq_percpu_pool_set_add_pool(struct rseq_percpu_pool_set *pool_set,
38 struct rseq_percpu_pool *pool);
39
40 void *rseq_percpu_pool_set_malloc(struct rseq_percpu_pool_set *pool_set, size_t len);
41 void *rseq_percpu_pool_set_zmalloc(struct rseq_percpu_pool_set *pool_set, size_t len);
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47 #endif /* _RSEQ_PERCPU_ALLOC_H */
This page took 0.030417 seconds and 5 git commands to generate.