ust: continue work
[ust.git] / hello / hello.c
index 0735fd6b6004a518d2c37f11c11623c2d97f2d3f..51979861e28b0e37003c1ec7fb6600887701bb7a 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <unistd.h>
+#include <sys/mman.h>
 
 #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);
This page took 0.023404 seconds and 4 git commands to generate.