From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 8 11:15:00 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A10116A4CE for ; Mon, 8 Nov 2004 11:15:00 +0000 (GMT) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [194.125.244.127]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFD3C43D41 for ; Mon, 8 Nov 2004 11:14:47 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm514-9.comsys.ntu-kpi.kiev.ua (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) (authenticated bits=0)iA8BEaPD032495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 8 Nov 2004 13:14:36 +0200 (EET) Received: by pm514-9.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1000) id 0B3C614D; Mon, 8 Nov 2004 13:14:08 +0200 (EET) Date: Mon, 8 Nov 2004 13:14:08 +0200 From: Andrey Simonenko To: Dan Strick Message-ID: <20041108111408.GA300@pm514-9.comsys.ntu-kpi.kiev.ua> References: <200411080029.iA80TgJ0040646@mist.nodomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200411080029.iA80TgJ0040646@mist.nodomain> User-Agent: Mutt/1.4.2.1i cc: freebsd-hackers@freebsd.org Subject: Re: Where is the source to the system calls? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2004 11:15:00 -0000 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.