From owner-freebsd-hackers Mon Jun 28 21:48:39 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (Postfix) with ESMTP id CE83314D67 for ; Mon, 28 Jun 1999 21:48:33 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id OAA22136; Tue, 29 Jun 1999 14:18:31 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.3/8.9.0) id OAA89139; Tue, 29 Jun 1999 14:18:30 +0930 (CST) Date: Tue, 29 Jun 1999 14:18:30 +0930 From: Greg Lehey To: Patryk Zadarnowski Cc: Amol Mohite , freebsd-hackers@FreeBSD.ORG Subject: Re: environment strings Message-ID: <19990629141830.J85121@freebie.lemis.com> References: <199906290444.OAA30104@mycenae.ilion.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <199906290444.OAA30104@mycenae.ilion.eu.org>; from Patryk Zadarnowski on Tue, Jun 29, 1999 at 02:44:39PM +1000 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tuesday, 29 June 1999 at 14:44:39 +1000, Patryk Zadarnowski wrote: > >> I know about envp. >> >> What I want to know is the exact position of these variables on the stack. >> >> and if anywhere I can find some data, on the exact compisoition of the >> stcak, then it will be very helpful. >> >> references of books and websites wil be most helpful. > > Basically, i386 BSD kernels (you're after i386, aren't you?) point ESP to > the following "struct" (which means that it will be dumped at the very > top of the address space) > > struct kframe { > int argc; /* "argc" to be passed to main() */ > char *argv[argc]; /* "argv" to be passed to main() */ > char *null; /* a NULL pointer terminating argv[] */ > char **envp; /* value to be assigned to "environ" */ > }; In fact, the environment strings are at the very top, followed by the arguments, followed by this structure. But I suppose that's what you meant to say. Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message