Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Nov 2000 20:57:57 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        flaw@vt.edu (flaw)
Cc:        rlaw@vt.edu (Raymond Law), tlambert@primenet.com (Terry Lambert), freebsd-hackers@FreeBSD.ORG (freebsd-hackers)
Subject:   Re: system call and SYSCALL macro
Message-ID:  <200011082057.NAA26096@usr08.primenet.com>
In-Reply-To: <3A13684F@zathras.cc.vt.edu> from "flaw" at Nov 08, 2000 03:10:56 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> I am not using kld to implement my system call.  I am just using
> the old way.  
>
> But I tried using pointers also.  But I am not getting the correct
> returned values either...

The correct return value is probably "-1", with the value of 'z'
being undefined, for what you have now.

If you are not KLD'in your system call, how are you informing
the kernel of its existance?

The normal way this is done is to modify /sys/kern/syscalls.master,
e.g.:

180	STD	NOHIDE	{ int my_call(int x, int y, int *z); }

And building a new kernel, after making sure that syscalls.c is
regenerated from syscalls.master, and that your .c file that
implements "my_call" is included in the kernel compilation.

Examine the sysent[] array created from syscalls.master during
the build process (down in your kernel compile directory) to
make sure that it was put in there; if it wasn't go back and
try again until it is.

Once you have built a kernel that has your entry in it, you
will need to install it and boot off it (I suggest using the
name "kernel.test" as the installed kernel name, so that if
you screw up, your default kernel will still boot, and so you
can ignore it at boot time, when you switch to KLDs).

Really, you want to use KLDs for this.

If you are adamant about not using KLDs, remember: don't bother
even trying to boot your new kernel, if there isn't a "my_call"
listed in syscalls.c or its function pointer is not in the
sysent[] array.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.


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?200011082057.NAA26096>