LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   building module... errno undeclared (https://www.linuxquestions.org/questions/programming-9/building-module-errno-undeclared-910148/)

dbrazeau 10-25-2011 06:55 PM

building module... errno undeclared
 
I'm trying to build a driver module, but I keep getting:
Code:

error: 'errno' undeclared (first use in this function)
I'm including <linux/errno.h>, and it apparently has no problem finding it, so why is errno still undeclared?

NevemTeve 10-25-2011 10:20 PM

I think there is no errno when you are in the kernel space; return values between -4095 and -1 are the error codes.

dbrazeau 10-26-2011 11:39 AM

Quote:

Originally Posted by NevemTeve (Post 4508395)
I think there is no errno when you are in the kernel space; return values between -4095 and -1 are the error codes.

I believe you are correct. If you return an negative number, the kernel will internally set errno to that value.

NevemTeve 10-26-2011 12:08 PM

(When the supervisor call returns negative value, the C library sets the errno.)

dbrazeau 10-27-2011 11:23 AM

Quote:

Originally Posted by NevemTeve (Post 4509014)
(When the supervisor call returns negative value, the C library sets the errno.)

Oh, ok. Thanks.


All times are GMT -5. The time now is 12:39 AM.