> --- Jonathan Haslam <Jonathan.Haslam at Sun.COM> wrote: > > > Hi Stefan, > > > > The ::getenv dcmd was only introduced in Solaris 10. > > right, thanks. That explains. > > I will try tomorrow to see if I'm able to extract the > information using " the pr_envp pointer > in the psinfo_t struct" > > I'm trying to figure out how. > > thanks, > Stefan
pr_envp is the *original* environ pointer created by exec(). But if the application has undergone a large number of setenv()s, then the array may have needed to be resized, in which case that value isn't the proper one anymore. (Technically a process could also reassign _environ directly, although that isn't kosher from a POSIX perspective) So you really need to lookup _environ and read the array it refers to. My recommendation would be to either take the code for mdb's ::getenv or pargs (usr/src/cmd/ptools/pargs/pargs.c), now conveniently OpenSourced for your viewing pleasure, and recompile it on your Solaris 8 system. Pargs may require some newer stuff from libproc, but you can take that too. Alternately, it should be pretty easy to take the S10 mdb ::getenv and recompile that as a stand-alone mdb module for S8. -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/