Blob Blame History Raw
char psb[64];	/* DEBUG in main()'s declarations */
(void) snpf(psb, sizeof(psb), "/bin/ps -l -p %d", Mypid);	/* DEBUG before the do loop */
DBMon=1;	/* DEBUG in the do loop before gather_proc_info() */
system(psb);	/* DEBUG in the sleep section after fflush() */
/* start DEBUG section after the end of main() */

int DBMon=0;

void *
lsofcalloc(char *f, int l, size_t n, size_t s)
{
#undef	calloc
	void *v;
	v = (void *)calloc(n, s);
	if (DBMon)
	    (void) fprintf(stderr, "MEMa %#x %s:%d calloc(%d, %d)\n",
		v, f, l, n, s);
	return(v);
}

void
lsoffree(char *f, int l, void *p)
{
#undef	free
	(void) free(p);
	if (DBMon)
	    (void) fprintf(stderr, "MEMf %#x %s:%d free\n", p, f, l);
}

void *
lsofmalloc(char *f, int l, size_t s)
{
#undef	malloc
	void *v;
	v = (void *)malloc(s);
	if (DBMon)
	    (void) fprintf(stderr, "MEMa %#x %s:%d malloc(%d)\n", v, f, l, s);
	return(v);
}

void *
lsofrealloc(char *f, int l, void *p, size_t s)
{
#undef	realloc
	void *v;
	v = (void *)realloc(p, s);
	if (DBMon)
	    (void) fprintf(stderr, "MEMr %#x %#x %s:%d realloc(%d)\n",
		p, v, f, l, s);
	return(v);
}

/* end DEBUG section */