aboutsummaryrefslogtreecommitdiffstats
path: root/arena.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2001-10-18 06:15:32 +0000
committerH. Peter Anvin <hpa@zytor.com>2001-10-18 06:15:32 +0000
commit3adff3ab0f554dc8d08c563f61b93e7c1ca80805 (patch)
tree6021f89e30cd33b74700615161e889135134133b /arena.c
parent26f21f20a407f7982a9710e95bdc7496a2609edd (diff)
downloadlpsm-3adff3ab0f554dc8d08c563f61b93e7c1ca80805.tar.gz
lpsm-3adff3ab0f554dc8d08c563f61b93e7c1ca80805.tar.xz
lpsm-3adff3ab0f554dc8d08c563f61b93e7c1ca80805.zip
Change the object store to use a file-backed mmap by default.
*** THIS MIGHT HAVE TO BE BACKED OUT IF THE LINUX KERNEL IS TOO DUMB *** Add recovery test.
Diffstat (limited to 'arena.c')
-rw-r--r--arena.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arena.c b/arena.c
index 7ab018e..4d3f611 100644
--- a/arena.c
+++ b/arena.c
@@ -655,3 +655,22 @@ int objstore_extend(size_t new_size)
while ( fcntl(os->main_fd, F_SETLKW, &lock) == -1 && errno == EINTR );
return -1;
}
+
+/*
+ * Shut down the object store, free all resources.
+ * THIS DOES NOT CHECKPOINT - call objstore_checkpoint() first
+ * if you want that functionality. Calling this function without
+ * first checkpointing and then calling objstore_init() can be used
+ * to (very slowly) roll back to the last commit point.
+ */
+void objstore_shutdown(void)
+{
+ struct ObjStore *os = objstore_os_struct;
+
+ munmap(os->arena, os->arena_len);
+ free(os->pageinfo);
+ sigaction(SIGSEGV, &os->oldact, NULL);
+ close(os->log_fd);
+ close(os->main_fd);
+ free(os);
+}