Merge pull request #2802 from BrzVlad/feature-evacuation-opt2
[mono.git] / mono / profiler / utils.c
index b16e9bfc6aa7474e61a40ec7075fc349eb6a30ea..753024dcf72963e30c7ebef03da79e54b7cdc7e0 100644 (file)
  *   Paolo Molaro (lupus@ximian.com)
  *
  * Copyright 2010 Novell, Inc (http://www.novell.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #include "utils.h"
 #include <stdlib.h>
 #include <time.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #ifdef HOST_WIN32
 #include <windows.h>
 #else
@@ -274,7 +276,7 @@ alloc_buffer (int size)
        return ptr;
 #else
        ptr = mmap (NULL, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-       if (ptr == (void*)-1)
+       if (ptr == MAP_FAILED)
                return NULL;
        return ptr;
 #endif
@@ -412,3 +414,13 @@ thread_id (void)
 #endif
 }
 
+uintptr_t
+process_id (void)
+{
+#ifdef HOST_WIN32
+       return 0; /* FIXME */
+#else
+       return (uintptr_t)getpid ();
+#endif
+}
+