syscall from modules
Hi,
I am trying to write a linux kernel module.I want
to use sys_sendto,sys_recvfrom etc calls from the module.However these symbols are not present in 'ksyms'.One sluggish option is to modify socket.c ( which contains these function definitions ) to export the symbols. However this would require
comiling the entire kernel.Is there a descent way to do this ??
Pls help !!!
Amber
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == Amber Palekar <[email protected]> writes:
> Hi,
> I am trying to write a linux kernel module.I want
> to use sys_sendto,sys_recvfrom etc calls from the
> module.However these symbols are not present in 'ksyms'.One > sluggish option is to modify socket.c ( which contains these > function definitions ) to export the symbols. However this > would require
> comiling the entire kernel.Is there a descent way to do this ??
Hi,
Just use sock_sendmsg() and sock_recvmsg() directly. They are both exported in netsyms.c.
Cheers,
Trond
Again:syscall from modules
Hi,
Quoted 3 lines
Just use
sock_sendmsg()andsock_recvmsg()directly. They are both
exported innetsyms.c.
Is there any specific reason behind not exportingsys_sendto and sys_recvfrom ??
Quoted 2 lines
Cheers,
Trond
TIA
Amber
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
Again:syscall from modules
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == Amber Palekar <[email protected]> writes:
> Hi,
>> Just use sock_sendmsg() and sock_recvmsg() directly. They are >> both exported in netsyms.c.
> Is there any specific reason behind not exporting
> sys_sendto and sys_recvfrom ??
Why would you want to do that when you already have a better kernel interface available?
The sys_sendto, sys_recvfrom references the sockets by file handle, something which requires an extra lookup operation to map the file handle to socket struct.
OTOH sock_sendmsg(), sock_recvmesg() provides exactly the same functionality, but takes a pointer to the kernel socket structure as the argument.
Cheers,
Trond
Re: Again:syscall from modules
In reply to Amber PalekarYes, the sys_* funcs are declared asmlinkage int sys_*. where the asmlinkage differ from platform to platform. It's used to tell the compiler if a non standared calling convertion is used, typically if params are passed by registers instead of stack. The asmlinkage define must be sett according to the syscall dispatcher (entry.S on ia32), and may be changed accordingly.
In short, if you want to use sys_* you must understand the interaction between the sys_* funcs and the dispatcher on *every* platform, and the interaction may change without notice.
In short short, don't don't don't don't use the sys_* functions.
TJ
Quoted 25 lines · Amber Palekar
Hi,
Quoted 3 lines
Just use
sock_sendmsg()andsock_recvmsg()directly. They are both
exported innetsyms.c.Is there any specific reason behind not exporting
sys_sendtoandsys_recvfrom??Quoted 2 lines
Cheers,
TrondTIA
Amber__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: Again:syscall from modules
Guess I should add that most sys_* functions are wrappers.
Quoted 50 lines · Terje Eggestad
Yes, the sys_* funcs are declared asmlinkage int sys_*. where the asmlinkage differ from platform to platform. It's used to tell the compiler if a non standared calling convertion is used, typically if params are passed by registers instead of stack. The asmlinkage define must be sett according to the syscall dispatcher (
entry.Son ia32), and may be changed accordingly.In short, if you want to use sys_* you must understand the interaction between the sys_* funcs and the dispatcher on *every* platform, and the interaction may change without notice.
In short short, don't don't don't don't use the sys_* functions.
TJ
Quoted 16 lines · Amber Palekar
Hi,
Quoted 3 lines
Just use
sock_sendmsg()andsock_recvmsg()directly. They are both
exported innetsyms.c.Is there any specific reason behind not exporting
sys_sendtoandsys_recvfrom??Quoted 2 lines
Cheers,
TrondTIA
AmberQuoted 9 lines
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: Again:syscall from modules
In reply to Terje EggestadQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == Terje Eggestad <[email protected]> writes:
> Yes, the sys_* funcs are declared asmlinkage int sys_*. where > the asmlinkage differ from platform to platform. It's used to > tell the compiler if a non standared calling convertion is > used, typically if params are passed by registers instead of > stack. The asmlinkage define must be sett according to the > syscall dispatcher (entry.S on ia32), and may be changed > accordingly.
> In short, if you want to use sys_* you must understand the > interaction between the sys_* funcs and the dispatcher on > *every* platform, and the interaction may change without > notice.
> In short short, don't don't don't don't use the sys_* > functions.
You are scaremongering a bit here. Several of the sys_* functions *are* generic, and could be called by quite safely by the kernel. Look for instance at the use of sys_close() by the binfmt stuff.
Normally, though, there will be a price to pay in terms of an overhead.
Furthermore, if you find that you absolutely *have* to use the sys_* interface, from userspace you will probably want to rethink your
design: after all you can call all those sys_* functions from user space, and the rule of thumb is that if you *can* do something in user space, you ought to do it there...
Cheers,
Trond
Re: Again:syscall from modules
In reply to Amber PalekarQuoted 11 lines · Trond Myklebust
You are scaremongering a bit here. Several of the sys_* functions *are* generic, and could be called by quite safely by the kernel. Look for instance at the use of
sys_close()by the binfmt stuff.Normally, though, there will be a price to pay in terms of an overhead.
Furthermore, if you find that you absolutely *have* to use the sys_* interface, from userspace you will probably want to rethink your
design: after all you can call all those sys_* functions from user space, and the rule of thumb is that if you *can* do something in user space, you ought to do it there...
Many sys_*() functions may be in the generic code but that still doesn't mean the ports are actually using it or that no special calling sequence which normally would be done in libc is required. Only people doing syscalls themselfes and not through libc wrappers is worse ...
Ralf
Re: Again:syscall from modules
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == Ralf Baechle <[email protected]> writes:
> Many sys_*() functions may be in the generic code but that > still doesn't mean the ports are actually using it or that no > special calling sequence which normally would be done in libc > is required. Only people doing syscalls themselfes and not > through libc wrappers is worse ...
Please read the beginning of the thread. The question was about calling from within kernel space. No libc is or can be involved...
Cheers,
Trond
Re: Again:syscall from modules
In reply to Amber PalekarQuoted 8 lines · Trond Myklebust
> Many sys_*() functions may be in the generic code but that > still doesn't mean the ports are actually using it or that no > special calling sequence which normally would be done in libc > is required. Only people doing syscalls themselfes and not > through libc wrappers is worse ...
Please read the beginning of the thread. The question was about calling from within kernel space. No libc is or can be involved...
I was just comparing ...
Ralf