sparse, llvm: set target specification
[smatch.git] / compat-cygwin.c
blobe65b538a2cef5c9d560b5892f1167606e35fbe3c
1 /*
2 * Cygwin Compatibility functions
3 *
4 *
5 * Licensed under the Open Software License version 1.1
6 */
10 #include <sys/mman.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <sys/stat.h>
15 #include "lib.h"
16 #include "allocate.h"
17 #include "token.h"
19 void *blob_alloc(unsigned long size)
21 void *ptr;
22 size = (size + 4095) & ~4095;
23 ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
24 if (ptr == MAP_FAILED)
25 ptr = NULL;
26 else
27 memset(ptr, 0, size);
28 return ptr;
31 void blob_free(void *addr, unsigned long size)
33 size = (size + 4095) & ~4095;
34 munmap(addr, size);
37 long double string_to_ld(const char *nptr, char **endptr)
39 return strtod(nptr, endptr);