- Update some headers that was incorrect - Reformat the code in all files to match the same code style - Removal of unwanted/unneeded files
40 lines
631 B
C
40 lines
631 B
C
/*
|
|
* Copyright (c) 2003-2018 986-Studio. All rights reserved.
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <signal.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
/* Map a file in memory */
|
|
void *LoadFilePtr(char *filename)
|
|
{
|
|
int fd;
|
|
void *RetPtr;
|
|
struct stat FileStat;
|
|
|
|
fd = open(filename, O_RDONLY);
|
|
|
|
fstat(fd, &FileStat);
|
|
|
|
RetPtr = mmap(NULL, FileStat.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
|
|
|
close(fd);
|
|
|
|
if (RetPtr == MAP_FAILED)
|
|
{
|
|
RetPtr = NULL;
|
|
}
|
|
|
|
return RetPtr;
|
|
}
|