summaryrefslogtreecommitdiff
path: root/source3/lib/util_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r--source3/lib/util_file.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index 06008886c0..fff564aeb0 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -441,6 +441,26 @@ char *file_load(const char *fname, size_t *size, size_t maxsize)
}
/*******************************************************************
+ unmap or free memory
+*******************************************************************/
+
+BOOL unmap_file(void* start, size_t size)
+{
+#ifdef HAVE_MMAP
+ if ( munmap( start, size ) != 0 ) {
+ DEBUG( 1, ("map_file: Failed to unmap address %X "
+ "of size %d - %s\n",
+ start, size, strerror(errno) ));
+ return False;
+ }
+ return True;
+#else
+ SAFE_FREE( start );
+ return True;
+#endif
+}
+
+/*******************************************************************
mmap (if possible) or read a file.
********************************************************************/