From owner-freebsd-questions@FreeBSD.ORG Tue Jan 20 03:38:21 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0046ED4 for ; Tue, 20 Jan 2015 03:38:21 +0000 (UTC) Received: from mail-pd0-x22a.google.com (mail-pd0-x22a.google.com [IPv6:2607:f8b0:400e:c02::22a]) (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 BA6E1822 for ; Tue, 20 Jan 2015 03:38:21 +0000 (UTC) Received: by mail-pd0-f170.google.com with SMTP id p10so28695503pdj.1 for ; Mon, 19 Jan 2015 19:38:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=3rB/s17JXYqvup3lbAzfX5o3I8itEtVh2Jg+J/rnTdE=; b=gojHeq416p93xEsqdsrE8OwgHgItastdAQJtyIm0tjdw9762cvvh65Qf0Us2hRHb5U V4SHtsyAa2hfIzYW35JOFEaxl9CQyr5MK+yC5boxLSJ5fkWOwmdBKhRY8rODFjsrqEM3 4QN2Mat/YCQ4zFX0BcSsRHbdNLg4ZLQiLeGC1vo08xzuUYiLrnThsFKdtZACl9iIN7KQ mq06nC5yfwtXxdf1WuwBlQmwNc3YkGQD3nPMVt+71ykKfm8ziv23QME1vQ2iAwQudonx EXmnmk6SzcEoMg2CNtiW4pK/4jZY+so2EFz+pK8hf6eZiLqpGiKjWdwzfAm52nypEMHH jgFA== X-Received: by 10.68.201.1 with SMTP id jw1mr27031074pbc.167.1421725101358; Mon, 19 Jan 2015 19:38:21 -0800 (PST) Received: from charmander (75-149-173-2-Washington.hfc.comcastbusiness.net. [75.149.173.2]) by mx.google.com with ESMTPSA id k5sm363601pdb.14.2015.01.19.19.38.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jan 2015 19:38:20 -0800 (PST) Date: Mon, 19 Jan 2015 19:38:06 -0800 From: Mark Johnston To: "Ivan \"Rambius\" Ivanov" Subject: Re: modfind() returns -1 Message-ID: <20150120033806.GA8920@charmander> References: <20150120004633.GA5448@charmander.picturesperfect.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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:38:22 -0000 On Tue, Jan 20, 2015 at 05:27:16AM +0200, Ivan "Rambius" Ivanov wrote: > 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/ ? 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.