<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno lun 11 apr 2022 alle ore 19:30 Dmitry Kozlyuk <<a href="mailto:dmitry.kozliuk@gmail.com">dmitry.kozliuk@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">2022-04-11 15:03 (UTC+0200), Antonio Di Bacco:<br>
> I did a short program where a  primary (--file-prefix=p1) allocates a<br>
> memzone and generates a file descriptor that is passed to another primary<br>
> (--file-prefix=p2) .<br>
> The process P2 tries to mmap the memory but I get an error (Bad file<br>
> descriptor):<br>
> <br>
>         uint64_t* addr = mmap(NULL, 1024*1024*1024, PROT_READ, flags,<br>
> mem_fd, 0);<br>
>         if (addr == -1)<br>
>             perror("mmap");<br>
<br>
How do you pass the FD?<br>
Memif does the same thing under the hood, so you should be able too.<br></blockquote><div><br></div><div><br></div><div>Ok, after having a look to memif I managed to exchange the fd  between the two processes and it works. </div><div>Anyway the procedure seems a little bit clunky and I think I'm going to use the new SYSCALL pidfd_getfd </div><div>to achieve the same result.  In your opinion this method (getfd_pidfd) could also work if the two DPDK processes</div><div>are inside different docker containers? </div><div>Or is there another mechanims like using handles to hugepages present in the filesystem to share between two</div><div>different containers? </div><div><br></div><div><br></div></div></div>