Help with linprocfs small patch

Hi,

Could anyone help me with this small patch? I don't know why it doesn't show the proper environment for the process. It seems to show the current process' environment.

Code:
/*
 * Filler function for proc/pid/environ
 */
static int
linprocfs_doprocenviron(PFS_FILL_ARGS)
{
        int i, error;
        struct ps_strings pss;
        char **ps_envstr;

        if (p_cansee(td, p) != 0)
                return (0);

        error = copyin((void *)p->p_sysent->sv_psstrings, &pss,
                                            sizeof(pss));
        if (error)
                return (error);

        ps_envstr = malloc(pss.ps_nenvstr * sizeof(char *),
            M_TEMP, M_WAITOK);

        error = copyin((void *)pss.ps_envstr, ps_envstr,
            pss.ps_nenvstr * sizeof(char *));

        if (error) {
                free(ps_envstr, M_TEMP);
                return (error);
        }

        /* NULL separated list of variable=value pais */
        
        for (i = 0; i < pss.ps_nenvstr; i++) {
                sbuf_copyin(sb, ps_envstr[i], 0);
        } 

        free(ps_envstr, M_TEMP);
        return (0);
}

I'm running this on FreeBSD 8.0-RELEASE-p2.

Thanks in advance
 
Back
Top