Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2000 11:25:59 +0100 (CET)
From:      Andrzej Bialecki <abial@webgiro.com>
To:        "G. Adam Stanislav" <adam@whizkidtech.net>
Cc:        Michael Bacarella <mbac@mmap.nyct.net>, hackers@FreeBSD.org
Subject:   Re: Kernel calls, are they documented somewhere?
Message-ID:  <Pine.BSF.4.20.0011021047001.55116-100000@mx.webgiro.com>
In-Reply-To: <20001102001056.A276@whizkidtech.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Nov 2000, G. Adam Stanislav wrote:

> I do have the source code, and I have studied it, but it is uncommented.
> And, it seems, not all of it is included. For example, there is a
> /usr/src/lib/libc/sys/open.2 but no corresponding open.c. I have been
> unable to find the source code for open() in libc. There is an open.c

The source for this type of syscalls is made "on the fly" in
Makefile. Since normally you use /usr/obj for keeping built objects, the
source files like e.g. open.S end up there. For open.S it contains the
following:

#include "SYS.h"
RSYSCALL(open)

which is a macro expanding to an asm wrapper around the syscall.

(Mind  you, I'm not an asm expert by any means, I just happen to know how
the building process works.. :-)

> in /usr/src/lib/libstand/ but it makes no system calls. Actually, it
> looks like a system call (it assigns its own file descriptors to files
> it opens), but it does not behave like our kernel (since it returns -1
> on errors, while our kernel has been returning 2 in my tests when trying
> to open a non-existing file as O_RDONLY:

libstand is a very special animal - it's used only for providing BSD-like
interface in BTX (bootloader) environment. Never use it when you run
kernel. OTOH, it's very enlightening to look into it and see how you
implement "syscalls" on a bare hardware...

Andrzej Bialecki

//  <abial@webgiro.com> WebGiro AB, Sweden (http://www.webgiro.com)
// -------------------------------------------------------------------
// ------ FreeBSD: The Power to Serve. http://www.freebsd.org --------
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ ----




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.20.0011021047001.55116-100000>