kmalloc #include <linux/slab.h> void *kmalloc(size_t size,int flags); void kfree(void *addr); flags: GFP_ATOMIC: Used to allocate memory from interrupt handlers and other code outside of a process context.Never sleeps GFP_KERNEL: Normal allocation o…
Concurrency and Its Management Race condition can often lead to system crashes, memory leak,corrupted data,or security problem as well avoid the use of global variables The Linux Semaphore Implementation Semaphore #include <linux/semaphore.h> void s…
Measuring Time Lapses The counter and the utility functions to read it live in <linux/jiffies.h>.Needless to say both jiffies and jiffies_64 must be considered read-only. Processor-Specific Registers #include <asm/msr.h> rdtsc(low32,high32); r…
ioctl //user space int ioctl(int fd,unsigned long cmd,...); //kernel space int (*ioctl)(struct inode *inode,struct file* filp,unsigned int cmd,unsigned long arg) Blocking I/O #include <linux/wait.h> wait_queue_head_t my_queue; DECLARE_WAIT_QUEUE_HEA…
Linux kernel coding style | Linux内核编码风格 This is a short document describing the preferred coding style for the linux kernel. Coding style is very personal, and I won't force my views on anybody, but this is what goes for anything that I have to be ab…
## Linux kernel memory-faq.txt What is some existing documentation on Linux memory management? Ulrich Drepper (the ex-glibc maintainer) wrote an article series called "What every programmer should know about memory": Part 1: http://lwn.net/Artic…
转自:http://blog.csdn.net/u011461299/article/details/9772215 版权声明:本文为博主原创文章,未经博主允许不得转载. 一般来说,在一个device driver中实现中断,是比较简单的,如上面的RTC的例子.其无非就是: 1.       定义一个IRQ No.如何将Hardware中断信息map到我们的IRQ No就是get_irqnr_and_base要做得事情,get_irqnr_and_base是一个macro,后面会详细分析之.这个…
ANALYSIS AND EXPLOITATION OF A LINUX KERNEL VULNERABILITY (CVE-2016-0728) By Perception Point Research Team Introduction The Perception Point Research team has identified a 0-day local privilege escalation vulnerability in the Linux kernel. While the…
python/python-linux-procfs/python-linux-procfs.git - Python classes to extract information from the Linux kernel /proc files. https://git.kernel.org/pub/scm/libs/python/python-linux-procfs/python-linux-procfs.git/ #! /usr/bin/python # -*- python -*-…
Linux Kernel中所應用的數據結構及演算法 Basic Data Structures and Algorithms in the Linux kernel Links are to the source code on github. Linked list, doubly linked list, lock-free linked list. B+ Trees with comments telling you what you can't find in the textbooks…