1

I have a kernel module that intercepts IOCTL system calls. Now as you now the IOCTL signature is like int ioctl(int fd, unsigned long request, ...); Now I want to have a condition on "fd", actually I want to do a special thing in my kernel module when file descriptor parameter is linked to a special file path (e.g /dev/binder/).

Now my question is that, is fd that linked to kernel driver file is unique all the time or no? if yes, can I retrieve the file descriptor that linked to intended file path with readlink command and hardcode that in my kernel module code to detect the special kernel driver file descriptor? if no, how I can detect the special kernel driver file descriptor in my kernel module?

Cert
  • 99
  • 1
  • 2
  • 9
  • File descriptor for the concrete file is not constant/predefined. For extract name of the file, corresponded to file's descriptor, use answer for this [related question](http://stackoverflow.com/questions/8250078/how-can-i-get-a-filename-from-a-file-descriptor-inside-a-kernel-module). – Tsyvarev Apr 07 '16 at 09:06

0 Answers0