summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/aral
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnetdata/aral')
-rw-r--r--src/libnetdata/aral/README.md9
-rw-r--r--src/libnetdata/aral/aral.c9
-rw-r--r--src/libnetdata/aral/aral.h4
3 files changed, 7 insertions, 15 deletions
diff --git a/src/libnetdata/aral/README.md b/src/libnetdata/aral/README.md
index d999e820a..564f00f6d 100644
--- a/src/libnetdata/aral/README.md
+++ b/src/libnetdata/aral/README.md
@@ -1,12 +1,3 @@
-<!--
-title: "Array Allocator"
-custom_edit_url: https://github.com/netdata/netdata/edit/master/src/libnetdata/aral/README.md
-sidebar_label: "Array allocator"
-learn_status: "Published"
-learn_topic_type: "Tasks"
-learn_rel_path: "Developers/libnetdata"
--->
-
# Array Allocator
Come on! Array allocators are embedded in libc! Why do we need such a thing in Netdata?
diff --git a/src/libnetdata/aral/aral.c b/src/libnetdata/aral/aral.c
index 64b63d8e0..2ec27b3df 100644
--- a/src/libnetdata/aral/aral.c
+++ b/src/libnetdata/aral/aral.c
@@ -72,7 +72,7 @@ struct aral {
struct {
bool enabled;
const char *filename;
- char **cache_dir;
+ const char **cache_dir;
} mmap;
} config;
@@ -117,7 +117,7 @@ size_t aral_structures(ARAL *ar) {
return aral_structures_from_stats(ar->stats);
}
-struct aral_statistics *aral_statistics(ARAL *ar) {
+struct aral_statistics *aral_get_statistics(ARAL *ar) {
return ar->stats;
}
@@ -709,7 +709,7 @@ size_t aral_element_size(ARAL *ar) {
}
ARAL *aral_create(const char *name, size_t element_size, size_t initial_page_elements, size_t max_page_size,
- struct aral_statistics *stats, const char *filename, char **cache_dir, bool mmap, bool lockless) {
+ struct aral_statistics *stats, const char *filename, const char **cache_dir, bool mmap, bool lockless) {
ARAL *ar = callocz(1, sizeof(ARAL));
ar->config.options = (lockless) ? ARAL_LOCKLESS : 0;
ar->config.requested_element_size = element_size;
@@ -799,6 +799,7 @@ ARAL *aral_create(const char *name, size_t element_size, size_t initial_page_ele
aral_delete_leftover_files(ar->config.name, directory_name, file);
}
+ errno_clear();
internal_error(true,
"ARAL: '%s' "
"element size %zu (requested %zu bytes), "
@@ -1078,7 +1079,7 @@ int aral_stress_test(size_t threads, size_t elements, size_t seconds) {
}
int aral_unittest(size_t elements) {
- char *cache_dir = "/tmp/";
+ const char *cache_dir = "/tmp/";
struct aral_unittest_config auc = {
.single_threaded = true,
diff --git a/src/libnetdata/aral/aral.h b/src/libnetdata/aral/aral.h
index 2e749bc4c..4cd21d17a 100644
--- a/src/libnetdata/aral/aral.h
+++ b/src/libnetdata/aral/aral.h
@@ -28,11 +28,11 @@ struct aral_statistics {
};
ARAL *aral_create(const char *name, size_t element_size, size_t initial_page_elements, size_t max_page_size,
- struct aral_statistics *stats, const char *filename, char **cache_dir, bool mmap, bool lockless);
+ struct aral_statistics *stats, const char *filename, const char **cache_dir, bool mmap, bool lockless);
size_t aral_element_size(ARAL *ar);
size_t aral_overhead(ARAL *ar);
size_t aral_structures(ARAL *ar);
-struct aral_statistics *aral_statistics(ARAL *ar);
+struct aral_statistics *aral_get_statistics(ARAL *ar);
size_t aral_structures_from_stats(struct aral_statistics *stats);
size_t aral_overhead_from_stats(struct aral_statistics *stats);