+
+/** The initSnapshotLibrary function initializes the snapshot library.
+ * @param entryPoint the function that should run the program.
+ */
+void initSnapshotLibrary(unsigned int numbackingpages,
+ unsigned int numsnapshots, unsigned int nummemoryregions,
+ unsigned int numheappages, VoidFuncPtr entryPoint)
+{
+#if USE_MPROTECT_SNAPSHOT
+ mprot_snapshot_init(numbackingpages, numsnapshots, nummemoryregions, numheappages, entryPoint);
+#else
+ fork_snapshot_init(numbackingpages, numsnapshots, nummemoryregions, numheappages, entryPoint);
+#endif
+}
+
+/** The addMemoryRegionToSnapShot function assumes that addr is page aligned. */
+void addMemoryRegionToSnapShot(void *addr, unsigned int numPages)
+{
+#if USE_MPROTECT_SNAPSHOT
+ mprot_add_to_snapshot(addr, numPages);
+#else
+ /* not needed for fork-based snapshotting */
+#endif
+}
+
+/** The takeSnapshot function takes a snapshot.
+ * @return The snapshot identifier.
+ */
+snapshot_id takeSnapshot()
+{
+#if USE_MPROTECT_SNAPSHOT
+ return mprot_take_snapshot();
+#else
+ return fork_take_snapshot();
+#endif
+}
+
+/** The rollBack function rollback to the given snapshot identifier.
+ * @param theID is the snapshot identifier to rollback to.
+ */
+void rollBack(snapshot_id theID)
+{
+#if USE_MPROTECT_SNAPSHOT
+ mprot_roll_back(theID);
+#else
+ fork_roll_back(theID);
+#endif
+}