|
|
Subscribe / Log in / New account

why are ringbuffers bound to an existing file descriptor?

why are ringbuffers bound to an existing file descriptor?

Posted Jun 13, 2024 13:42 UTC (Thu) by koverstreet (✭ supporter ✭, #4296)
In reply to: why are ringbuffers bound to an existing file descriptor? by donald.buczek
Parent article: A generic ring buffer for the kernel

Excluding the ringbuffer_wait and ringbuffer_wait syscalls, a ringbuffer is just a region of memory.

So once we switch to futex operations for wait/wake, you'll be able to make your own ringbuffer in shared memory, no kernel involvement.


to post comments

why are ringbuffers bound to an existing file descriptor?

Posted Jun 14, 2024 17:12 UTC (Fri) by donald.buczek (subscriber, #112892) [Link] (1 responses)

Thanks.

I was just curious whether an unconventional use of the proposed ringbuffer API for userspace to userspace communication would work, assuming that whatever the kernel does with the ringbuffer for the chosen file type doesn't interfere or is taken into account. It's not sensible or needed, though, because that can be done right now and you only need help from the kernel for the non-spinning wait, e.g., via futex, which is available.

Regarding my first question, why a ringbuffer needs to be associated with a file descriptor: Do you expect ringbuffers will only be used as an alternative api to the same data channels as accessible by reading/writing the file descriptors? Is this why there is no standalone ringbuffer? Any kernel feature which supports ringbuffer communication should also support conventional I/O on the same descriptor?

why are ringbuffers bound to an existing file descriptor?

Posted Jun 14, 2024 18:52 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

There are now FDs that don't support regular reading/writing. For example, pidfd().


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds