From owner-freebsd-hackers Fri Apr 13 18:32:22 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 7462A37B506 for ; Fri, 13 Apr 2001 18:32:19 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 93BED3E25; Fri, 13 Apr 2001 18:32:18 -0700 (PDT) To: Evan S Cc: freebsd-hackers@freebsd.org Subject: Re: question on kvm_getprocs In-Reply-To: ; from kaworu@sektor7.ath.cx on "Fri, 13 Apr 2001 21:17:13 -0400 (EDT)" Date: Fri, 13 Apr 2001 18:32:18 -0700 From: Dima Dorfman Message-Id: <20010414013218.93BED3E25@bazooka.unixfreak.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Evan S 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