On Thu, Nov 02, 2000 at 12:12:02AM -0500, Michael Bacarella wrote:
>gcc does not generate code that can make FreeBSD system calls directly.
>Most system calls as we know them by the manual have corresponding
>wrappers in libc. See /usr/src/lib/libc if you have the source installed.

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
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:

        sub     eax, eax        ; EAX = 0 = O_RDONLY
        push    eax
        push    eax
        push    esi             ; points at file name
        push    eax             ; fake return address
        int     80h
        add     esp, byte 16

(That's NASM syntax.) If the file exists, I get a file descriptor in EAX,
otherwise EAX = 2. It would be nice if I could get some kind of formal
confirmation that this is how it is supposed to be, and that all FreeBSD
versions behave like that.

Adam

-- 
Apply standard disk lamer


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to