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
// <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message