lkml.org 
[lkml]   [2000]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: (newbie) Questions on kernel thread and socket interface
Hi Athanasios

You said that you want to create a network service in a kernel thread and
use sys_bind/sys_socket etc. to do that. These functions are the
implementations of the corresponding system calls, which are passed
parameters from userspace, i.e. user virtual addresses. So, what happens,
for example in sys_bind() is that it uses move_addr_to_kernel() to copy to
the kernel address space and then calls the SOP->bind() method.

Therefore, although you could use set_fs(KERNEL_DS)/set_fs(old_fs) trick
to solve this "problem" a proper way of doing is this is the way it is
done by khttpd. Have a look at the

/usr/src/linux/net/khttpd/sockets.c:StartListening() function - it invokes
socket_create() to create the socket and SOP->bind() to bind it to the
port. Since your thread is a kernel thread (assuming you did careful
analysis and decided that you *have* to implement it in the kernel) it
makes more sense to call kernel's internal functions than to go through
the system calls entry points.

Hope this helps,
------
Tigran A. Aivazian | http://www.sco.com
Escalations Research Group | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd | http://www.ocston.org/~tigran


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.027 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site