summaryrefslogtreecommitdiffstats
path: root/bin/grepc
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-06 16:56:43 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-06 23:18:27 +0200
commit2dbf25293c33f579c05091ae4661be4fa9748a1f (patch)
tree16cfbd579f9d5741c116687669e27d0dff5c8045 /bin/grepc
parentbf61511260fc61f7231fea5838c97842eb064731 (diff)
grepc: grepc_syscall: Find kernel syscalls (both declaration and definition)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'bin/grepc')
-rwxr-xr-xbin/grepc31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/grepc b/bin/grepc
index e9b6877..9332509 100755
--- a/bin/grepc
+++ b/bin/grepc
@@ -67,6 +67,36 @@ function grepc_func()
}
+function grepc_syscall_decl()
+{
+ find . -type f \
+ | grep '\.[ch]$' \
+ | xargs grep -l "\bsys_$1\b" \
+ | sort \
+ | xargs pcregrep -Mn \
+ "(?s)^asmlinkage\s+[\w\s]+\**sys_$1\s*\(.*?\)" /dev/null \
+ | sed -E 's/^[^: ]+:[0-9]+:/\n\n&\n\n/';
+}
+
+
+function grepc_syscall_def()
+{
+ find . -type f \
+ | grep '\.c$' \
+ | xargs grep -l "SYSCALL_DEFINE.($1\b" \
+ | sort \
+ | xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\($1\b.*?^}" /dev/null \
+ | sed -E 's/^[^: ]+:[0-9]+:/\n\n&\n\n/';
+}
+
+
+function grepc_syscall()
+{
+ grepc_syscall_decl "$1";
+ grepc_syscall_def "$1";
+}
+
+
function grepc_type_struct_union_enum()
{
find . -type f \
@@ -139,6 +169,7 @@ function main()
{
grepc_macro "$1";
grepc_func "$1";
+ grepc_syscall "$1";
grepc_type "$1";
}