no-op error in dmesg

2012-06-18 Thread Pritam Bankar

Hi,
I have one structure called foo. Address of object of foo(say objfoo) is 
passed to ioctl call


status = ioctl(fd, arg, objfoo);

But during manipulation I am not getting ioctl error 5 (input/output error).
I am more confused about error in dmesg which is
*foo: no-op *

What does no-op indicate? If it is no-operation, how can we relate this 
to foo structure?


Thanks,
Pritam
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


RE: A confusion about invoking my syscall

2012-06-18 Thread Jeff Haran


From: kernelnewbies-boun...@kernelnewbies.org 
[mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of ??
Sent: Monday, June 18, 2012 6:40 PM
To: kernelnewbies
Subject: A confusion about invoking my syscall

Hello everyone:

 I append a simple syscall in kernel. and the function is as follows:

  asmlinkage  long sys_mysyscall(long data)
 {
  printk(This is my syscall!\n);
  return data;
  }

and i test it sucessfully in user space . and the test program:

   #include linux/unistd.h
   #include syscall.h
   #include sys/types.h
   #include stdio.h



   int main(void)
   {
   long n = 0,m = 0,pid1,pid2;
   n = syscall(345,190);// #define __NR_mysyscall  345
   printf(n = %ld\n,n);
   pid1 = syscall(SYS_getpid);  //getpid
   printf(pid = %ld\n,pid1);
   pid2 = syscall(20);  //getpid
   printf(pid = %ld\n,pid2);
   return 0;
  }
and the result:
n = 190
pid = 4097
pid = 4097

but if the test program is:
#include linux/unistd.h
#include syscall.h
#include sys/types.h
#include stdio.h



int main(void)
{
 long n = 0,m = 0,pid1,pid2;
 n = syscall(345,190);// #define __NR_mysyscall  345
 printf(n = %ld\n,n);
 m = syscall(SYS_mysyscall,190);
 printf(m = %ld\n,m);
 pid1 = syscall(SYS_getpid);  //getpid
 printf(pid = %ld\n,pid1);
 pid2 = syscall(20);  //getpid
 printf(pid = %ld\n,pid2);
 return 0;
}
and the result:
wanny@wanny-C-Notebook-:~/syscall/src$ gcc test1.c
test1.c: In function ‘main’:
test1.c:13:14: error: ‘SYS_mysyscall’ undeclared (first use in this function)
test1.c:13:14: note: each undeclared identifier is reported only once for each 
function it appears in


why i can't invoke my syscall with SYS_mysyscall?

Thanks in advance!

Because it appears you never defined the symbol SYS_mysyscall.

Jeff Haran


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: A confusion about invoking my syscall

2012-06-18 Thread 王哲
2012/6/19 Jeff Haran jha...@bytemobile.com

  ** **

 ** **

 *From:* kernelnewbies-boun...@kernelnewbies.org [mailto:
 kernelnewbies-boun...@kernelnewbies.org] *On Behalf Of *??
 *Sent:* Monday, June 18, 2012 6:40 PM
 *To:* kernelnewbies
 *Subject:* A confusion about invoking my syscall

 ** **

 Hello everyone:

  I append a simple syscall in kernel. and the function is as
 follows:

   asmlinkage  long sys_mysyscall(long data)
  {
   printk(This is my syscall!\n);
   return data;
   }

 and i test it sucessfully in user space . and the test program:

#include
 linux/unistd.h

#include syscall.h
#include sys/types.h
#include stdio.h



int main(void)
{
long n = 0,m = 0,pid1,pid2;
n = syscall(345,190);// #define __NR_mysyscall  345
printf(n = %ld\n,n);
pid1 = syscall(SYS_getpid);  //getpid
printf(pid = %ld\n,pid1);
pid2 = syscall(20);  //getpid
printf(pid = %ld\n,pid2);
return 0;
   }
 and the result:
 n = 190
 pid = 4097
 pid = 4097

 but if the test program is:
 #include linux/unistd.h
 #include syscall.h
 #include sys/types.h
 #include stdio.h



 int main(void)
 {
  long n = 0,m = 0,pid1,pid2;
  n = syscall(345,190);// #define __NR_mysyscall  345
  printf(n = %ld\n,n);
  m = syscall(SYS_mysyscall,190);
  printf(m = %ld\n,m);
  pid1 = syscall(SYS_getpid);  //getpid
  printf(pid = %ld\n,pid1);
  pid2 = syscall(20);  //getpid
  printf(pid = %ld\n,pid2);
  return 0;
 }
 and the result:
 wanny@wanny-C-Notebook-:~/syscall/src$ gcc test1.c
 test1.c: In function ‘main’:
 test1.c:13:14: error: ‘SYS_mysyscall’ undeclared (first use in this
 function)
 test1.c:13:14: note: each undeclared identifier is reported only once for
 each function it appears in


 why i can't invoke my syscall with SYS_mysyscall?

 Thanks in advance!

 Because it appears you never defined the symbol SYS_mysyscall.

 ** I think so,but where shoud i defne the  **symbol SYS_mysyscall ?

  and where is the symbol SYS_getpid defined?





 Jeff Haran
  

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies