原创 _Generic keyword in C

A major drawback ofMacro in C/C++is that the arguments are strongly typed checked i.e. a macro can operate on different

原创 Squash commits into one with Git

Step 1: choose your starting commitgit rebase --interactive [commit-hash]Where[commit-hash]is the hash ofthe commit just

原创 ubuntu: How to Copy selection to clipboard automatically like putty?

ubuntu中設置鼠標選中即複製的功能。(不太好用,設置之後vs code中也變成了鼠標選中即複製……寫代碼的時候不行,還是設置個快捷鍵吧)主要命令和設置:it's possible.sudo apt-get install parcell

原创 win10總是很快自動休眠的解決方案

https://www.zhihu.com/question/39263412

原创 max(a, b) and more

Summary fromlink1andlink2.The “maximum” function is commonly defined as a macro in standard C as follows:#define max(a,b

原创 offsetof()

Add comments to offsetof()wikito understand its implementation.The "traditional" implementation of the macro relied on t

原创 The Slab Allocator

Save space for The Slab Allocator.

原创 size_t

According to the 1999 ISO C standard (C99),size_tis anunsignedinteger type of at least 16 bit (see sections 7.17 and 7.1

原创 How time is updated when tick interrupts are disabled

In Understanding the Linux Kernel, there is paragram pasted below. It states why jiffies_64 is correctin long runeven se

原创 process switch in interrupt handler or sleep in interrupt handler

ULK:The price to pay for allowing nested kernel control paths is that an interrupt handlermust never block, that is, no

原创 c volatile keyword and memory cache

The 'volatile' keyword is used to tells the compiler to fetch a variable each time frommemoryrather then use a "compiler

原创 fork() printf()

#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { int i; for(i=0; i<2; i++){

原创 find variale value in ELF file

copied fromstackoverflow.First, you would usereadelfto determine the virtual address of the variable (where it lives in

原创 add a new system call for x86

#define T_SYSCALL 64 // system call #define SYS_fork 1 #define SYS_sleep 2 #define SYSCALL(name) \ .

原创 vscode regex replace

question:replace following line in left to its right part.[SYS_write]   sys_write,    -> [SYS_write]   "write",solution: