Problem with mmap
Here is a program that works on ext2 but not on jffs2.
Signature · 4 lines
Kenneth Johansson Ericsson Business Innovation AB Tel: +46 8 404 71 83 Viderögatan 3 Fax: +46 8 404 72 72 164 80 Stockholm [email protected]
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <stdio.h>
#include <string.h>
static const char *file = "mmap_file";
#define FILE_SIZE 8192
int main ()
{
int i,fd;
unsigned char *map;
if ((fd = open ("mmap_file",O_RDWR|O_CREAT)) < 0) {
printf("Could not open file %s\n",file);
perror (NULL);
exit (1);
} map = mmap (NULL,
FILE_SIZE,
PROT_READ | PROT_WRITE,
MAP_SHARED,
fd,
0);
if (map == MAP_FAILED){
printf("Could not mmap file %s\n",file);
perror (NULL);
exit (1);
}
printf("mmap of file %s OK\n",file); munmap (map,FILE_SIZE);
close (fd);
exit (0);
}
Quoted 1 line · [email protected] said:
Here is a program that works on ext2 but not on jffs2.
http://mhonarc.axis.se/jffs-dev/msg00963.html
--
dwmw2