Date: Thu, 2 Nov 2000 00:12:02 -0500 From: Michael Bacarella <mbac@mmap.nyct.net> To: "G. Adam Stanislav" <adam@whizkidtech.net> Cc: hackers@FreeBSD.org Subject: Re: Kernel calls, are they documented somewhere? Message-ID: <20001102001202.A14447@mmap.nyct.net> In-Reply-To: <20001101222558.A408@whizkidtech.net>; from adam@whizkidtech.net on Wed, Nov 01, 2000 at 10:25:58PM -0600 References: <20001101222558.A408@whizkidtech.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 01, 2000 at 10:25:58PM -0600, G. Adam Stanislav 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. > 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)? If you're invoking syscalls directly, you're going to find yourself duplicating a lot of the conveniance that it provides. > 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.) This isn't such a daunting task with grep. Source code cross referencers can also help, but I don't use them nearly as often as I thought I would. -- Michael Bacarella <mbac@mmap.nyct.net> ;finger address for public key GPG Key Fingerprint: B4E4 82F5 BCAC AB83 E6F7 B5AA 933E 2A75 79A4 A9C1 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?20001102001202.A14447>