Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2001 21:17:13 -0400 (EDT)
From:      Evan S <kaworu@sektor7.ath.cx>
To:        freebsd-hackers@freebsd.org
Subject:   question on kvm_getprocs
Message-ID:  <Pine.GSO.4.10.10104132113550.17812-100000@wintermute.sekt7>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I am writing a program called jailstat, which goes through the proc
structure, checks if p_prison is true, if it is, prints out
p_prison->pr_host.

I have it working so it says, "jailed process", and prints out it's UID.
But, when I try to make it print the hostname, this is what happens.

Here's a snippet of code:

       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

If anyone could give a little help. Thanks a lot. :-)

Evan Sarmiento (kaworu@sektor7.ath.cx)
http://sekt7.org/es
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (SunOS)
Comment: Made with pgp4pine 1.75-6

iEYEARECAAYFAjrXpR8ACgkQa7CFsJ0L22wnawCgpVWLMcqBegbb5opBR2Hx8esV
KJMAoJlZ1a/BsqqbPh8TxiTISPyN85fA
=SaP9
-----END PGP SIGNATURE-----



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?Pine.GSO.4.10.10104132113550.17812-100000>