On Tue, May 28, 2019 at 5:10 PM David Howells <dhowells@xxxxxxxxxx> wrote: > > Implement a misc device that implements a general notification queue as a > ring buffer that can be mmap()'d from userspace. > > The way this is done is: > > (1) An application opens the device and indicates the size of the ring > buffer that it wants to reserve in pages (this can only be set once): > > fd = open("/dev/watch_queue", O_RDWR); > ioctl(fd, IOC_WATCH_QUEUE_NR_PAGES, nr_of_pages); > > (2) The application should then map the pages that the device has > reserved. Each instance of the device created by open() allocates > separate pages so that maps of different fds don't interfere with one > another. Multiple mmap() calls on the same fd, however, will all work > together. > > page_size = sysconf(_SC_PAGESIZE); > mapping_size = nr_of_pages * page_size; > char *buf = mmap(NULL, mapping_size, PROT_READ|PROT_WRITE, > MAP_SHARED, fd, 0); Would it make sense to use relayfs for the implementation of the mapped ring buffer? Thanks, Miklos