Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2002 19:43:37 +0100
From:      Pawel Jakub Dawidek <nick@garage.freebsd.pl>
To:        freebsd-hackers@freebsd.org
Subject:   Syscall number.
Message-ID:  <20021220184337.GD11475@garage.freebsd.pl>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hello hackers...

Simple example (from kld module):

sysent[SYS_chmod].sy_call = myfunction;
sysent[SYS_open].sy_call = myfunction;
sysent[SYS_execve].sy_call = myfunction;

int
myfunction(register struct proc *p, register void *uap)
{
	int syscallno;

	syscallno = ?

	return (0);
}

How to get syscall number inside myfunction()?

I've always use method used in spy from Andrzej Bialecki:

	syscallno = p->p_md.md_regs->tf_eax;

for i386 arch.
But when I catch many syscalls I got false numbers.
Hmm, not false numbers, one false numer: SYS___syscall (and I don't catch it).

So is there some diffrent way to get syscall number (in -STABLE
or in -CURRENT)? Anyone?

-- 
Pawel Jakub Dawidek
UNIX Systems Administrator
http://garage.freebsd.pl
Am I Evil? Yes, I Am.

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iQCVAwUBPgNk2T/PhmMH/Mf1AQF3kAP+OjXHQvI05L2VrhUGL5CTL14gGH5splhG
+noP3XQ225+PuLJRyFvgezTPqBj5Ol9XaQT3YyzLtYQDFWUjSb25xrRlmO0cJmZ0
OD3jD00IV/FkVxyNSmHEXzSB62IF4wt5F7nbOroZ7fHOyqB1WW9UlVQ2AnVqGD/C
+6LpWT/wuBk=
=ZjfK
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021220184337.GD11475>