From owner-freebsd-hackers Sat Sep 28 08:57:17 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA12986 for hackers-outgoing; Sat, 28 Sep 1996 08:57:17 -0700 (PDT) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA12918; Sat, 28 Sep 1996 08:57:09 -0700 (PDT) Received: (from root@localhost) by dyson.iquest.net (8.7.5/8.6.9) id KAA01300; Sat, 28 Sep 1996 10:56:43 -0500 (EST) From: "John S. Dyson" Message-Id: <199609281556.KAA01300@dyson.iquest.net> Subject: Re: stack To: guido@gvr.win.tue.nl (Guido van Rooij) Date: Sat, 28 Sep 1996 10:56:43 -0500 (EST) Cc: dyson@FreeBSD.org, FreeBSD-hackers@FreeBSD.org In-Reply-To: <199609281552.RAA05940@gvr.win.tue.nl> from "Guido van Rooij" at Sep 28, 96 05:52:49 pm Reply-To: dyson@FreeBSD.org X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > John S. Dyson wrote: > > > When I allocate something on the stack, isn't it supposed to be completely > > > zero? > > > like: > > > main(int argc, char **argv) { > > > char buf[1000]; > > > > > > ... > > > } > > > > > > Then buf should be zero, or am I missing something here? > > > > > The first time that you use a page the kernel will demand zero it. But > > if you have used the stack space before, it will be whatever you left in > > it. > > I used exactly this program: > main() { > char buf[1000]; > > write(1, buf, 1000); > } > > The resulting file did not conatin only zero's. I think this is weird. > This is on a 2.1.5R system > If something had been called before main(), by the startup code, then there will likely be stuff left on the stack. John