static int fill_psinfo(struct target_elf_prpsinfo *psinfo, const TaskState *ts)

{

    char *filename, *base_filename;

    unsigned int i, len;



    (void) memset(psinfo, 0, sizeof (*psinfo));



    len = ts->info->arg_end - ts->info->arg_start;

    if (len >= ELF_PRARGSZ)

        len = ELF_PRARGSZ - 1;

    if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_start, len))

        return -EFAULT;

    for (i = 0; i < len; i++)

        if (psinfo->pr_psargs[i] == 0)

            psinfo->pr_psargs[i] = ' ';

    psinfo->pr_psargs[len] = 0;



    psinfo->pr_pid = getpid();

    psinfo->pr_ppid = getppid();

    psinfo->pr_pgrp = getpgrp();

    psinfo->pr_sid = getsid(0);

    psinfo->pr_uid = getuid();

    psinfo->pr_gid = getgid();



    filename = strdup(ts->bprm->filename);

    base_filename = strdup(basename(filename));

    (void) strncpy(psinfo->pr_fname, base_filename,

                   sizeof(psinfo->pr_fname));

    free(base_filename);

    free(filename);



#ifdef BSWAP_NEEDED

    bswap_psinfo(psinfo);

#endif

    return (0);

}

static int fill_psinfo(struct target_elf_prpsinfo *psinfo, const TaskState *ts)

{

    char *filename, *base_filename;

    unsigned int i, len;



    (void) memset(psinfo, 0, sizeof (*psinfo));



    len = ts->info->arg_end - ts->info->arg_start;

    if (len >= ELF_PRARGSZ)

        len = ELF_PRARGSZ - 1;

    if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_start, len))

        return -EFAULT;

    for (i = 0; i < len; i++)

        if (psinfo->pr_psargs[i] == 0)

            psinfo->pr_psargs[i] = ' ';

    psinfo->pr_psargs[len] = 0;



    psinfo->pr_pid = getpid();

    psinfo->pr_ppid = getppid();

    psinfo->pr_pgrp = getpgrp();

    psinfo->pr_sid = getsid(0);

    psinfo->pr_uid = getuid();

    psinfo->pr_gid = getgid();



    filename = strdup(ts->bprm->filename);

    base_filename = strdup(basename(filename));

    (void) strncpy(psinfo->pr_fname, base_filename,

                   sizeof(psinfo->pr_fname));

    free(base_filename);

    free(filename);



#ifdef BSWAP_NEEDED

    bswap_psinfo(psinfo);

#endif

    return (0);

}

static int FUNC_0(struct target_elf_prpsinfo *VAR_0, const TaskState *VAR_1)

{

    char *VAR_2, *VAR_3;

    unsigned int VAR_4, VAR_5;



    (void) memset(VAR_0, 0, sizeof (*VAR_0));



    VAR_5 = VAR_1->info->arg_end - VAR_1->info->arg_start;

    if (VAR_5 >= ELF_PRARGSZ)

        VAR_5 = ELF_PRARGSZ - 1;

    if (copy_from_user(&VAR_0->pr_psargs, VAR_1->info->arg_start, VAR_5))

        return -EFAULT;

    for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++)

        if (VAR_0->pr_psargs[VAR_4] == 0)

            VAR_0->pr_psargs[VAR_4] = ' ';

    VAR_0->pr_psargs[VAR_5] = 0;



    VAR_0->pr_pid = getpid();

    VAR_0->pr_ppid = getppid();

    VAR_0->pr_pgrp = getpgrp();

    VAR_0->pr_sid = getsid(0);

    VAR_0->pr_uid = getuid();

    VAR_0->pr_gid = getgid();



    VAR_2 = strdup(VAR_1->bprm->VAR_2);

    VAR_3 = strdup(basename(VAR_2));

    (void) strncpy(VAR_0->pr_fname, VAR_3,

                   sizeof(VAR_0->pr_fname));

    free(VAR_3);

    free(VAR_2);



#ifdef BSWAP_NEEDED

    bswap_psinfo(VAR_0);

#endif

    return (0);

}

static int FUNC_0(struct target_elf_prpsinfo *VAR_0, const TaskState *VAR_1)
{ char *VAR_2, *VAR_3; unsigned int VAR_4, VAR_5; (void) memset(VAR_0, 0, sizeof (*VAR_0)); VAR_5 = VAR_1->info->arg_end - VAR_1->info->arg_start; if (VAR_5 >= ELF_PRARGSZ)
VAR_5 = ELF_PRARGSZ - 1; if (copy_from_user(&VAR_0->pr_psargs, VAR_1->info->arg_start, VAR_5))
return -EFAULT; for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) if (VAR_0->pr_psargs[VAR_4] == 0)
VAR_0->pr_psargs[VAR_4] = ' '; VAR_0->pr_psargs[VAR_5] = 0; VAR_0->pr_pid = getpid(); VAR_0->pr_ppid = getppid(); VAR_0->pr_pgrp = getpgrp(); VAR_0->pr_sid = getsid(0); VAR_0->pr_uid = getuid(); VAR_0->pr_gid = getgid(); VAR_2 = strdup(VAR_1->bprm->VAR_2); VAR_3 = strdup(basename(VAR_2)); (void) strncpy(VAR_0->pr_fname, VAR_3,
sizeof(VAR_0->pr_fname)); free(VAR_3); free(VAR_2); #ifdef BSWAP_NEEDED
bswap_psinfo(VAR_0); #endif
return (0); }