public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Izik Eidus <izike-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org,
	avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org,
	dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org
Subject: [RFC][PATCH 4/5] example for userspace scanner
Date: Mon, 21 Jan 2008 18:14:35 +0200	[thread overview]
Message-ID: <4794C4EB.8090309@qumranet.com> (raw)

[-- 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;
}

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

                 reply	other threads:[~2008-01-21 16:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4794C4EB.8090309@qumranet.com \
    --to=izike-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=andrea-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox