xref: /illumos-gate/usr/src/tools/smatch/src/compat.h (revision c85f09cc)
1*1f5207b7SJohn Levon #ifndef COMPAT_H
2*1f5207b7SJohn Levon #define COMPAT_H
3*1f5207b7SJohn Levon 
4*1f5207b7SJohn Levon /*
5*1f5207b7SJohn Levon  * Various systems get these things wrong. So
6*1f5207b7SJohn Levon  * we create a small compat library for them.
7*1f5207b7SJohn Levon  *
8*1f5207b7SJohn Levon  *  - zeroed anonymous mmap
9*1f5207b7SJohn Levon  *	Missing in MinGW
10*1f5207b7SJohn Levon  *  - "string to long double" (C99 strtold())
11*1f5207b7SJohn Levon  *	Missing in Solaris and MinGW
12*1f5207b7SJohn Levon  */
13*1f5207b7SJohn Levon 
14*1f5207b7SJohn Levon /*
15*1f5207b7SJohn Levon  * Our "blob" allocator works on chunks that are multiples
16*1f5207b7SJohn Levon  * of this size (the underlying allocator may be a mmap that
17*1f5207b7SJohn Levon  * cannot handle smaller chunks, for example, so trying to
18*1f5207b7SJohn Levon  * allocate blobs that aren't aligned is not going to work).
19*1f5207b7SJohn Levon  */
20*1f5207b7SJohn Levon #define CHUNK 32768
21*1f5207b7SJohn Levon 
22*1f5207b7SJohn Levon void *blob_alloc(unsigned long size);
23*1f5207b7SJohn Levon void blob_free(void *addr, unsigned long size);
24*1f5207b7SJohn Levon long double string_to_ld(const char *nptr, char **endptr);
25*1f5207b7SJohn Levon 
26*1f5207b7SJohn Levon #endif
27