I'd say that the most significant category of objects that don't have file descriptors is the objects that the kernel doesn't manage. There is only limited support for having userspace create structures and then expose them to other programs or other parts of the same program (e.g., from a library to an application) through file descriptors. Of course, programs use a wide variety of objects not managed by the kernel, and many of them could be interacted with primarily through the system calls that use file descriptors. For example, it would be extremely handy in a GUI toolkit to be able to create a dialog box, select() on its file descriptor (along with other sources of input), and then read() the user's response, rather than needing to use callback mechanisms specified by (and particular to) the GUI toolkit. There are also more straightforward examples of cases where userspace provides access to objects which are just like objects that the kernel manages and has file descriptors for, but where the particular objects are not managed by the kernel; for example, the PCM data in a compressed audio file, or everything that Gnome VFS provides beyond the kernel-provided filesystem.
Ghosts of Unix Past: a historic search for design patterns
Posted Oct 27, 2010 17:49 UTC (Wed) by wahern (subscriber, #37304)
[Link]
The dialog box's API could just provide a socket descriptor. Reads are troublesome; you could allow atomic reads if the socket was a SOCK_DGRAM type, but only up to some limit (usually around 65535).
In Linux you could use an eventfd for signaling, and either fall back to the API for reading, or use a second descriptor (i.e. an unlinked tmp file to hold the contents).
It's all quite ugly, though, except eventfd can be an elegant solution for purely signaling purposes. And none of this is based on named objects, only anonymous descriptors. FUSE seems like overkill, though.
Ghosts of Unix Past: a historic search for design patterns
Posted Oct 27, 2010 23:10 UTC (Wed) by jg (subscriber, #17537)
[Link]
Fuse would be fine... Seems like the right idea to me. Sure beats the NFS X implementation, that most have mercifully forgotten was done at one point. I'd certainly like to be able to wander through my graphics system for lots of reasons.
Unfortunately, it didn't exist in 1984: there were 20 file descriptors total a process could use in that era.
- Jim