Date: Sat, 28 Sep 1996 10:56:43 -0500 (EST) From: "John S. Dyson" <toor@dyson.iquest.net> To: guido@gvr.win.tue.nl (Guido van Rooij) Cc: dyson@FreeBSD.org, FreeBSD-hackers@FreeBSD.org Subject: Re: stack Message-ID: <199609281556.KAA01300@dyson.iquest.net> In-Reply-To: <199609281552.RAA05940@gvr.win.tue.nl> from "Guido van Rooij" at Sep 28, 96 05:52:49 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609281556.KAA01300>
