summaryrefslogtreecommitdiff
path: root/scripts/bpf_doc.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/bpf_doc.py')
-rwxr-xr-xscripts/bpf_doc.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index dfb260de17a8..061ad1dc3212 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -10,6 +10,8 @@ from __future__ import print_function
import argparse
import re
import sys, os
+import subprocess
+
class NoHelperFound(BaseException):
pass
@@ -357,6 +359,20 @@ class PrinterRST(Printer):
print('')
+ def get_kernel_version(self):
+ try:
+ version = subprocess.run(['git', 'describe'], cwd=linuxRoot,
+ capture_output=True, check=True)
+ version = version.stdout.decode().rstrip()
+ except:
+ try:
+ version = subprocess.run(['make', 'kernelversion'], cwd=linuxRoot,
+ capture_output=True, check=True)
+ version = version.stdout.decode().rstrip()
+ except:
+ return 'Linux'
+ return 'Linux {version}'.format(version=version)
+
class PrinterHelpersRST(PrinterRST):
"""
A printer for dumping collected information about helpers as a ReStructured
@@ -378,6 +394,7 @@ list of eBPF helper functions
-------------------------------------------------------------------------------
:Manual section: 7
+:Version: {version}
DESCRIPTION
===========
@@ -410,8 +427,10 @@ kernel at the top).
HELPERS
=======
'''
+ kernelVersion = self.get_kernel_version()
+
PrinterRST.print_license(self)
- print(header)
+ print(header.format(version=kernelVersion))
def print_footer(self):
footer = '''