This scheme would also work for @sima 's #dmabuf file handles (should that become an actual thing) or other in-kernel filesystems.

For example, namespace file descriptors could work the same way although they would need to be uniqified and a lookup routine for them implemented similar to what I did with #pidfs.