Date: Tue, 23 Mar 1999 23:06:19 +0000 (GMT) From: Doug Rabson <dfr@nlsystems.com> To: Dan Seguin <dseg@texar.com> Cc: freebsd-hackers@freebsd.org Subject: Re: syscalls Message-ID: <Pine.BSF.4.05.9903232303410.78570-100000@herring.nlsystems.com> In-Reply-To: <Pine.BSF.3.91.990323173006.1207A-100000@pak.texar.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 23 Mar 1999, Dan Seguin wrote: > > > Hi all. > > Is it possible to make syscalls from KLDs? I had assumed that the indirect > syscall(SYS_call, ...) would do the trick, but all I get is a panic (12, > page fault) when I try to load the KLD. Is there anything special I need > to do before calling syscall()? What I'm trying to do is create a > socket/connect channel for auditing purposes. So... > > /* Code snippet */ > { > > #include <sys/socket.h> > #include <unistd.h> > > int sockfd; > > sockfd = syscall(SYS_socket, AF_UNIX, SOCK_STREAM, 0); > > } > > > etc, etc. This appears in a function that is called upon KLD LOAD. > > > I've tried __syscall((quad_t) SYS_socket, AF_UNIX, SOCK_STREAM, 0), to no > avail. > > > Thanks for your help. Syscalls are the interface from user code to kernel code. The code in a KLD is kernel code and as such should not (can't) use syscalls to obtain kernel services. In many cases, it is possible to call the underlying kernel implementation for these services directly using the internal kernel apis. For most of these apis, the only documentation is the kernel sources. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 442 9037 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9903232303410.78570-100000>