Questions tagged [linux-kernel]

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers). Questions about writing userspace code in Linux should generally be tagged [linux] instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers).

Questions about writing userspace code in Linux should generally be tagged instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

The kernel is a UNIX-like kernel initially created by Linus Torvalds in 1991 and now is maintained by developers around the world.

Frequently Asked Questions

Online resources

Books

Kernel source code and source code browsers

Further reading

Mailing lists

17371 questions
6
votes
1 answer

how to list USB mass storage devices programatically using libudev in Linux?

I am doing a project with mass storage devices in linux. I am trying to write an application which will list all the connected usb mass storage devices and will give notification when a new mass storage device is plugged in. I am using libudev for…
jsaji
  • 900
  • 1
  • 15
  • 31
6
votes
1 answer

context of linux kernel threads

I wrote a simple kernel module that loops through all processes and extracts their registers saved when these were descheduled (especially EIP). If I'm not wrong, what I need is saved on the kernel stack pointed by sp0 in the thread_struct of every…
progacci
  • 61
  • 4
6
votes
4 answers

mounting without -o loop

I have written a dummy (ram disk) block device driver for linux kernel. When the driver is loaded, I can see it as /dev/mybd. I can successfully transfer data onto it using dd command, compare the copied data successfully. The problem is that when I…
6
votes
1 answer

Patching and compiling Ext4 as a kernel module

I'm currently patching Ext4 for academic purposes (only linux/fs/ext4/*, like file.c, ioctl.c, ext4.h) . I'm working on the QEMU virtual machine, and to speed up the whole process I've selected Ext4 to compile as a kernel module. The problem occurs…
6
votes
1 answer

Event notification from kernel space to user space

How to notify the user space application whenever an event occurs in the kernel space? A hardware generates an interrupt when the data arrives at some GPIO. This data is copied to the kernel buffer. At this point, I want the driver to notify the…
Sagar Jain
  • 7,475
  • 12
  • 47
  • 83
6
votes
2 answers

Why keep a kernel stack for each process in linux?

What's the point in keeping a different kernel stack for each process in linux? Why not keep just one stack for the kernel to work with?
Dan Dv
  • 473
  • 3
  • 12
6
votes
1 answer

Wake up android phone on an interrupt, on a GPIO

On Android development board, I am trying to wake up the AP based on an interrupt received on a GPIO, can anybody help me with this? My understanding on this is: We need to create an input device and update an event to this device based on the…
kumar
  • 73
  • 6
6
votes
1 answer

create device mapper target

I am trying to implement device mapper target by referring to the already existing ones dm-linear, dm-snapshot, dm-cache etc. In my implementation, I need to perform a read/modify/write operation on a certain sector range. Since the device mapper…
Rashid Shaikh
  • 395
  • 4
  • 12
6
votes
2 answers

redirect executable progress bar to log file

I have an Executable which shows progress bar on terminal. when i redirect the output to a file in th ebelow manner the below command is embedded in a script file usr/bin/exec >> log.txt this is terminal out put Progress…
user2598064
  • 157
  • 1
  • 13
6
votes
5 answers

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…
donatello
  • 5,727
  • 6
  • 32
  • 56
6
votes
1 answer

Why is sk_buff->protocol stored in network endian order?

Since the sk_buff fields are processed locally it makes more sense to store it in the host order. Fields like sk_buff->vlan_tci are in host order. Is there a reason for storing some fields sk_buff->protocol, sk_buff->vlan_proto in network/big endian…
Manohar
  • 3,865
  • 11
  • 41
  • 56
6
votes
1 answer

Getting 'errno 38: function not implemented' while making a system call

I'm trying to write a system call in Linux. I modified the unistd.h, syscall_32.tbl and sys.c as follows respectively: /* #define __NR3264_fadvise64 223 __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) */ #define…
zijuexiansheng
  • 337
  • 3
  • 14
6
votes
2 answers

How to generate a kernel oops or panic crash in Linux kernel code?

How can I generate a kernel oops or crash in kernel code? Is there a function for that?
user1804788
  • 187
  • 1
  • 3
  • 12
6
votes
2 answers

The difference between vold and udevd

I knew that Android uses volume daemon instead of udevd. Since both of these two daemons act similar as the following: Use netlink socket to receive uevents sent from kernel. Deals with file nodes for further processing. I am not clear with the…
Sam
  • 4,521
  • 13
  • 46
  • 81
6
votes
2 answers

physical memory address to DRAM mapping information for x86

I am wondering if there is any information on how to tell if two given physical memory addresses are in the same memory bank. I am working on x86 multicore architecture and need to hack memory access performance on task level. Thanks in…
user1201566
  • 103
  • 5