linux-kernel

Using sigprocmask to implement locks

I'm implementing user threads in Linux kernel 2.4, and I'm using ualarm to invoke context switches between the threads. We have a requirement that our thread library's functions should be uninterruptable by the context switching mechanism for threads, so I looked into blocking signals and learned that using sigprocmask is the standard ...

Catching the return of main function before it deallocates resources

I'm trying to implement user threads in Linux kernel 2.4, and I ran into something problematic and unexpected. Background: a thread basically executes a single function and dies, except that when I call thread_create for the first time it must turn main() into a thread as well (by default it is not a thread until the first call, which ...

Saving information in the IO System

Hi Kernel Gurus, I need to write a kernel module that simulate a "multicaster" Using the /proc file system. Basically it need to support the following scenarios: 1) allow one write access to the /proc file and many read accesses to the /proc file. 2) The module should have a buffer of the contents last successful write. Each write sh...

Help with a cryptic error message with KGDB - Bogus trace status reply from target: E22

Hi, I'm using gdb to connect to a 2.6.31.13 linux kernel patched with KGDB over Ethernet, and when I try to detach the debugger I get this: (gdb) quit A debugging session is active. Inferior 1 [Remote target] will be killed. Quit anyway? (y or n) y Bogus trace status reply from target: E22 after that the session is still open, I c...

Is there a way/tool to list TCP connections flaged as "thin" under Linux ?

Is there a way/tool to list TCP connections flaged as "thin" under Linux ? ...

Embedded systems linux

I want to make final year project so i want a two way interface device one connect to server and other connect to ouput display device..like television. whats are the rquirements i need....and how do i this. ...

cant open device

I have a little problem. I install this module into my kernel and its written under /proc When I try to open() it from user mode I get the following message: "Can't open device file: my_dev" static int module_permission(struct inode *inode, int op, struct nameidata *foo) { //if its write if ((op == 2)&&(writer == DOESNT_EXIST)){...

Linux: Can Recvmsg be used to receive the IP_TOS of every incoming packet

Can one use recvmsg() to obtain the IP_TOS field of every incoming packet or does it just show the IP_TOS value that is set for the particular socket. If not, does anyone know of a solution to obtain the IP_TOS values of every incoming packets. I am using a UDP application and therefore do not get to view the IP_TOS field at the applicat...

Linux: Timing during recording/playing sound

Hi, I have a more general question, regarding timing in a standard Linux-OS dealing with playing sound and receiving data over a serial port. In the moment, I'm reading a PCM-Signal arriving over a USB-to-Serial Bridge (pl2303) which is recorded, encoded and sent from a FPGA. Now, I need to create "peaks" at a known position in the re...

Java OutOfMemoryError due to Linux RAM disk cache not freed

The process will run fine all day, then, bam, without warning, it will throw this error. Sometimes seemingly in the middle of doing nothing. It will happen at seemingly random times during the day. I checked to see if anything else was running on the machine, like scheduled backups or something, but found nothing. The machine has enough ...

Linux System Programming

I wanted to get into systems programming for linux and wanted to know how to approach that and where to begin. I come from a web development background (Python, PHP) but I also know some C and C++. Essentially, I would like to know: Which language(s) to learn and pursue (I think mainly C and C++)? How/Where to learn those languages sp...

Problem with .release behavior in file_operations

Hello, I'm dealing with a problem in a kernel module that get data from userspace using a /proc entry. I set open/write/release entries for my own defined /proc entry, and manage well to use it to get data from userspace. I handle errors in open/write functions well, and they are visible to user as open/fopen or write/fwrite/fprintf err...

unix DECLARE_WAIT_QUEUE_HEAD (var) var prototype?

hello i want to work with 2 queue in the module where i change my pointer to them therefore i need to use : //declartion wait_queue_head_t **currentQ; DECLARE_WAIT_QUEUE_HEAD (readWaitQ1); DECLARE_WAIT_QUEUE_HEAD (readWaitQ2); if(condition){ currentQ = &readWaitQ1; }else{ currentQ = &readWaitQ2; } but i get incorrect type f...

malloc in kernel

when i try to malloc at kernel mod i get screamed by the compiler : res=(ListNode*)malloc(sizeof(ListNode)); and the compiler is screaming : /root/ex3/ex3mod.c:491: error: implicit declaration of function ‘malloc’ what should i do ? ...

TIPC networking protocol in Linux

Hello How should I program to use TIPC networking protocol, that comes with linux kernel (CONFIG_TIPC xconfig parameter) ? Is there any applications, which uses TIPC? ...

How do I strip local symbols from linux kernel module without breaking it?

If I do --strip-debug or --strip-unneeded, I have the .ko that lists all function names with nm, if I do just strip foo.ko I have a kernel module that refuses to load. Does anyone know a quick shortcut how to remove all symbols that are not needed for module loading so that people cannot reverse engineer the API:s as easily? PS: For a...

How can I uniquely identify users trying to open() a kernel module?

I'm working on a kernel module and I'm trying to uniquely identify each one of the users trying to open() the module (can be either processes or threads). What is the best way to identify them? Is there an ID I can get from a system call? I wish to get all users in a list that specifies whether they're trying to open the module for rea...

How to keep asm output from Linux kernel module build

I'm working on a Linux kernel module for a 2.6.x kernel and I need to view the assembly output, though it's currently being done as a temporary file an deleted afterwords. I'd like to have the assembly output mixed with my C source file so I can easily trace where my problem lies. This is for an ARMv6 core and apparently objdump doesn'...

Linux: Ways to communicate with kernel module from user space.

Hello, What are the ways to communicate with a kernel module from user space? By communication i mean sending information and commands between the module and a user space process. I currently know of two way: open/close/read/write/ioctl on published device node. read/write on exported and hooked /proc file. More specifically, can ...

Trace interruption on a linux system

Hi, The command strace is mainly for tracing system call. Does someone know the equivalent for tracing interruption like IRQ14... Thanks ...