>Solaris 5.10 Generic_141445-09 i86pc > >I am playing around with a kernel module, learning some of the inner workings >of the kernel, and I would like to have a look at a process' environment. > >I am confused by the definition in user_t for environment: > > uintptr_t u_envp; > >.. since I am more used to seeing "char **" in userland. > >How can I use this? Is this a pointer into the process's stack which >the environment pointer-list?
It is the pointer into the user stack where the kernel copied the environment when the process started. > >If I use something like (curthread)->t_procp->p_user.u_envp to locate it, >should I first use copyin() on "u_envp" ? Yep. >This simply incur GP panic: > > if ( (curthread)->t_procp->p_user.u_envp ) { > char **ep = NULL; > if (!copyin((curthread)->t_procp->p_user.u_envp, > &env, sizeof(env))) { > > cmn_err(CE_NOTE, "env is '%s'\n",env[0]); > > >Thanks. > >ps. Is it required to check for NULL on 'curthread', 't_procp', 'p_user' >generally? Should I? No. What exactly are trying to do? Casper _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code