diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-06 16:56:43 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-05-06 23:18:27 +0200 |
commit | 2dbf25293c33f579c05091ae4661be4fa9748a1f (patch) | |
tree | 16cfbd579f9d5741c116687669e27d0dff5c8045 /bin/grepc | |
parent | bf61511260fc61f7231fea5838c97842eb064731 (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-x | bin/grepc | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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"; } |