Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-14-2004, 04:58 PM   #1
LQ Newbie
Registered: Jul 2004
Posts: 1

Rep: Reputation: 0
Socket API from Kernel Space

I need to write a device driver for a network storage device (no, not NAS or iSCSI), and am having difficulty understanding just where the network stack resides -- user or kernel space. I have found some information (on the web and other sources) that might indicate that the stack resides in kernel space. However, the code does not appear to be __KERNEL__ code.

My driver needs to be a kernel mode block device, but how do I access the stack from within kernel space? I have seen other implementations using a daemon, but I would like this to be a purely kernel space ipmlementation. Using BSD sockets would be ideal. However, the /usr/src/linux-2.4.xx/include/linux/sockets.h does not seem to prototype any socket functions. The user space sockets.h does, but I can't get there from kernel space.

Any constructive suggestions would be greatly appreciated.
Old 07-14-2004, 10:47 PM   #2
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
the protocol stack is in kernel space. look in /usr/src/linux/net/ipv4/ for files. what exactly are you trying to do? open up sockets in a kernel module? why? maybe u should check out the NFS code, as it sounds similar to what u want. i'm sure u can open up a socket, look at the sys_socket sys_bind sys_connect ..etc
Old 07-15-2004, 02:20 AM   #3
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
User space network programming is different than kernel mode programming. The functions which are used in user mode are not used in the kernel modules. Take a look at this article -



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to access the different flags of a socket from user space enthusiast_abdul Linux - Networking 0 11-10-2005 03:04 AM
API for getting free space information in Linux. srns Programming 5 04-26-2005 05:52 PM
Socket API shy Programming 2 10-23-2004 01:32 PM
Squid: "Socket error... (55) no buffer space available J_Szucs Linux - Networking 1 08-30-2004 08:10 AM
How to broascast a message using socket API in linux with C dileepkk Linux - Networking 0 07-21-2004 04:54 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration