Hi,
Have you ever written (or encountered) code that uses the procfs (the Linux /proc file system) in non-trivial ways?
I have a very nice idea for a kernel patch, and I want to conduct some research and see code examples before I shape my idea.
Udi
EDIT
I'm looking for interesting code examples that would demonstrate advanced usage ...
I'm trying to understand the journey a piece of data undergoes through the linux kernel from application layer onto the wire in detail through the kernel. Does anyone know of a good place to start or a good tutorial?
...
Hi there,
I'm writing a kernel (2.6.28) module that uses a dynamic timer. I'm using the timer_list structure as follows:
struct timer_list our_timer;
init_timer(&our_timer);
our_timer.function = handleFlowTimer;
our_timer.expires = jiffies + 2000;
our_timer.data = 0;
add_timer(&our_timer);
void handleFlowTimer(unsigned long data)
{
...
How can the CPU affinity of a process be set in kernel module? In user mode there is a syscall sched_setaffinity, but I am looking for the kernel mode equivalent.
In the Linux kernel code, there is also a function called sched_setaffinity. It's called from the sys_sched_setaffinity function which is called by system_call. From what i...
What is a reentrant kernel?
...
I know all the discussions about why one should not read/write files from kernel, instead how to use /proc or netlink to do that. I want to read/write anyway. I have also read
http://www.linuxjournal.com/article/8110
However, problem is 2.6.30 does not export sys_read(). Rather its wrapped in SYSCALL_DEFINE3. So if I use that in my mod...
Hi,
Im getting into kernel work for a bit of my summer research. We are looking to make modifications to the TCP, in specific RTT calculations. What I would like to do is replace the resolution of one of the functions in tcp_input.c to a function provided by a dynamically loaded kernel module. I think this would improve the pace at w...
Inspired by this question
http://stackoverflow.com/questions/1237489/how-can-i-force-gdb-to-disassemble
and related to this one
http://stackoverflow.com/questions/1245809/what-is-int-21h
How does an actually system call happen under linux? what happens when the call is performed, until the actual kernel routine is invoked ?
...
I have this program in C++ that forks two new processes:
#include <pthread.h>
#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <cstdlib>
using namespace std;
int shared;
void func(){
extern int shared;
for (int i=0; i<10;i++)
shared++;
cout<<"Process "<<getpid()<<", shared "
...
At fairly high level in the Linux write() function, it filters out requests for writing 0 length buffers. Which makes sense. Who'd want to the OS wasting it's time drilling through layers only to determine there is no work to be done?
Well ... me.
It's related to this question; and the discovery that the bit-banged I2C driver will g...
I want to write a linux 2.6 netfilter module, which can check the incoming IP packet information ,such as dest-ip ,source-ip. and then pass these information to user space app. that app (socket app,I think ) will handle these information as soon as the packet reach the HOOKs.
I want to try two ways :
1, inside the netfilter module, ma...
I'm just wondering about what happens to memory that a user program releases through a brk system call, then gets back again. Does the kernel clear it out or is the contents left undefined?
I believe that the kernel clears out pages when they are newly allocated via brk, but I can't work out if it zeros them all if that page is returned...
I'm developing a Linux kernel module outside of the Linux source tree (in the standard way) and am trying to automatically include the git commit hash of the driver into the version string printed out during the module load. The Makefile computes the git hash using the command
DRV_TAG := $(shell git log -1 --pretty=format:"%h")
but ...
These are the steps I am doing to compile the linux source on my machine :
1. Copy the config file from /boot to /usr/src/kernels/2.6.29.4-167.fc11.i586/ directory
2. make oldconfig
3. make
Step 3 fails with the following error :
make[1]: *** No rule to make target `missing-syscalls'. Stop.
Compiling on a x86 box.
Any suggestion...
While trying to compile a 64 bit linux kernel using gcc, I see the
following error :
kernel/bounds.c:1: error: code model ‘kernel’ not supported in the 32
bit mode
kernel/bounds.c:1: sorry, unimplemented: 64-bit mode not compiled in
This is what gcc -v reports :
Using built-in specs.
Target: i586-redhat-linux
Configured with: ../conf...
Hi all.. i am working in Fedora OS.. actually i am working in windows and running fedora through VMware (as u all know, VMware is used to load the OS image, thus running a different OS being in one OS).. by default the kernel source tree should be in usr/src/ directory.. instead i could find only an empty directory called kernels.. the a...
I'm looking to load and unload a linux kernel module from my Java program.
I initially tried doing it by using ProcessBuilder to run the commands, however it fails because the program doesnt have root access. Running my program as root also yields the same problem as it's a different process which needs the root access.
So how do I acq...
I have been trying to look around in the linux source code for a structure/union that'd correspond to the PTE on x86 system with PAE disabled. So far I've found only the following in arch/x86/include/asm/page_32.h
typedef union {
pteval_t pte;
pteval_t pte_low;
} pte_t;
I'm a bit confused right now since I have the Int...
I am porting a app/PCI driver from vxWorks to Linux and I would like to keep the same architecture if possible. The current driver has 2 tasks(threads) that communicate with each other using message queues. Is there a mechanism to communicate between kernel threads? The message queues are being used to pass buffer addresses and size i...
I am trying to traverse a task_struct's children in the linux kernel and get information from the children. I'm having problems with all the information, so let's just keep it at the getting the pid for simplicity.
This is the relavant part of my code.
struct list_head * p;
struct task_struct ts, *tsk;
pid_t tmp_pid;
INIT_LIST_HEAD(&ts...