C.Mohanasundaram wrote: >> In my userland code, I change new system call >> our_sys_open("mytest", O_RDONLY, 0444); into >> #include <unistd.h> >> ... >> _syscall3(errno, "our_sys_open", name, "mytest", filename, O_RDONLY, >> flags, 0444); >> ... > > > this is how the macro will look like > _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3); > > type - return type(int,long etc) > name - function name (in ur case our_sys_open not "our_sys_open") > type 1 - type of 1st argument (int, struct something *,etc) > arg1 - first argument of ur system call.(in ur case mytest not "mytest") > type 2 - same like above > arg2 - " > type 3 - " > arg 3 - " > > refer asm/unistd.h for the macro. > > the statement should like > _syscall3(int,our_sys_open,<data type of mytest>,mytest,<data > type>,O_RDONLY,<data type>,0444); > > dont use any double quotes like "our_sys_call" that is our_sys_call > and "mytest" should be simply mytest > >> the compilation still gives me error: undefined reference to `_syscall3' >> >> I guess there is something I am still missing, >> -Hong > > dont forget to include asm/unistd.h > > if u still have trouble i will send u some code.because putting the whole > code here will waste everyone's disk space.i have done similar kinda work. > > regards, > mohan. > mohan, I use kernel 2.4.2. At this stage, my code: #include <linux/unistd.h> ...... /* generate syscall stub */ _syscall4(int, foo, struct result *, &result, const char *, filename, int, flags, int, mode); /*line143 */ /* invoke system call */ m_errno = foo(&result, "mytest", O_RDONLY, 0444); ...... gives me error: observer.c:143: `__res' undeclared (first use in this function) as I compile my above userland code as follow: #gcc -c -Wall -O2 observer.c my module code is: asmlinkage int sys_foo(struct result *res, const char *filename, int flags, int mode) { ... } I would like to look at your code. You may send it to me directly at honghsu@bellatlantic.net Many thanks, -Hong - Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/