linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 4/5] example for userspace scanner
@ 2008-01-21 16:14 Izik Eidus
  0 siblings, 0 replies; only message in thread
From: Izik Eidus @ 2008-01-21 16:14 UTC (permalink / raw)
  To: kvm-devel, andrea, avi, dor.laor, linux-mm, yaniv

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]


-- 
woof.


[-- Attachment #2: ksmscan.c --]
[-- Type: text/x-csrc, Size: 593 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include "linux/ksm.h"

int main()
{
	int fd;
	int fd_scan;
	int r;

	fd = open("/dev/ksm", O_RDWR | O_TRUNC, (mode_t)0600);
	if (fd == -1) {
		fprintf(stderr, "couldnt even open it\n");
		exit(1);
	}

	fd_scan = ioctl(fd, KSM_CREATE_SCAN);
	if (fd_scan == -1) {
		printf("KSM_CREATE_SCAN failed\n");
		exit(1);
	}
	printf("created scanner!\n");

	while(1) {
		r = ioctl(fd_scan, KSM_SCAN, 100);
		usleep(1000);
	}
	return 0;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-21 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-21 16:14 [RFC][PATCH 4/5] example for userspace scanner Izik Eidus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox