ti-nesulator/src/os/macos/loadfile.c
Godzil cdda587579 [Cosmetics]
- Update some headers that was incorrect
- Reformat the code in all files to match the same code style
- Removal of unwanted/unneeded files
2018-02-02 17:43:15 +00:00

41 lines
643 B
C

/*
* File functions - The peTI-NESulator Project
* os/macos/load.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>
#include <os_dependent.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);
return RetPtr;
}