All pastes #717871 Raw Edit

Something

public c v1 · immutable
#717871 ·published 2007-09-27 22:49 UTC
rendered paste body
#include <stdio.h>#include <fcntl.h>#include <unistd.h>#include <sys/types.h>#include <sys/uio.h>int main(int argc, char *argv[]){	int fd = open("/dev/kmem", O_RDONLY);	if(fd < 0) {		perror("open");		return -1;	}	int in_block = 0;	char buffer[4096];	for(unsigned long i = 0; i < 0xfffff000; i+= sizeof(buffer)) {		if(lseek(fd, i, SEEK_SET) == -1) {			continue;		}		if(read(fd, buffer, sizeof(buffer)) == sizeof(buffer)) {			if(!in_block) {				printf("block found at 0x%8.8x:", i);				fflush(stdout);				in_block = 1;			}		}		else {			if(in_block) {				in_block = 0;				printf("0x%8.8x\n", i);				fflush(stdout);			}		}	}}