return true;
}
+kernel_long_t
+scno_by_name(const char *s, unsigned int p, kernel_long_t start)
+{
+ if (p >= SUPPORTED_PERSONALITIES)
+ return -1;
+
+ for (kernel_ulong_t i = start; i < nsyscall_vec[p]; ++i) {
+ if (sysent_vec[p][i].sys_name &&
+ strcmp(s, sysent_vec[p][i].sys_name) == 0)
+ return i;
+ }
+
+ return -1;
+}
+
static bool
qualify_syscall_name(const char *s, struct number_set *set)
{
bool found = false;
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
- for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
- if (sysent_vec[p][i].sys_name &&
- strcmp(s, sysent_vec[p][i].sys_name) == 0) {
- add_number_to_set_array(i, set, p);
- found = true;
- }
+ for (kernel_long_t scno = 0;
+ (scno = scno_by_name(s, p, scno)) >= 0;
+ ++scno) {
+ add_number_to_set_array(scno, set, p);
+ found = true;
}
}
* is valid; NULL otherwise.
*/
extern const char *syscall_name(kernel_ulong_t scno);
+/**
+ * Convert a syscall name to the corresponding (shuffled) syscall number.
+ *
+ * @param s Syscall name.
+ * @param p Personality.
+ * @param start From which position in syscall entry table resume the search.
+ * @return Shuffled syscall number (ready to use against sysent_vec)
+ * if syscall name is found; -1 otherwise.
+ */
+extern kernel_long_t scno_by_name(const char *s, unsigned p,
+ kernel_long_t start);
/**
* Shuffle syscall numbers so that we don't have huge gaps in syscall table.
* The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n.