file name for the open character special device file in driver code
In solaris when open call to char special device file is made in user space, the driver's open call is called with only two parameters. 1. major and mi开发者_如何学JAVAnor number and 2. flag that contains read/write etc.. Is there any way to the get the name of the opened device file in driver's open call. or Is there any way to get the name of the device file from major and minor number in driver code?
I doubt the OS has any way to retrieve the name of the device file. Actually, this file name is not enforced by the OS and can be any name created with the mknod command. The only things that matter are the major and minor device numbers.
You can go through the lists of entries in /dev
or /devices
and compare the numbers. But of course in general, the special file could have been created anywhere in the filesystem.
But you shouldn't try doing this. Which problem are you trying to solve by this?
精彩评论