linux-kernel

How to hook syscall table at runtime on PPC Linux ?

Hello All - Subject: PPC Assembly Language - Linux Loadble Kernel Module Detail: How access local TOC area (r2) when called from kernel in syscall table hook? I have written a loadable kernel module for Linux that uses syscall table hooking to intercept system calls and log information about them before passing the call on to the orig...

inotify program compile error

hi i want write a program in c by inotify to a system with kernel 2.6.9 but 2.6.9 dosnt support inotify, since i update kernel to version 2.6.18, when i want to compile my program error say:undefined reference toinotify_init'` what can i solve that? glibc version 2.3.4 gcc version 3.4.4 ...

How to solve "BUG: scheduling while atomic: swapper /0x00000103/0, CPU#0"? in TSC2007 Driver?

I found tsc2007 driver and modified according to our needs. Our firm is producing its own TI DM365 board. In this board we used TSC2007 and connected PENIRQ pin to GPIO0 of DM365. It is being seen OK on driver. when i touch to touchscreen cursor is moving but at the same time i am getting BUG: scheduling while atomic: swapper /0x0000010...

How can a kernel be non preemptive and still have multiple control paths

In an operating systems course I took a while ago we were working on an old, non-preemptive kernel of Linux (2.4.X). However, we were told that there could be multiple control paths in the kernel simultaneously. Doesn't that contradict the non-preemptive nature of the kernel? EDIT: I mean, there is no context switch inside the kernel. ...

Linux Kernel Programming for Beginners

I have been working on LINUX for the past six years, and am a core Linux guys since I started my career on Linux. Working more on Redhat / Centos / Fedora based distribution system administration, with some basic bash scripting knowledge. Now I am looking to deep dive into programming to contribute or innovate something new on Linux ope...

syscall error handling inside the linux kernel

Hi, I'm writing a new syscall inside the linux kernel. I want to implement an error handling system to return to the user who uses the sycall a code which describes the type of the error. I'd like to know how this is done inside the kernel, since I want to follow the standard. I want to let the user read the errno variable, or something ...

How are threads terminated during a linux crash?

If you have a multithreaded program (Linux 2.26 kernel), and one thread does something that causes a segfault, will the other threads still be scheduled to run? How are the other threads terminated? Can someone explain the process shutdown procedure with regard to multithreaded programs? ...

Is it possible to "hang" a Linux box with a SCHED_FIFO process?

Hello, I want to have a real-time process take over my computer. :) I've been playing a bit with this. I created a process which is essentially a while (1) (never blocks nor yields the processor) and used schedtool to run it with SCHED_FIFO policy (also tried chrt). However, the process was letting other processes run as well. Then som...

How can I use spinlocks on list entries inside the linux kernel?

Hi, I'm developing a patch for the linux kernel. I have to use several lists and I have to protect'em against concurrent modification on a multicore machine. I'm trying to use spinlocks for this goal, but there's something I can't understand. I have to lock the entries of a list (I'm using linux default implementation of linked lists) an...

Generating intermediate .i files (preprocessed files) when compiling Ubuntu-8.04

I'm building ubuntu-8.04 with gcc 3.4 and I need to generate the .i files, which are the output of the gcc preprocessor. I have tried adding the --save-temps flag but this only generates the .i files for the top level directory, i.e. source, and does not seem to get passed recursively to the child directories. I also tried the -E flag, w...

Why does COW mmap fail with ENOMEM on (sparse) files larger than 4GB?

This happens on a 2.6.26-2-amd64 Linux kernel when trying to mmap a 5GB file with copy-on-write semantics ( PROT_READ | PROT_WRITE and MAP_PRIVATE). Mapping files smaller than 4GB or using only PROT_READ works fine. This is not a soft resource limit issue as reported in this question; the virtual limit size is unlimited. Here is the co...

Are ioctl driver functions executed from an atomic context under linux 2.6?

I am tracking down a "scheduling while atomic" error in one of our drivers, and am wondering if ioctl's are an atomic context. Also if any one has anything to share on how to get into and out of atomic contexts, and common places they occur, it would be helpful. ...

How does linux synchronize preempt count

http://lxr.linux.no/linux+v2.6.35/include/linux/preempt.h#L21 I am just trying get the linux source. I saw this preempt count and how does linux ensure the preempt count is atomic ? The code just increments the value. Also I have an another question. why does interrupt handles need to maintain mutual exclusion. Because only one can exe...

Understanding the counters in /proc/[pid]/io

I'm creating a plugin for Munin to monitor stats of named processes. One of the sources of information would be /proc/[pid]/io. But I have a hard time finding out what the difference is between rchar/wchar and read_bytes/written_bytes. They are not the same, as they provide different values. What do they represent? ...

Question on signal handling, interrupt handling

Hi, While the process is executing a blocking system call, say read or write, signal has arrived. Does the system call is terminated with the error EINTR? Does the system call is restarted after handling the system call? Suppose, system call is terminated with the error EINTR, Kernel handles the signal before returing to user space. ...

Is "Understanding the Linux Virtual Memory Manager" by Mel Gorman too outdated?

I am trying to get a deeper understanding of the virtual memory manager of linux. If have found a book called "Understanding the Linux Virtual Memory Manager[1]" written by Mel Gorman which looks quite elaborate. Unfortunately it is based on the 2.4 kernel series so its kind of ancient. Has anyone read the book? Is it still relevant? Al...

How can I make a linux module load another module?

I have the task to program one module to store some data and another module to control the first one, been able to load/unload it from the code. I'm and kernel programming ignorant but i've tried hard to find the way to do this. Is there any function to do this? Thank you very much in advance ...

How to list all the processes which are using/accessing a given Linux kernel driver

Hi, Is there any way to list all the processes which are using/accessing a given Linux kernel driver? I've got a (framebuffer) driver which I'm trying to rmmod, however the system is returning Module is in use, and I'd like to get to the bottom of it and see what process is still using it. Can we get first the file descriptors that're...

linux kernel ota framework?

Hi there, Before designing my own Linux OTA stack, I'd better probe if anybody knows of an existing Linux OTA stack/framework that I could make use of/contribute to. What I mean by Linux OTA stack/framework is a service capable of updating the Linux kernel on my device from a remote repository. Basically something like the OTA update f...

difference between character devices vs Terminal devices vs Streams

Hello guys, I am unable to figure out the exact difference between character devices vs Terminal devices vs Streams. Any help is very much appreciated. Thanks & Regards, Mousey. ...