Guess you have to specify O_CREAT flag too in open.<div><br></div><div>Chaitra<br><br>On Sunday, May 25, 2014, Pietro Paolini <<a href="mailto:P.Paolini@genexis.eu">P.Paolini@genexis.eu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello everyone,<br>
in order to try to use mmap() to perform IPC I am writing a test program like this :<br>
<br>
int main(char **argv, int argn)<br>
{<br>
char *addr;<br>
int fd;<br>
<br>
if ((fd = open(FILENAME, O_RDWR) == -1)) {<br>
perror("open:");<br>
exit(1);<br>
}<br>
addr = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);<br>
if (addr == MAP_FAILED) {<br>
printf("mmap() : %p %s", addr, strerror(errno));<br>
exit(1);<br>
}<br>
close(fd);<br>
....<br>
<br>
<br>
I am running under<br>
Linux crunchbang 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux<br>
<br>
My problem is that everytime I have got an "No such device" error which I don't fully get, could a problem of my platoform<br>
or am I simply doing something wrong ?<br>
<br>
Thanks all,<br>
Pietro<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'Kernelnewbies@kernelnewbies.org')">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div>