Re: error of proc_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




	Hi,

	There are two things a little different.

	1) hijack a syscall
	2) add a syscall

	1 and 2 in kernel module!! no compile kernel....

	if you want 1. You have only replace the entry on sys_call_table
for your function. Look at http://kernelnewbies.org/code/intercept for
example.

	2) you have to replace a entry on sys_call_table that isnīt used.
Like up the 222, syscall_table[224]. Replace for your syscall. Like hijack
a syscall.

	For the program call your syscall, do it.

#include <asm/unistd.h> // _syscallX macro

#define __NR_my_newsyscall 224 // the number of your syscall on sys_call_table

_syscall1(int,my_newsyscall,int,x) //example, depend how many arg

	ok after it, is only call the syscall like:
main(){
int i;
i=my_newsyscall(100);
}
	The only difference beteween add and hijack is how the program
will call your syscall. case 2, you have to inform the user program which entry
on sys_call_table is your syscall. Case 1....

	If I forgot some detail, anyone....

	[]īs
Thobias

-- 
Watch your mouth, kid, or you'll find yourself floating home.
		-- Han Solo

----
Thobias Salazar Trevisan <thobias@cos.ufrj.br>
Home Page - http://www.cos.ufrj.br/~thobias
Parallel Computing Laboratory / COPPE
Federal University of Rio de Janeiro
Brazil
__________________________
|	                 |
| Against - HTML Mail    |
|                        |
--------------------------


>
>    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/
>

-
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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux