aboutsummaryrefslogtreecommitdiffstats
path: root/teststore.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2001-07-08 21:51:31 +0000
committerH. Peter Anvin <hpa@zytor.com>2001-07-08 21:51:31 +0000
commit7be4b5ec6f20e3ffe13e2a574549e8028faba526 (patch)
tree8e14b9522e61a08a1c09c69639c0797c52b4368b /teststore.c
downloadlpsm-7be4b5ec6f20e3ffe13e2a574549e8028faba526.tar.gz
lpsm-7be4b5ec6f20e3ffe13e2a574549e8028faba526.tar.xz
lpsm-7be4b5ec6f20e3ffe13e2a574549e8028faba526.zip
Initial version under CVS control
Diffstat (limited to 'teststore.c')
-rw-r--r--teststore.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/teststore.c b/teststore.c
new file mode 100644
index 0000000..14c40fc
--- /dev/null
+++ b/teststore.c
@@ -0,0 +1,47 @@
+#ident "$Id$"
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2000 Transmeta Corporation - All Rights Reserved
+ *
+ * This source module contains confidential and proprietary information
+ * of Transmeta Corporation. It is not to be disclosed or used except
+ * in accordance with applicable agreements. This copyright notice does
+ * not evidence any actual or intended publication of such source code.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include "objstore.h"
+
+int main(int argc, char *argv[])
+{
+ void *buf;
+ int arena_len = 16384;
+
+ buf = objstore_init("test.dat", "test.log", &arena_len);
+
+ printf("Read from first page: %s\n", (char *)buf);
+
+ strcpy((char *)buf + 4096, "This is the second page!");
+ strcpy((char *)buf + 8192, "This is the third page!");
+
+ printf("Read from third page: %s\n", (char *)buf + 8192);
+ objstore_checkpoint(0.5);
+
+ strcpy((char *)buf + 8192, "This is also the third page!");
+
+ printf("Read from third page: %s\n", (char *)buf + 8192);
+ objstore_checkpoint(0.0);
+
+ objstore_extend(65536);
+ strcpy((char *)buf + 32768, "This is the ninth page!");
+ objstore_checkpoint(0.0);
+
+ sleep(5);
+
+ return 0;
+}
+