File:  [MW Coherent from dump] / coherent / d / lib / libc / gen / malloc / memok.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:37 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * memok.c
 * Test for corruption of malloc arena.
 */

#include <stdio.h>
#include <sys/malloc.h>

/*
 * memok() returns 1 if memory is ok,
 * 0 if it is corrupted.
 */
int
memok()
{
	register MBLOCK *mp;
	unsigned counter, flag, len;

	if (NULL == (mp = __a_first))
		return ((NULL == __a_scanp) && !__a_count);
	flag = 0;
	for (counter = __a_count; counter--; ) {
		if (mp == __a_scanp)
			flag++;
		mp = (len = realsize(mp->blksize)) ? bumpp(mp, len) : mp->uval.next;
	}
	return ((1 == flag) && (mp == __a_first));
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.