linux-kernel

Limiting the File System Usage Programmatically in Linux

I was assigned to write a system call for Linux kernel, which oddly determines (and reduces) users´ maximum transfer amount per minute (for file operations). This system call will be called lim_fs_usage and will take a parameter for maximum number of bytes all users can access in a minute. For short, I am going to determine bandwidth of ...

Signal handling for linux kernel thread (jffs2 garbage collection thread to be specific)

I am trying to manually trigger jffs2 garbage collection thread by sending it SIGHUP with kill -s SIGHUP (the source for the thread is here: http://lxr.linux.no/linux-old+*/fs/jffs2/background.c#L98) I added a bunch of printk statement in the thread to tell me that the thread has run but none of the print statements got triggered. Ev...

How to symlink a file in linux

Hello, I am trying to symlink a file, a compiled kernel source needs to be sym linked into /home/build/basebuild/kernel. Does anyone know how to do this? Thanks Hi again, I have written this code where the first path is the folder I want link into and the second path is the compiled source. Is this correct? 'ln -s '+basebuild+'/IpD...

USB Port Speed Linux

How to determine the usb port speed in embedded devices running the linux kernel? ...

Developing an operating system

I want to develop a simple operating system. One that asks user to login by entering username and password. Once logged in the user sees their desktop and can create some text files. I don't have any prior experience of OS development. I know C and C++ and Java. I don't know where to start. I want to use the Linux kernel, but I don't k...

Good guide to Linux internals?

Hello everyone! I really want to start developing deeper into the Linux kernel. I want to understand how it all comes together and how I can possibly make some changes or compile it for different architectures. I don't feel like buying another book, so I want to know, what are some good and free online guides to getting more into the Li...

How to modify struct sk_buff

I have to write a vpn module. First of all, I have wrote a kernel module that modifies all the incoming and outgoing TCP packets. It uses netfilter hooks. For the incoming packets, I have modified the bytes between (struct sk_buff)->data and (struct sk_buff)->tail pointers by incrementing them by one. For the outgoing packets, I have mod...

What are the exact conditions based on which Linux swaps process(s) memory from RAM to a swap file?

My server has 8Gigs of RAM and 8Gigs configured for swap file. I have memory intensive apps running. These apps have peak loads during which we find swap usage increase. Approximately 1 GIG of swap is used. I have another server with 4Gigs of RAM and 8 Gigs of swap and similar memory intensive apps running on it. But here swap usage i...

How to intercept HTTP requests on Linux desktops?

I really appreciate if someone could give me an idea how to implement this. Also, is it possible to have a common implementation for most of the popular Linux desktop distros, if not all of them. Thanks. What I need to implement is something like a Windows service, which runs automatically every time the OS boots. What it does is to int...

tasklet advantage in userspace application

Hi, Got some doubts with bottom half.Here, I consider tasklets only. Also , I consider non-preemptible kernel only. Suppose consider a ethernet driver in which rx interrupt processing is doing some 10 functions calls.(bad programming :) ) Now, looking at performance perspective if 9 function calls can be moved to a tasklet and only 1...

Does Linux drop into the kernel on all cores?

Hi: For a multi-core computer running Linux 2.6.x, what happens when a thread makes a system call? Does it drop into the kernel only on the core that the thread is running on, or does it drop into the kernel on all cores (sorry if this is a newbie question). Is this behaviour (whichever is the correct one) the same when receiving inte...

How do I call Linux syscall from kernel space?

I'm porting linux kernel module written for Linux 2.4 to work with Linux 2.6. Some syscalls declared through syscallN() macros and wrapped in set_fs() calls were used in the code. How can I still use sycalls in Linux 2.6 where those macros are absent? I know it's a bad taste to use syscalls from kernel space and syscallN() macros are br...

counting clock ticks linux 2.4.14

hello I am trying to count the total number of clock ticks for each process (only when its actually running). I inserted the following code in schedule() (sched.h): ... switch_tasks: prefetch(next); clear_tsk_need_resched(prev); if (likely(prev != next)) { rq->nr_switches++; rq->curr = next; ...

why not just plain files instead of initramfs or initrd?

The linux kernel uses a kind of ram disk to access modules at an early boot stage. Out of curiosity I want to understand I have a question: The file containing the initramfs/initrd must be accessible for the kernel at this stage. This means the kernel must have support for the appropriate filesystem. So why couldn't the content of the in...

How do I build an app for an old linux distribution, and avoid the FATAL: kernel too old error?

I distribute a statically linked binary version of my application on linux. However, on systems with the 2.4 kernel, I get a segfault on startup, and the message: "FATAL: kernel too old." How can I easily get a version up and running with a 2.4 kernel? Some of the libraries I need aren't even available on old linux distributions circa 2...

UML Linux - vmlinux.o Error 1 - final close failed: Input/output error

I'm trying to install UML linux. Kernel is 2.6.28. I link to Linux files so that I have a read-only copy that I can revert back to. I then run the commands: make defconfig ARCH=um # works make ARCH=um # errors out at the very end: final close failed: Input/output error make: *** [vmlinux.o] Error 1 Because of this error,...

where can I find a good enough default config to compile the Linux kernel?

i want to compile a custom linux kernel for myself. because i dont know every option of kernel therefore i am looking for a good default config for start. ...

compile drivers as module or built-in problem

i compiled Linux kernel with all drivers as built-in (all network drivers also compiled as built-in). all things work but ping time goes irregular (10ms , 90ms, ...). is it from built-in mode in compilation or problem is from another thing? ...

How can I allocate memory in the Linux kernel for a char* type string?

I'm trying to allocate some memory for a char* as follows. static ssize_t memo_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos){ ssize_t retval = -ENOMEM; printk("write function\n"); if((data = kmalloc(strlen(buf), GFP_KERNEL)) == NULL) printk("kmalloc fail\n"); if(copy_from_use...

Can software be executed in bare metal machine?

I just wonder, can we execute a program on a machine without an operating system? Besides, I heard that the Linux kernel is written in C language and a kernel is run during booting, so I just wonder how a computer understand the language without first compiling? ...