Date: Mon, 19 Jan 2015 19:38:06 -0800 From: Mark Johnston <markjdb@gmail.com> To: "Ivan \"Rambius\" Ivanov" <rambiusparkisanius@gmail.com> Cc: "mail.list freebsd-questions" <freebsd-questions@freebsd.org> Subject: Re: modfind() returns -1 Message-ID: <20150120033806.GA8920@charmander> In-Reply-To: <CAE9rwzMG6V=qr9=KuvdgKjcWCRY88FVUSBxEzfPMvRkCh50WzA@mail.gmail.com> References: <CAE9rwzNtUkBMzSskVigiW7hQH0NcHrovCv1UOoTrhwRp_JkUZQ@mail.gmail.com> <20150120004633.GA5448@charmander.picturesperfect.net> <CAE9rwzMG6V=qr9=KuvdgKjcWCRY88FVUSBxEzfPMvRkCh50WzA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 20, 2015 at 05:27:16AM +0200, Ivan "Rambius" Ivanov wrote: > Hello, > > On 1/20/15, Mark Johnston <markjdb@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/ ? I just looked at the SYSCALL_MODULE(9) definition - it prepends "sys/" to the module name. This doesn't appear to be documented though, which is a bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150120033806.GA8920>