Fatal error: sys/ioctl.h: No such file or directory

Hi,
while writing a kernel module, I get the following error:

fatal error: sys/ioctl.h: No such file or directory

The strange thing is, that all other include like <linux/xxx.h> are working without a problem and they are in the same usr/include/ path in the toolchain.

I also tried to give it the full path to this directory, but the problem remains.

Any advice?

Regards,
Simon

you can use
#include <linux/ioctl.h>

I can compile with this line.

unfortunately that’s also not working, because it says that ioctl() is declared implicitly.
Please see the attached minimal project:
ioctltest.zip (1.7 KB)

There are also problem with finding other includes like fcntl.h to use the open() function, which I need for SPI.
I installed legato with leaf, so this is a completely basic setup.
I’m really curious why this is not working. All the other files that include header files like that are working.

Thanks,
Simon

I think ioctl() is for user application, not for inside kernel module

Also open() is for user application, not for kernel module.

Here is an example showing using spi in kernel module:

puhh, ok, I’ll try :slight_smile: