2022-04-11 15:03 (UTC+0200), Antonio Di Bacco:
> I did a short program where a primary (--file-prefix=p1) allocates a
> memzone and generates a file descriptor that is passed to another primary
> (--file-prefix=p2) .
> The process P2 tries to mmap the memory but I get an error (Bad file
> descriptor):
>
> uint64_t* addr = mmap(NULL, 1024*1024*1024, PROT_READ, flags,
> mem_fd, 0);
> if (addr == -1)
> perror("mmap");
How do you pass the FD?
Memif does the same thing under the hood, so you should be able too.
Ok, after having a look to memif I managed to exchange the fd between the two processes and it works.
Anyway the procedure seems a little bit clunky and I think I'm going to use the new SYSCALL pidfd_getfd
to achieve the same result. In your opinion this method (getfd_pidfd) could also work if the two DPDK processes
are inside different docker containers?
Or is there another mechanims like using handles to hugepages present in the filesystem to share between two
different containers?