Implementing ioctl () Commands in FreeBSD

I am adding code to an existing FreeBSD device driver, and I am trying to pass char*from user space to the driver. I implemented a custom command ioctl()using a macro _IOWas follows:#define TIBLOOMFILTER _IOW(0,253,char*)

My call looks something like this:

int file_desc = open("/dev/ti0", O_RDWR);
ioctl(file_desc, TIBLOOMFILTER, (*filter).getBitArray());
close(file_desc);

When I call ioctl(), I get: Inappropriate ioctl for deviceas an error message. Any guess on what might be doing wrong? I defined the same macro in my device driver and added it to the statement case.

+3
source share
1 answer

You registered your ioctl handler with

.d_ioctl  = ioctl_handler

in? devsw (char/ )?

+1

Source: https://habr.com/ru/post/1737967/


All Articles