Is there a to prevent a file descriptor being closed

ayaka ayaka at
Thu Nov 16 16:22:51 EST 2017


   I am writing a driver to operation with the dma-buf, a problem I meet 
is that a dma-buf maybe closed by the other driver or userspace 
application, then the same number of the file descriptor will be 
assigned with the other thing, its private data is different. I watch 
what the drm system do. The drm system doesn't use the file descriptor 
but the its private data (from dma_buf_get()) to check whether it is the 
same buffer.

   Is there a reference in the file descriptor? And is there a way  to 
increase the reference to a file descriptor.

   I have designed a way to track the usage of the dma-buf of my driver, 
there is not a problem for the driver to release them. But I just want 
the new dma-buf is assigned with new file descriptor number, not re-use 
the closed one.

   Thank you.

More information about the Kernelnewbies mailing list