Fix small building issue on linux/unix system when building with mmap.

This commit is contained in:
Godzil 2022-05-27 12:18:18 +01:00
parent 8a604309bb
commit bbef89bcd9
2 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#ifndef MINIFFS_H #ifndef MINIFFS_H
#define MINIFFS_H #define MINIFFS_H
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>

View File

@ -9,6 +9,13 @@
* *
******************************************************************************/ ******************************************************************************/
#ifndef _WIN32
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#endif
static miniffs_t *get_fs(const char *filename) static miniffs_t *get_fs(const char *filename)
{ {
#ifdef BUILD_PLATFORM_MEMORY #ifdef BUILD_PLATFORM_MEMORY
@ -34,7 +41,7 @@ static miniffs_t *get_fs(const char *filename)
fstat(fd, &FileStat); fstat(fd, &FileStat);
fs_image = (char *)mmap(NULL, FileStat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); fs_image = (char *)mmap(NULL, FileStat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd); close(fd);
fileSize = FileStat.st_size fileSize = FileStat.st_size;
if (fs_image == MAP_FAILED) if (fs_image == MAP_FAILED)
{ {
fs_image = NULL; fs_image = NULL;