Hello everyone:<br><br>         I append a simple syscall in kernel. and the function is as follows:<br><br>  asmlinkage  long sys_mysyscall(long data)<br> {<br>          printk(&quot;This is my syscall!\n&quot;);<br>          return data;<br>
  }<br><br>and i test it sucessfully in user space . and the test program:<br><br>   #include &lt;linux/unistd.h&gt;                                                                                                                                <br>
   #include &lt;syscall.h&gt;<br>   #include &lt;sys/types.h&gt;<br>   #include &lt;stdio.h&gt;<br>   <br>   <br>   <br>   int main(void)<br>   {<br>   long n = 0,m = 0,pid1,pid2;<br>   n = syscall(345,190);// #define __NR_mysyscall          345<br>
   printf(&quot;n = %ld\n&quot;,n);<br>   pid1 = syscall(SYS_getpid);  //getpid<br>   printf(&quot;pid = %ld\n&quot;,pid1);<br>   pid2 = syscall(20);  //getpid<br>   printf(&quot;pid = %ld\n&quot;,pid2);<br>   return 0;<br>
  }<br>and the result:<br>n = 190<br>pid = 4097<br>pid = 4097<br><br>but if the test program is:<br>#include &lt;linux/unistd.h&gt;<br>#include &lt;syscall.h&gt;<br>#include &lt;sys/types.h&gt;<br>#include &lt;stdio.h&gt;<br>
<br><br><br>int main(void)<br>{<br> long n = 0,m = 0,pid1,pid2;<br> n = syscall(345,190);// #define __NR_mysyscall          345<br> printf(&quot;n = %ld\n&quot;,n);<br> m = syscall(SYS_mysyscall,190);<br> printf(&quot;m = %ld\n&quot;,m);<br>
 pid1 = syscall(SYS_getpid);  //getpid<br> printf(&quot;pid = %ld\n&quot;,pid1);<br> pid2 = syscall(20);  //getpid<br> printf(&quot;pid = %ld\n&quot;,pid2);<br> return 0;<br>}<br>and the result:<br>wanny@wanny-C-Notebook-XXXX:~/syscall/src$ gcc test1.c <br>
test1.c: In function ‘main’:<br>test1.c:13:14: error: ‘SYS_mysyscall’ undeclared (first use in this function)<br>test1.c:13:14: note: each undeclared identifier is reported only once for each function it appears in<br><br>
<br>why i can&#39;t invoke my syscall with &quot;SYS_mysyscall&quot;?<br><br>Thanks in advance!<br><br><br> <br>