Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Re: stack sizes, Segments Date: Thu, 23 Jan 2025 07:24:12 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 25 Message-ID: <2025Jan23.082412@mips.complang.tuwien.ac.at> References: <20250122152543.00000682@yahoo.com> <20250123014516.00006d99@yahoo.com> Injection-Date: Thu, 23 Jan 2025 09:10:07 +0100 (CET) Injection-Info: dont-email.me; posting-host="6989dc083b91c8ffbf9160be9bc4dae3"; logging-data="1632140"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bnvVJ37V9thBeeHddhtRz" Cancel-Lock: sha1:Bzo6Q2wrEkCHyfp+D0ePF2iC5F8= X-newsreader: xrn 10.11 Bytes: 2098 scott@slp53.sl.home (Scott Lurndal) writes: >What would an application (portable or otherwise) use the process >stack base address for? Finding roots for garbage collection. >The data is available through the /proc/ filesystem. > >$ cat /proc/$$/maps | grep "[stack]" > >7fff77b52000-7fff77b73000 rw-p 00000000 00:00 0 [stack] That's Linux (I just tried it on AIX 7.3.3; there is no /proc/$$/maps). For the kind of application under discussion Linux also has /proc/self/maps, so you don't need to getpid() and convert it to decimal, but in the example that would produce the maps of the "cat" process, not that of the surrounding shell. I would use "grep -F", because grep by default searches for regexp and '[' and ']' are regexp meta-characters. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup,