From owner-freebsd-questions@FreeBSD.ORG Tue Jan 20 03:27:17 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08D7CD82 for ; Tue, 20 Jan 2015 03:27:17 +0000 (UTC) Received: from mail-pa0-x22f.google.com (mail-pa0-x22f.google.com [IPv6:2607:f8b0:400e:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D251F6C0 for ; Tue, 20 Jan 2015 03:27:16 +0000 (UTC) Received: by mail-pa0-f47.google.com with SMTP id kq14so42730849pab.6 for ; Mon, 19 Jan 2015 19:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8x2f8Uc47EWTwNVJSNi74SW0JeOsgHaE/CvN9TlnW1g=; b=kpZbmOKjF79BWAEoh413cTdDqlb7tF47bJSlcb2GCK9KKNjCwknuqJ5K/afqqwkg8h TdcgVhEbXx97v/1EIqdB05udMkMMbPrUxMITH7WmqAG8SZrLQULDws8ip5tTha3fwFQb vNgw5HmmErgp/Q+P2oe8NSC0qG9RdcCaMlYOhfUp4O/uaPuMXX42TOBbhPHnWnHNVOnU fxpezGn+xYtZSsHPqLIjWM4PJKLRG2nlfnP2l+KbFvL537C8DlH+k6fwRe05LiqXvuAG xXNlABVd9o5aUr5dROhdbnzYVHeBUYSxYYguA9QwPt88oGWEh0loJxoh0OG8+n/BNCx+ O4Ig== MIME-Version: 1.0 X-Received: by 10.70.89.207 with SMTP id bq15mr49259748pdb.68.1421724436325; Mon, 19 Jan 2015 19:27:16 -0800 (PST) Received: by 10.70.99.171 with HTTP; Mon, 19 Jan 2015 19:27:16 -0800 (PST) In-Reply-To: <20150120004633.GA5448@charmander.picturesperfect.net> References: <20150120004633.GA5448@charmander.picturesperfect.net> Date: Tue, 20 Jan 2015 05:27:16 +0200 Message-ID: Subject: Re: modfind() returns -1 From: "Ivan \"Rambius\" Ivanov" To: Mark Johnston Content-Type: text/plain; charset=UTF-8 Cc: "mail.list freebsd-questions" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2015 03:27:17 -0000 Hello, On 1/20/15, Mark Johnston 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 >> #include >> #include >> #include >> #include >> #include >> >> 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