On Wed, Jun 27, 2001 at 03:59:03AM +0200, Marcus Brinkmann wrote:
> To prove that PID 4 is the only process with this
> problem, the below program iterates over all pids. If you specify any command
> line arguments, it will skip PID 4. In this case, no memory is leaked.
#define _GNU_SOURCE
#include <hurd.h>
#include <hurd/process.h>
int
main (int argc, char *argv[])
{
int i;
int err;
mach_port_t proc = getproc();
pid_t *pids;
int pidslen;
int flags = PI_FETCH_THREADS | PI_FETCH_THREAD_BASIC;
int *piarray;
int picount = 0;
char *waits;
int waitslen = 0;
pids = 0;
pidslen = 0;
err = proc_getallpids (proc, &pids, &pidslen);
if (err)
{
printf ("%s: proc_getallpids(): %s\n", argv[0], strerror(errno));
exit (1);
}
for (i = 0; i < pidslen; i++)
{
/* Specify an argument, and the symptoms go away. */
if (argc >= 2 && i == 4)
continue;
piarray = waits = picount = waitslen = 0;
err = proc_getprocinfo (proc, pids[i], &flags, &piarray, &picount, &waits,
&waitslen);
if (err)
{
printf ("%s: proc_getprocinfo() for %i: %s\n", argv[0], pids[i],
strerror(errno));
exit (1);
}
printf ("%i: %i, %i\n", pids[i], picount, waitslen);
if (piarray)
munmap (piarray, sizeof(int) * picount);
if (waits)
munmap (waits, sizeof(char) * waitslen);
}
}
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org [EMAIL PROTECTED]
Marcus Brinkmann GNU http://www.gnu.org [EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.marcus-brinkmann.de
_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd