From owner-freebsd-hackers Sun Aug 22 18:38:29 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.xmission.com (mail.xmission.com [198.60.22.22]) by hub.freebsd.org (Postfix) with ESMTP id D247C14F88 for ; Sun, 22 Aug 1999 18:38:27 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from [204.68.178.39] (helo=softweyr.com) by mail.xmission.com with esmtp (Exim 2.12 #1) id 11Ij3S-0003mh-00; Sun, 22 Aug 1999 19:37:47 -0600 Message-ID: <37C0A5E8.9390D0DB@softweyr.com> Date: Sun, 22 Aug 1999 19:37:44 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Dillon Cc: Don Lewis , hackers@FreeBSD.ORG Subject: Re: mmap mapped segment length References: <199908210906.CAA17706@salsa.gv.tsc.tdk.com> <37BF4C99.67814B7@softweyr.com> <199908220247.TAA75778@apollo.backplane.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matthew Dillon wrote: > > :Now I've got to go figure out what *I've* screwed up. I fstat the file before > :mapping it and pass S.st_size as the map length. Is there any reason why > :mmap would return non-NULL but map less than the requested size? > : > :Scratching my head, > > Note that mmap() returns (void *)-1 when an error occurs, *not* NULL. > > This is because it is legal to mmap at address 0. Uh, yeah, the program source actually checks against MAP_FAILED. I do usually read the man pages when I write code. ;^) I found the problem, it was caused by unexpected input. Doh! The program is now working, and is on the 44th (of 78) 60 megabyte input files. Good thing the REAL system is a dual PII Xeon 450, huh? Maybe I should add a -j jobs option so I can make sure we use that other processor. As I/O bound as this task is, I'm not sure it would help. Thanks to everyone who responded, and for the politeness of the responses in the face of the stupidity of the original question. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC http://softweyr.com/ wes@softweyr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message