Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2000 22:25:58 -0600
From:      "G. Adam Stanislav" <adam@whizkidtech.net>
To:        hackers@FreeBSD.org
Subject:   Kernel calls, are they documented somewhere?
Message-ID:  <20001101222558.A408@whizkidtech.net>

next in thread | raw e-mail | index | archive | help
Are the system calls made via interrupt 0x80 documented somewhere?

Whatever section 2 of man says does not work when making direct kernel
calls. It only describes how the C library calls work.

For example, open() returns -1 if the file is not open. But int 80h
made in assembly language with EAX = 5 (SYS_open) returns a positive
value whether or not the file was opened. My tests show it returns 2
if the open fails, or a valid file descriptor otherwise. But can I
rely on it being the case with other versions of FreeBSD (I have 3.1)?

Similarly, SYS_sbrk always returns a very small value, while the C sbrk()
works as described in man 2 sbrk. I have given up on SYS_sbrk altogether,
and am reserving a huge buffer in .bss instead. But if I overrun that
buffer, my software has to quit for "lack of memory".

Please don't tell me to read the kernel source code: I am not about
to spend weeks or months wading through it just so I can write free
software. (Quite frankly I tried, but I often have no clue as to which
file contains the code I am looking for.)

What I'd like to know is if there is a document or a book that describes
the return values of the various system calls. All I could find is
the systemcalls.master (and .h and such) file which only gives me
the arguments to pass to each call but not how to determine whether
the call succeeded. Nor is eaminging the libc source code too helpful
(it contains very few if any comments). This is very frustrating...

Please, rest assured that I will publish any answers I find in Assembly
Programming Journal, and on my web site, to make it easier on other assembly
language programmers to code for FreeBSD. Most of them (us) have enough
information to write assembly programs for Windows only. I'd like to change
that and bring as many as possible to our camp.

Cheers,
Adam

-- 
This signature intentionally left blank


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?20001101222558.A408>