From: Izik Eidus <izike@qumranet.com>
To: kvm-devel <kvm-devel@lists.sourceforge.net>,
andrea@qumranet.com, avi@qumranet.com, dor.laor@qumranet.com,
linux-mm@kvack.org, yaniv@qumranet.com
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;
}
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@qumranet.com \
--cc=andrea@qumranet.com \
--cc=avi@qumranet.com \
--cc=dor.laor@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-mm@kvack.org \
--cc=yaniv@qumranet.com \
/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