linux-kernel

character device driver

The read() and write() callback functions in our ‘cmosram.c’ device-driver only transfer a single byte of data for each time called, so it takes 128 system-calls to read all of the RTC storage-locations! Can you improve this driver’s efficiency, by modifying its read() and write() functions, so they’ll transfer as many valid bytes as th...

when is the push flag set in tcp segment

i asked this previous question here: http://stackoverflow.com/questions/2231283/tcp-two-sides-trying-to-connect-simultaneously i tried the method given in the solution and while sending while using netcat and sniffing packets with ethereal i observed that when i sent a "hello" string from one side to the other it was sent in a segment ...

Linux kernel: the cost of immediate descheduling.

Hello From the http://lkml.indiana.edu/hypermail/linux/kernel/0103.1/0030.html I learn about a new type of mutexes in linux, an adaptive_np one: The PTHRED_MUTEX_ADAPTIVE_NP is a new mutex that is intended for high throughput at the sacrifice of fairness and even CPU cycles. This mutex does not transfer ownership to a wa...

how can I change cpu frequency manualy using sysfs & CPUFREQ subsystem ?

I don't have cpufreq-info/set, utility, How can I change cpu frequency manualy using sysfs & CPUFREQ ? ...

Where is my module located?

I made a kernel module and used the code below to try to make a /dev/mytimer entry. #define DEVICE_NAME "mytimer" #define MAJOR_NUM 61 static struct class *fc; fc = class_create(THIS_MODULE, DEVICE_NAME); device_create(fc, NULL, MAJOR_NUM, "%s", DEVICE_NAME); I don't see my module in /dev as /dev/mytimer... But when I lsmod, I see i...

Customize android?

Question, I have a HTC Hero with Android 1.5. The buggy (speed <= 10 kb) network driver bothers me since a long time. (I saw it can serve 50 kb/s or more, but only temporarely, but then, after a few seconds, it slows down to < 5kb/s and takes about an hour to come back to 50 kb/s...) Now HTC is working on 2.1, but whatever... I don't k...

Internals of a Linux system call

What happens (in detail) when a thread makes a system call by raising interrupt 80? What work does Linux do to the thread's stack and other state? What changes are done to the processor to put it into kernel mode? After running the interrupt handler, how is control restored back to the calling process? What if the system call can't be ...

maven not working anymore with new kernel

Hi, I'm a bit disappointed by what is happening to me. I'm not a maven expert (ie I just type mvn clean install as I was told) but as I installed a new kernel on my debian machine, it seems maven doesnt work anymore : on old kernel (2.6.26-1-amd64) it download all dependencies well. on new kernel (2.6.32-trunk-amd64) it fail downloadi...

Creating physical memory from user space to use for DMA transfers

I want to create some memory to use for DMA transfers. (Using Linux 2.6.18-128.el5 #1 SMP) I have a API stack+kernel driver for my H/W that can do this for me, but its very very slow! If I use the API to create a DMA transfer, it allocates some memory very high up in System RAM (eg 0x7373a6f8 on one run). (I have the ICD of the device,...

What is the theoretical maximum number of open TCP connections that a modern Linux box can have.

Assuming infinite performance from hardware, can a Linux box support >65536 open TCP connections? I understand that the number of ephemeral ports (<65536) limits the number of connections from one local IP to one port on one remote IP. The tuple (local ip, local port, remote ip, remote port) is what uniquely defines a TCP connection; d...

compiling linux kernel with non-gcc

Hello. Linux kernel is written for compiling with gcc and uses a lot of small and ugly gcc-hacks. Which compilers can compile linux kernel except gcc? The one, which can, is the Intel Compiler. What minimal version of it is needed for kernel compiling? There also was a Tiny C compiler, but it was able to compile only reduced and speci...

Tell proc_entry->write_proc to use an ioctl with an argument?

I've seen some sample code that does this: proc_entry->read_proc = module_read; proc_entry->write_proc = module_write; However, in my module, I've used ioctls instead of the read and write. Here is my ioctl function prototype: int mytimer_ioctl(struct inode *inode, struct file *file, unsigned int fcn, unsigned long args) For read, ...

Help me create JojoMips algorithm, the BogoMips for Java VMs

Hello there, I would like to test the speed of different Java platforms and thought about creating a JojoMips benchmark routine that would work like the Linux BogoMips. It would do a calculation and would provide a number like: 4346 JojoMips. The faster the virtual machine, the higher the JojoMips. I thought counting how many decimals o...

Linux Kernel - what function holds the source where port numbers are randomly chosen?

Anyone know what function or file in linux holds the algorithm that finds a random port to use for the bind() system call? I'm hunting all over and cannot find the method that contains this algorithm in the Linux source. Thanks! ...

BUG: Scheduling while atomic RAID_LAZY_WRITE/102/0x00000205

Hi all, I am developing a raid system and I am getting following BUG when I issue lots of parallel IO. I am not able to figure out how to go about debugging this dump. It's evident here that RAID_LAZY_WRITE thread is trying to schedule while it has locked the CPU but I am not able to trace it exactly how and why it's happening. As I don...

Measuring process statistics in Linux

I am building programming contest software. A user's program is received by our judging system and is evaluated by compiling it and running it via a fork() and exec(). The parent process waits for the child (submission's process) to exit, and then cleans it up. To give useful information about the program's run, I want to measure the CP...

What does "do { ... } while (0)" do exactly in kernel code?

Possible Duplicates: Whats the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? C multi-line macro: do/while(0) vs scope block I have seen a lot of usages like this, previously I though that the programmer wanted to break out of a block of code...

comparing 2 kernel images and flashing the diff FLASH memory

hi all, i have existing old version images like kernel image,filesys image,application images in my NAND flash. i want to port the new modified kernel or application image on to the NAND flash by replacing the older one. But in the new images 90% is common to the old images. so i don't want the entire new image to transfer. inspite ...

Linux kernel - add system call dynamically through module

Is there any way to add a system call dynamic, such as through a module? I have found places where I can override an existing system call with a module by just changing the sys_call_table[] array to get my overridden function instead of the native when my module is installed, but can you do this with a new system call and a module? ...

Conflict between system call number and system call handler pointer

When I was reading Operating System Concepts (7e, Silberschatz, Galvin, Gagne), I encountered a study project about adding a system call to the linux kernel. The book says that The system call numbers for recent versions of the Linux kernel are listed in /usr/src/linux-2.x/include/asm-i386/unistd.h. (for instance, __NR_close, whic...