views:

123

answers:

2

I'm working with Rad Hat 8.0, trying to make changes to the kernel, and I'm at the compilation stage. I have a header in include/linux where I define wrapper functions, and they use errno. I included errno.h using #include <errno.h>. When I try to compile, it tells me "errno.h no such file or directory". When I try #include <linux/errno.h> it finds it but complains that I did not declare errno the variable before use. I looked at errno.h and it really doesn't have it declared, which is confusing because I was under the impression that this is where it is defined.

Am I looking in the wrong places? How do I make use of errno?

A: 

errno is defined as an extern in

/usr/src/lib/linux/errno.c

you have to compile this file with yours

ennuikiller
+1  A: 

For kernel code, #include <linux/errno.h>.

The extern declaration for errno is in #include <linux/unistd.h>.

David Joyner