chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mmap: resize arrays dynamically
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index 359a7cac3e4e6231cfc6b6c60326543275484db7..725c979c8799347555b831ab695aa86e2a43ea1d 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-1118,7
+1118,7
@@
static int add_file(sd_journal *j, const char *prefix, const char *filename) {
return 0;
}
return 0;
}
- r = journal_file_open(path, O_RDONLY, 0, false, false, NULL, NULL, &f);
+ r = journal_file_open(path, O_RDONLY, 0, false, false, NULL,
j->mmap,
NULL, &f);
free(path);
if (r < 0) {
free(path);
if (r < 0) {
@@
-1439,6
+1439,14
@@
static sd_journal *journal_new(int flags, const char *path) {
return NULL;
}
return NULL;
}
+ j->mmap = mmap_cache_new();
+ if (!j->mmap) {
+ hashmap_free(j->files);
+ hashmap_free(j->directories_by_path);
+ free(j->path);
+ free(j);
+ }
+
return j;
}
return j;
}
@@
-1527,6
+1535,9
@@
_public_ void sd_journal_close(sd_journal *j) {
sd_journal_flush_matches(j);
sd_journal_flush_matches(j);
+ if (j->mmap)
+ mmap_cache_unref(j->mmap);
+
free(j->path);
free(j);
}
free(j->path);
free(j);
}