compiler errors - "'errno' undeclared" when compile Linux kernel -
i'm trying compile , keep getting following error: enter image description here
i've included asm-i386/errno.h
once , didn't work. i've tried including linux/errno.h
, didn't work ether.
what file should include?
there no errno
variable in linux kernel: variable lives in user space only.
if kernel function wants report error , specify error code, encapsulates error code returning value. there 3 possibilities of such encapsulation, dependent value type returned on success:
- function returns 0 on success, negated error code on fail.
this used convention referenced 0/-err
.
- function returns valid pointer on success, expression
err_ptr(err)
on fail.
this expression evaluated pointer, can never points real kernel object. convention may used if null valid result.
- function returns positive integer on success, negated error code on fail:
+val/-err
.
in case when 0 valid result, convention may used too: +val/0/-err
.
when user space library needs set errno according kernel's request, checks result of system call (which way perform request kernel). dependent on syscall, either 1 or 3 convention used (return type of system call long
).
example of "setting" errno
in kernel space user space see here.
Comments
Post a Comment