Solved

open file in kernel space????

Posted on 2002-05-03
4
425 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
script 11 137
Boot Linux vm into a menu system 2 82
Prestashop 1.5 Redirect Problem 1 103
How to run a Linux Command from a different other than Root in Linux 5 104
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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now