Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Nov 2004 13:14:08 +0200
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        Dan Strick <strick@covad.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Where is the source to the system calls?
Message-ID:  <20041108111408.GA300@pm514-9.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <200411080029.iA80TgJ0040646@mist.nodomain>
References:  <200411080029.iA80TgJ0040646@mist.nodomain>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 07, 2004 at 04:29:42PM -0800, Dan Strick wrote:
> Does anyone know where the system calls are really defined?

As others said, syscalls are implemented in /sys.

> I followed open() to _open() to __sys_open() which seems
> to be part of something called libc_r before I ran into a
> blank wall.  I grepped all of the regular files in /usr/src
> and /usr/include and turned up nothing.  I even tried
> grepping for open in the output of "nm -g /usr/lib/libc.a".
> There is no __sys_open() in libc.  Am I dealing with
> C-compiler magic?  Secret macro instructions invoking
> undocumented gnu C-compiler asm() features?  A CIA plot?

You didn't say the version of FreeBSD you use (I guess
that you use 4.x).

__sys_open is an entry name for open() syscall and it (and most
of other ones) is "constructed" in the /usr/src/lib/libc/i386/SYS.h
file for i386, check it.

And check /usr/src/lib/libc/sys/Makefile.inc to understand
from where names of syscalls are taken and how Assembler
sources are created for syscalls.



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