它是指向当前进程(即发出系统调用的进程)的指针。
在x86上,它是在
arch/x86/include/current.h(其他拱门的类似文件)中定义的。
#ifndef _ASM_X86_CURRENT_H#define _ASM_X86_CURRENT_H#include <linux/compiler.h>#include <asm/percpu.h>#ifndef __ASSEMBLY__struct task_struct;DECLARE_PER_CPU(struct task_struct *, current_task);static __always_inline struct task_struct *get_current(void){ return percpu_read_stable(current_task);}#define current get_current()#endif #endif Linux设备驱动程序第2章中的更多信息:
当前指针是指当前正在执行的用户进程。在执行系统调用(例如打开或读取)期间,当前进程是调用该调用的进程。如果需要,内核代码可以通过使用current来使用特定于进程的信息。[…]



