EDIT:
If myinc_value is an N-digit integer, I get the first N/2 bytes of the msg buffer back in user space. So if myinc_value = 48, cat /dev/my_inc yields 4. If myinc_value = 489324, cat /dev/my_inc yields 489.
This behavior persists even after I added the following code directly after the while loop, to nul-terminate the user-space b...
Hi everyone,
I am writing a simple memory manager for my application which will free any excess memory being used by my modules, so that it's available again for use. My modules allocate memory using alloc_page & kmem_cache_alloc and so the memory manager uses put_page & kmem_cache_free respectively to free up the memory which is not in...
I'm currently on a stable 2.6.32 kernel. But I need certain fixes on 2.6.33 branch to be incorporated into this 2.6.32 kernel so that I can create a custom kernel for testing purposes. I can't apply the said fixes directly to the 2.6.32 source because they seem to have dependencies on other fixes.
Is there any safe way to incorporate on...
I'm trying to debug what appears to be a completion queue issue:
Apr 14 18:39:15 ST2035 kernel: Call Trace:
Apr 14 18:39:15 ST2035 kernel: [<ffffffff8049b295>] schedule_timeout+0x1e/0xad
Apr 14 18:39:15 ST2035 kernel: [<ffffffff8049a81c>] wait_for_common+0xd5/0x13c
Apr 14 18:39:15 ST2035 kernel: [<ffffffffa01ca32b>]
ib_unregister_mad...
Hi,
when i search for adding a system call, i get many articles but they seem to be for old versions, it also seems like a trivial process.
But the problem is, the directories that articles suggest does not hold for the version 2.6.31. does anyone know where unistd.h, syscall_table.S and syscalls.h or their corresponding files are?
Th...
Where are the ioctl(2) list of codes for a hard disk partition in the linux kernel source? I can't seem to find them.
...
Is there an equivalent ioctl(2) code for the CDROM_LAST_WRITTEN code when dealing with hard disks and their respective ioctl codes? I can't find any in the documentation folder and assume there isn't an equivalent.
...
I'm trying to implement a red/black tree in Linux per task_struct using code from linux/rbtree.h. I can get a red/black tree inserting properly in a standalone space in the kernel such as a module but when I try to get the same code to function with the rb_root declared in either task_struct or task_struct->files_struct, I get a SEGFAULT...
In the Linux kernel, is there a way to traverse down to the buffer_heads from within a module?
I can see how to get to struct bio (task_struct macro: current->bio). But how can I get to the buffer heads? The buffer_head struct holds some information I'd like to obtain at any point regarding physical block numbers.
...
Recently, i began developing a driver of an embedded device running linux.
Until now i have only read about linux internals.
Having no prior experience in driver devlopment, i am finding it a tad difficult to land my first step.
I have downloaded the kernel source-code (v2.6.32).
I have read (skimped) Linux Device Drivers (3e)
I rea...
Hello
What are sources of latency in process of sending/receiving tcp/udp packets in linux 2.6 ?
I want to know a latency sources in "ping-pong" latency tests.
There are some rather good papers of ethernet latency, but they cover only latency sources in the wire and switch (and rather cursory, only for specific switch).
What steps of...
Hello
Is there a good overview of tcp data path in Linux (2.6, not 2.4 if the path actually differ)? Where is a packet on different stages of tcp/ip stack handling?
How packet is packed to tcp segment, then ip packet. How it is transmitted to network card? (with series of I/O regs write and DMA?) Is it transmitted to network card in th...
Is it possible to expand the ioctl interface in Linux so that the user-space application can send a pointer to a function to the kernel space driver?
I'm in particular thinking of ways to handle the stream in user-controllable way but doing it in the kernel. Those operations could be attached to the kernel module but this would make de...
void get_cwd(char* buf)
{
char *result;
current->fs->pwd;
result = get_dentry_path(current->fs->pwd);
memcpy(buf, result, strlen(result)+1);
kfree(result);
}
error: dereferencing pointer to incomplete type
The error points to current->fs->pwd;
includes:
#include <asm/stat.h>
#include <linux/fs.h>
#include <linux...
I'm playing around with the linux kernel and added a struct field to the task_struct in sched.h. I know that can be costly but my struct is very small.
I then initialize the new struct in INIT_TASK() and also re-initialize in fork.c copy_process() function so that when the INIT task or any other task creates a new process the process g...
Hello
What process will be pointed by "current" pointer in linux kernel, when CPU load is 0% and there isn't any ready-to-run process?
Consider situation without any power-saving.
What is the name of this process? I think task with PID 0 will be running and code will be
rep nop
or
HLT
...
I am playing around with the kernel and am looking at the kmem_cache files_cachep belonging to fork.c. It detects the sizeof(files_struct). My question is this:
I have altered files_struct and added a rb_root (red/black tree root) using the built-in functionality in linux/rbtree.h. I can properly insert values into this tree. However, a...
How to access block level storage via the kernel (w/o using scsi libraries)?
My intent is to implement a block level storage protocol over network for learning purpose, almost the same way SCSI works. Requests will be generated by initiator and sent to target (both userspace program) which makes call to kernel module and returns the ...
I am wring a netfilter module which would operate one specific TCP connection. After operating on one packet the function will return. Now, my question; is it possible if I want to steal one packet, and want to send it few millisecond later in one of my timeout(timer_list) function by storing the previous sk_buff structure?
...
Hi, I have to develop a patch for the linux kernel (2.6) for an university course I'm attending. I have to develop this patch with a friend of mine and we need to edit the same files on our computers (2-3 PCs). So, we want to use something like a collaborative editor and/or a version control system. The problem is that we never used some...