modfind() returns -1

Ivan "Rambius" Ivanov rambiusparkisanius at gmail.com
Tue Jan 20 03:27:17 UTC 2015


Hello,

On 1/20/15, Mark Johnston <markjdb at gmail.com> wrote:
> On Mon, Jan 19, 2015 at 06:17:10AM +0200, Ivan "Rambius" Ivanov wrote:
>> Hello,
>>
>> I am trying to implement a simple system call module, but after I
>> install it and try to find its offset with modfind, I somehow get -1.
>>
>> [...]
>> Here is the code that tries to invoke that system call:
>>
>> $ cat interface.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>> #include <sys/syscall.h>
>> #include <sys/types.h>
>> #include <sys/module.h>
>>
>> int main(int argc, char *argv[]) {
>>   int syscall_num;
>>   struct module_stat stat;
>>   int mod_id;
>>
>>   stat.version = sizeof(stat);
>>   mod_id = modfind("sc_example_no_args");
>
> Does it work if you instead look up "sys/sc_example_no_args"?
>

Yes, it works with

  mod_id = modfind("sys/sc_example_no_args");

Thank you very much for your help. Can you explain though why prefixed
with sys/ ?

Regards
Rambius
-- 
Tangra Mega Rock: http://www.radiotangra.com


More information about the freebsd-questions mailing list