Cover image for 查询内核API最早引入版本

查询内核API最早引入版本

字数 116
阅读
访客

时间轴

时间轴

2026-05-21

init

本文介绍了如何查询内核特定API最早引入的版本,并通过具体示例说明了查询方法。

如何查看内核某个API是在哪个版本引入的呢?以array_index_nospec为例

1
2
3
4
5
6
7
8
9
10
git clone https://github.com/torvalds/linux.git

# 找到其定义所在的头文件 include/linux/nospec.h
git blame include/linux/nospec.h

# 找到commit id号
git show f3804203306e0

# 查看包含这个commit id的所有tag
git tag --contains f3804203306e0