<div class="gmail_quote">Hi Vichy<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I found there are 2 errno.h we can include when coding.<br>
#include &lt;asm-generic/errno.h&gt; and #include &lt;linux/errno.h&gt;<br>
is there difference or rue I need to follow when I want to take<br>
advantage of errno in kernel?<br>
</blockquote></div>
<br>
Looking at my sources you should use linux/errno.h. When I look, I see the following:<br>
<br>
<b>linux/errno.h:</b><br>
<span style="font-family: courier new,monospace;">#ifndef _LINUX_ERRNO_H</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define _LINUX_ERRNO_H</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#include &lt;asm/errno.h&gt;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#endif</span><br>
<br>
<b>asm/errno.h:</b><br>
<span style="font-family: courier new,monospace;">#include &lt;asm-generic/errno.h&gt;</span><br>
<br>
<b>asm-generic/errno.h:</b><br>
<span style="font-family: courier new,monospace;">#ifndef _ASM_GENERIC_ERRNO_H</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define _ASM_GENERIC_ERRNO_H</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#include &lt;asm-generic/errno-base.h&gt;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define EDEADLK         35      /* Resource deadlock would occur */</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define ENAMETOOLONG    36      /* File name too long */</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define ENOLCK          37      /* No record locks available */</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#define ENOSYS          38      /* Function not implemented */</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">...</span><br style="font-family: courier new,monospace;">
<br>
So, it only makes sense to use linux/errno.h in my opinion.<br>
<br>
Hope this helps,<br>
Michael<br>
<br clear="all">Michael F Clarke<br>MEng Software Engineering<div>PhD Candidate, Aberystwyth University<br><br>Help fight cancer with your spare CPU time:<br><a href="http://www.grid.org/services/teams/team.htm?id=AD952B24-3A86-4C79-9EF8-F5C92F938018" target="_blank">http://www.grid.org/services/teams/team.htm?id=AD952B24-3A86-4C79-9EF8-F5C92F938018</a></div>
<br>