public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* syscall from modules
@ 2001-12-25 11:31 Amber Palekar
  2001-12-25 13:09 ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: Amber Palekar @ 2001-12-25 11:31 UTC (permalink / raw)
  To: kernel list

 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: syscall from modules
  2001-12-25 11:31 syscall from modules Amber Palekar
@ 2001-12-25 13:09 ` Trond Myklebust
  2001-12-25 13:14   ` Again:syscall " Amber Palekar
  0 siblings, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2001-12-25 13:09 UTC (permalink / raw)
  To: Amber Palekar; +Cc: kernel list

>>>>> " " == Amber Palekar <amber_palekar@yahoo.com> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Again:syscall from modules
  2001-12-25 13:09 ` Trond Myklebust
@ 2001-12-25 13:14   ` Amber Palekar
  2001-12-25 18:37     ` Trond Myklebust
  2001-12-27 15:54     ` Terje Eggestad
  0 siblings, 2 replies; 10+ messages in thread
From: Amber Palekar @ 2001-12-25 13:14 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: kernel list


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

> Cheers,
>   Trond

TIA
Amber


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Again:syscall from modules
  2001-12-25 13:14   ` Again:syscall " Amber Palekar
@ 2001-12-25 18:37     ` Trond Myklebust
  2001-12-27 15:54     ` Terje Eggestad
  1 sibling, 0 replies; 10+ messages in thread
From: Trond Myklebust @ 2001-12-25 18:37 UTC (permalink / raw)
  To: Amber Palekar; +Cc: kernel list

>>>>> " " == Amber Palekar <amber_palekar@yahoo.com> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-25 13:14   ` Again:syscall " Amber Palekar
  2001-12-25 18:37     ` Trond Myklebust
@ 2001-12-27 15:54     ` Terje Eggestad
  2001-12-27 16:04       ` Terje Eggestad
  2001-12-27 18:57       ` Trond Myklebust
  1 sibling, 2 replies; 10+ messages in thread
From: Terje Eggestad @ 2001-12-27 15:54 UTC (permalink / raw)
  To: Amber Palekar; +Cc: Trond Myklebust, kernel list

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.

TJ

On Tue, 2001-12-25 at 14:14, Amber Palekar wrote:
> 
>  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 ??
> 
> > Cheers,
> >   Trond
> 
> TIA
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-27 15:54     ` Terje Eggestad
@ 2001-12-27 16:04       ` Terje Eggestad
  2001-12-27 18:57       ` Trond Myklebust
  1 sibling, 0 replies; 10+ messages in thread
From: Terje Eggestad @ 2001-12-27 16:04 UTC (permalink / raw)
  To: Terje Eggestad; +Cc: Amber Palekar, Trond Myklebust, kernel list

Guess I should add that most sys_* functions are wrappers.

On Thu, 2001-12-27 at 16:54, Terje Eggestad wrote:
> 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.
> 
> TJ
> 
> On Tue, 2001-12-25 at 14:14, Amber Palekar wrote:
> > 
> >  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 ??
> > 
> > > Cheers,
> > >   Trond
> > 
> > TIA
> > 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 majordomo@vger.kernel.org
> > 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-27 15:54     ` Terje Eggestad
  2001-12-27 16:04       ` Terje Eggestad
@ 2001-12-27 18:57       ` Trond Myklebust
  2001-12-28 15:41         ` Ralf Baechle
  1 sibling, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2001-12-27 18:57 UTC (permalink / raw)
  To: Terje Eggestad; +Cc: Amber Palekar, Trond Myklebust, kernel list

>>>>> " " == Terje Eggestad <terje.eggestad@scali.com> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-27 18:57       ` Trond Myklebust
@ 2001-12-28 15:41         ` Ralf Baechle
  2001-12-28 15:48           ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: Ralf Baechle @ 2001-12-28 15:41 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Terje Eggestad, Amber Palekar, kernel list

On Thu, Dec 27, 2001 at 07:57:46PM +0100, Trond Myklebust wrote:

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-28 15:41         ` Ralf Baechle
@ 2001-12-28 15:48           ` Trond Myklebust
  2001-12-28 16:26             ` Ralf Baechle
  0 siblings, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2001-12-28 15:48 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Terje Eggestad, Amber Palekar, kernel list

>>>>> " " == Ralf Baechle <ralf@uni-koblenz.de> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Again:syscall from modules
  2001-12-28 15:48           ` Trond Myklebust
@ 2001-12-28 16:26             ` Ralf Baechle
  0 siblings, 0 replies; 10+ messages in thread
From: Ralf Baechle @ 2001-12-28 16:26 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Terje Eggestad, Amber Palekar, kernel list

On Fri, Dec 28, 2001 at 04:48:58PM +0100, Trond Myklebust wrote:

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-12-28 19:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-25 11:31 syscall from modules Amber Palekar
2001-12-25 13:09 ` Trond Myklebust
2001-12-25 13:14   ` Again:syscall " Amber Palekar
2001-12-25 18:37     ` Trond Myklebust
2001-12-27 15:54     ` Terje Eggestad
2001-12-27 16:04       ` Terje Eggestad
2001-12-27 18:57       ` Trond Myklebust
2001-12-28 15:41         ` Ralf Baechle
2001-12-28 15:48           ` Trond Myklebust
2001-12-28 16:26             ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox