some questions about errno.h

Michael Clarke michaelfclarke at gmail.com
Sun Jan 2 04:41:20 EST 2011


Hi Vichy

I found there are 2 errno.h we can include when coding.
> #include <asm-generic/errno.h> and #include <linux/errno.h>
> is there difference or rue I need to follow when I want to take
> advantage of errno in kernel?
>

Looking at my sources you should use linux/errno.h. When I look, I see the
following:

*linux/errno.h:*
#ifndef _LINUX_ERRNO_H
#define _LINUX_ERRNO_H

#include <asm/errno.h>

#endif

*asm/errno.h:*
#include <asm-generic/errno.h>

*asm-generic/errno.h:*
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H

#include <asm-generic/errno-base.h>

#define EDEADLK         35      /* Resource deadlock would occur */
#define ENAMETOOLONG    36      /* File name too long */
#define ENOLCK          37      /* No record locks available */
#define ENOSYS          38      /* Function not implemented */
...

So, it only makes sense to use linux/errno.h in my opinion.

Hope this helps,
Michael

Michael F Clarke
MEng Software Engineering
PhD Candidate, Aberystwyth University

Help fight cancer with your spare CPU time:
http://www.grid.org/services/teams/team.htm?id=AD952B24-3A86-4C79-9EF8-F5C92F938018
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110102/8f619b1c/attachment.html 


More information about the Kernelnewbies mailing list