简体   繁体   中英

Conflicting header files in Linux Kernel Module

I'm trying to write a Linux kernel module that uses first_net_device() from <linux/netdevice.h> and getsockname() from <sys/socket.h> . The problem at compile time is that these two header files have some duplicate definitions, resulting in a compilation failure. How do I solve this? Thanks

The sys/socket.h header is not a kernel header. When you try and add it to your module you'll almost certainly get errors because it's not part of the kernel. Have a look at this answer for more details....

Why can't we use C standard library functions in kernel development?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM