This content has been marked as final. Show 3 replies
I think you'll need a better explanation. You statement
Solaris only passes the device number to open(), so I can only determine my device was opened, but not which file.doesn't make any sense, unless you are asking if you can figure out what path is being used - if you need that, I think you are out of luck, since I don't think there's anyway to distinguish mknod devices if they have the same major and minor numbers. If you are asking how to keep track of instances, you might want to look at streams devices (like /dev/tcp) as an example.
Thanks for the reply!
A more specific description of the problem is: If the device is opened multiple times by a single process, then how do I determine which of the user's open file descriptors called the device operation?
For now, we've decided to limit one open file descriptor per user process, then determine the user with ddi_get_pid().
I'm still at a loss why you need to know the file descriptor value (unless the app is sufficiently spaghettied that it has to query the driver to figure out what it opened with what). It's like asking what filename was used to open the device (which you can't get either). Since Solaris is based on a Streams framework, it would be bad to have drivers to even think it has a direct mapping into user space. It would be the same in asking (using /bin/sh):
prog3 4>&1 3>&1 2>&1 | prog2 | prog1
and you want to know from prog1 what descriptor prog3 wrote to. I don't see how linux even does this properly, since any given file open can have multiple file descriptors (via dup).