X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=hello%2Fhello.c;h=51979861e28b0e37003c1ec7fb6600887701bb7a;hb=b6bf28ecd4c07e7865d340f1600a35d6edc05ec8;hp=0735fd6b6004a518d2c37f11c11623c2d97f2d3f;hpb=9dad1eb8e433b1dbbd199cbca2f902f3a2ae6f5e;p=ust.git diff --git a/hello/hello.c b/hello/hello.c index 0735fd6..5197986 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -1,5 +1,6 @@ #include #include +#include #include "../libmarkers/marker.h" @@ -10,8 +11,27 @@ void probe(const struct marker *mdata, printf("In probe\n"); } +void try_map() +{ + char *m; + + /* maybe add MAP_LOCKED */ + m = mmap(NULL, 4096, PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE , -1, 0); + if(m == (char*)-1) { + perror("mmap"); + return; + } + + printf("The mapping is at %p.\n", m); + strcpy(m, "Hello, Mapping!"); +} + int main() { + //ltt_trace_create(); + + try_map(); + printf("Hello, World!\n"); marker_probe_register("abc", "testmark", "", probe, NULL);