Open file descriptors on a file

Is there a userland C function available that will tell me the number of open file descriptors on a file? I'm trying to write a program that accesses a user's mailbox, and once I rename the mailbox to mailbox.lock, I want to be sure that there are no open file descriptors left open on it before I start processing the file. (I want to make sure procmail has finished any pending writes). I thought the best way to do this would be to check for remaining open file descriptors, but I cannot find a userland C function that supports this.
 
jostrowski said:
I thought the best way to do this would be to check for remaining open file descriptors

I don't think so. New file descriptors can be obtained between the moment you checked and the moment you started moving the file (it may be a long shot but it can happen).

Have you considered using flopen()()?

Hope this helps,

Alphons
 
Back
Top