Skip to content

Instantly share code, notes, and snippets.

@khibino
Created January 31, 2013 04:23
Show Gist options
  • Save khibino/4680166 to your computer and use it in GitHub Desktop.
Save khibino/4680166 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
int
main (int argc, char *argv[]) {
char buf[1048576];
char obuf[1048576];
int i;
#define N 0x1000
if(argc > 1) {
printf("rv(mlock) = %d\n", mlockall (MCL_CURRENT));
}
unsigned long long rp = (unsigned long long)obuf;
for (i = 0; i < N; i++) {
void *p = memcpy (buf, obuf, sizeof (obuf));
rp = rp & (unsigned long long)p;
}
printf("%llx\n", rp);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment