From: Kenneth Johansson <kenneth.johansson@inn.ericsson.se>
To: mtd <linux-mtd@lists.infradead.org>
Subject: Problem with mmap
Date: Wed, 29 Aug 2001 17:47:33 +0200 [thread overview]
Message-ID: <3B8D0E95.FF94487@inn.ericsson.se> (raw)
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
Here is a program that works on ext2 but not on jffs2.
--
Kenneth Johansson
Ericsson Business Innovation AB Tel: +46 8 404 71 83
Viderögatan 3 Fax: +46 8 404 72 72
164 80 Stockholm kenneth.johansson@inn.ericsson.se
[-- Attachment #2: fail1.c --]
[-- Type: text/plain, Size: 748 bytes --]
#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);
}
next reply other threads:[~2001-08-29 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-29 15:47 Kenneth Johansson [this message]
2001-08-29 16:11 ` Problem with mmap David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B8D0E95.FF94487@inn.ericsson.se \
--to=kenneth.johansson@inn.ericsson.se \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.