Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2001 18:32:18 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        Evan S <kaworu@sektor7.ath.cx>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: question on kvm_getprocs 
Message-ID:  <20010414013218.93BED3E25@bazooka.unixfreak.org>
In-Reply-To: <Pine.GSO.4.10.10104132113550.17812-100000@wintermute.sekt7>; from kaworu@sektor7.ath.cx on "Fri, 13 Apr 2001 21:17:13 -0400 (EDT)"

next in thread | previous in thread | raw e-mail | index | archive | help
Evan S <kaworu@sektor7.ath.cx> writes:
>        if ((kinfo = malloc(nentries * sizeof(*kinfo))) == NULL)
>                            err(1, NULL);
>                    for (i = nentries; --i >= 0; ++proc_list) {
>                            (&kinfo[i])->ki_p = proc_list;
>                               if (KI_PROC(&kinfo[i])->p_prison)
>                                       {
>                                        printf("Jailed Process\n");
>                                        printf("%s\n",
> 
> KI_PROC(&kinfo[i])->p_prison->pr_host);
>                                       }
>                                       }
> 
> KI_PROC is just a macro that is 
> #define KI_PROC(ki) (&(ki)->ki_p->kp_proc)
> 
> [teqnix](~/work/c/getprocs)%gcc -g -lkvm getprocs.c -o getprocs
> getprocs.c: In function `main':
> getprocs.c:87: dereferencing pointer to incomplete type

pr_host is a member of struct prison, which is a kernel structure.
It's under #ifdef _KERNEL, which is why you don't have a definition
for it.  I'm not quite sure where you're getting your process list
from, but I think that p_prison is a kernel pointer in your context.
Obviously, trying to follow that from the userland won't do what you
want. :-)

Then again, I could be wrong.  If you want, take the definition of
struct prison from /usr/include/sys/jail.h and paste it into your
code.  That will get rid of the warning.  If your program seg faults
when you try to run it, you'll know I was right.

Regards,

					Dima Dorfman
					dima@unixfreak.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010414013218.93BED3E25>