From owner-freebsd-hackers Wed Nov 1 22:12:53 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from whizkidtech.net (rh8.bfm.org [216.127.220.201]) by hub.freebsd.org (Postfix) with ESMTP id 8207D37B4D7 for ; Wed, 1 Nov 2000 22:12:47 -0800 (PST) Received: (from adam@localhost) by whizkidtech.net (8.9.2/8.9.2) id AAA00312; Thu, 2 Nov 2000 00:11:28 -0600 (CST) (envelope-from adam) Date: Thu, 2 Nov 2000 00:10:56 -0600 From: "G. Adam Stanislav" To: Michael Bacarella Cc: hackers@FreeBSD.org Subject: Re: Kernel calls, are they documented somewhere? Message-ID: <20001102001056.A276@whizkidtech.net> References: <20001101222558.A408@whizkidtech.net> <20001102001202.A14447@mmap.nyct.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20001102001202.A14447@mmap.nyct.net>; from mbac@mmap.nyct.net on Thu, Nov 02, 2000 at 12:12:02AM -0500 Organization: Whiz Kid Technomagic X-URL: http://www.whizkidtech.net/ X-Castle: http://www.redprince.net/ X-Special-Effects: http://www.FilmSFX.com/ X-Operating-System: FreeBSD whizkidtech.net 3.1-RELEASE FreeBSD 3.1-RELEASE Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message