summaryrefslogtreecommitdiff
path: root/libhfcommon
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2019-09-04 21:36:11 +0200
committerRobert Swiecki <robert@swiecki.net>2019-09-04 21:36:11 +0200
commit41a6c8cb44768564e2d6109da374a2ca7ddcd780 (patch)
tree7d01f69798b8acb7969c54421e832533909176ae /libhfcommon
parentb5005f8c005e51f1ba938afd0a168355a483c412 (diff)
downloadhonggfuzz-41a6c8cb44768564e2d6109da374a2ca7ddcd780.tar.gz
libhfcommon/files_mapFileShared
Diffstat (limited to 'libhfcommon')
-rw-r--r--libhfcommon/files.c36
-rw-r--r--libhfcommon/files.h2
2 files changed, 0 insertions, 38 deletions
diff --git a/libhfcommon/files.c b/libhfcommon/files.c
index 549a2894..01047538 100644
--- a/libhfcommon/files.c
+++ b/libhfcommon/files.c
@@ -370,42 +370,6 @@ uint8_t* files_mapFile(const char* fileName, off_t* fileSz, int* fd, bool isWrit
return buf;
}
-uint8_t* files_mapFileShared(const char* fileName, off_t* fileSz, int* fd) {
- if ((*fd = TEMP_FAILURE_RETRY(open(fileName, O_RDONLY))) == -1) {
- PLOG_W("Couldn't open() '%s' file in R/O mode", fileName);
- return NULL;
- }
-
- struct stat st;
- if (fstat(*fd, &st) == -1) {
- PLOG_W("Couldn't stat() the '%s' file", fileName);
- close(*fd);
- return NULL;
- }
-
- uint8_t* buf;
- int mmapflags = MAP_SHARED;
-#if defined(MAP_NOSYNC)
- /*
- * Some kind of bug in FreeBSD kernel. Without this flag, the shm_open() memory will cause a lot
- * of troubles to the calling process when mmap()'d
- */
- mmapflags |= MAP_NOSYNC;
-#endif /* defined(MAP_NOSYNC) */
-#if defined(MAP_HASSEMAPHORE)
- /* We use mutexes, so.. */
- mmapflags |= MAP_HASSEMAPHORE;
-#endif /* defined(MAP_HASSEMAPHORE) */
- if ((buf = mmap(NULL, st.st_size, PROT_READ, mmapflags, *fd, 0)) == MAP_FAILED) {
- PLOG_W("Couldn't mmap() the '%s' file", fileName);
- close(*fd);
- return NULL;
- }
-
- *fileSz = st.st_size;
- return buf;
-}
-
void* files_mapSharedMem(size_t sz, int* fd, const char* name) {
*fd = -1;
diff --git a/libhfcommon/files.h b/libhfcommon/files.h
index 99090db2..31741c15 100644
--- a/libhfcommon/files.h
+++ b/libhfcommon/files.h
@@ -61,8 +61,6 @@ extern bool files_copyFile(
extern uint8_t* files_mapFile(const char* fileName, off_t* fileSz, int* fd, bool isWritable);
-extern uint8_t* files_mapFileShared(const char* fileName, off_t* fileSz, int* fd);
-
extern void* files_mapSharedMem(size_t sz, int* fd, const char* name);
extern size_t files_parseSymbolFilter(const char* inFIle, char*** filterList);