I have a kernel module I'm building where I modified some protocols which changes socket.h
, and I patched my running kernel with these changes. Then I test these sockets with a user-space program which requires I include the patched header. So in my user-space C
file I include the header as such.
#include "include/linux/socket.h"
And in my Makefile.am
I have a CFLAG with -I$(LINUX_DIR)
which I point to the patched kernel sources.
But this socket.h
file also pulls in a few others to include asm/linkage.h
. The problem is that, there are linkage.h files for each architecture.
/usr/src/linux $ find . -name linkage.h./arch/sh/include/asm/linkage.h./arch/m68k/include/asm/linkage.h./arch/s390/include/asm/linkage.h./arch/x86/include/asm/linkage.h./arch/riscv/include/asm/linkage.h./arch/alpha/include/asm/linkage.h./arch/arc/include/asm/linkage.h./arch/c6x/include/asm/linkage.h./arch/powerpc/include/asm/linkage.h./arch/nios2/include/asm/linkage.h./arch/arm/include/asm/linkage.h./arch/parisc/include/asm/linkage.h./arch/arm64/include/asm/linkage.h./arch/unicore32/include/asm/linkage.h./arch/xtensa/include/asm/linkage.h./arch/nds32/include/asm/linkage.h./arch/hexagon/include/asm/linkage.h./arch/ia64/include/asm/linkage.h./arch/mips/include/asm/linkage.h./arch/openrisc/include/asm/linkage.h./include/linux/linkage.h./include/asm-generic/linkage.h./tools/include/linux/linkage.h./tools/perf/util/include/linux/linkage.h
I understand that normally I'd be using the system file which is already chosen for this architecture, i.e., /usr/include/system/socket.h
.
But as I don't want to contaminate my system with my patches and I'm testing this one kernel source tree ... how would I have the socket.h
file choose the correct architecture/headers I want to pull in?