Recognize the kernel's syscall-handler naming conventions. On x86_64 kernels with the per-arch wrapper macros, every entry resolves to one of these prefixes (or to `sys_ni_syscall` for unimplemented numbers).
| 59 | // kernels with the per-arch wrapper macros, every entry resolves to one |
| 60 | // of these prefixes (or to `sys_ni_syscall` for unimplemented numbers). |
| 61 | bool name_is_syscall_handler(const std::string& n) { |
| 62 | if (n.empty()) return false; |
| 63 | static const char* prefixes[] = { |
| 64 | "__x64_sys_", "__x64_compat_sys_", |
| 65 | "__ia32_sys_", "__ia32_compat_sys_", |
| 66 | "__do_sys_", "__se_sys_", |
| 67 | "sys_", "compat_sys_", |
| 68 | "__arm64_sys_", // for completeness — not relevant on x86 dumps |
| 69 | }; |
| 70 | for (const char* p : prefixes) { |
| 71 | std::size_t plen = std::strlen(p); |
| 72 | if (n.size() >= plen && n.compare(0, plen, p) == 0) return true; |
| 73 | } |
| 74 | // `sys_ni_syscall` shows up bare (no prefix) and is legitimate. |
| 75 | return n == "sys_ni_syscall"; |
| 76 | } |
| 77 | |
| 78 | } // anonymous |
| 79 |
no test coverage detected