Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

open file in kernel space????

Posted on 2002-05-03
4
Medium Priority
?
452 Views
Last Modified: 2008-01-09
Please help me! Can i open file or create socket in kernel space????
0
Comment
Question by:minhtuanq7
4 Comments
 
LVL 5

Accepted Solution

by:
bryanh earned 400 total points
ID: 6990680
Yes.  This is a common enough question that I keep an example of it in ftp://giraffe-data.com/pub/filewrite.c .

The example is C source code for a loadable kernel module that writes stuff into a regular file when you attempt to load it.  The load always fails.

It's usually bad design to have the kernel access a regular file, and in fact in Linux the only place I have ever seen it is in the NFS server, and that's pretty much an acknowledged performance hack (i.e. it was meant to be in user space).  But it works.

The key to understanding it is that you can't issue a system call (e.g. write()) from inside the kernel, but you can call the same subroutine that the system call handler does when a user program issues the system call.

Creating sockets is a whole separate question, but the overall strategy is similar.
0
 
LVL 3

Expert Comment

by:superschlonz
ID: 7020299
Have also a look at khttpd, it's in /usr/src/linux/net/khttpd.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9915669
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: bryanh {http:#6990680}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question